** Refactor
Previously most functions used to "get" a mark returned a position,
changed the line number and sometimes changed even the current buffer.
Now functions return a {x}fmark_T making calling context aware whether
the mark is in another buffer without arcane casting. A new function is
provided for switching to the mark buffer and returning a flag style
Enum to convey what happen in the movement. If the cursor changed, line,
columns, if it changed buffer, etc.
The function to get named mark was split into multiple functions.
- mark_get() -> fmark_T
- mark_get_global() -> xfmark_T
- mark_get_local() -> fmark_T
- mark_get_motion() -> fmark_T
- mark_get_visual() -> fmark_T
Functions that manage the changelist and jumplist were also modified to
return mark types.
- get_jumplist -> fmark_T
- get_changelist -> fmark_T
The refactor is also seen mainly on normal.c, where all the mark
movement has been siphoned through one function nv_gomark, while the
other functions handle getting the mark and setting their movement
flags. To handle whether context marks should be left, etc.
** Mark View
While doing the refactor the concept of a mark view was also
implemented:
The view of a mark currently implemented as the number of lines between
the mark position on creation and the window topline. This allows for
moving not only back to the position of a mark but having the window
look similar to when the mark was defined. This is done by carrying and
extra element in the fmark_T struct, which can be extended later to also
restore horizontal shift.
*** User space features
1. There's a new option, jumpoptions+=view enables the mark view restoring
automatically when using the jumplist, changelist, alternate-file and
mark motions. <C-O> <C-I> g; g, <C-^> '[mark] `[mark]
** Limitations
- The view information is not saved in shada.
- Calls to get_mark should copy the value in the pointer since we are
using pos_to_mark() to wrap and provide a homogeneous interfaces. This
was also a limitation in the previous state of things.
Problem: ">" marker sometimes not displayed in the jumplist.
Solution: If the buffer no longer exists show "-invalid-". (Christian
Brabandt, closesvim/vim#10131, closesvim/vim#10100)
a0f659c76e
Add a modeline to test_jumplist.vim
Update runtime files.
cb80aa2d53
Omit runtime/doc/tabpage.txt.
Patch v8.2.1401 is not ported yet.
Port optwin.vim changes without gettext().
Patch v8.2.1544 is not ported yet.
Traditionally, when navigating to a specific location from the middle of
the jumplist results in shifting the current location to the bottom of
the list and adding the new location after it. This behavior is not
desireable to all users--see, for example
https://vi.stackexchange.com/questions/18344/how-to-change-jumplist-behavior.
Here, another jumplist behavior is introduced. When jumpoptions (a new
option set added here) includes stack, the jumplist behaves like the
tagstack or like history in a web browser. That is, when navigating to
a location from the middle of the jumplist
2 first
1 second
0 third <-- current location
1 fourth
2 fifth
to a new location the locations after the current location in the jump
list are discarded
2 first
1 second
0 third
<-- current location
The result is that when moving forward from that location, the new
location will be appended to the jumplist:
3 first
2 second
1 third
0 new
If the new location is the same
new == second
as some previous (but not immediately prior) entry in the jumplist,
2 first
1 second
0 third <-- current location
1 fourth
2 fifth
both occurrences preserved
3 first
2 second
1 third
0 second (new)
when moving forward from that location.
It would be desireable to go farther and, when the new location is the
same as the location that is currently next in the jumplist,
new == fourth
make the result of navigating to the new location by jumping (e.g. 50gg)
be the same as moving forward in the jumplist
2 first
1 second
0 third
1 new <-- current location
2 fifth
and simply increment the jumplist index. That change is NOT part of
this patch because it would require passing the new cursor location to
the function (setpcmark) from all of its callees. That in turn would
require those callees to know *before* calling what the new cursor
location is, which do they do not currently.
Runtime updates that were bundled into the otherwise NA commit:
Problem: "make proto" adds extra function prototype.
Solution: Add vim/vim#ifdef.
5162822914
- CPO_ALL and CPO_VI are identical, so merge them
- No longer check for the environment variable 'VIM_POSIX'
- In vim_diff.txt, mention the removal of 'cpoptions' flags
This removes all instances of '{not in Vi}', '{Vi: ... }', etc.
We don't care about Vi compatibility, so all of these annotations are
useless in nvim. This also removed the syntax definitions for these
items.
In addition, remove instances of '{only when compiled with +feature}'
adjacent to instances of '{not in Vi}' and friends.
Helped-by: David Bürgin <676c7473@gmail.com>
Helped-by: Felipe Morales <hel.sheep@gmail.com>
closes#2535