When in overwrite mode, some actions still behave as in insert mode (will cause text to the right of the cursor to move right instead of staying in place and having part of it overwritten). Furthermore, other actions that are "complementary" in insert mode are not in overwrite mode. For example, I think it would make sense that pressing backspace in overwrite mode would "leave the characters in place" the same way adding text does when in that mode, so rather than simply deleting characters, they would be replaced with spaces. Something similar would apply to cutting and pasting (which I found already reported in #763 and #716), and deleting selected text.
This behavior would be particularly convenient when editing **tables** that use space padding for alignment (e.g. in LaTeX or reStructuredText), or for ASCII art diagrams (which I often (~~ab~~)use for block diagrams and the like), which are actually the only cases where I've found overwrite mode useful (and quite convenient, in fact). That way I could cut and paste or delete text without having to realign everything afterwards. (In particular, being able to replace a whole segment of text with spaces with a single key press rather than pressing space many times can save a lot of time in this scenario.)
The behavior of the proposed "smart" overwrite mode would be: - Typing: overwrites text. - Pressing tab: overwrites with tab/spaces depending on setting, OR: simply moves the cursor forward to the next tab stop without overwriting text. - Backspace: deletes char at left, places space at right (*: except at end of line); moves cursor left. - Delete: deletes char at right, places space at left; moves cursor right. (Not too useful since typing space will already do that, but this behavior would mirror insert-mode Delete.) - Select+backspace: replaces selection with spaces (*); leaves cursor left of selection. - Select+delete: replaces selection with spaces; leaves cursor *right* of selection. - Select+cut: same effect as select+backspace. - Paste (N characters): overwrites N characters. - Select+paste: same effect as select+backspace followed by paste (overwrite, and if selection was longer than paste buffer, add spaces (*)). - Ctrl+backspace/delete: word deletion with same behavior as select+backspace/delete. - Select+typing: equivalent to select+backspace followed by typing (the current behavior is to delete the selected text AND overwrite the following text, which might be done by accident when you're too used to doing that in insert mode). - _Alternatively, select + typing a character could replace the whole selection with that character rather than space._ - Drag and drop text: equivalent to cut+paste (TBD - maybe making this equivalent to the proposed behavior for cut+paste is not a good idea, since it is a destructive operation, and some may still want to use it e.g. to change the order of words in a sentence).
(Since this behavior would probably be unique to Geany, or at least I haven't seen it before, it should be implemented as an option, possibly disabled by default.)
What do you mean by "overwrite mode"?
AFAICT Geany does not have a deliberate overwrite mode, so if something does overwrite it is without Geany's knowledge, which is why many features ignore it, it does not exist.
Something like this could possibly be implemented as a plugin.
What do you mean by "overwrite mode"?
I mean what happens when you press the "Insert" key and the status bar changes from "INS" to "OVR" and the cursor changes to an underscore (apparently this is documented as "overtype" and not "overwrite").
Something like this could possibly be implemented as a plugin.
Maybe this is a better approach.
I mean what happens when you press the "Insert" key and the status bar changes from "INS" to "OVR" and the cursor changes to an underscore (apparently this is documented as "overtype" and not "overwrite").
Ahh, ok, overtype is entirely within Scintilla, the only thing Geany does with it is read the status from Scintilla to set the status bar INS/OVR, even the insert key operation is within Scintilla.
So yeah the way to go is a plugin that captured keybindings and tested overtype and if it is on did the new behaviour in its own code, or if overtype is off passed control to Geany to do as normal.
github-comments@lists.geany.org