Commit 49d5c1bf authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

minor fixes involving case insensitive searches and NANO_SMALL

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1984 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 17 additions and 7 deletions
+17 -7
...@@ -120,8 +120,11 @@ CVS code - ...@@ -120,8 +120,11 @@ CVS code -
do_int_spell_fix() do_int_spell_fix()
- Move the REVERSE_SEARCH flag toggling into the NANO_SMALL - Move the REVERSE_SEARCH flag toggling into the NANO_SMALL
#ifdef, since the tiny version of nano doesn't support reverse #ifdef, since the tiny version of nano doesn't support reverse
searching. Also, turn the USE_REGEXP flag off during spell searching. Move the CASE_SENSITIVE flag toggling out in order
checking in order to avoid a potential segfault. (DLR) to allow the internal spell checker to work when NANO_SMALL is
defined and DISABLE_SPELLER isn't. 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
...@@ -146,6 +149,10 @@ CVS code - ...@@ -146,6 +149,10 @@ CVS code -
debugging messages indicating when a flag is set or unset. debugging messages indicating when a flag is set or unset.
(DLR) (DLR)
- search.c: - search.c:
regexp_init()
- If NANO_SMALL is defined, don't bother checking the
CASE_SENSITIVE flag or using its value when compiling a list
of matching regular expressions. (DLR)
search_init() search_init()
- Add parameter use_answer. When it's TRUE, only set - Add parameter use_answer. When it's TRUE, only set
backupstring to answer. This is needed to preserve the text backupstring to answer. This is needed to preserve the text
......
...@@ -1425,8 +1425,8 @@ bool do_int_spell_fix(const char *word) ...@@ -1425,8 +1425,8 @@ 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. */
#ifndef NANO_SMALL
bool case_sens_set = ISSET(CASE_SENSITIVE); bool case_sens_set = ISSET(CASE_SENSITIVE);
#ifndef NANO_SMALL
bool reverse_search_set = ISSET(REVERSE_SEARCH); bool reverse_search_set = ISSET(REVERSE_SEARCH);
bool old_mark_set = ISSET(MARK_ISSET); bool old_mark_set = ISSET(MARK_ISSET);
#endif #endif
...@@ -1434,10 +1434,10 @@ bool do_int_spell_fix(const char *word) ...@@ -1434,10 +1434,10 @@ bool do_int_spell_fix(const char *word)
bool regexp_set = ISSET(USE_REGEXP); bool regexp_set = ISSET(USE_REGEXP);
#endif #endif
#ifndef NANO_SMALL
/* Make sure spell-check is case sensitive. */ /* Make sure spell-check is case sensitive. */
SET(CASE_SENSITIVE); SET(CASE_SENSITIVE);
#ifndef NANO_SMALL
/* Make sure spell-check goes forward only. */ /* Make sure spell-check goes forward only. */
UNSET(REVERSE_SEARCH); UNSET(REVERSE_SEARCH);
...@@ -1500,11 +1500,11 @@ bool do_int_spell_fix(const char *word) ...@@ -1500,11 +1500,11 @@ 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. */ /* Restore case sensitivity setting. */
if (!case_sens_set) if (!case_sens_set)
UNSET(CASE_SENSITIVE); UNSET(CASE_SENSITIVE);
#ifndef NANO_SMALL
/* Restore search/replace direction. */ /* Restore search/replace direction. */
if (reverse_search_set) if (reverse_search_set)
SET(REVERSE_SEARCH); SET(REVERSE_SEARCH);
......
...@@ -42,8 +42,11 @@ static int regexp_compiled = FALSE; ...@@ -42,8 +42,11 @@ static int regexp_compiled = FALSE;
* bar. Return value 1 means success. */ * bar. Return value 1 means success. */
int regexp_init(const char *regexp) int regexp_init(const char *regexp)
{ {
int rc = regcomp(&search_regexp, regexp, REG_EXTENDED | int rc = regcomp(&search_regexp, regexp, REG_EXTENDED
(ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)); #ifndef NANO_SMALL
| (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)
#endif
);
assert(!regexp_compiled); assert(!regexp_compiled);
if (rc != 0) { if (rc != 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment