in 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


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1979 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
David Lawrence Ramsey 2004-10-09 16:59:43 +00:00
parent 3497666a21
commit d93ee682c0
2 changed files with 30 additions and 7 deletions

View File

@ -115,6 +115,11 @@ CVS code -
miscellaneous meta key sequence to be displayed in a shortcut miscellaneous meta key sequence to be displayed in a shortcut
that has a control key, a primary meta key sequence, and a that has a control key, a primary meta key sequence, and a
miscellaneous meta key sequence, but no function key. (DLR) 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() justify_format()
- For more compatibility with Pico, remove extra space after a - For more compatibility with Pico, remove extra space after a
character in punct if that character is the same as the one character in punct if that character is the same as the one

View File

@ -1425,17 +1425,29 @@ bool do_int_spell_fix(const char *word)
/* Save where we are. */ /* Save where we are. */
bool accepted = TRUE; bool accepted = TRUE;
/* The return value. */ /* The return value. */
bool reverse_search_set = ISSET(REVERSE_SEARCH);
#ifndef NANO_SMALL #ifndef NANO_SMALL
bool case_sens_set = ISSET(CASE_SENSITIVE); bool case_sens_set = ISSET(CASE_SENSITIVE);
bool reverse_search_set = ISSET(REVERSE_SEARCH);
bool old_mark_set = ISSET(MARK_ISSET); 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); SET(CASE_SENSITIVE);
/* Make sure spell-check goes forward only. */
UNSET(REVERSE_SEARCH);
/* Make sure the marking highlight is off during spell-check. */ /* Make sure the marking highlight is off during spell-check. */
UNSET(MARK_ISSET); UNSET(MARK_ISSET);
#endif #endif
/* Make sure spell-check goes forward only. */ #ifndef HAVE_REGEX_H
UNSET(REVERSE_SEARCH); /* Make sure spell-check doesn't use regular expressions. */
UNSET(USE_REGEXP);
#endif
/* Save the current search/replace strings. */ /* Save the current search/replace strings. */
search_init_globals(); search_init_globals();
@ -1488,18 +1500,24 @@ bool do_int_spell_fix(const char *word)
current_x = current_x_save; current_x = current_x_save;
edittop = edittop_save; edittop = edittop_save;
#ifndef NANO_SMALL
/* Restore case sensitivity setting. */
if (!case_sens_set)
UNSET(CASE_SENSITIVE);
/* Restore search/replace direction. */ /* Restore search/replace direction. */
if (reverse_search_set) if (reverse_search_set)
SET(REVERSE_SEARCH); SET(REVERSE_SEARCH);
#ifndef NANO_SMALL
if (!case_sens_set)
UNSET(CASE_SENSITIVE);
/* Restore marking highlight. */ /* Restore marking highlight. */
if (old_mark_set) if (old_mark_set)
SET(MARK_ISSET); SET(MARK_ISSET);
#endif #endif
#ifndef HAVE_REGEX_H
/* Restore regular expression usage setting. */
if (regexp_set)
SET(USE_REGEXP);
#endif
return accepted; return accepted;
} }