aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c24
-rw-r--r--sam.c12
-rw-r--r--view.c6
-rw-r--r--view.h4
-rw-r--r--vis-lua.c4
-rw-r--r--vis.c12
6 files changed, 31 insertions, 31 deletions
diff --git a/main.c b/main.c
index d9939c0..b9b6675 100644
--- a/main.c
+++ b/main.c
@@ -1309,7 +1309,7 @@ static const char *cursors_align_indent(Vis *vis, const char *keys, const Arg *a
for (int i = 0; i < columns; i++) {
int mincol = INT_MAX, maxcol = 0;
for (Cursor *c = view_cursors_column(view, i); c; c = view_cursors_column_next(c, i)) {
- Filerange sel = view_cursors_selection_get(c);
+ Filerange sel = view_selections_get(c);
size_t pos = left_align ? sel.start : sel.end;
int col = text_line_width_get(txt, pos);
if (col < mincol)
@@ -1325,7 +1325,7 @@ static const char *cursors_align_indent(Vis *vis, const char *keys, const Arg *a
memset(buf, ' ', len);
for (Cursor *c = view_cursors_column(view, i); c; c = view_cursors_column_next(c, i)) {
- Filerange sel = view_cursors_selection_get(c);
+ Filerange sel = view_selections_get(c);
size_t pos = left_align ? sel.start : sel.end;
size_t ipos = sel.start;
int col = text_line_width_get(txt, pos);
@@ -1358,7 +1358,7 @@ static const char *cursors_select(Vis *vis, const char *keys, const Arg *arg) {
for (Cursor *cursor = view_cursors(view); cursor; cursor = view_cursors_next(cursor)) {
Filerange word = text_object_word(txt, view_cursors_pos(cursor));
if (text_range_valid(&word))
- view_cursors_selection_set(cursor, &word);
+ view_selections_set(cursor, &word);
}
vis_mode_switch(vis, VIS_MODE_VISUAL);
return keys;
@@ -1368,7 +1368,7 @@ static const char *cursors_select_next(Vis *vis, const char *keys, const Arg *ar
Text *txt = vis_text(vis);
View *view = vis_view(vis);
Cursor *cursor = view_selections_primary_get(view);
- Filerange sel = view_cursors_selection_get(cursor);
+ Filerange sel = view_selections_get(cursor);
if (!text_range_valid(&sel))
return keys;
@@ -1379,19 +1379,19 @@ static const char *cursors_select_next(Vis *vis, const char *keys, const Arg *ar
if (text_range_valid(&word)) {
size_t pos = text_char_prev(txt, word.end);
if ((cursor = view_selections_new(view, pos))) {
- view_cursors_selection_set(cursor, &word);
+ view_selections_set(cursor, &word);
view_selections_primary_set(cursor);
goto out;
}
}
- sel = view_cursors_selection_get(view_cursors(view));
+ sel = view_selections_get(view_cursors(view));
word = text_object_word_find_prev(txt, sel.start, buf);
if (!text_range_valid(&word))
goto out;
size_t pos = text_char_prev(txt, word.end);
if ((cursor = view_selections_new(view, pos))) {
- view_cursors_selection_set(cursor, &word);
+ view_selections_set(cursor, &word);
view_selections_primary_set(cursor);
}
@@ -1509,7 +1509,7 @@ static const char *selections_rotate(Vis *vis, const char *keys, const Arg *arg)
next = view_cursors_next(c);
size_t line_next = 0;
- Filerange sel = view_cursors_selection_get(c);
+ Filerange sel = view_selections_get(c);
Rotate rot;
rot.cursor = c;
rot.len = text_range_size(&sel);
@@ -1532,7 +1532,7 @@ static const char *selections_rotate(Vis *vis, const char *keys, const Arg *arg)
Rotate *newrot = array_get(&arr, j);
if (!oldrot || !newrot || oldrot == newrot)
continue;
- Filerange newsel = view_cursors_selection_get(newrot->cursor);
+ Filerange newsel = view_selections_get(newrot->cursor);
if (!text_range_valid(&newsel))
continue;
if (!text_delete_range(txt, &newsel))
@@ -1540,7 +1540,7 @@ static const char *selections_rotate(Vis *vis, const char *keys, const Arg *arg)
if (!text_insert(txt, newsel.start, oldrot->data, oldrot->len))
continue;
newsel.end = newsel.start + oldrot->len;
- view_cursors_selection_set(newrot->cursor, &newsel);
+ view_selections_set(newrot->cursor, &newsel);
free(oldrot->data);
}
array_clear(&arr);
@@ -1558,7 +1558,7 @@ static const char *selections_trim(Vis *vis, const char *keys, const Arg *arg) {
View *view = vis_view(vis);
for (Cursor *c = view_cursors(view), *next; c; c = next) {
next = view_cursors_next(c);
- Filerange sel = view_cursors_selection_get(c);
+ Filerange sel = view_selections_get(c);
if (!text_range_valid(&sel))
continue;
for (char b; sel.start < sel.end && text_byte_get(txt, sel.end-1, &b)
@@ -1566,7 +1566,7 @@ static const char *selections_trim(Vis *vis, const char *keys, const Arg *arg) {
for (char b; sel.start <= sel.end && text_byte_get(txt, sel.start, &b)
&& isspace((unsigned char)b); sel.start++);
if (sel.start < sel.end) {
- view_cursors_selection_set(c, &sel);
+ view_selections_set(c, &sel);
} else if (!view_selections_dispose(c)) {
vis_mode_switch(vis, VIS_MODE_NORMAL);
}
diff --git a/sam.c b/sam.c
index c0cd9e8..fceb3e6 100644
--- a/sam.c
+++ b/sam.c
@@ -1212,7 +1212,7 @@ enum SamError sam_cmd(Vis *vis, const char *s) {
c->range.start+c->len);
if (c->cursor) {
if (visual) {
- view_cursors_selection_set(c->cursor, &sel);
+ view_selections_set(c->cursor, &sel);
view_cursors_selection_start(c->cursor);
} else {
if (memchr(c->data, '\n', c->len))
@@ -1223,7 +1223,7 @@ enum SamError sam_cmd(Vis *vis, const char *s) {
} else if (visual) {
Cursor *cursor = view_selections_new(c->win->view, sel.start);
if (cursor) {
- view_cursors_selection_set(cursor, &sel);
+ view_selections_set(cursor, &sel);
view_cursors_selection_start(cursor);
}
}
@@ -1447,7 +1447,7 @@ static bool cmd_select(Vis *vis, Win *win, Command *cmd, const char *argv[], Cur
next = view_cursors_next(c);
size_t pos = view_cursors_pos(c);
if (vis->mode->visual) {
- sel = view_cursors_selection_get(c);
+ sel = view_selections_get(c);
} else if (cmd->cmd->address) {
/* convert a single line range to a goto line motion */
if (!multiple_cursors && cmd->cmd->cmddef->func == cmd_print) {
@@ -1504,7 +1504,7 @@ static bool cmd_print(Vis *vis, Win *win, Command *cmd, const char *argv[], Curs
cur = view_selections_new_force(view, pos);
if (cur) {
if (range->start != range->end) {
- view_cursors_selection_set(cur, range);
+ view_selections_set(cur, range);
view_cursors_selection_start(cur);
} else {
view_cursors_selection_clear(cur);
@@ -1563,7 +1563,7 @@ static bool cmd_write(Vis *vis, Win *win, Command *cmd, const char *argv[], Curs
bool visual = vis->mode->visual;
for (Cursor *c = view_cursors(win->view); c; c = view_cursors_next(c)) {
- Filerange range = visual ? view_cursors_selection_get(c) : *r;
+ Filerange range = visual ? view_selections_get(c) : *r;
ssize_t written = text_write_range(text, &range, file->fd);
if (written == -1 || (size_t)written != text_range_size(&range)) {
vis_info_show(vis, "Can not write to stdout");
@@ -1615,7 +1615,7 @@ static bool cmd_write(Vis *vis, Win *win, Command *cmd, const char *argv[], Curs
bool visual = vis->mode->visual;
for (Cursor *c = view_cursors(win->view); c; c = view_cursors_next(c)) {
- Filerange range = visual ? view_cursors_selection_get(c) : *r;
+ Filerange range = visual ? view_selections_get(c) : *r;
ssize_t written = text_save_write_range(ctx, &range);
failure = (written == -1 || (size_t)written != text_range_size(&range));
if (failure) {
diff --git a/view.c b/view.c
index 27269c6..3648097 100644
--- a/view.c
+++ b/view.c
@@ -1198,10 +1198,10 @@ void view_selections_dispose_all(View *view) {
}
Filerange view_selection_get(View *view) {
- return view_cursors_selection_get(view->cursor);
+ return view_selections_get(view->cursor);
}
-Filerange view_cursors_selection_get(Selection *s) {
+Filerange view_selections_get(Selection *s) {
if (!s)
return text_range_empty();
Text *txt = s->view->text;
@@ -1213,7 +1213,7 @@ Filerange view_cursors_selection_get(Selection *s) {
return sel;
}
-void view_cursors_selection_set(Selection *s, const Filerange *r) {
+void view_selections_set(Selection *s, const Filerange *r) {
if (!text_range_valid(r))
return;
Text *txt = s->view->text;
diff --git a/view.h b/view.h
index 0acbecc..5984c5f 100644
--- a/view.h
+++ b/view.h
@@ -185,9 +185,9 @@ Cursor *view_cursors_column_next(Cursor*, int column);
* @{
*/
/** Get an inclusive range of the selection cover. */
-Filerange view_cursors_selection_get(Cursor*);
+Filerange view_selections_get(Cursor*);
/** Set selection cover. Updates both cursor and anchor. */
-void view_cursors_selection_set(Cursor*, const Filerange*);
+void view_selections_set(Cursor*, const Filerange*);
/**
* Reduce selection to character currently covered by the cursor.
* @rst
diff --git a/vis-lua.c b/vis-lua.c
index ad8912a..dc18e9f 100644
--- a/vis-lua.c
+++ b/vis-lua.c
@@ -1864,7 +1864,7 @@ static int window_cursor_index(lua_State *L) {
}
if (strcmp(key, "selection") == 0) {
- Filerange sel = view_cursors_selection_get(cur);
+ Filerange sel = view_selections_get(cur);
pushrange(L, &sel);
return 1;
}
@@ -1888,7 +1888,7 @@ static int window_cursor_newindex(lua_State *L) {
if (strcmp(key, "selection") == 0) {
Filerange sel = getrange(L, 3);
if (text_range_valid(&sel))
- view_cursors_selection_set(cur, &sel);
+ view_selections_set(cur, &sel);
else
view_cursors_selection_clear(cur);
return 0;
diff --git a/vis.c b/vis.c
index 9044ab0..75cc719 100644
--- a/vis.c
+++ b/vis.c
@@ -247,7 +247,7 @@ void vis_window_status(Win *win, const char *status) {
void window_selection_save(Win *win) {
Vis *vis = win->vis;
File *file = win->file;
- Filerange sel = view_cursors_selection_get(view_cursors(win->view));
+ Filerange sel = view_selections_get(view_cursors(win->view));
file->marks[VIS_MARK_SELECTION_START] = text_mark_set(file->text, sel.start);
file->marks[VIS_MARK_SELECTION_END] = text_mark_set(file->text, sel.end);
if (!vis->action.op) {
@@ -331,7 +331,7 @@ static void window_draw_cursorline(Win *win) {
}
static void window_draw_selection(View *view, Cursor *cur, CellStyle *style) {
- Filerange sel = view_cursors_selection_get(cur);
+ Filerange sel = view_selections_get(cur);
if (!text_range_valid(&sel))
return;
Line *start_line; int start_col;
@@ -916,7 +916,7 @@ void vis_do(Vis *vis) {
else
view_cursors_to(cursor, pos);
if (vis->mode->visual)
- c.range = view_cursors_selection_get(cursor);
+ c.range = view_selections_get(cursor);
if (a->movement->type & JUMP)
window_jumplist_add(win, pos);
else
@@ -928,7 +928,7 @@ void vis_do(Vis *vis) {
}
} else if (a->textobj) {
if (vis->mode->visual)
- c.range = view_cursors_selection_get(cursor);
+ c.range = view_selections_get(cursor);
else
c.range.start = c.range.end = pos;
for (int i = 0; i < count; i++) {
@@ -964,7 +964,7 @@ void vis_do(Vis *vis) {
}
}
} else if (vis->mode->visual) {
- c.range = view_cursors_selection_get(cursor);
+ c.range = view_selections_get(cursor);
if (!text_range_valid(&c.range))
c.range.start = c.range.end = pos;
}
@@ -972,7 +972,7 @@ void vis_do(Vis *vis) {
if (linewise && vis->mode != &vis_modes[VIS_MODE_VISUAL])
c.range = text_range_linewise(txt, &c.range);
if (vis->mode->visual)
- view_cursors_selection_set(cursor, &c.range);
+ view_selections_set(cursor, &c.range);
if (a->op) {
size_t pos = a->op->func(vis, txt, &c);