diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-06-12 18:26:59 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-06-15 15:51:43 +0200 |
| commit | a91e705dfd9b7358bf24e02312dfb06ab3e6848d (patch) | |
| tree | 28c25cdf44b19d56b47447be4fa1991d09424482 | |
| parent | 9e0c192423a165e735441279e0ee6af7cb0353ef (diff) | |
| download | vis-a91e705dfd9b7358bf24e02312dfb06ab3e6848d.tar.gz vis-a91e705dfd9b7358bf24e02312dfb06ab3e6848d.tar.xz | |
view: rename view_cursors_count
| -rw-r--r-- | main.c | 14 | ||||
| -rw-r--r-- | sam.c | 4 | ||||
| -rw-r--r-- | view.c | 2 | ||||
| -rw-r--r-- | view.h | 2 | ||||
| -rw-r--r-- | vis-lua.c | 6 | ||||
| -rw-r--r-- | vis-prompt.c | 2 | ||||
| -rw-r--r-- | vis-registers.c | 2 | ||||
| -rw-r--r-- | vis.c | 6 |
8 files changed, 19 insertions, 19 deletions
@@ -1345,7 +1345,7 @@ static const char *cursors_align_indent(Vis *vis, const char *keys, const Arg *a static const char *cursors_clear(Vis *vis, const char *keys, const Arg *arg) { View *view = vis_view(vis); - if (view_cursors_count(view) > 1) + if (view_selections_count(view) > 1) view_selections_dispose_all(view); else view_selection_clear(view_selections_primary_get(view)); @@ -1422,7 +1422,7 @@ static const char *cursors_remove_column(Vis *vis, const char *keys, const Arg * int column = vis_count_get_default(vis, arg->i) - 1; if (column >= max) column = max - 1; - if (view_cursors_count(view) == 1) { + if (view_selections_count(view) == 1) { vis_mode_switch(vis, VIS_MODE_NORMAL); return keys; } @@ -1442,7 +1442,7 @@ static const char *cursors_remove_column_except(Vis *vis, const char *keys, cons int column = vis_count_get_default(vis, arg->i) - 1; if (column >= max) column = max - 1; - if (view_cursors_count(view) == 1) { + if (view_selections_count(view) == 1) { vis_redraw(vis); return keys; } @@ -1463,7 +1463,7 @@ static const char *cursors_remove_column_except(Vis *vis, const char *keys, cons static const char *cursors_navigate(Vis *vis, const char *keys, const Arg *arg) { View *view = vis_view(vis); - if (view_cursors_count(view) == 1) + if (view_selections_count(view) == 1) return wscroll(vis, keys, arg); Cursor *c = view_selections_primary_get(view); VisCountIterator it = vis_count_iterator_get(vis, 1); @@ -1498,7 +1498,7 @@ static const char *selections_rotate(Vis *vis, const char *keys, const Arg *arg) Text *txt = vis_text(vis); View *view = vis_view(vis); int columns = view_cursors_column_count(view); - int selections = columns == 1 ? view_cursors_count(view) : columns; + int selections = columns == 1 ? view_selections_count(view) : columns; int count = vis_count_get_default(vis, 1); array_init_sized(&arr, sizeof(Rotate)); if (!array_reserve(&arr, selections)) @@ -1710,7 +1710,7 @@ static const char *undo(Vis *vis, const char *keys, const Arg *arg) { size_t pos = text_undo(vis_text(vis)); if (pos != EPOS) { View *view = vis_view(vis); - if (view_cursors_count(view) == 1) + if (view_selections_count(view) == 1) view_cursor_to(view, pos); /* redraw all windows in case some display the same file */ vis_draw(vis); @@ -1722,7 +1722,7 @@ static const char *redo(Vis *vis, const char *keys, const Arg *arg) { size_t pos = text_redo(vis_text(vis)); if (pos != EPOS) { View *view = vis_view(vis); - if (view_cursors_count(view) == 1) + if (view_selections_count(view) == 1) view_cursor_to(view, pos); /* redraw all windows in case some display the same file */ vis_draw(vis); @@ -1437,11 +1437,11 @@ static bool cmd_select(Vis *vis, Win *win, Command *cmd, const char *argv[], Cur bool ret = true; View *view = win->view; Text *txt = win->file->text; - bool multiple_cursors = view_cursors_count(view) > 1; + bool multiple_cursors = view_selections_count(view) > 1; Cursor *primary = view_selections_primary_get(view); if (vis->mode->visual) - count_init(cmd->cmd, view_cursors_count(view)+1); + count_init(cmd->cmd, view_selections_count(view)+1); for (Cursor *c = view_cursors(view), *next; c && ret; c = next) { next = view_selections_next(c); @@ -937,7 +937,7 @@ Cursor *view_selections_new_force(View *view, size_t pos) { return cursors_new(view, pos, true); } -int view_cursors_count(View *view) { +int view_selections_count(View *view) { return view->cursor_count; } @@ -157,7 +157,7 @@ Cursor *view_selections_next(Cursor*); * .. note:: Is always at least 1. * @endrst */ -int view_cursors_count(View*); +int view_selections_count(View*); /** * Get selection index. * @rst @@ -79,7 +79,7 @@ static void window_status_update(Vis *vis, Win *win) { vis_macro_recording(vis) ? " @": ""); left_count++; - int cursor_count = view_cursors_count(view); + int cursor_count = view_selections_count(view); if (cursor_count > 1) { Cursor *c = view_selections_primary_get(view); int cursor_number = view_cursors_number(c) + 1; @@ -1727,7 +1727,7 @@ static const struct luaL_Reg window_funcs[] = { static int window_cursors_index(lua_State *L) { View *view = obj_ref_check(L, 1, VIS_LUA_TYPE_CURSORS); size_t index = luaL_checkunsigned(L, 2); - size_t count = view_cursors_count(view); + size_t count = view_selections_count(view); if (index == 0 || index > count) goto err; for (Cursor *c = view_cursors(view); c; c = view_selections_next(c)) { @@ -1743,7 +1743,7 @@ err: static int window_cursors_len(lua_State *L) { View *view = obj_ref_check(L, 1, VIS_LUA_TYPE_CURSORS); - lua_pushunsigned(L, view_cursors_count(view)); + lua_pushunsigned(L, view_selections_count(view)); return 1; } diff --git a/vis-prompt.c b/vis-prompt.c index fc76dc7..30334b7 100644 --- a/vis-prompt.c +++ b/vis-prompt.c @@ -117,7 +117,7 @@ static const char *prompt_enter(Vis *vis, const char *keys, const Arg *arg) { static const char *prompt_esc(Vis *vis, const char *keys, const Arg *arg) { Win *prompt = vis->win; - if (view_cursors_count(prompt->view) > 1) { + if (view_selections_count(prompt->view) > 1) { view_selections_dispose_all(prompt->view); } else { prompt_restore(prompt); diff --git a/vis-registers.c b/vis-registers.c index d5bb10d..55aab11 100644 --- a/vis-registers.c +++ b/vis-registers.c @@ -177,7 +177,7 @@ bool register_put_range(Vis *vis, Register *reg, Text *txt, Filerange *range) { size_t vis_register_count(Vis *vis, Register *reg) { if (reg->type == REGISTER_NUMBER) - return vis->win ? view_cursors_count(vis->win->view) : 0; + return vis->win ? view_selections_count(vis->win->view) : 0; return array_length(®->values); } @@ -311,7 +311,7 @@ static void window_draw_cursorline(Win *win) { return; if (vis->mode->visual || vis->win != win) return; - if (view_cursors_count(view) > 1) + if (view_selections_count(view) > 1) return; int width = view_width_get(view); @@ -398,7 +398,7 @@ static void window_draw_cursor(Win *win, Cursor *cur, CellStyle *style, CellStyl static void window_draw_cursors(Win *win) { View *view = win->view; Filerange viewport = view_viewport_get(view); - bool multiple_cursors = view_cursors_count(view) > 1; + bool multiple_cursors = view_selections_count(view) > 1; Cursor *cursor = view_selections_primary_get(view); CellStyle style_cursor = win->ui->style_get(win->ui, UI_STYLE_CURSOR); CellStyle style_cursor_primary = win->ui->style_get(win->ui, UI_STYLE_CURSOR_PRIMARY); @@ -830,7 +830,7 @@ void vis_do(Vis *vis) { if (a->op == &vis_operators[VIS_OP_MODESWITCH]) count = 1; /* count should apply to inserted text not motion */ bool repeatable = a->op && !vis->macro_operator && !vis->win->parent; - bool multiple_cursors = view_cursors_count(view) > 1; + bool multiple_cursors = view_selections_count(view) > 1; bool linewise = !(a->type & CHARWISE) && ( a->type & LINEWISE || (a->movement && a->movement->type & LINEWISE) || vis->mode == &vis_modes[VIS_MODE_VISUAL_LINE]); |
