MCPcopy Index your code
hub / github.com/git-bug/git-bug / editQueryWithEditor

Function editQueryWithEditor

termui/termui.go:323–355  ·  view source on GitHub ↗
(bt *bugTable)

Source from the content-addressed store, hash-verified

321}
322
323func editQueryWithEditor(bt *bugTable) error {
324 // This is somewhat hacky.
325 // As there is no way to pause gocui, run the editor and restart gocui,
326 // we have to stop it entirely and start a new one later.
327 //
328 // - an error channel is used to route the returned error of this new
329 // instance into the original launch function
330 // - a custom error (errTerminateMainloop) is used to terminate the original
331 // instance's mainLoop. This error is then filtered.
332
333 ui.g.Close()
334 ui.g = nil
335
336 queryStr, err := buginput.QueryEditorInput(bt.repo, bt.queryStr)
337
338 if err != nil {
339 return err
340 }
341
342 bt.queryStr = queryStr
343
344 q, err := query.Parse(queryStr)
345
346 if err != nil {
347 ui.msgPopup.Activate(msgPopupErrorTitle, err.Error())
348 } else {
349 bt.query = q
350 }
351
352 initGui(nil)
353
354 return errTerminateMainloop
355}
356
357func maxInt(a, b int) int {
358 if a > b {

Callers 1

changeQueryMethod · 0.85

Calls 5

ParseFunction · 0.92
initGuiFunction · 0.85
CloseMethod · 0.65
ActivateMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected