mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(help): force tree reparse after local addition insertion
Problem: *local-additions* in `help.txt` are inserted via `ml_append`, which messes up treesitter highlighting of this file as the buffer becomes desynced from the tree. Solution: Add hack on top of hack by explicitly calling `mark_adjust` and `changed_lines_buf` after each insertion.
This commit is contained in:
parent
f01f18cdf4
commit
95ab5a0da3
@ -10,6 +10,7 @@
|
||||
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/buffer.h"
|
||||
#include "nvim/change.h"
|
||||
#include "nvim/charset.h"
|
||||
#include "nvim/cmdexpand.h"
|
||||
#include "nvim/ex_cmds.h"
|
||||
@ -699,6 +700,8 @@ void fix_help_buffer(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
int lnum_start = lnum;
|
||||
|
||||
// Go through all directories in 'runtimepath', skipping
|
||||
// $VIMRUNTIME.
|
||||
char *p = p_rtp;
|
||||
@ -829,6 +832,11 @@ void fix_help_buffer(void)
|
||||
}
|
||||
xfree(rt);
|
||||
}
|
||||
linenr_T appended = lnum - lnum_start;
|
||||
if (appended) {
|
||||
mark_adjust(lnum_start + 1, (linenr_T)MAXLNUM, appended, 0L, kExtmarkUndo);
|
||||
changed_lines_buf(curbuf, lnum_start + 1, lnum_start + 1, appended);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user