Hi all. It's me again, with another little patch (probably the last one from me for a long period of time).
I discovered that Geany doesn't provide key bindings for the abovementioned scintilla commands. I think they are very useful while editing text, or HTML, or other markup, especially when you don't like when your text exceeds 80 char boundary (like me). With these shortcuts, you no longer need to manually reformat your text after you make a slight change in it, you know. There are such shortcuts in other editors like (afair) Eclipse and Notepad++ for Windows.
Unfortunately, SCI_LINESJOIN and SCI_LINESSPLIT commands are not very smart, e.g., they do not respect indentation. I had to write some code so that these commands could be useful. Particularly, in lines_split() function I had to change line indentations and text selection (see comments in the code for more information)... My knowledge of Scintilla's features is not perfect; if you could suggest more user-friendly ways to deal with indentation, please do.
When implementing this, I had to add couple of sciwrappers, so I placed them at the end of sciwrappers.{c,h}.
The patch also adds corresponding entries to key bindings properties in the preferences dialog. Maybe "Split lines" entry should be renamed as it may be ambiguous.
The patch is against rev. 3951. Alternative link: http://pastie.org/543980. Hope you'll find it useful.
Best regards, Eugene.
On Mon, 13 Jul 2009 14:31:04 +0400, Eugene wrote:
Hi,
I discovered that Geany doesn't provide key bindings for the abovementioned scintilla commands. I think they are very useful while editing text, or HTML, or other markup, especially when you don't like when your text exceeds 80 char boundary (like me). With these
Even after reading the Scintilla docs and your comments in the code, I fail to see any use of these commands. But nevertheless, I guess there is a proper use otherwise these commands wouldn't exist in Scintilla and you wouldn't have spent time adding them to Geany :).
So, my question is: do we really need/want this in Geany itself? Alternatively, you could add them to a plugin even though creating and maintaining a plugin because of two keybindings is a bit much. So, a third alternative could be that you add your code as part of the addons plugins, which aims to collect such small changes which aren't worth an own plugin.
OTOH, we could also integrate the patch into Geany itself if it's just me who can't make any use of this :).
Regards, Enrico
Hi Enrico.
On Mon, 13 Jul 2009 14:31:04 +0400, Eugene wrote:
Hi,
I discovered that Geany doesn't provide key bindings for the abovementioned scintilla commands. I think they are very useful while editing text, or HTML, or other markup, especially when you don't like when your text exceeds 80 char boundary (like me). With these
Even after reading the Scintilla docs and your comments in the code, I fail to see any use of these commands. But nevertheless, I guess there is a proper use otherwise these commands wouldn't exist in Scintilla and you wouldn't have spent time adding them to Geany :).
So, my question is: do we really need/want this in Geany itself? Alternatively, you could add them to a plugin even though creating and maintaining a plugin because of two keybindings is a bit much. So, a third alternative could be that you add your code as part of the addons plugins, which aims to collect such small changes which aren't worth an own plugin.
If the patch won't be included in geany, the third alternative will do.
OTOH, we could also integrate the patch into Geany itself if it's just me who can't make any use of this :).
I suppose if anybody needed this patch, he would already post a reply before :)
Best regards, Eugene.
Eugene Arshinov schrieb:
Hi Enrico.
On Mon, 13 Jul 2009 14:31:04 +0400, Eugene wrote:
Hi,
I discovered that Geany doesn't provide key bindings for the abovementioned scintilla commands. I think they are very useful while editing text, or HTML, or other markup, especially when you don't like when your text exceeds 80 char boundary (like me). With these
Even after reading the Scintilla docs and your comments in the code, I fail to see any use of these commands. But nevertheless, I guess there is a proper use otherwise these commands wouldn't exist in Scintilla and you wouldn't have spent time adding them to Geany :).
So, my question is: do we really need/want this in Geany itself? Alternatively, you could add them to a plugin even though creating and maintaining a plugin because of two keybindings is a bit much. So, a third alternative could be that you add your code as part of the addons plugins, which aims to collect such small changes which aren't worth an own plugin.
If the patch won't be included in geany, the third alternative will do.
OTOH, we could also integrate the patch into Geany itself if it's just me who can't make any use of this :).
I suppose if anybody needed this patch, he would already post a reply before :)
Best regards, Eugene.
A project I'm involved in enforces the 80-char limit, so it would be of use for me. The problem would probably be the indentation still, since I prefer a wider indentation for lines which are split for the 80-char limit reason (2x4 spaces more than the line which was split has).
Best regards.
Hi Thomas. Thanks for your reply and sorry for late answer.
A project I'm involved in enforces the 80-char limit, so it would be of use for me. The problem would probably be the indentation still, since I prefer a wider indentation for lines which are split for the 80-char limit reason (2x4 spaces more than the line which was split has).
I think, there are many difficulties with applying this command to code (not plain text or markup). Consider an example:
void function_with_long_arguments_list(int argument, int another_argument);
I believe that most of C programmers will prefer splitting it into
void function_with_long_arguments_list(int argument, int another_argument);
And the command knows nothing about C syntax and may split the line to
void function_with_long_arguments_list(int argument, int another_argument);
The same thing with long “if” expressions etc. As a result, the programmer will have to manually edit the results of splitting.
So, as this command seems to be not very useful for code, I suppose that providing more features (e.g., additional indentation like in your example) is meaningless.
Moreover, this would require making the “split” command filetype-dependent and providing additional settings in filedefs. There is too much complexity for a little profit.
Best regards, Eugene.
Well, “join” and “split” commands are not very useful for code, and Geany is primarily a programmer's editor… Maybe this patch is not actually needed to be included. So I'll just leave it here for those who would google it :-)
On Mon, 20 Jul 2009 22:50:28 +0400, Eugene wrote:
Well, “join” and “split” commands are not very useful for code, and Geany is primarily a programmer's editor… Maybe this patch is not actually needed to be included. So I'll just leave it here for those who would google it :-)
Why not putting your code into a plugin? (As mentioned earlier either into a separate, new plugin or as part of the Addons plugin, whatever you prefer.)
Regards, Enrico
Hi, Sorry for the late reply.
On Mon, 13 Jul 2009 14:31:04 +0400 Eugene Arshinov earshinov@gmail.com wrote:
I discovered that Geany doesn't provide key bindings for the abovementioned scintilla commands. I think they are very useful while editing text, or HTML, or other markup, especially when you don't like when your text exceeds 80 char boundary (like me). With these shortcuts, you no longer need to manually reformat your text after you make a slight change in it
I had a look at the patch code, looks good. I use the 'Edit->Format->Send selection to' command with the *nix 'fmt' program, but the code in your patch looks like it would be better as it handles indents too.
Personally I'm not sure that separate Join and Split commands are necessary, but I could be wrong. Could you give a use case as to why it's better to have two commands instead of one 'Reflow paragraph / selected lines' command (called 'Fill paragraph' in NEdit)?
If one command would be sufficient, I could use the patch code to make it. This would be a lot better than using 'fmt' as I wouldn't have to make a selection first.
So I think a 'Reflow paragraph' command would be OK in the core; does this sound OK Enrico?
Regards, Nick
P.S. This is also related to the Line Breaking command, but even if we improved that, a separate 'Reflow paragraph' command would still be useful IMO.
On Tue, 21 Jul 2009 12:35:45 +0100, Nick wrote:
Hi, Sorry for the late reply.
On Mon, 13 Jul 2009 14:31:04 +0400 Eugene Arshinov earshinov@gmail.com wrote:
I discovered that Geany doesn't provide key bindings for the abovementioned scintilla commands. I think they are very useful while editing text, or HTML, or other markup, especially when you don't like when your text exceeds 80 char boundary (like me). With these shortcuts, you no longer need to manually reformat your text after you make a slight change in it
I had a look at the patch code, looks good. I use the 'Edit->Format->Send selection to' command with the *nix 'fmt' program, but the code in your patch looks like it would be better as it handles indents too.
Personally I'm not sure that separate Join and Split commands are necessary, but I could be wrong. Could you give a use case as to why it's better to have two commands instead of one 'Reflow paragraph / selected lines' command (called 'Fill paragraph' in NEdit)?
If one command would be sufficient, I could use the patch code to make it. This would be a lot better than using 'fmt' as I wouldn't have to make a selection first.
So I think a 'Reflow paragraph' command would be OK in the core; does this sound OK Enrico?
Yo, sure.
Regards, Enrico
On Mon, 13 Jul 2009 14:31:04 +0400 Eugene Arshinov earshinov@gmail.com wrote:
I discovered that Geany doesn't provide key bindings for the abovementioned scintilla commands. I think they are very useful while editing text, or HTML, or other markup, especially when you don't like when your text exceeds 80 char boundary (like me). With these shortcuts, you no longer need to manually reformat your text after you make a slight change in it, you know. There are such shortcuts in other editors like (afair) Eclipse and Notepad++ for Windows.
...
When implementing this, I had to add couple of sciwrappers, so I placed them at the end of sciwrappers.{c,h}.
Cool. BTW we had sci_target_start, sci_target_end already but perhaps they're not clearly named, I might rename them to your versions.
The patch also adds corresponding entries to key bindings properties in the preferences dialog. Maybe "Split lines" entry should be renamed as it may be ambiguous.
I added a 'Reflow lines/paragraph' Format keybinding as discussed in the other mail. It uses all the code in your patch - thanks ;-) If you still want a 'Join lines' command perhaps we could add it, I just haven't thought how it would be useful yet.
Regards, Nick
Hi Nick!
Nick Treleaven wrote:
On Mon, 13 Jul 2009 14:31:04 +0400 Eugene Arshinov earshinov@gmail.com wrote:
I discovered that Geany doesn't provide key bindings for the abovementioned scintilla commands. I think they are very useful while editing text, or HTML, or other markup, especially when you don't like when your text exceeds 80 char boundary (like me). With these shortcuts, you no longer need to manually reformat your text after you make a slight change in it, you know. There are such shortcuts in other editors like (afair) Eclipse and Notepad++ for Windows.
...
When implementing this, I had to add couple of sciwrappers, so I placed them at the end of sciwrappers.{c,h}.
Cool. BTW we had sci_target_start, sci_target_end already but perhaps they're not clearly named, I might rename them to your versions.
Another fault... I just saw sci_get_target_end in the end of sciwrappers.h and thought that corresponding setter function should be sci_set_target_end :) Thanks for noticing.
The patch also adds corresponding entries to key bindings properties in the preferences dialog. Maybe "Split lines" entry should be renamed as it may be ambiguous.
I added a 'Reflow lines/paragraph' Format keybinding as discussed in the other mail. It uses all the code in your patch - thanks ;-) If you still want a 'Join lines' command perhaps we could add it, I just haven't thought how it would be useful yet.
It's very nice that my patch got useful. I also think reflow command is enough in most cases, so I won't insist for inclusion of split/join lines commands :)
Best regards, Eugene.