diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-01-14 20:46:49 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-01-14 20:50:17 +0100 |
| commit | 0ade88d86e4fdfca01c0ff48fe82e2aa46c6130d (patch) | |
| tree | bbd8f79307cc5d487d28dfc5bc28dbb6dd283a2c /vis-operators.c | |
| parent | fd340d7c5eb12b79139b5ea6e3f3f187783bf9f2 (diff) | |
| download | vis-0ade88d86e4fdfca01c0ff48fe82e2aa46c6130d.tar.gz vis-0ade88d86e4fdfca01c0ff48fe82e2aa46c6130d.tar.xz | |
vis: inline expand_tab
Diffstat (limited to 'vis-operators.c')
| -rw-r--r-- | vis-operators.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vis-operators.c b/vis-operators.c index 7148b8c..1d288ff 100644 --- a/vis-operators.c +++ b/vis-operators.c @@ -82,9 +82,11 @@ static size_t op_put(Vis *vis, Text *txt, OperatorContext *c) { } static size_t op_shift_right(Vis *vis, Text *txt, OperatorContext *c) { - size_t pos = text_line_begin(txt, c->range.end), prev_pos; - const char *tab = expandtab(vis); + char spaces[9] = " "; + spaces[MIN(vis->tabwidth, LENGTH(spaces) - 1)] = '\0'; + const char *tab = vis->expandtab ? spaces : "\t"; size_t tablen = strlen(tab); + size_t pos = text_line_begin(txt, c->range.end), prev_pos; /* if range ends at the begin of a line, skip line break */ if (pos == c->range.end) |
