On 13-09-11 11:40 AM, pauriem@gmail.com wrote:
thanks so much for this info
I will look at the source and maybe I can contribute the patch you outlined, but in the meantime if I write the script to pass 0 with the SCI_SETBACKSPACEUNINDENTS Scintilla message, would it be okay to run this script on document open events, or would the hardwired code override it for each document? or does the hardwired Scintilla message re backspace behavior happen only once at program start-up?
It happens in many cases; when the editor is created, setting the document indent type or width, when the preferences dialog is accepted, when a new document is opened, when the filetype is changed, when a document is cloned, and more that I'm too lazy to track down.
So it sounds like you probably need to do it some way to keep forcing the setting if you don't want to modify Geany's code. Maybe in a "editor-notify" signal handler in your script just call SCI_SETBACKSPACEUNINDENTS at the top so it fires on every Scintilla notification. It just sets a boolean flag inside Scintilla from what I see, so I doubt the overhead would be too great for a one-off script.
P.S.: Here's a diagram that shows all the ways editor_set_indent - the function that hardcodes the Scintilla setting - can be called from inside Geany: http://www.pasteall.org/pic/show.php?id=59192
Cheers, Matthew Brush
On 9/8/13, Lex Trotman elextr@gmail.com wrote:
On 9 September 2013 14:19, pauriem@gmail.com pauriem@gmail.com wrote:
I want to follow up on the part of this old thread which is complaining about the behavior of the backspace in Scintilla, which will sometimes trigger a forward delete in an indentation context
It doesn't forward delete, it just removes one indentation level.
I also find this really annoying and pointless and would like to disable it
There are times when it can be, yes, particularly in space indented code.
from what I can gather, the behavior is governed by a property in Scintilla called backspace-undeletes
IAW your next post backspaceunindents (no hyphen) yes.
what I would hope to be able to do is to use the plugin API to pass a message to Scintilla to knock off doing this
You can but, ... Geany also sets it when it sets the indent, which will overwrite anything you set. It is hardcoded :( to set backspaceunindents for anything but tab indented files.
is there such a message I can send, or would I have to patch the geany source to call a lower-level Scintilla function not exposed through the message-passing?
Just use the normal Scintilla messaging, see where Geany sets it editor.c:4540. Given that this sets the backspaceunindents setting you will need to submit a well written patch to Geany that makes it depend on preferences. Given that the current behaviour is indent type dependent, perhaps two prefs, current behaviour, or manual setting.
failing that, I expect I can write a script or macro that moves the cursor one space left and then does a forward delete (potentially in a loop indexed by the indentation value defined by the conf settings), and bind the backspace key to that? is there any reason why that would fail?
Why not just delete the character prior to the cursor? That would be the expected backspace behaviour.
Cheers Lex
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users