Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#634 Do not treat symbols as whitespace in Previous/Next Word

open
nobody
5
2012-11-19
2012-11-19
Thrawn
No

When going to previous/next word (Ctrl + Left or Ctrl + Right), punctuation characters are treated as whitespace. So, if I had:

fooBar + "[] baz"

with the cursor at the start of 'fooBar', then Ctrl + Right would skip to the start of 'baz', which is too greedy. It would be better to skip to the plus sign, then to the double quote, then to the start of 'baz'.

Using Geany 0.20 on Ubuntu 11.10.

Discussion

  • Lex Trotman
    Lex Trotman
    2012-11-19

    On the current release (1.22) something like the functionality you want is available as "Go to previous word part" and "Go to next word part" bound by default to <ctrl>+/ and <ctrl>+\. The behaviour of <ctrl>+<left> <ctrl>+<right> is inherited from Scintilla (the editing component we use) and isn't set by Geany. You can re-bind the Geany functions to <ctrl>+<left> etc.

     
  • Thrawn
    Thrawn
    2012-11-21

    I'm aware of navigating/selecting by word parts, and it's a great feature, which I use (it's in 0.20 too).

    However, it's not a total answer; in the above example, if the cursor were at the start of 'foo', then Next Word Part would take it to the start of 'Bar', rather than to the plus sign.

    The fact that it's inherited from Scintilla isn't surprising, I guess...presumably Geany would only override it if it were considered to be actually broken, rather than just not being someone's preference. Still, I will point out that Geany's behavior in this situation is much greedier than any other editor I've come across, particularly since it will entirely skip a punctuation character that has whitespace on either side. Even the 'Next WORD' feature in vim wouldn't do that.

     
  • Thrawn
    Thrawn
    2013-05-10

    Can this be revisited now that Geany uses a version of Scintilla that supports SCI_SETPUNCTUATIONCHARS?

     
  • Lex Trotman
    Lex Trotman
    2013-05-10

    I can't see where Scintilla uses the punctuation chars?

    And also I note that in current git <ctrl>+right goes to the *end* of the word, not the start and <ctrl>+left to the *start* of the word. Thats different to your description.

    Finally I am assuming you tried simply defining the punctuations you wanted to visit into the wordchars in the filetypes file?