micro/internal/buffer
Dmitry Maluka f108c90643 hltrailingws: improve updateTrailingWs logic
Handle the case when the cursor itself hasn't really moved to
another line, but its line number has changed due to insert
or remove of some lines above.
In this case, if the cursor is still at its new trailingws,
we should not reset NewTrailingWsY to -1 but update it to the
new line number.

A scenario exemplifying this issue:
Bind some key, e.g. Alt-r, to such a lua function:

function insertNewlineAbove(bp)
    bp.Buf:Insert(buffer.Loc(0, bp.Cursor.Y), "\n")
end

Then in a file containing these lines:

aaa
bbb
ccc

insert a space at the end of bbb line, and then press Alt-r.
bbb and ccc are moved one line down, but also the trailing space
after bbb becomes highlighted, which isn't what we expect.
This commit fixes that.
2024-03-14 03:18:11 +01:00
..
autocomplete.go feat: adds GetArg and GetWord methods to Buffer (#3112) 2024-03-12 21:23:08 +01:00
backup.go Allow aborting while opening a file with backup 2021-08-02 21:05:22 -04:00
buffer.go options: add matchbracestyle (#2876) 2024-03-13 20:21:27 +01:00
buffer_generated_test.go Merge branch 'buffer-benchmarks' of https://github.com/p-e-w/micro into p-e-w-buffer-benchmarks 2020-05-20 15:28:36 -04:00
buffer_test.go Use CharacterCount over RuneCount 2020-05-20 16:47:08 -04:00
cursor.go Highlighting trailing whitespaces 2024-03-14 03:10:31 +01:00
eventhandler.go hltrailingws: improve updateTrailingWs logic 2024-03-14 03:18:11 +01:00
line_array.go Fixed newline format detection for files not ending with a newline (#2875) 2023-10-16 11:03:03 +02:00
line_array_test.go Improve unicode line array test 2020-05-20 19:53:54 -04:00
loc.go Use CharacterCount over RuneCount 2020-05-20 16:47:08 -04:00
message.go Warn for readonly instead of setting option 2021-05-19 14:58:00 -04:00
save.go Set bits in mode used when opening files (#3095) 2024-01-17 00:06:14 -08:00
search.go Improve comments 2021-08-21 17:58:30 -04:00
serialize.go Fix quality issues (#1856) 2020-09-16 00:08:01 -04:00
settings.go plugins: Add capability to dis-/enable them per buffer (#2836) 2023-06-05 17:38:33 -07:00
stack.go Change project layout and use go.mod 2019-12-25 17:05:10 -05:00
stack_test.go Change project layout and use go.mod 2019-12-25 17:05:10 -05:00