refactor(sign): move legacy signs to extmarks

Problem:  The legacy signlist data structures and associated functions are
          redundant since the introduction of extmark signs.
Solution: Store signs defined through the legacy commands in a hashmap, placed
          signs in the extmark tree. Replace signlist associated functions.

Usage of the legacy sign commands should yield no change in behavior with the
exception of:
  - "orphaned signs" are now always removed when the line it is placed on is
    deleted. This used to depend on the value of 'signcolumn'.
  - It is no longer possible to place multiple signs with the same identifier
    in a single group on multiple lines. This will now move the sign instead.

Moreover, both signs placed through the legacy sign commands and through
|nvim_buf_set_extmark()|:
  - Will show up in both |sign-place| and |nvim_buf_get_extmarks()|.
  - Are displayed by increasing sign identifier, left to right.
    Extmark signs used to be ordered decreasingly as opposed to legacy signs.
This commit is contained in:
Luuk van Baal
2023-11-11 00:52:50 +01:00
parent ba58c6f8a4
commit c4afb9788c
33 changed files with 768 additions and 1899 deletions

View File

@@ -6170,7 +6170,7 @@ bool fish_like_shell(void)
/// buffer signs and on user configuration.
int win_signcol_count(win_T *wp)
{
return win_signcol_configured(wp, NULL);
return win_signcol_configured(wp);
}
/// Return true when window "wp" has no sign column.
@@ -6182,14 +6182,10 @@ bool win_no_signcol(win_T *wp)
}
/// Return the number of requested sign columns, based on user / configuration.
int win_signcol_configured(win_T *wp, int *is_fixed)
int win_signcol_configured(win_T *wp)
{
const char *scl = wp->w_p_scl;
if (is_fixed) {
*is_fixed = 1;
}
if (win_no_signcol(wp)) {
return 0;
}
@@ -6203,11 +6199,6 @@ int win_signcol_configured(win_T *wp, int *is_fixed)
return 1;
}
if (is_fixed) {
// auto or auto:<NUM>
*is_fixed = 0;
}
int minimum = 0, maximum = 1;
if (!strncmp(scl, "auto:", 5)) {