commit 49d5c1bf1ca8ec8a3e7a2fa6a19eb77a95c3838b
parent 731e7f28e70f294c2ee6b808b3e778830ea8193e
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Mon, 11 Oct 2004 13:55:33 +0000
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
Diffstat:
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -120,8 +120,11 @@ CVS code -
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)
+ searching. Move the CASE_SENSITIVE flag toggling out in order
+ 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()
- For more compatibility with Pico, remove extra space after a
character in punct if that character is the same as the one
@@ -146,6 +149,10 @@ CVS code -
debugging messages indicating when a flag is set or unset.
(DLR)
- 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()
- Add parameter use_answer. When it's TRUE, only set
backupstring to answer. This is needed to preserve the text
diff --git a/src/nano.c b/src/nano.c
@@ -1425,8 +1425,8 @@ bool do_int_spell_fix(const char *word)
/* Save where we are. */
bool accepted = TRUE;
/* The return value. */
-#ifndef NANO_SMALL
bool case_sens_set = ISSET(CASE_SENSITIVE);
+#ifndef NANO_SMALL
bool reverse_search_set = ISSET(REVERSE_SEARCH);
bool old_mark_set = ISSET(MARK_ISSET);
#endif
@@ -1434,10 +1434,10 @@ bool do_int_spell_fix(const char *word)
bool regexp_set = ISSET(USE_REGEXP);
#endif
-#ifndef NANO_SMALL
/* Make sure spell-check is case sensitive. */
SET(CASE_SENSITIVE);
+#ifndef NANO_SMALL
/* Make sure spell-check goes forward only. */
UNSET(REVERSE_SEARCH);
@@ -1500,11 +1500,11 @@ bool do_int_spell_fix(const char *word)
current_x = current_x_save;
edittop = edittop_save;
-#ifndef NANO_SMALL
/* Restore case sensitivity setting. */
if (!case_sens_set)
UNSET(CASE_SENSITIVE);
+#ifndef NANO_SMALL
/* Restore search/replace direction. */
if (reverse_search_set)
SET(REVERSE_SEARCH);
diff --git a/src/search.c b/src/search.c
@@ -42,8 +42,11 @@ static int regexp_compiled = FALSE;
* bar. Return value 1 means success. */
int regexp_init(const char *regexp)
{
- int rc = regcomp(&search_regexp, regexp, REG_EXTENDED |
- (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE));
+ int rc = regcomp(&search_regexp, regexp, REG_EXTENDED
+#ifndef NANO_SMALL
+ | (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)
+#endif
+ );
assert(!regexp_compiled);
if (rc != 0) {