Skip to content

Commit

Permalink
view: rename view_cursors_column{,count,next}
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Jun 15, 2017
1 parent 742fb8b commit 08d7d23
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1304,11 +1304,11 @@ static const char *cursors_align_indent(Vis *vis, const char *keys, const Arg *a
View *view = vis_view(vis);
Text *txt = vis_text(vis);
bool left_align = arg->i < 0;
int columns = view_cursors_column_count(view);
int columns = view_selections_column_count(view);

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)) {
for (Cursor *c = view_cursors_column(view, i); c; c = view_selections_column_next(c, i)) {
Filerange sel = view_selections_get(c);
size_t pos = left_align ? sel.start : sel.end;
int col = text_line_width_get(txt, pos);
Expand All @@ -1324,7 +1324,7 @@ static const char *cursors_align_indent(Vis *vis, const char *keys, const Arg *a
return keys;
memset(buf, ' ', len);

for (Cursor *c = view_cursors_column(view, i); c; c = view_cursors_column_next(c, i)) {
for (Cursor *c = view_cursors_column(view, i); c; c = view_selections_column_next(c, i)) {
Filerange sel = view_selections_get(c);
size_t pos = left_align ? sel.start : sel.end;
size_t ipos = sel.start;
Expand Down Expand Up @@ -1418,7 +1418,7 @@ static const char *cursors_remove(Vis *vis, const char *keys, const Arg *arg) {

static const char *cursors_remove_column(Vis *vis, const char *keys, const Arg *arg) {
View *view = vis_view(vis);
int max = view_cursors_column_count(view);
int max = view_selections_column_count(view);
int column = vis_count_get_default(vis, arg->i) - 1;
if (column >= max)
column = max - 1;
Expand All @@ -1428,7 +1428,7 @@ static const char *cursors_remove_column(Vis *vis, const char *keys, const Arg *
}

for (Cursor *c = view_cursors_column(view, column), *next; c; c = next) {
next = view_cursors_column_next(c, column);
next = view_selections_column_next(c, column);
view_selections_dispose(c);
}

Expand All @@ -1438,7 +1438,7 @@ static const char *cursors_remove_column(Vis *vis, const char *keys, const Arg *

static const char *cursors_remove_column_except(Vis *vis, const char *keys, const Arg *arg) {
View *view = vis_view(vis);
int max = view_cursors_column_count(view);
int max = view_selections_column_count(view);
int column = vis_count_get_default(vis, arg->i) - 1;
if (column >= max)
column = max - 1;
Expand All @@ -1452,7 +1452,7 @@ static const char *cursors_remove_column_except(Vis *vis, const char *keys, cons
for (Cursor *next; cur; cur = next) {
next = view_selections_next(cur);
if (cur == col)
col = view_cursors_column_next(col, column);
col = view_selections_column_next(col, column);
else
view_selections_dispose(cur);
}
Expand Down Expand Up @@ -1497,7 +1497,7 @@ static const char *selections_rotate(Vis *vis, const char *keys, const Arg *arg)
Array arr;
Text *txt = vis_text(vis);
View *view = vis_view(vis);
int columns = view_cursors_column_count(view);
int columns = view_selections_column_count(view);
int selections = columns == 1 ? view_selections_count(view) : columns;
int count = vis_count_get_default(vis, 1);
array_init_sized(&arr, sizeof(Rotate));
Expand Down
4 changes: 2 additions & 2 deletions view.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ int view_selections_number(Cursor *c) {
return c->number;
}

int view_cursors_column_count(View *view) {
int view_selections_column_count(View *view) {
Text *txt = view->text;
int cpl_max = 0, cpl = 0; /* cursors per line */
size_t line_prev = 0;
Expand Down Expand Up @@ -994,7 +994,7 @@ Cursor *view_cursors_column(View *view, int column) {
return cursors_column_next(view, NULL, column);
}

Cursor *view_cursors_column_next(Cursor *c, int column) {
Cursor *view_selections_column_next(Cursor *c, int column) {
return cursors_column_next(c->view, c, column);
}

Expand Down
4 changes: 2 additions & 2 deletions view.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ int view_selections_count(View*);
*/
int view_selections_number(Cursor*);
/** Get maximal number of selections on a single line. */
int view_cursors_column_count(View*);
int view_selections_column_count(View*);
/**
* Starting from the start of the text, get the `column`-th selection on a line.
* @param column The zero based column index.
Expand All @@ -178,7 +178,7 @@ Cursor *view_cursors_column(View*, int column);
* Get the next `column`-th selection on a line.
* @param column The zero based column index.
*/
Cursor *view_cursors_column_next(Cursor*, int column);
Cursor *view_selections_column_next(Cursor*, int column);
/**
* @}
* @defgroup view_cover
Expand Down

0 comments on commit 08d7d23

Please sign in to comment.