diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-02-02 23:10:43 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-02-12 14:20:15 +0100 |
| commit | b4399ffbb402943e1972a9ed04b3ddb3fa6c6cfe (patch) | |
| tree | 4782b5eb06b24e85faef98116117ac5b65a40229 /vis.c | |
| parent | 78f1da727768cc398a09939fdb8d325fdcdca863 (diff) | |
| download | vis-b4399ffbb402943e1972a9ed04b3ddb3fa6c6cfe.tar.gz vis-b4399ffbb402943e1972a9ed04b3ddb3fa6c6cfe.tar.xz | |
Improve large file support
Disable absolute line numbers for large files (currently
anything bigger than 32MiB). This speeds up moving around
with for example nn% since no new lines need to be calculated.
Of course movements like :nn will be unaffected.
The optimizations can be disabled by explicitly enabling
absolute line numbers as in :set number
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -43,6 +43,9 @@ #include "util.h" #include "vis-core.h" +/* enable large file optimization for files larger than: */ +#define LARGE_FILE (1 << 25) + static Macro *macro_get(Vis *vis, enum VisMacro m); static void macro_replay(Vis *vis, const Macro *macro); @@ -180,6 +183,14 @@ Win *window_new_file(Vis *vis, File *file) { } file->refcount++; view_tabwidth_set(win->view, vis->tabwidth); + + if (text_size(file->text) > LARGE_FILE) { + enum UiOption opt = view_options_get(win->view); + opt |= UI_OPTION_LARGE_FILE; + opt &= ~UI_OPTION_LINE_NUMBERS_ABSOLUTE; + view_options_set(win->view, opt); + } + if (vis->windows) vis->windows->prev = win; win->next = vis->windows; |
