diff --git a/ChangeLog b/ChangeLog index e90a5fd821c4e69e0bfca57e7866edcc692a8585..090d252f7a445f4a74286add7668d72fd3126e7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -115,6 +115,11 @@ CVS code - miscellaneous meta key sequence to be displayed in a shortcut that has a control key, a primary meta key sequence, and a miscellaneous meta key sequence, but no function key. (DLR) + do_int_spell_fix() + - Move the REVERSE_SEARCH flag toggling into the NANO_SMALL + #ifdef, since the tiny version of nano doesn't support reverse + searching. Also, turn the USE_REGEXP flag off during spell + checking in order to avoid a potential segfault. (DLR) justify_format() - For more compatibility with Pico, remove extra space after a character in punct if that character is the same as the one diff --git a/src/nano.c b/src/nano.c index b59eb664b16cfb66e024fbceec1cc40beeb38d68..0d1c9a4c8edbf9e55d2a7c232ce4a94291d3346b 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1425,17 +1425,29 @@ bool do_int_spell_fix(const char *word) /* Save where we are. */ bool accepted = TRUE; /* The return value. */ - bool reverse_search_set = ISSET(REVERSE_SEARCH); #ifndef NANO_SMALL bool case_sens_set = ISSET(CASE_SENSITIVE); + bool reverse_search_set = ISSET(REVERSE_SEARCH); bool old_mark_set = ISSET(MARK_ISSET); +#endif +#ifndef HAVE_REGEX_H + bool regexp_set = ISSET(USE_REGEXP); +#endif +#ifndef NANO_SMALL + /* Make sure spell-check is case sensitive. */ SET(CASE_SENSITIVE); + + /* Make sure spell-check goes forward only. */ + UNSET(REVERSE_SEARCH); + /* Make sure the marking highlight is off during spell-check. */ UNSET(MARK_ISSET); #endif - /* Make sure spell-check goes forward only. */ - UNSET(REVERSE_SEARCH); +#ifndef HAVE_REGEX_H + /* Make sure spell-check doesn't use regular expressions. */ + UNSET(USE_REGEXP); +#endif /* Save the current search/replace strings. */ search_init_globals(); @@ -1488,18 +1500,24 @@ bool do_int_spell_fix(const char *word) current_x = current_x_save; edittop = edittop_save; - /* Restore search/replace direction. */ - if (reverse_search_set) - SET(REVERSE_SEARCH); - #ifndef NANO_SMALL + /* Restore case sensitivity setting. */ if (!case_sens_set) UNSET(CASE_SENSITIVE); + /* Restore search/replace direction. */ + if (reverse_search_set) + SET(REVERSE_SEARCH); + /* Restore marking highlight. */ if (old_mark_set) SET(MARK_ISSET); #endif +#ifndef HAVE_REGEX_H + /* Restore regular expression usage setting. */ + if (regexp_set) + SET(USE_REGEXP); +#endif return accepted; }