summaryrefslogtreecommitdiffstats
path: root/src/spell.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:58 +0000
commit0f75b2ad2e23107f8112b6dcd4785eeef6cc34aa (patch)
tree25185226a8d172d94b0ff72f5a611659252c76d6 /src/spell.c
parentReleasing progress-linux version 2:9.1.0377-1~progress7.99u1. (diff)
downloadvim-0f75b2ad2e23107f8112b6dcd4785eeef6cc34aa.tar.xz
vim-0f75b2ad2e23107f8112b6dcd4785eeef6cc34aa.zip
Merging upstream version 2:9.1.0496.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/spell.c')
-rw-r--r--src/spell.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/spell.c b/src/spell.c
index 43c521d..909d426 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -1336,7 +1336,7 @@ no_spell_checking(win_T *wp)
spell_move_to(
win_T *wp,
int dir, // FORWARD or BACKWARD
- int allwords, // TRUE for "[s"/"]s", FALSE for "[S"/"]S"
+ smt_T behaviour, // Behaviour of the function
int curline,
hlf_T *attrp) // return: attributes of bad word or NULL
// (only when "dir" is FORWARD)
@@ -1441,7 +1441,9 @@ spell_move_to(
if (attr != HLF_COUNT)
{
// We found a bad word. Check the attribute.
- if (allwords || attr == HLF_SPB)
+ if (behaviour == SMT_ALL
+ || (behaviour == SMT_BAD && attr == HLF_SPB)
+ || (behaviour == SMT_RARE && attr == HLF_SPR))
{
// When searching forward only accept a bad word after
// the cursor.
@@ -2953,6 +2955,7 @@ ex_spellrepall(exarg_T *eap UNUSED)
{
pos_T pos = curwin->w_cursor;
char_u *frompat;
+ size_t frompatlen;
char_u *line;
char_u *p;
int save_ws = p_ws;
@@ -2970,7 +2973,7 @@ ex_spellrepall(exarg_T *eap UNUSED)
frompat = alloc(repl_from_len + 7);
if (frompat == NULL)
return;
- sprintf((char *)frompat, "\\V\\<%s\\>", repl_from);
+ frompatlen = vim_snprintf((char *)frompat, repl_from_len + 7, "\\V\\<%s\\>", repl_from);
p_ws = FALSE;
sub_nsubs = 0;
@@ -2978,7 +2981,7 @@ ex_spellrepall(exarg_T *eap UNUSED)
curwin->w_cursor.lnum = 0;
while (!got_int)
{
- if (do_search(NULL, '/', '/', frompat, 1L, SEARCH_KEEP, NULL) == 0
+ if (do_search(NULL, '/', '/', frompat, frompatlen, 1L, SEARCH_KEEP, NULL) == 0
|| u_save_cursor() == FAIL)
break;