| 321 | } |
| 322 | |
| 323 | func 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 | |
| 357 | func maxInt(a, b int) int { |
| 358 | if a > b { |