From 0ade88d86e4fdfca01c0ff48fe82e2aa46c6130d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 14 Jan 2016 20:46:49 +0100 Subject: vis: inline expand_tab --- vis-operators.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'vis-operators.c') 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) -- cgit v1.2.3