Commit 08cd197b authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

general: include word-jumping and block-jumping into the tiny version

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