|
@@ -0,0 +1,19 @@
|
|
|
|
|
+diff --git a/pkg/cli/modes/mode.go b/pkg/cli/modes/mode.go
|
|
|
|
|
+index c1def4f5..0ce3ce69 100644
|
|
|
|
|
+--- a/pkg/cli/modes/mode.go
|
|
|
|
|
++++ b/pkg/cli/modes/mode.go
|
|
|
|
|
+@@ -17,9 +17,13 @@ var ErrFocusedWidgetNotCodeArea = errors.New("focused widget is not a code area"
|
|
|
|
|
+ // FocusedCodeArea returns a CodeArea widget if the currently focused widget is
|
|
|
|
|
+ // a CodeArea. Otherwise it returns the error ErrFocusedWidgetNotCodeArea.
|
|
|
|
|
+ func FocusedCodeArea(a cli.App) (tk.CodeArea, error) {
|
|
|
|
|
+- if w, ok := a.FocusedWidget().(tk.CodeArea); ok {
|
|
|
|
|
++ widget := a.FocusedWidget()
|
|
|
|
|
++ if w, ok := widget.(tk.CodeArea); ok {
|
|
|
|
|
+ return w, nil
|
|
|
|
|
+ }
|
|
|
|
|
++ if w, ok := widget.(tk.ComboBox); ok {
|
|
|
|
|
++ return w.CodeArea(), nil
|
|
|
|
|
++ }
|
|
|
|
|
+ return nil, ErrFocusedWidgetNotCodeArea
|
|
|
|
|
+ }
|
|
|
|
|
+
|