fix(jumplist): Ctrl+o, Ctrl+i weird behavior when deleting buffers #25461

Problem:
- Navigation is not always symmetric: pressing Ctrl+o n times followed
  by Ctrl+i n times does not always gets me back to where I started.
- Invalid buffers are not skipped by Ctrl+i/o, I have to press Ctrl+i/o
  multiple times to get to the next/previous buffer.

Solution:
- Remove all entries of a buffer from the jump list when deleting it.
- Don't add a new entry to the jump list if the next buffer to be
  displayed is already in the jump list.

Closes #25365
This commit is contained in:
vE5li
2024-01-29 04:08:51 +01:00
committed by GitHub
parent eee52d3427
commit af6537bc66
3 changed files with 209 additions and 36 deletions

View File

@@ -405,7 +405,7 @@ buf_found:
// Open the changed buffer in the current window.
if (buf != curbuf) {
set_curbuf(buf, unload ? DOBUF_UNLOAD : DOBUF_GOTO);
set_curbuf(buf, unload ? DOBUF_UNLOAD : DOBUF_GOTO, true);
}
theend: