[Github-comments] [geany/geany] ctrl leftArrow jumps up a line (#2258)

elextr notifications at xxxxx
Tue Aug 13 01:42:21 UTC 2019


Ctrl-left and ctrl-right move by word, to the start or end of the word respectively. 

So logically there is no reason for the cursor to stop at the start of a line unless its the start or end of a word.  There is no logical definition of a "word" that makes a line start _both_ a start and an end of a word.

Its unfortunate that the definition is not prefect for your use-case, but it meets its intended use-case.  Being identical to other IDEs is not in the definition, Eclipse for example stops at underscores in identifiers which is a pain.

TL;DR details:

Words are defined by Scintilla (rather poorly IMHO) [here](https://www.scintilla.org/ScintillaDoc.html#Words).

To perhaps explain it better (as I understand it), there are four categories of characters:

- ASCII whitespace and Unicode whitespace
- ASCII punctuation and Unicode punctuation
- ASCII line ends and Unicode line ends
- the rest (the whole Unicode shebang)

and word moves move to the start/end of the next contiguous sequence of characters in the same category but skipping intervening whitespace category characters.

That somewhat artificial (but easy to implement) definition turns out to be very useful in code since the categories often align with syntactic entities ("punctuation" with operators, "the rest" with identifiers and keywords etc).  But that means the line ends are considered words, so ctrl-left will go to the start of the line end (ie the end of the preceding line) and ctrl-right will move to the end of the line end (ie the start of the next line).

Scintilla allows ASCII characters to be moved between categories, but Unicode characters are always defined by their Unicode category definition.

Geany defines the whitespace category in `filetypes.common` (potentially overridden by specific filetypes, but rarely is) in `[settings]whitespace_chars` and includes the ASCII punctuation so a "word" is closer to human "word" or computer "identifier".  Adding newline (\n) to that removes it from the line ends list, so now neither ctrl-left/right stop there :grin:.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/2258#issuecomment-520655801
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20190812/39b594c7/attachment.html>


More information about the Github-comments mailing list