Just now, while editing a couple of notes, I used Ctrl-Z to recover a recent delete and was surprised that it took action on the main source code I was working on.
Thinking it was a focus issue I tried a few time clicking on the scribble text before actually doing the Ctrl-Z, same result though - the Ctrl-Z acted on the main editor. Then I tried with Ctrl-Y to redo, and that too acted on the main editor. Normal cut/copy/paste actions are local to scribble though.
I submit that, if implementing the Undo and Redo functions in the scribble box is too complicated, at least disabling those functions in the main editor would be wise. After all, the scribble box could be covering the code editor's window.
Geany: 1.38 GTK+ v3.24.34 and GLib v2.74.3 Slackware64 15.0
Scribble is a standard GTK text edit widget. Geany uses GTK3, but Undo and Redo are not implemented until GTK4 AFAICT so the keypresses are ignored by the widget. Unless consumed by a widget, keypresses are passed to the top level window which is the Geany application which then applies them. Editing keys like undo and redo only apply to the main editor, so thats where they are applied.
Some keycodes (eg navigation actions) should work no matter which pane has the focus, so fixing it is not simply a matter of disallowing all keypresses in non-editing panes. "Somebody" has to devise and implement a method of discriminating which actions should work where.
Oh, I see... I don't know much about the inner workings Geany - though I'd love to find the time to know more. I suspect Geany uses GtkSource for the 'normal' editor? Maybe replace the Scribble Gtk editor by a stripped-down GtkSource instance (disabling linenumbers, syntax coloring, line markers etc)? Would that be a solution?
Geany uses Scintilla not GTKSource view.
Geany's keybindings do not handle undo/redo unless a document has focus, it defers them. The problem is the menu accelerators override Geany's keybindings. For the menu callbacks I tried requiring a document to have focus, but that breaks the popup menu undo/redo items.
Then the test for preconditions should be in the callbacks for all that are mentioned in Glade, or they all should be removed from glade?
When the popup menu callbacks are called a document never has focus.
Sure, so the popup menu needs different callbacks with different precondition tests to the callbacks that can be activated by GTK that bypass Geanys keybindings.
Well how do you check what the focus will be once the popup menu is no longer showing?
The popup menu undo/redo has to have a different callback that does not check focus, its only precondition is a valid document, the popup can only be activated by right click on the edit pane so the focus check is not needed.
The callbacks for the GTK actions need to check both focus and valid document, so they need to be different callbacks.
The callback called by Geany keybindings doesn't need to check anything since `cb_func_editor_action()` has already done both, although it won't hurt to use either one of the others.
github-comments@lists.geany.org