- Remove parameter can_display_wrap, as it's always set to TRUE
now, and rename parameter wholeword to whole_word, for
consistency. (DLR)
+ - Only include the whole_word parameter when DISABLE_SPELLER
+ isn't defined, as it's only used then. (DLR)
do_replace_loop()
- Change order of parameters to more closely match those of
findnextstr(), and rename parameter wholewords to whole_word,
for consistency. (DLR)
+ - Only include the whole_word parameter when DISABLE_SPELLER
+ isn't defined, as it's only used then. (DLR)
- text.c:
begpar()
- Return FALSE if foo is NULL, as inpar() does. (DLR)
the text of the spell-checked file into its own function,
replace_buffer(). (DLR)
- utils.c:
+ is_whole_word()
+ - Only include when DISABLE_SPELLER isn't defined, as it's only
+ used then. (DLR)
get_page_start()
- Fix test so that we scroll through the line in 8-character
chunks when COLS is greater than 8, not when COLS is greater
void search_abort(void);
void search_init_globals(void);
int search_init(bool replacing, bool use_answer);
-bool findnextstr(bool whole_word, bool no_sameline, const filestruct
- *begin, size_t begin_x, const char *needle, size_t *needle_len);
+bool findnextstr(
+#ifndef DISABLE_SPELLER
+ bool whole_word,
+#endif
+ bool no_sameline, const filestruct *begin, size_t begin_x, const
+ char *needle, size_t *needle_len);
void findnextstr_wrap_reset(void);
void do_search(void);
#ifndef NANO_TINY
int replace_regexp(char *string, bool create);
#endif
char *replace_line(const char *needle);
-ssize_t do_replace_loop(bool whole_word, bool *canceled, const
- filestruct *real_current, size_t *real_current_x, const char
- *needle);
+ssize_t do_replace_loop(
+#ifndef DISABLE_SPELLER
+ bool whole_word,
+#endif
+ bool *canceled, const filestruct *real_current, size_t
+ *real_current_x, const char *needle);
void do_replace(void);
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
bool interactive, bool save_pos, bool allow_update);
#endif
int regexp_bol_or_eol(const regex_t *preg, const char *string);
#endif
+#ifndef DISABLE_SPELLER
bool is_whole_word(size_t pos, const char *buf, const char *word);
+#endif
const char *strstrwrapper(const char *haystack, const char *needle,
const char *start);
void nperror(const char *s);
* where we first started searching, at column begin_x. The return
* value specifies whether we found anything. If we did, set needle_len
* to the length of the string we found if it isn't NULL. */
-bool findnextstr(bool whole_word, bool no_sameline, const filestruct
- *begin, size_t begin_x, const char *needle, size_t *needle_len)
+bool findnextstr(
+#ifndef DISABLE_SPELLER
+ bool whole_word,
+#endif
+ bool no_sameline, const filestruct *begin, size_t begin_x, const
+ char *needle, size_t *needle_len)
{
filestruct *fileptr = openfile->current;
const char *rev_start = NULL, *found = NULL;
/* We've found a potential match. */
if (found != NULL) {
+#ifndef DISABLE_SPELLER
bool found_whole = FALSE;
/* Is this potential match a whole word? */
+#endif
/* Set found_len to the length of the potential match. */
found_len =
#endif
strlen(needle);
+#ifndef DISABLE_SPELLER
/* If we're searching for whole words, see if this potential
* match is a whole word. */
if (whole_word) {
fileptr->data, word);
free(word);
}
+#endif
/* If we're searching for whole words and this potential
* match isn't a whole word, or if we're not allowed to find
* a match on the same line we started on and this potential
* match is on that line, continue searching. */
- if ((!whole_word || found_whole) && (!no_sameline ||
- fileptr != openfile->current))
+ if (
+#ifndef DISABLE_SPELLER
+ (!whole_word || found_whole) &&
+#endif
+ (!no_sameline || fileptr != openfile->current))
break;
}
#endif
findnextstr_wrap_reset();
- didfind = findnextstr(FALSE, FALSE, openfile->current,
- openfile->current_x, answer, NULL);
+ didfind = findnextstr(
+#ifndef DISABLE_SPELLER
+ FALSE,
+#endif
+ FALSE, openfile->current, openfile->current_x, answer, NULL);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
* which case it's the only occurrence. */
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
last_search)) {
- didfind = findnextstr(FALSE, TRUE, openfile->current,
+ didfind = findnextstr(
+#ifndef DISABLE_SPELLER
+ FALSE,
+#endif
+ TRUE, openfile->current,
openfile->current_x, answer, NULL);
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && !didfind)
#endif
findnextstr_wrap_reset();
- didfind = findnextstr(FALSE, FALSE, openfile->current,
- openfile->current_x, last_search, NULL);
+ didfind = findnextstr(
+#ifndef DISABLE_SPELLER
+ FALSE,
+#endif
+ FALSE, openfile->current, openfile->current_x,
+ last_search, NULL);
/* Check to see if there's only one occurrence of the string and
* we're on it now. */
* found again, in which case it's the only occurrence. */
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
last_search)) {
- didfind = findnextstr(FALSE, TRUE, openfile->current,
- openfile->current_x, answer, NULL);
+ didfind = findnextstr(
+#ifndef DISABLE_SPELLER
+ FALSE,
+#endif
+ TRUE, openfile->current, openfile->current_x,
+ answer, NULL);
if (fileptr == openfile->current && fileptr_x ==
openfile->current_x && !didfind)
statusbar(_("This is the only occurrence"));
* needle is the string to seek. We replace it with answer. Return -1
* if needle isn't found, else the number of replacements performed. If
* canceled isn't NULL, set it to TRUE if we canceled. */
-ssize_t do_replace_loop(bool whole_word, bool *canceled, const
- filestruct *real_current, size_t *real_current_x, const char
- *needle)
+ssize_t do_replace_loop(
+#ifndef DISABLE_SPELLER
+ bool whole_word,
+#endif
+ bool *canceled, const filestruct *real_current, size_t
+ *real_current_x, const char *needle)
{
ssize_t numreplaced = -1;
size_t match_len;
*canceled = FALSE;
findnextstr_wrap_reset();
- while (findnextstr(whole_word,
+ while (findnextstr(
+#ifndef DISABLE_SPELLER
+ whole_word,
+#endif
#ifdef HAVE_REGEX_H
/* We should find a bol and/or eol regex only once per line. If
* the bol_or_eol flag is set, it means that the last search
begin_x = openfile->current_x;
pww_save = openfile->placewewant;
- numreplaced = do_replace_loop(FALSE, NULL, begin, &begin_x,
- last_search);
+ numreplaced = do_replace_loop(
+#ifndef DISABLE_SPELLER
+ FALSE,
+#endif
+ NULL, begin, &begin_x, last_search);
/* Restore where we were. */
openfile->edittop = edittop_save;