Open sidkshatriya opened 1 year ago
Looking at when it was introduced (b03b51d2), it does not seem like it was ever 1-based, the test already assumed coordinates such as '+0.5|m'
.
cursor_line
and cursor_column
both explicitly add 1 (https://github.com/mawww/kakoune/blob/master/src/main.cc#L286-L292), whereas uncommitted_modifications
uses the coordinates as is (https://github.com/mawww/kakoune/blob/master/src/buffer_utils.cc#L306-L309).
Since %val{history} was recently changed, we could match the implementation to the documentation before the next release.
@occivink BTW great job on https://github.com/mawww/kakoune/pull/4777 :-) !
Perhaps I should be making a new ticket, but line numbers for o
in the history don't seem to be correct. A quick example:
Line with return
Line with O
- 244048 1 0 244065 2 +0.0|L +0.1|i +0.2|n +0.3|e +0.4| +0.5|w +0.6|i +0.7|t +0.8|h +0.9| +0.10|r +0.11|e +0.12|t +0.13|u +0.14|r +0.15|n +0.16|
+1.0|
1 244071 3 +2.0|L +2.1|i +2.2|n +2.3|e +2.4| +2.5|w +2.6|i +2.7|t +2.8|h +2.9| +2.10|O 2 244076 - +3.0|
+3.0|
On the first line, I pressed return
twice after the text. +0.16 is the first \n, +1.0 is the second \n.
On the second line, I esc
without any new lines, then o
to start a new line and return
to drop a second new line. Both o
and return
report +3.0 as the modification.
o
should probably be reporting the end of the previous line.
Question
When I type
cat
in a buffer and doecho -debug %val{history}
I see:According to the documentation coordinates are
+line.column
(addition) and-line.column
(removal) and are supposed to be "1-based". Here 0.0 is not 1-based. Or is it still considered 1-based in some way?I am looking at the latest kakoune at https://github.com/mawww/kakoune/commit/a4918f934ceb8c36ab398c0c973174ac17fc8600