mirror of
https://github.com/neovim/neovim.git
synced 2025-10-15 06:16:08 +00:00
feat(extmarks,ts,spell): full support for spelling
- Added 'spell' option to extmarks: Extmarks with this set will have the region spellchecked. - Added 'noplainbuffer' option to 'spelloptions': This is used to tell Neovim not to spellcheck the buffer. The old behaviour was to spell check the whole buffer unless :syntax was set. - Added spelling support to the treesitter highlighter: @spell captures in highlights.scm are used to define regions which should be spell checked. - Added support for navigating spell errors for extmarks: Works for both ephemeral and static extmarks - Added '_on_spell_nav' callback for decoration providers: Since ephemeral callbacks are only drawn for the visible screen, providers must implement this callback to instruct Neovim which regions in the buffer need can be spell checked. The callback takes a start position and an end position. Note: this callback is subject to change hence the _ prefix. - Added spell captures for built-in support languages Co-authored-by: Lewis Russell <lewis6991@gmail.com> Co-authored-by: Björn Linse <bjorn.linse@gmail.com>
This commit is contained in:

committed by
Lewis Russell

parent
05893aea39
commit
75adfefc85
@@ -69,7 +69,7 @@ void bufhl_add_hl_pos_offset(buf_T *buf, int src_id, int hl_id, lpos_T pos_start
|
||||
void decor_redraw(buf_T *buf, int row1, int row2, Decoration *decor)
|
||||
{
|
||||
if (row2 >= row1) {
|
||||
if (!decor || decor->hl_id || decor_has_sign(decor) || decor->conceal) {
|
||||
if (!decor || decor->hl_id || decor_has_sign(decor) || decor->conceal || decor->spell) {
|
||||
redraw_buf_range_later(buf, row1 + 1, row2 + 1);
|
||||
}
|
||||
}
|
||||
@@ -116,6 +116,11 @@ void decor_free(Decoration *decor)
|
||||
}
|
||||
}
|
||||
|
||||
void decor_state_free(DecorState *state)
|
||||
{
|
||||
xfree(state->active.items);
|
||||
}
|
||||
|
||||
void clear_virttext(VirtText *text)
|
||||
{
|
||||
for (size_t i = 0; i < kv_size(*text); i++) {
|
||||
@@ -306,6 +311,7 @@ next_mark:
|
||||
bool conceal = 0;
|
||||
int conceal_char = 0;
|
||||
int conceal_attr = 0;
|
||||
bool spell = false;
|
||||
|
||||
for (size_t i = 0; i < kv_size(state->active); i++) {
|
||||
DecorRange item = kv_A(state->active, i);
|
||||
@@ -339,6 +345,9 @@ next_mark:
|
||||
conceal_attr = item.attr_id;
|
||||
}
|
||||
}
|
||||
if (active && item.decor.spell) {
|
||||
spell = true;
|
||||
}
|
||||
if ((item.start_row == state->row && item.start_col <= col)
|
||||
&& decor_virt_pos(item.decor)
|
||||
&& item.decor.virt_text_pos == kVTOverlay && item.win_col == -1) {
|
||||
@@ -355,6 +364,7 @@ next_mark:
|
||||
state->conceal = conceal;
|
||||
state->conceal_char = conceal_char;
|
||||
state->conceal_attr = conceal_attr;
|
||||
state->spell = spell;
|
||||
return attr;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user