Skip to content

Commit

Permalink
patch 9.1.0512: Mode message for spell completion doesn't match allow…
Browse files Browse the repository at this point in the history
…ed keys

Problem:  Mode message for spell completion doesn't match allowed keys
          (Kyle Kovacs)
Solution: Show "^S" instead of "s".
          (zeertzjq)

This matches the code in vim_is_ctrl_x_key():

	case CTRL_X_SPELL:
	    return (c == Ctrl_S || c == Ctrl_P || c == Ctrl_N);

fixes: neovim/neovim#29431
closes: #15065

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
  • Loading branch information
zeertzjq authored and chrisbra committed Jun 21, 2024
1 parent bc6f967 commit 7002c05
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/insexpand.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static char *ctrl_x_msgs[] =
N_(" Command-line completion (^V^N^P)"),
N_(" User defined completion (^U^N^P)"),
N_(" Omni completion (^O^N^P)"),
N_(" Spelling suggestion (s^N^P)"),
N_(" Spelling suggestion (^S^N^P)"),
N_(" Keyword Local completion (^N^P)"),
NULL, // CTRL_X_EVAL doesn't use msg.
N_(" Command-line completion (^V^N^P)"),
Expand Down
15 changes: 15 additions & 0 deletions src/testdir/test_spell.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ source check.vim
CheckFeature spell

source screendump.vim
source view_util.vim

func TearDown()
set nospell
Expand Down Expand Up @@ -300,6 +301,20 @@ func Test_compl_with_CTRL_X_CTRL_K_using_spell()
set spell& spelllang& dictionary& ignorecase&
endfunc

func Test_compl_with_CTRL_X_s()
new
set spell spelllang=en_us showmode
inoremap <buffer><F2> <Cmd>let g:msg = Screenline(&lines)<CR>
call feedkeys("STheatre\<C-X>s\<F2>\<C-Y>\<Esc>", 'tx')
call assert_equal(['Theater'], getline(1, '$'))
call assert_match('(^S^N^P)', g:msg)

bwipe!
set spell& spelllang& showmode&
unlet g:msg
endfunc

func Test_spellrepall()
new
set spell
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
512,
/**/
511,
/**/
Expand Down

0 comments on commit 7002c05

Please sign in to comment.