aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandy Palamar <randy@rnpnr.xyz>2024-05-11 17:52:28 -0600
committerRandy Palamar <randy@rnpnr.xyz>2024-05-21 20:21:46 -0600
commit06d7681cfffbc3e982fe192db4190f124b2b0848 (patch)
treeaf1d349cdca3890ce0b616789f719121b254a98b
parent4c2b2d8a100a67212134c1bb89fad39311fa441e (diff)
downloadvis-06d7681cfffbc3e982fe192db4190f124b2b0848.tar.gz
vis-06d7681cfffbc3e982fe192db4190f124b2b0848.tar.xz
make Selection unopaque
-rw-r--r--main.c23
-rw-r--r--sam.c10
-rw-r--r--ui-terminal.c3
-rw-r--r--view.c69
-rw-r--r--view.h71
-rw-r--r--vis-cmds.c2
-rw-r--r--vis-lua.c6
-rw-r--r--vis-marks.c4
-rw-r--r--vis-modes.c6
-rw-r--r--vis-prompt.c4
-rw-r--r--vis.c13
11 files changed, 72 insertions, 139 deletions
diff --git a/main.c b/main.c
index 7a45dff..e40abb9 100644
--- a/main.c
+++ b/main.c
@@ -1240,7 +1240,7 @@ static const char *repeat(Vis *vis, const char *keys, const Arg *arg) {
static const char *selections_new(Vis *vis, const char *keys, const Arg *arg) {
View *view = vis_view(vis);
- bool anchored = view_selections_anchored(view_selections_primary_get(view));
+ bool anchored = view_selections_primary_get(view)->anchored;
VisCountIterator it = vis_count_iterator_get(vis, 1);
while (vis_count_iterator_next(&it)) {
Selection *sel = NULL;
@@ -1277,7 +1277,7 @@ static const char *selections_new(Vis *vis, const char *keys, const Arg *arg) {
}
if (sel_new) {
view_selections_primary_set(sel_new);
- view_selections_anchor(sel_new, anchored);
+ sel_new->anchored = anchored;
}
}
vis->action.count = VIS_COUNT_UNKNOWN;
@@ -1289,9 +1289,10 @@ static const char *selections_align(Vis *vis, const char *keys, const Arg *arg)
Text *txt = vis_text(vis);
int mincol = INT_MAX;
for (Selection *s = view_selections(view); s; s = view_selections_next(s)) {
- int col = view_cursors_cell_get(s);
- if (col >= 0 && col < mincol)
- mincol = col;
+ if (!s->line)
+ continue;
+ if (s->col >= 0 && s->col < mincol)
+ mincol = s->col;
}
for (Selection *s = view_selections(view); s; s = view_selections_next(s)) {
if (view_cursors_cell_set(s, mincol) == -1) {
@@ -1362,7 +1363,7 @@ static Selection *selection_new(View *view, Filerange *r, bool isprimary) {
if (!s)
return NULL;
view_selections_set(s, r);
- view_selections_anchor(s, true);
+ s->anchored = true;
if (isprimary)
view_selections_primary_set(s);
return s;
@@ -1432,7 +1433,7 @@ static const char *selections_match_skip(Vis *vis, const char *keys, const Arg *
static const char *selections_remove(Vis *vis, const char *keys, const Arg *arg) {
View *view = vis_view(vis);
view_selections_dispose(view_selections_primary_get(view));
- view_cursor_to(view, view_cursor_get(view));
+ view_cursors_to(view->selection, view_cursor_get(view));
return keys;
}
@@ -1878,7 +1879,7 @@ static const char *undo(Vis *vis, const char *keys, const Arg *arg) {
if (pos != EPOS) {
View *view = vis_view(vis);
if (view->selection_count == 1)
- view_cursor_to(view, pos);
+ view_cursors_to(view->selection, pos);
/* redraw all windows in case some display the same file */
vis_draw(vis);
}
@@ -1890,7 +1891,7 @@ static const char *redo(Vis *vis, const char *keys, const Arg *arg) {
if (pos != EPOS) {
View *view = vis_view(vis);
if (view->selection_count == 1)
- view_cursor_to(view, pos);
+ view_cursors_to(view->selection, pos);
/* redraw all windows in case some display the same file */
vis_draw(vis);
}
@@ -1903,7 +1904,7 @@ static const char *earlier(Vis *vis, const char *keys, const Arg *arg) {
while (vis_count_iterator_next(&it))
pos = text_earlier(vis_text(vis));
if (pos != EPOS) {
- view_cursor_to(vis_view(vis), pos);
+ view_cursors_to(vis_view(vis)->selection, pos);
/* redraw all windows in case some display the same file */
vis_draw(vis);
}
@@ -1916,7 +1917,7 @@ static const char *later(Vis *vis, const char *keys, const Arg *arg) {
while (vis_count_iterator_next(&it))
pos = text_later(vis_text(vis));
if (pos != EPOS) {
- view_cursor_to(vis_view(vis), pos);
+ view_cursors_to(vis_view(vis)->selection, pos);
/* redraw all windows in case some display the same file */
vis_draw(vis);
}
diff --git a/sam.c b/sam.c
index ef39ff6..8b32240 100644
--- a/sam.c
+++ b/sam.c
@@ -1270,7 +1270,7 @@ enum SamError sam_cmd(Vis *vis, const char *s) {
if (c->sel) {
if (visual) {
view_selections_set(c->sel, &r);
- view_selections_anchor(c->sel, true);
+ c->sel->anchored = true;
} else {
if (memchr(c->data, '\n', c->len))
view_cursors_to(c->sel, r.start);
@@ -1281,7 +1281,7 @@ enum SamError sam_cmd(Vis *vis, const char *s) {
Selection *sel = view_selections_new(c->win->view, r.start);
if (sel) {
view_selections_set(sel, &r);
- view_selections_anchor(sel, true);
+ sel->anchored = true;
}
}
}
@@ -1295,12 +1295,12 @@ enum SamError sam_cmd(Vis *vis, const char *s) {
if (vis->win) {
if (primary_pos != EPOS && view_selection_disposed(vis->win->view))
- view_cursor_to(vis->win->view, primary_pos);
+ view_cursors_to(vis->win->view->selection, primary_pos);
view_selections_primary_set(view_selections(vis->win->view));
vis_jumplist_save(vis);
bool completed = true;
for (Selection *s = view_selections(vis->win->view); s; s = view_selections_next(s)) {
- if (view_selections_anchored(s)) {
+ if (s->anchored) {
completed = false;
break;
}
@@ -1572,7 +1572,7 @@ static bool cmd_print(Vis *vis, Win *win, Command *cmd, const char *argv[], Sele
return false;
if (range->start != range->end) {
view_selections_set(sel, range);
- view_selections_anchor(sel, true);
+ sel->anchored = true;
} else {
view_cursors_to(sel, range->start);
view_selection_clear(sel);
diff --git a/ui-terminal.c b/ui-terminal.c
index c26cdb0..8c27416 100644
--- a/ui-terminal.c
+++ b/ui-terminal.c
@@ -257,8 +257,7 @@ static void ui_window_draw(UiWin *w) {
line = view->topline;
size_t prev_lineno = 0;
Selection *sel = view_selections_primary_get(view);
- const Line *cursor_line = view_cursors_line_get(sel);
- size_t cursor_lineno = cursor_line->lineno;
+ size_t cursor_lineno = sel->line->lineno;
char buf[(sizeof(size_t) * CHAR_BIT + 2) / 3 + 1 + 1];
int x = win->x, y = win->y;
int view_width = view->width;
diff --git a/view.c b/view.c
index 046fdff..29b8c32 100644
--- a/view.c
+++ b/view.c
@@ -29,20 +29,6 @@
* the necessary offset for the last character.
*/
-struct Selection {
- Mark cursor; /* other selection endpoint where it changes */
- Mark anchor; /* position where the selection was created */
- bool anchored; /* whether anchor remains fixed */
- size_t pos; /* in bytes from the start of the file */
- int row, col; /* in terms of zero based screen coordinates */
- int lastcol; /* remembered column used when moving across lines */
- Line *line; /* screen line on which cursor currently resides */
- int generation; /* used to filter out newly created cursors during iteration */
- int number; /* how many cursors are located before this one */
- View *view; /* associated view to which this cursor belongs */
- Selection *prev, *next; /* previous/next cursors ordered by location at creation time */
-};
-
static const SyntaxSymbol symbols_none[] = {
[SYNTAX_SYMBOL_SPACE] = { " " },
[SYNTAX_SYMBOL_TAB] = { " " },
@@ -64,7 +50,7 @@ static Cell cell_unused;
/* move visible viewport n-lines up/down, redraws the view but does not change
* cursor position which becomes invalid and should be corrected by calling
- * view_cursor_to. the return value indicates whether the visible area changed.
+ * view_cursors_to. the return value indicates whether the visible area changed.
*/
static bool view_viewport_up(View *view, int n);
static bool view_viewport_down(View *view, int n);
@@ -406,12 +392,6 @@ bool view_coord_get(View *view, size_t pos, Line **retline, int *retrow, int *re
return true;
}
-/* move the cursor to the character at pos bytes from the beginning of the file.
- * if pos is not in the current viewport, redraw the view to make it visible */
-void view_cursor_to(View *view, size_t pos) {
- view_cursors_to(view->selection, pos);
-}
-
/* redraw the complete with data starting from view->start bytes into the file.
* stop once the screen is full, update view->end, view->lastline */
void view_draw(View *view) {
@@ -577,7 +557,7 @@ void view_free(View *view) {
void view_reload(View *view, Text *text) {
view->text = text;
view_selections_clear_all(view);
- view_cursor_to(view, 0);
+ view_cursors_to(view->selection, 0);
}
View *view_new(Text *text) {
@@ -606,7 +586,7 @@ View *view_new(Text *text) {
return NULL;
}
- view_cursor_to(view, 0);
+ view_cursors_to(view->selection, 0);
return view;
}
@@ -683,7 +663,8 @@ void view_redraw_top(View *view) {
for (Line *cur = view->topline; cur && cur != line; cur = cur->next)
view->start += cur->len;
view_draw(view);
- view_cursor_to(view, view->selection->pos);
+ /* FIXME: does this logic make sense */
+ view_cursors_to(view->selection, view->selection->pos);
}
void view_redraw_center(View *view) {
@@ -705,7 +686,7 @@ void view_redraw_center(View *view) {
break;
}
view_draw(view);
- view_cursor_to(view, pos);
+ view_cursors_to(view->selection, pos);
}
void view_redraw_bottom(View *view) {
@@ -721,7 +702,7 @@ size_t view_slide_up(View *view, int lines) {
if (sel->line == view->topline)
cursor_set(sel, view->topline, sel->col);
else
- view_cursor_to(view, sel->pos);
+ view_cursors_to(view->selection, sel->pos);
} else {
view_screenline_down(sel);
}
@@ -736,7 +717,7 @@ size_t view_slide_down(View *view, int lines) {
if (lastline)
cursor_set(sel, view->lastline, col);
else
- view_cursor_to(view, sel->pos);
+ view_cursors_to(view->selection, sel->pos);
} else {
view_screenline_up(sel);
}
@@ -749,7 +730,7 @@ size_t view_scroll_up(View *view, int lines) {
Line *line = sel->line < view->lastline ? sel->line : view->lastline;
cursor_set(sel, line, view->selection->col);
} else {
- view_cursor_to(view, 0);
+ view_cursors_to(view->selection, 0);
}
return sel->pos;
}
@@ -757,9 +738,9 @@ size_t view_scroll_up(View *view, int lines) {
size_t view_scroll_page_up(View *view) {
Selection *sel = view->selection;
if (view->start == 0) {
- view_cursor_to(view, 0);
+ view_cursors_to(view->selection, 0);
} else {
- view_cursor_to(view, view->start-1);
+ view_cursors_to(view->selection, view->start-1);
view_redraw_bottom(view);
view_screenline_begin(sel);
}
@@ -774,9 +755,9 @@ size_t view_scroll_page_down(View *view) {
size_t view_scroll_halfpage_up(View *view) {
Selection *sel = view->selection;
if (view->start == 0) {
- view_cursor_to(view, 0);
+ view_cursors_to(view->selection, 0);
} else {
- view_cursor_to(view, view->start-1);
+ view_cursors_to(view->selection, view->start-1);
view_redraw_center(view);
view_screenline_begin(sel);
}
@@ -787,7 +768,7 @@ size_t view_scroll_halfpage_down(View *view) {
size_t end = view->end;
size_t pos = view_scroll_down(view, view->height/2);
if (pos < text_size(view->text))
- view_cursor_to(view, end);
+ view_cursors_to(view->selection, end);
return view->selection->pos;
}
@@ -797,7 +778,7 @@ size_t view_scroll_down(View *view, int lines) {
Line *line = sel->line > view->topline ? sel->line : view->topline;
cursor_set(sel, line, sel->col);
} else {
- view_cursor_to(view, text_size(view->text));
+ view_cursors_to(view->selection, text_size(view->text));
}
return sel->pos;
}
@@ -885,10 +866,6 @@ size_t view_cursor_get(View *view) {
return view_cursors_pos(view->selection);
}
-Line *view_cursors_line_get(Selection *sel) {
- return sel->line;
-}
-
void view_scroll_to(View *view, size_t pos) {
view_cursors_scroll_to(view->selection, pos);
}
@@ -1167,10 +1144,6 @@ size_t view_cursors_col(Selection *s) {
return text_line_char_get(s->view->text, pos) + 1;
}
-int view_cursors_cell_get(Selection *s) {
- return s->line ? s->col : -1;
-}
-
int view_cursors_cell_set(Selection *s, int cell) {
if (!s->line || cell < 0)
return -1;
@@ -1231,10 +1204,6 @@ void view_cursors_place(Selection *s, size_t line, size_t col) {
view_cursors_to(s, pos);
}
-void view_selections_anchor(Selection *s, bool anchored) {
- s->anchored = anchored;
-}
-
void view_selection_clear(Selection *s) {
s->anchored = false;
s->anchor = s->cursor;
@@ -1248,10 +1217,6 @@ void view_selections_flip(Selection *s) {
view_cursors_to(s, text_mark_get(s->view->text, s->cursor));
}
-bool view_selections_anchored(Selection *s) {
- return s->anchored;
-}
-
void view_selections_clear_all(View *view) {
for (Selection *s = view->selections; s; s = s->next)
view_selection_clear(s);
@@ -1270,10 +1235,6 @@ void view_selections_dispose_all(View *view) {
view_draw(view);
}
-Filerange view_selection_get(View *view) {
- return view_selections_get(view->selection);
-}
-
Filerange view_selections_get(Selection *s) {
if (!s)
return text_range_empty();
diff --git a/view.h b/view.h
index 003e83e..fff6cfc 100644
--- a/view.h
+++ b/view.h
@@ -4,10 +4,8 @@
#include <stddef.h>
#include <stdbool.h>
-typedef struct Selection Selection;
-
-#include "text.h"
#include "ui.h"
+#include "text.h"
#include "array.h"
typedef struct {
@@ -49,7 +47,22 @@ struct Line { /* a line on the screen, *not* in the file */
Cell cells[]; /* win->width cells storing information about the displayed characters */
};
-typedef struct {
+struct View;
+typedef struct Selection {
+ Mark cursor; /* other selection endpoint where it changes */
+ Mark anchor; /* position where the selection was created */
+ bool anchored; /* whether anchor remains fixed */
+ size_t pos; /* in bytes from the start of the file */
+ int row, col; /* in terms of zero based screen coordinates */
+ int lastcol; /* remembered column used when moving across lines */
+ Line *line; /* screen line on which cursor currently resides */
+ int generation; /* used to filter out newly created cursors during iteration */
+ int number; /* how many cursors are located before this one */
+ struct View *view; /* associated view to which this cursor belongs */
+ struct Selection *prev, *next; /* previous/next cursors ordered by location at creation time */
+} Selection;
+
+typedef struct View {
Text *text; /* underlying text management */
char *textbuf; /* scratch buffer used for drawing */
UiWin *ui; /* corresponding ui window */
@@ -250,19 +263,6 @@ void view_selections_clear_all(View*);
void view_selections_flip(Selection*);
/**
* @}
- * @defgroup view_anchor
- * @{
- */
-/**
- * Anchor selection.
- * Further updates will only update the cursor, the anchor will remain fixed.
- */
-void view_selections_anchor(Selection*, bool anchored);
-/** Check whether selection is anchored. */
-bool view_selections_anchored(Selection*);
-/** Get position of selection cursor. */
-/**
- * @}
* @defgroup view_props
* @{
*/
@@ -279,20 +279,6 @@ size_t view_cursors_line(Selection*);
*/
size_t view_cursors_col(Selection*);
/**
- * Get screen line of selection cursor.
- * @rst
- * .. warning: Is `NULL` for non-visible selections.
- * @endrst
- */
-Line *view_cursors_line_get(Selection*);
-/**
- * Get zero based index of screen cell on which selection cursor currently resides.
- * @rst
- * .. warning:: Returns ``-1`` if the selection cursor is currently not visible.
- * @endrst
- */
-int view_cursors_cell_get(Selection*);
-/**
* @}
* @defgroup view_place
* @{
@@ -304,6 +290,11 @@ int view_cursors_cell_get(Selection*);
* will be adjusted to form a singleton selection covering one
* character starting at `pos`. Otherwise only the selection
* cursor will be changed while the anchor remains fixed.
+ *
+ * If primary position was not visible before, we attempt to show
+ * the surrounding context. The viewport will be adjusted such
+ * that the line holding the primary cursor is shown in the middle
+ * of the window.
* @endrst
*/
void view_cursors_to(Selection*, size_t pos);
@@ -351,27 +342,9 @@ size_t view_screenline_end(Selection*);
* @defgroup view_primary
* @{
*/
-/**
- * Move primary selection cursor to the given position.
- * Makes sure that position is visible.
- * @rst
- * .. note:: If position was not visible before, we attempt to show
- * surrounding context. The viewport will be adjusted such
- * that the line holding the cursor is shown in the middle
- * of the window.
- * @endrst
- */
-void view_cursor_to(View*, size_t pos);
/** Get cursor position of primary selection. */
size_t view_cursor_get(View*);
/**
- * Get primary selection.
- * @rst
- * .. note:: Is always a non-empty range.
- * @endrst
- */
-Filerange view_selection_get(View*);
-/**
* @}
* @defgroup view_save
* @{
diff --git a/vis-cmds.c b/vis-cmds.c
index 2874169..6cfc932 100644
--- a/vis-cmds.c
+++ b/vis-cmds.c
@@ -876,7 +876,7 @@ static bool cmd_help(Vis *vis, Win *win, Command *cmd, const char *argv[], Selec
text_appendf(txt, " %-32s\t%s\n", configs[i].name, configs[i].enabled ? "yes" : "no");
text_save(txt, NULL);
- view_cursor_to(vis->win->view, 0);
+ view_cursors_to(vis->win->view->selection, 0);
if (argv[1])
vis_motion(vis, VIS_MOVE_SEARCH_FORWARD, argv[1]);
diff --git a/vis-lua.c b/vis-lua.c
index c51a924..e8911f1 100644
--- a/vis-lua.c
+++ b/vis-lua.c
@@ -2363,7 +2363,7 @@ static int window_selection_index(lua_State *L) {
}
if (strcmp(key, "anchored") == 0) {
- lua_pushboolean(L, view_selections_anchored(sel));
+ lua_pushboolean(L, sel->anchored);
return 1;
}
@@ -2388,7 +2388,7 @@ static int window_selection_newindex(lua_State *L) {
Filerange range = getrange(L, 3);
if (text_range_valid(&range)) {
view_selections_set(sel, &range);
- view_selections_anchor(sel, true);
+ sel->anchored = true;
} else {
view_selection_clear(sel);
}
@@ -2396,7 +2396,7 @@ static int window_selection_newindex(lua_State *L) {
}
if (strcmp(key, "anchored") == 0) {
- view_selections_anchor(sel, lua_toboolean(L, 3));
+ sel->anchored = lua_toboolean(L, 3);
return 0;
}
}
diff --git a/vis-marks.c b/vis-marks.c
index 8ae97ac..aea654d 100644
--- a/vis-marks.c
+++ b/vis-marks.c
@@ -161,7 +161,7 @@ static bool marklist_prev(Win *win, MarkList *list) {
View *view = win->view;
bool restore = false;
Array cur = view_selections_get_all(view);
- bool anchored = view_selections_anchored(view_selections_primary_get(view));
+ bool anchored = view_selections_primary_get(view)->anchored;
Array *top = array_peek(&list->prev);
if (!top)
goto out;
@@ -192,7 +192,7 @@ out:
static bool marklist_next(Win *win, MarkList *list) {
View *view = win->view;
- bool anchored = view_selections_anchored(view_selections_primary_get(view));
+ bool anchored = view_selections_primary_get(view)->anchored;
for (;;) {
Array *next = array_pop(&list->next);
if (!next)
diff --git a/vis-modes.c b/vis-modes.c
index 2e120aa..41121a8 100644
--- a/vis-modes.c
+++ b/vis-modes.c
@@ -190,7 +190,7 @@ static void vis_mode_visual_enter(Vis *vis, Mode *old) {
Win *win = vis->win;
if (!old->visual && win) {
for (Selection *s = view_selections(win->view); s; s = view_selections_next(s))
- view_selections_anchor(s, true);
+ s->anchored = true;
}
}
@@ -198,7 +198,7 @@ static void vis_mode_visual_line_enter(Vis *vis, Mode *old) {
Win *win = vis->win;
if (!old->visual && win) {
for (Selection *s = view_selections(win->view); s; s = view_selections_next(s))
- view_selections_anchor(s, true);
+ s->anchored = true;
}
if (!vis->action.op)
vis_motion(vis, VIS_MOVE_NOP);
@@ -213,7 +213,7 @@ static void vis_mode_visual_line_leave(Vis *vis, Mode *new) {
window_selection_save(win);
view_selections_clear_all(win->view);
} else {
- view_cursor_to(win->view, view_cursor_get(win->view));
+ view_cursors_to(win->view->selection, view_cursor_get(win->view));
}
}
diff --git a/vis-prompt.c b/vis-prompt.c
index f265b10..6dbe69c 100644
--- a/vis-prompt.c
+++ b/vis-prompt.c
@@ -54,7 +54,7 @@ static const char *prompt_enter(Vis *vis, const char *keys, const Arg *arg) {
Win *win = prompt->parent;
char *cmd = NULL;
- Filerange range = view_selection_get(view);
+ Filerange range = view_selections_get(view->selection);
if (!vis->mode->visual) {
const char *pattern = NULL;
Regex *regex = text_regex_new();
@@ -202,6 +202,6 @@ void vis_message_show(Vis *vis, const char *msg) {
size_t pos = text_size(txt);
text_appendf(txt, "%s\n", msg);
text_save(txt, NULL);
- view_cursor_to(win->view, pos);
+ view_cursors_to(win->view->selection, pos);
vis_window_focus(win);
}
diff --git a/vis.c b/vis.c
index a5606e3..c1b9ae0 100644
--- a/vis.c
+++ b/vis.c
@@ -259,7 +259,7 @@ static void window_draw_cursorline(Win *win) {
int width = view->width;
Selection *sel = view_selections_primary_get(view);
- size_t lineno = view_cursors_line_get(sel)->lineno;
+ size_t lineno = sel->line->lineno;
for (Line *l = view->topline; l; l = l->next) {
if (l->lineno == lineno) {
for (int x = 0; x < width; x++)
@@ -314,12 +314,11 @@ static void window_draw_cursor_matching(Win *win, Selection *cur) {
static void window_draw_cursor(Win *win, Selection *cur) {
if (win->vis->win != win)
return;
- Line *line = view_cursors_line_get(cur);
- int col = view_cursors_cell_get(cur);
- if (!line || col == -1)
+ Line *line = cur->line;
+ if (!line)
return;
Selection *primary = view_selections_primary_get(win->view);
- win->ui->style_set(win->ui, &line->cells[col], primary == cur ? UI_STYLE_CURSOR_PRIMARY : UI_STYLE_CURSOR);
+ win->ui->style_set(win->ui, &line->cells[cur->col], primary == cur ? UI_STYLE_CURSOR_PRIMARY : UI_STYLE_CURSOR);
window_draw_cursor_matching(win, cur);
return;
}
@@ -451,7 +450,7 @@ bool vis_window_split(Win *original) {
}
win->file = original->file;
view_options_set(win->view, view_options_get(original->view));
- view_cursor_to(win->view, view_cursor_get(original->view));
+ view_cursors_to(win->view->selection, view_cursor_get(original->view));
vis_doupdates(win->vis, true);
return true;
}
@@ -910,7 +909,7 @@ void vis_do(Vis *vis) {
c.range = text_range_linewise(txt, &c.range);
if (vis->mode->visual) {
view_selections_set(sel, &c.range);
- view_selections_anchor(sel, true);
+ sel->anchored = true;
}
if (a->op) {