diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-10-12 13:47:36 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-10-14 10:33:26 +0200 |
| commit | 277c6b4897e11a5449fc1cfab3ab6e83307a7989 (patch) | |
| tree | a8b34ab47c11dfd9995ef03d9fae1613dde2be67 /vis.c | |
| parent | 9e391f5e3b2baaee0bf73e5273daf84be8a76ce2 (diff) | |
| download | vis-277c6b4897e11a5449fc1cfab3ab6e83307a7989.tar.gz vis-277c6b4897e11a5449fc1cfab3ab6e83307a7989.tar.xz | |
view: cleanup option handling
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 26 |
1 files changed, 20 insertions, 6 deletions
@@ -1783,15 +1783,29 @@ static bool cmd_set(Filerange *range, enum CmdOpt cmdopt, const char *argv[]) { } view_symbols_set(vis->win->view, flags); break; - case OPTION_NUMBER: - editor_window_options(vis->win, arg.b ? UI_OPTION_LINE_NUMBERS_ABSOLUTE : - UI_OPTION_LINE_NUMBERS_NONE); + case OPTION_NUMBER: { + enum UiOption opt = view_options_get(vis->win->view); + if (arg.b) { + opt &= ~UI_OPTION_LINE_NUMBERS_RELATIVE; + opt |= UI_OPTION_LINE_NUMBERS_ABSOLUTE; + } else { + opt &= ~UI_OPTION_LINE_NUMBERS_ABSOLUTE; + } + view_options_set(vis->win->view, opt); break; - case OPTION_NUMBER_RELATIVE: - editor_window_options(vis->win, arg.b ? UI_OPTION_LINE_NUMBERS_RELATIVE : - UI_OPTION_LINE_NUMBERS_NONE); + } + case OPTION_NUMBER_RELATIVE: { + enum UiOption opt = view_options_get(vis->win->view); + if (arg.b) { + opt &= ~UI_OPTION_LINE_NUMBERS_ABSOLUTE; + opt |= UI_OPTION_LINE_NUMBERS_RELATIVE; + } else { + opt &= ~UI_OPTION_LINE_NUMBERS_RELATIVE; + } + view_options_set(vis->win->view, opt); break; } + } return true; } |
