BufView returns not only the buffer's width and height but also its
x,y position. It may be useful e.g. for checking if a mouse click was
on the actual buffer or ourside it, e.g. on the gutter.
Don't highlight space characters at the right edge which are used just
for padding after line break in word wrapping, i.e. don't correspond to
any real characters in the buffer.
This makes it look nicer e.g. when selecting word-wrapped text.
Modified behavior of CursorUp, CursorDown, CursorPageUp etc:
if softwrap is enabled, cursor moves by visual lines, not logical lines.
TODO: implement it also for Home and End keys: move cursor to the
visual start or end of a line. I haven't implemented it for now, because
I'm not sure what should be the behavior of StartOfTextToggle then
(considering that Home key is bound to StartOfTextToggle by default).
Fixes#1598
VLoc allows any location in the buffer to be represented as a visual
location in the linewrapped buffer. In particular, this is useful
for implementing moving cursor up and down within a wrapped line.
Fix displaying tabs and wide runes which don't fit in the window.
Don't overwrite the vertical divider and the adjacent window.
- For tabs: display only as many of the tab's spaces as fit in the window.
- For wide runes: if a rune doesn't fit, don't display it in this line at all.
If softwrap is on, display this rune in the next line.
Fixes#1979
Fixes issue with the usage of a slightly incorrect buffer height value
(v.Height should be v.Height-1 if statusline is displayed).
Also, to avoid too many duplications, the code reorganized a little:
buffer display params (width, height, gutter offset and others) are
calculated in a single place.
Softwrap implementation enhanced to fix various issues with scrolling,
centering, relocating etc.
The main idea is simple: work not with simple line numbers but
with (Line, Row) pairs, where Line is a line number in the buffer
and Row is a visual line (a row) number within this line.
The logic remains mostly the same, but simple arithmetic operations
on line numbers are replaced with corresponding operations on
(Line, Row) pairs.
Fixes#632, #1657
Fix regressions after ba98b55:
- Unable to override filetype autodetection by setting a specific filetype
for specific files, i.e. this doesn't work:
"*.h": {
"filetype": "c++"
},
- Unable to enable/disable syntax highlighting for specific files,
i.e. this doesn't work:
"*.c": {
"syntax": false
},
- "readonly" setting doesn't work (neither global nor per-filetype).
Fixed regression: since merging keybindings branch, TryBindKey and
UnbindKey and accordingly "bind" and "unbind" commands don't work
(fail to unmarshal bindings.json).
This is just a quick fixup to make TryBindKey and UnbindKey work again.
They still work with "buffer" bindings only.
In JumpToMatchingBrace, the loop should stop immediately after finding the matching bracket.
It causes multiple jumps in certain situations:
`(I [ ]{ }) => ( I[ ]{ })`