From a91e705dfd9b7358bf24e02312dfb06ab3e6848d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 12 Jun 2017 18:26:59 +0200 Subject: view: rename view_cursors_count --- main.c | 14 +++++++------- sam.c | 4 ++-- view.c | 2 +- view.h | 2 +- vis-lua.c | 6 +++--- vis-prompt.c | 2 +- vis-registers.c | 2 +- vis.c | 6 +++--- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/main.c b/main.c index 3bb58a7..50450f5 100644 --- a/main.c +++ b/main.c @@ -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); diff --git a/sam.c b/sam.c index bd29a92..0824df4 100644 --- a/sam.c +++ b/sam.c @@ -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); diff --git a/view.c b/view.c index 7762fa1..938e75d 100644 --- a/view.c +++ b/view.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; } diff --git a/view.h b/view.h index fcdb353..f725b88 100644 --- a/view.h +++ b/view.h @@ -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 diff --git a/vis-lua.c b/vis-lua.c index 2788be5..a78a866 100644 --- a/vis-lua.c +++ b/vis-lua.c @@ -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); } diff --git a/vis.c b/vis.c index cf647b3..2c72108 100644 --- a/vis.c +++ b/vis.c @@ -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]); -- cgit v1.2.3