commit 1cc19c8c6a05d5c878f704f21daf0f30d0fc67fc
parent 60e2f2baf27c0cc8bf920b87331141e98dd32fef
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 10 May 2025 16:06:49 +0200
feedback: change the appearance of anchors when they will be saved
When an anchor is present on the first line of the buffer, make any
anchors appear as little blocks (■) instead of the usual diamonds (⬥).
This different appearance lets the user know whether a placed anchor
anywhere in the file will be saved or not -- when line numbers are
active. (In an 8-bit locale an = replaces the usual +).
Diffstat:
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/search.c b/src/search.c
@@ -1003,7 +1003,10 @@ void put_or_lift_anchor(void)
{
openfile->current->has_anchor = !openfile->current->has_anchor;
- update_line(openfile->current, openfile->current_x);
+ if (openfile->current != openfile->filetop)
+ update_line(openfile->current, openfile->current_x);
+ else
+ refresh_needed = TRUE;
if (openfile->current->has_anchor)
statusline(REMARK, _("Placed anchor"));
diff --git a/src/winio.c b/src/winio.c
@@ -2558,10 +2558,12 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col)
if (line->has_anchor && (from_col == 0 || !ISSET(SOFTWRAP)))
#ifdef ENABLE_UTF8
if (using_utf8())
- wprintw(midwin, "\xE2\xAC\xA5"); /* black medium diamond */
+ wprintw(midwin, openfile->filetop->has_anchor ?
+ "\xEF\xBF\xAD" : /* halfwidth black square */
+ "\xE2\xAC\xA5"); /* black medium diamond */
else
#endif
- wprintw(midwin, "+");
+ wprintw(midwin, openfile->filetop->has_anchor ? "=" : "+");
else
#endif
wprintw(midwin, " ");