aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-19 11:27:55 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-19 11:27:55 +0200
commitf212b9d4952c87052e23b5161195917410b7c911 (patch)
tree238e6fdefac447230b556779870dde4baa466247 /window.c
parentdef913f428365d048ce30d71117421acbf379a75 (diff)
downloadvis-f212b9d4952c87052e23b5161195917410b7c911.tar.gz
vis-f212b9d4952c87052e23b5161195917410b7c911.tar.xz
Implement expand tab functionality, make tabwidth configurable
If expandtab is enabled then inserted tabs are replaced by tabwidth amount of spaces. Both settings apply to all windows files and can be changed via: :set tabwidth n # where 1 <= n <= 8 :set expandtab (1|yes|true)|(0|no|false)
Diffstat (limited to 'window.c')
-rw-r--r--window.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/window.c b/window.c
index db35c4d..a3b28b6 100644
--- a/window.c
+++ b/window.c
@@ -91,6 +91,11 @@ static void window_cursor_set(Win *win, Line *line, int col);
static bool window_viewport_up(Win *win, int n);
static bool window_viewport_down(Win *win, int n);
+void window_tabwidth_set(Win *win, int tabwidth) {
+ win->tabwidth = tabwidth;
+ window_draw(win);
+}
+
void window_selection_clear(Win *win) {
win->sel = text_range_empty();
window_draw(win);
@@ -489,7 +494,7 @@ Win *window_new(Text *text) {
}
win->text = text;
- win->tabwidth = 8; // TODO make configurable
+ win->tabwidth = 8;
int width, height;
getmaxyx(win->win, height, width);