From 08cd197bf13ef5686c9fb090b278ed1db3b11548 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 8 Sep 2016 21:00:51 +0200 Subject: [PATCH] general: include word-jumping and block-jumping into the tiny version And also case-sensitive searches, backward searches, and searching again. --- src/chars.c | 4 ---- src/global.c | 36 ++++++----------------------------- src/move.c | 2 -- src/nano.c | 8 +++++--- src/proto.h | 16 ++++------------ src/rcfile.c | 2 -- src/search.c | 54 +++++++++++++--------------------------------------- src/text.c | 5 ++--- src/utils.c | 21 ++++++-------------- src/winio.c | 19 +++++++++--------- 10 files changed, 46 insertions(+), 121 deletions(-) diff --git a/src/chars.c b/src/chars.c index 8f723641..4f12c5b2 100644 --- a/src/chars.c +++ b/src/chars.c @@ -600,7 +600,6 @@ char *mbstrcasestr(const char *haystack, const char *needle) return (char *) strcasestr(haystack, needle); } -#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP) /* This function is equivalent to strstr(), except in that it scans the * string in reverse, starting at rev_start. */ char *revstrstr(const char *haystack, const char *needle, const char @@ -628,9 +627,7 @@ char *revstrstr(const char *haystack, const char *needle, const char return NULL; } -#endif /* !NANO_TINY || !DISABLE_TABCOMP */ -#ifndef NANO_TINY /* This function is equivalent to strcasestr(), except in that it scans * the string in reverse, starting at rev_start. */ char *revstrcasestr(const char *haystack, const char *needle, const char @@ -696,7 +693,6 @@ char *mbrevstrcasestr(const char *haystack, const char *needle, const #endif return revstrcasestr(haystack, needle, rev_start); } -#endif /* !NANO_TINY */ /* This function is equivalent to strlen() for multibyte strings. */ size_t mbstrlen(const char *s) diff --git a/src/global.c b/src/global.c index 84d239da..65d4c52c 100644 --- a/src/global.c +++ b/src/global.c @@ -33,7 +33,7 @@ volatile sig_atomic_t sigwinch_counter = 0; /* Is incremented by the handler whenever a SIGWINCH occurs. */ #endif -#if defined(__linux__) && !defined(NANO_TINY) +#ifdef __linux__ bool console; /* Whether we're running on a Linux VC (TRUE) or under X (FALSE). */ #endif @@ -48,8 +48,8 @@ bool focusing = TRUE; message_type lastmessage = HUSH; /* Messages of type HUSH should not overwrite type MILD nor ALERT. */ -#ifndef NANO_TINY int controlleft, controlright, controlup, controldown; +#ifndef NANO_TINY int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown; int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown; #endif @@ -496,10 +496,8 @@ void shortcut_init(void) const char *fulljustify_tag = N_("FullJstify"); #endif const char *refresh_tag = N_("Refresh"); -#ifndef NANO_TINY /* TRANSLATORS: Try to keep this string at most 12 characters. */ const char *whereis_next_tag = N_("WhereIs Next"); -#endif #ifndef DISABLE_HELP #ifndef DISABLE_JUSTIFY @@ -555,18 +553,14 @@ void shortcut_init(void) #endif const char *nano_back_msg = N_("Go back one character"); const char *nano_forward_msg = N_("Go forward one character"); -#ifndef NANO_TINY const char *nano_prevword_msg = N_("Go back one word"); const char *nano_nextword_msg = N_("Go forward one word"); -#endif const char *nano_prevline_msg = N_("Go to previous line"); const char *nano_nextline_msg = N_("Go to next line"); const char *nano_home_msg = N_("Go to beginning of current line"); const char *nano_end_msg = N_("Go to end of current line"); -#ifndef NANO_TINY const char *nano_prevblock_msg = N_("Go to previous block of text"); const char *nano_nextblock_msg = N_("Go to next block of text"); -#endif #ifndef DISABLE_JUSTIFY const char *nano_parabegin_msg = N_("Go to beginning of paragraph; then of previous paragraph"); @@ -778,18 +772,14 @@ void shortcut_init(void) gotoline_tag, IFSCHELP(nano_gotoline_msg), BLANKAFTER, VIEW); #endif -#ifndef NANO_TINY add_to_funcs(case_sens_void, MWHEREIS|MREPLACE, N_("Case Sens"), IFSCHELP(nano_case_msg), TOGETHER, VIEW); -#endif #ifdef HAVE_REGEX_H add_to_funcs(regexp_void, MWHEREIS|MREPLACE, N_("Regexp"), IFSCHELP(nano_regexp_msg), TOGETHER, VIEW); #endif -#ifndef NANO_TINY add_to_funcs(backwards_void, MWHEREIS|MREPLACE, N_("Backwards"), IFSCHELP(nano_reverse_msg), TOGETHER, VIEW); -#endif add_to_funcs(flip_replace_void, MWHEREIS, replace_tag, IFSCHELP(nano_replace_msg), BLANKAFTER, VIEW); @@ -815,10 +805,10 @@ void shortcut_init(void) add_to_funcs(do_last_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, N_("Last Line"), IFSCHELP(nano_lastline_msg), BLANKAFTER, VIEW); -#ifndef NANO_TINY add_to_funcs(do_research, MMAIN, whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW); +#ifndef NANO_TINY add_to_funcs(do_find_bracket, MMAIN, N_("To Bracket"), IFSCHELP(nano_bracket_msg), TOGETHER, VIEW); @@ -851,12 +841,10 @@ void shortcut_init(void) N_("Forward"), IFSCHELP(nano_forwardfile_msg), TOGETHER, VIEW); #endif -#ifndef NANO_TINY add_to_funcs(do_prev_word_void, MMAIN, N_("Prev Word"), IFSCHELP(nano_prevword_msg), TOGETHER, VIEW); add_to_funcs(do_next_word_void, MMAIN, N_("Next Word"), IFSCHELP(nano_nextword_msg), TOGETHER, VIEW); -#endif add_to_funcs(do_home, MMAIN, N_("Home"), IFSCHELP(nano_home_msg), TOGETHER, VIEW); @@ -868,12 +856,10 @@ void shortcut_init(void) add_to_funcs(do_down_void, MMAIN|MBROWSER, next_line_tag, IFSCHELP(nano_nextline_msg), BLANKAFTER, VIEW); -#ifndef NANO_TINY add_to_funcs(do_prev_block, MMAIN, N_("Prev Block"), IFSCHELP(nano_prevblock_msg), TOGETHER, VIEW); add_to_funcs(do_next_block, MMAIN, N_("Next Block"), IFSCHELP(nano_nextblock_msg), TOGETHER, VIEW); -#endif #ifndef DISABLE_JUSTIFY add_to_funcs(do_para_begin_void, MMAIN|MWHEREIS, @@ -1104,9 +1090,9 @@ void shortcut_init(void) add_to_sclist(MMAIN|MHELP, "M-|", do_first_line, 0); add_to_sclist(MMAIN|MHELP, "M-/", do_last_line, 0); add_to_sclist(MMAIN|MHELP, "M-?", do_last_line, 0); -#ifndef NANO_TINY add_to_sclist(MMAIN|MBROWSER, "M-W", do_research, 0); add_to_sclist(MMAIN|MBROWSER, "F16", do_research, 0); +#ifndef NANO_TINY add_to_sclist(MMAIN, "M-]", do_find_bracket, 0); add_to_sclist(MMAIN, "^^", do_mark, 0); add_to_sclist(MMAIN, "M-A", do_mark, 0); @@ -1125,10 +1111,8 @@ void shortcut_init(void) add_to_sclist(MMOST, "Left", do_left, 0); add_to_sclist(MMOST, "^F", do_right, 0); add_to_sclist(MMOST, "Right", do_right, 0); -#ifndef NANO_TINY add_to_sclist(MMOST, "M-Space", do_prev_word_void, 0); add_to_sclist(MMOST, "^Space", do_next_word_void, 0); -#endif add_to_sclist((MMOST & ~MBROWSER), "^A", do_home, 0); add_to_sclist((MMOST & ~MBROWSER), "Home", do_home, 0); add_to_sclist((MMOST & ~MBROWSER), "^E", do_end, 0); @@ -1137,10 +1121,8 @@ void shortcut_init(void) add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", do_up_void, 0); add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", do_down_void, 0); add_to_sclist(MMAIN|MHELP|MBROWSER, "Down", do_down_void, 0); -#ifndef NANO_TINY add_to_sclist(MMAIN, "M-7", do_prev_block, 0); add_to_sclist(MMAIN, "M-8", do_next_block, 0); -#endif #ifndef DISABLE_JUSTIFY add_to_sclist(MMAIN, "M-(", do_para_begin_void, 0); add_to_sclist(MMAIN, "M-9", do_para_begin_void, 0); @@ -1208,11 +1190,9 @@ void shortcut_init(void) add_to_sclist(((MMOST & ~MMAIN & ~MBROWSER) | MYESNO), "^C", do_cancel, 0); -#ifndef NANO_TINY - add_to_sclist(MWHEREIS|MREPLACE, "M-B", backwards_void, 0); add_to_sclist(MWHEREIS|MREPLACE, "M-C", case_sens_void, 0); -#endif add_to_sclist(MWHEREIS|MREPLACE, "M-R", regexp_void, 0); + add_to_sclist(MWHEREIS|MREPLACE, "M-B", backwards_void, 0); add_to_sclist(MWHEREIS|MREPLACE, "^R", flip_replace_void, 0); add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^Y", do_first_line, 0); add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^V", do_last_line, 0); @@ -1395,10 +1375,10 @@ sc *strtosc(const char *input) s->scfunc = do_insertfile_void; else if (!strcasecmp(input, "whereis")) s->scfunc = do_search; -#ifndef NANO_TINY else if (!strcasecmp(input, "searchagain") || !strcasecmp(input, "research")) /* Deprecated. Remove in 2018. */ s->scfunc = do_research; +#ifndef NANO_TINY else if (!strcasecmp(input, "findprevious")) s->scfunc = do_findprevious; else if (!strcasecmp(input, "findnext")) @@ -1522,17 +1502,13 @@ sc *strtosc(const char *input) s->scfunc = total_refresh; else if (!strcasecmp(input, "suspend")) s->scfunc = do_suspend_void; -#ifndef NANO_TINY else if (!strcasecmp(input, "casesens")) s->scfunc = case_sens_void; -#endif else if (!strcasecmp(input, "regexp") || !strcasecmp(input, "regex")) /* Deprecated. Remove in 2018. */ s->scfunc = regexp_void; -#ifndef NANO_TINY else if (!strcasecmp(input, "backwards")) s->scfunc = backwards_void; -#endif else if (!strcasecmp(input, "flipreplace") || !strcasecmp(input, "dontreplace")) /* Deprecated. Remove in 2018. */ s->scfunc = flip_replace_void; diff --git a/src/move.c b/src/move.c index f3ad6e55..06cabe38 100644 --- a/src/move.c +++ b/src/move.c @@ -209,7 +209,6 @@ void do_para_end_void(void) } #endif /* !DISABLE_JUSTIFY */ -#ifndef NANO_TINY /* Move to the preceding block of text in the file. */ void do_prev_block(void) { @@ -360,7 +359,6 @@ void do_next_word_void(void) { do_next_word(ISSET(WORD_BOUNDS), TRUE); } -#endif /* !NANO_TINY */ /* Move to the beginning of the current line. If the SMART_HOME flag is * set, move to the first non-whitespace character of the current line diff --git a/src/nano.c b/src/nano.c index 31a96f29..a5420738 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1542,7 +1542,7 @@ void terminal_init(void) #endif } -#if !defined(NANO_TINY) && defined(HAVE_KEY_DEFINED) +#ifdef HAVE_KEY_DEFINED /* Ask ncurses for a keycode, or assign a default one. */ int get_keycode(const char *keyname, const int standard) { @@ -2527,7 +2527,7 @@ int main(int argc, char **argv) /* Set up the terminal state. */ terminal_init(); -#if defined(__linux__) && !defined(NANO_TINY) +#ifdef __linux__ /* Check whether we're running on a Linux console. */ console = (getenv("DISPLAY") == NULL); #endif @@ -2557,12 +2557,14 @@ int main(int argc, char **argv) interface_color_pair[FUNCTION_TAG] = A_NORMAL; #endif -#if !defined(NANO_TINY) && defined(HAVE_KEY_DEFINED) +#ifdef HAVE_KEY_DEFINED /* Ask ncurses for the key codes for Control+Left/Right/Up/Down. */ controlleft = get_keycode("kLFT5", CONTROL_LEFT); controlright = get_keycode("kRIT5", CONTROL_RIGHT); controlup = get_keycode("kUP5", CONTROL_UP); controldown = get_keycode("kDN5", CONTROL_DOWN); +#endif +#if !defined(NANO_TINY) && defined(HAVE_KEY_DEFINED) /* Ask for the codes for Shift+Control+Left/Right/Up/Down. */ shiftcontrolleft = get_keycode("kLFT6", SHIFT_CONTROL_LEFT); shiftcontrolright = get_keycode("kRIT6", SHIFT_CONTROL_RIGHT); diff --git a/src/proto.h b/src/proto.h index 85e1db0f..553418bc 100644 --- a/src/proto.h +++ b/src/proto.h @@ -29,7 +29,7 @@ extern volatile sig_atomic_t sigwinch_counter; #endif -#if defined(__linux__) && !defined(NANO_TINY) +#ifdef __linux__ extern bool console; #endif @@ -40,11 +40,11 @@ extern bool focusing; extern message_type lastmessage; -#ifndef NANO_TINY extern int controlleft; extern int controlright; extern int controlup; extern int controldown; +#ifndef NANO_TINY extern int shiftcontrolleft; extern int shiftcontrolright; extern int shiftcontrolup; @@ -225,16 +225,12 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n); char *nstrcasestr(const char *haystack, const char *needle); #endif char *mbstrcasestr(const char *haystack, const char *needle); -#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP) char *revstrstr(const char *haystack, const char *needle, const char *rev_start); -#endif -#ifndef NANO_TINY char *revstrcasestr(const char *haystack, const char *needle, const char *rev_start); char *mbrevstrcasestr(const char *haystack, const char *needle, const char *rev_start); -#endif size_t mbstrlen(const char *s); #ifndef HAVE_STRNLEN size_t nstrnlen(const char *s, size_t maxlen); @@ -410,14 +406,12 @@ void do_para_begin_void(void); void do_para_end(bool allow_update); void do_para_end_void(void); #endif -#ifndef NANO_TINY void do_prev_block(void); void do_next_block(void); void do_prev_word(bool allow_punct, bool allow_update); void do_prev_word_void(void); bool do_next_word(bool allow_punct, bool allow_update); void do_next_word_void(void); -#endif void do_home(void); void do_end(void); void do_up(bool scroll_only); @@ -573,9 +567,7 @@ void do_search(void); void do_findprevious(void); void do_findnext(void); #endif -#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER) void do_research(void); -#endif void go_looking(void); #ifdef HAVE_REGEX_H int replace_regexp(char *string, bool create); @@ -627,11 +619,11 @@ void do_tab(void); void do_indent(ssize_t cols); void do_indent_void(void); void do_unindent(void); -bool white_string(const char *s); void do_undo(void); void do_redo(void); #endif -#ifndef DISABLE_COMMENT +bool white_string(const char *s); +#ifdef ENABLE_COMMENT void do_comment(void); #endif void do_enter(void); diff --git a/src/rcfile.c b/src/rcfile.c index b078f031..cb9aa1cd 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -344,9 +344,7 @@ bool is_universal(void (*func)) { if (func == do_left || func == do_right || func == do_home || func == do_end || -#ifndef NANO_TINY func == do_prev_word_void || func == do_next_word_void || -#endif func == do_verbatim_input || func == do_cut_text_void || func == do_delete || func == do_backspace || func == do_tab || func == do_enter) diff --git a/src/search.c b/src/search.c index 181eb9e9..7ab6fce6 100644 --- a/src/search.c +++ b/src/search.c @@ -47,11 +47,8 @@ bool regexp_init(const char *regexp) assert(!regexp_compiled); - rc = regcomp(&search_regexp, fixbounds(regexp), NANO_REG_EXTENDED -#ifndef NANO_TINY - | (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE) -#endif - ); + rc = regcomp(&search_regexp, fixbounds(regexp), + NANO_REG_EXTENDED | (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)); if (rc != 0) { size_t len = regerror(rc, &search_regexp, NULL, 0); @@ -163,19 +160,13 @@ int search_init(bool replacing, bool use_answer) #endif /* TRANSLATORS: This is the main search prompt. */ edit_refresh, "%s%s%s%s%s%s", _("Search"), -#ifndef NANO_TINY /* TRANSLATORS: The next three modify the search prompt. */ - ISSET(CASE_SENSITIVE) ? _(" [Case Sensitive]") : -#endif - "", + ISSET(CASE_SENSITIVE) ? _(" [Case Sensitive]") : "", #ifdef HAVE_REGEX_H ISSET(USE_REGEXP) ? _(" [Regexp]") : #endif "", -#ifndef NANO_TINY - ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") : -#endif - "", replacing ? + ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") : "", replacing ? #ifndef NANO_TINY /* TRANSLATORS: The next two modify the search prompt. */ openfile->mark_set ? _(" (to replace) in selection") : @@ -214,7 +205,6 @@ int search_init(bool replacing, bool use_answer) func = func_from_key(&i); -#ifndef NANO_TINY if (func == case_sens_void) { TOGGLE(CASE_SENSITIVE); backupstring = mallocstrcpy(backupstring, answer); @@ -224,7 +214,6 @@ int search_init(bool replacing, bool use_answer) backupstring = mallocstrcpy(backupstring, answer); return 1; } else -#endif #ifdef HAVE_REGEX_H if (func == regexp_void) { TOGGLE(USE_REGEXP); @@ -270,12 +259,13 @@ int findnextstr( * will return immediately and say that no match was found, and * rev_start will be properly set when the search continues on the * previous or next line. */ - rev_start += -#ifndef NANO_TINY - ISSET(BACKWARDS_SEARCH) ? - ((openfile->current_x == 0) ? -1 : move_mbleft(fileptr->data, openfile->current_x)) : -#endif - move_mbright(fileptr->data, openfile->current_x); + if (ISSET(BACKWARDS_SEARCH)) { + if (openfile->current_x == 0) + rev_start += -1; + else + rev_start += move_mbleft(fileptr->data, openfile->current_x); + } else + rev_start += move_mbright(fileptr->data, openfile->current_x); enable_nodelay(); @@ -343,11 +333,9 @@ int findnextstr( } /* Move to the previous or next line in the file. */ -#ifndef NANO_TINY if (ISSET(BACKWARDS_SEARCH)) fileptr = fileptr->prev; else -#endif fileptr = fileptr->next; /* If we've reached the start or end of the buffer, wrap around. */ @@ -359,11 +347,9 @@ int findnextstr( return 0; } #endif -#ifndef NANO_TINY if (ISSET(BACKWARDS_SEARCH)) fileptr = openfile->filebot; else -#endif fileptr = openfile->fileage; statusbar(_("Search Wrapped")); @@ -377,23 +363,15 @@ int findnextstr( /* Set the starting x to the start or end of the line. */ rev_start = fileptr->data; -#ifndef NANO_TINY if (ISSET(BACKWARDS_SEARCH)) rev_start += strlen(fileptr->data); -#endif } found_x = found - fileptr->data; /* Ensure that the found occurrence is not beyond the starting x. */ - if (came_full_circle && -#ifndef NANO_TINY - ((!ISSET(BACKWARDS_SEARCH) && found_x > begin_x) || - (ISSET(BACKWARDS_SEARCH) && found_x < begin_x)) -#else - found_x > begin_x -#endif - ) { + if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && found_x > begin_x) || + (ISSET(BACKWARDS_SEARCH) && found_x < begin_x))) { not_found_msg(needle); disable_nodelay(); return 0; @@ -425,10 +403,8 @@ void do_search(void) search_replace_abort(); else if (i == -2) /* Do a replace instead. */ do_replace(); -#if !defined(NANO_TINY) || defined(HAVE_REGEX_H) else if (i == 1) /* Toggled something. */ do_search(); -#endif if (i == 0) go_looking(); @@ -459,7 +435,6 @@ void do_findnext(void) } #endif /* !NANO_TINY */ -#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER) /* Search for the last string without prompting. */ void do_research(void) { @@ -485,7 +460,6 @@ void do_research(void) go_looking(); } -#endif /* !NANO_TINY */ /* Search for the global string 'last_search'. Inform the user when * the string occurs only once. */ @@ -757,9 +731,7 @@ ssize_t do_replace_loop( /* Set the cursor at the last character of the replacement * text, so that searching will continue /after/ it. Note * that current_x might be set to (size_t)-1 here. */ -#ifndef NANO_TINY if (!ISSET(BACKWARDS_SEARCH)) -#endif openfile->current_x += match_len + length_change - 1; /* Update the file size, and put the changed line into place. */ diff --git a/src/text.c b/src/text.c index 31bfc0ab..d0d19550 100644 --- a/src/text.c +++ b/src/text.c @@ -435,7 +435,6 @@ void do_unindent(void) } #endif /* !NANO_TINY */ -#ifdef ENABLE_COMMENT /* Test whether the string is empty or consists of only blanks. */ bool white_string(const char *s) { @@ -445,6 +444,7 @@ bool white_string(const char *s) return !*s; } +#ifdef ENABLE_COMMENT /* Comment or uncomment the current line or the marked lines. */ void do_comment() { @@ -2630,10 +2630,9 @@ bool do_int_spell_fix(const char *word) /* Make sure spell-check is case sensitive. */ SET(CASE_SENSITIVE); -#ifndef NANO_TINY /* Make sure spell-check goes forward only. */ UNSET(BACKWARDS_SEARCH); -#endif + #ifdef HAVE_REGEX_H /* Make sure spell-check doesn't use regular expressions. */ UNSET(USE_REGEXP); diff --git a/src/utils.c b/src/utils.c index dd29741f..54b38590 100644 --- a/src/utils.c +++ b/src/utils.c @@ -321,10 +321,9 @@ const char *strstrwrapper(const char *haystack, const char *needle, #ifdef HAVE_REGEX_H if (ISSET(USE_REGEXP)) { -#ifndef NANO_TINY if (ISSET(BACKWARDS_SEARCH)) { - if (regexec(&search_regexp, haystack, 1, regmatches, - 0) == 0 && haystack + regmatches[0].rm_so <= start) { + if (regexec(&search_regexp, haystack, 1, regmatches, 0) == 0 && + haystack + regmatches[0].rm_so <= start) { const char *retval = haystack + regmatches[0].rm_so; /* Search forward until there are no more matches. */ @@ -338,10 +337,8 @@ const char *strstrwrapper(const char *haystack, const char *needle, regexec(&search_regexp, retval, 10, regmatches, 0); return retval; } - } else -#endif /* !NANO_TINY */ - if (regexec(&search_regexp, start, 10, regmatches, - (start > haystack) ? REG_NOTBOL : 0) == 0) { + } else if (regexec(&search_regexp, start, 10, regmatches, + (start > haystack) ? REG_NOTBOL : 0) == 0) { const char *retval = start + regmatches[0].rm_so; regexec(&search_regexp, retval, 10, regmatches, 0); @@ -350,20 +347,14 @@ const char *strstrwrapper(const char *haystack, const char *needle, return NULL; } #endif /* HAVE_REGEX_H */ -#if !defined(NANO_TINY) || !defined(DISABLE_SPELLER) if (ISSET(CASE_SENSITIVE)) { -#ifndef NANO_TINY if (ISSET(BACKWARDS_SEARCH)) return revstrstr(haystack, needle, start); else -#endif return strstr(start, needle); - } -#endif /* !DISABLE_SPELLER || !NANO_TINY */ -#ifndef NANO_TINY - else if (ISSET(BACKWARDS_SEARCH)) + } else if (ISSET(BACKWARDS_SEARCH)) return mbrevstrcasestr(haystack, needle, start); -#endif + return mbstrcasestr(start, needle); } diff --git a/src/winio.c b/src/winio.c index ab32c930..045462d2 100644 --- a/src/winio.c +++ b/src/winio.c @@ -23,7 +23,7 @@ #include "proto.h" #include "revision.h" -#if defined(__linux__) && !defined(NANO_TINY) +#ifdef __linux__ #include #endif @@ -399,14 +399,12 @@ int parse_kbinput(WINDOW *win) case 'B': retval = KEY_END; break; -#ifndef NANO_TINY case 'C': retval = controlright; break; case 'D': retval = controlleft; break; -#endif } double_esc = FALSE; escapes = 0; @@ -496,7 +494,6 @@ int parse_kbinput(WINDOW *win) if (retval == ERR) return ERR; -#ifndef NANO_TINY if (retval == controlleft) return sc_seq_or(do_prev_word_void, 0); else if (retval == controlright) @@ -505,6 +502,7 @@ int parse_kbinput(WINDOW *win) return sc_seq_or(do_prev_block, 0); else if (retval == controldown) return sc_seq_or(do_next_block, 0); +#ifndef NANO_TINY else if (retval == shiftcontrolleft) { shift_held = TRUE; return sc_seq_or(do_prev_word_void, 0); @@ -532,15 +530,12 @@ int parse_kbinput(WINDOW *win) } #endif -#if defined(__linux__) && !defined(NANO_TINY) +#ifdef __linux__ /* When not running under X, check for the bare arrow keys whether * Shift/Ctrl/Alt are being held together with them. */ unsigned char modifiers = 6; if (console && ioctl(0, TIOCLINUX, &modifiers) >= 0) { - if (modifiers & 0x01) - shift_held =TRUE; - /* Is Ctrl being held? */ if (modifiers & 0x04) { if (retval == KEY_UP) @@ -553,6 +548,11 @@ int parse_kbinput(WINDOW *win) return sc_seq_or(do_next_word_void, 0); } +#ifndef NANO_TINY + /* Is Shift being held? */ + if (modifiers & 0x01) + shift_held =TRUE; + /* Are both Shift and Alt being held? */ if ((modifiers & 0x09) == 0x09) { if (retval == KEY_UP) @@ -564,8 +564,9 @@ int parse_kbinput(WINDOW *win) else if (retval == KEY_RIGHT) return sc_seq_or(do_end, 0); } +#endif } -#endif /* __linux__ && !NANO_TINY */ +#endif /* __linux__ */ switch (retval) { #ifdef KEY_SLEFT