#ifndef NANO_SMALL
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
*toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg,
- *toggle_cuttoend_msg, *toggle_wrap_msg;
+ *toggle_cuttoend_msg, *toggle_wrap_msg, *toggle_case_msg,
+ *toggle_backwards_msg;
#ifdef HAVE_REGEX_H
char *toggle_regexp_msg;
#endif
toggle_picomode_msg = _("Pico mode");
toggle_mouse_msg = _("Mouse support");
toggle_cuttoend_msg = _("Cut to end");
+ toggle_backwards_msg = _("Backwards Search");
+ toggle_case_msg = _("Case Sensitive Search");
#ifdef HAVE_REGEX_H
toggle_regexp_msg = _("Regular expressions");
#endif
USE_MOUSE);
toggle_init_one(&toggles[7], TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg,
CUT_TO_END);
+ toggle_init_one(&toggles[8], TOGGLE_BACKWARDS_KEY, toggle_backwards_msg,
+ REVERSE_SEARCH);
+ toggle_init_one(&toggles[9], TOGGLE_CASE_KEY, toggle_case_msg,
+ CASE_SENSITIVE);
#ifdef HAVE_REGEX_H
- toggle_init_one(&toggles[8], TOGGLE_REGEXP_KEY, toggle_regexp_msg,
+ toggle_init_one(&toggles[10], TOGGLE_REGEXP_KEY, toggle_regexp_msg,
USE_REGEXP);
#endif
#endif
"", *nano_backspace_msg = "", *nano_tab_msg =
"", *nano_enter_msg = "", *nano_case_msg =
"", *nano_cancel_msg = "", *nano_unjustify_msg =
- "", *nano_append_msg = "", *nano_reverse_msg = "";
+ "", *nano_append_msg = "", *nano_reverse_msg =
+ "", *nano_regexp_msg = "";
#ifndef NANO_SMALL
char *nano_tofiles_msg = "";
nano_cancel_msg = _("Cancel the current function");
nano_append_msg = _("Append to the current file");
nano_reverse_msg = _("Search Backwards");
+ nano_regexp_msg = _("Use Regular Expressions");
#endif
sc_init_one(&main_list[0], NANO_HELP_KEY, _("Get Help"),
sc_init_one(&whereis_list[1], NANO_LASTLINE_KEY, _("Last Line"),
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
- sc_init_one(&whereis_list[2], NANO_CASE_KEY, _("Case Sens"),
- nano_case_msg, 0, 0, 0, VIEW, 0);
-
-
- sc_init_one(&whereis_list[3], NANO_OTHERSEARCH_KEY, _("Replace"),
+ sc_init_one(&whereis_list[2], NANO_OTHERSEARCH_KEY, _("Replace"),
nano_replace_msg, 0, 0, 0, VIEW, do_replace);
- sc_init_one(&whereis_list[4], NANO_FROMSEARCHTOGOTO_KEY,
+ sc_init_one(&whereis_list[3], NANO_FROMSEARCHTOGOTO_KEY,
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
do_gotoline_void);
- sc_init_one(&whereis_list[5], NANO_REVERSESEARCH_KEY, _("Backward"),
+ sc_init_one(&whereis_list[4], NANO_CANCEL_KEY, _("Cancel"),
+ nano_cancel_msg, 0, 0, 0, VIEW, 0);
+
+ sc_init_one(&whereis_list[5], TOGGLE_CASE_KEY, _("Case Sens"),
+ nano_case_msg, 0, 0, 0, VIEW, 0);
+
+ sc_init_one(&whereis_list[6], TOGGLE_BACKWARDS_KEY, _("Backward"),
nano_reverse_msg, 0, 0, 0, VIEW, 0);
- sc_init_one(&whereis_list[6], NANO_CANCEL_KEY, _("Cancel"),
- nano_cancel_msg, 0, 0, 0, VIEW, 0);
+#ifdef HAVE_REGEX_H
+ sc_init_one(&whereis_list[7], TOGGLE_REGEXP_KEY, _("Regexp"),
+ nano_regexp_msg, 0, 0, 0, VIEW, 0);
+#endif
sc_init_one(&replace_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
sc_init_one(&replace_list[1], NANO_LASTLINE_KEY, _("Last Line"),
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
- sc_init_one(&replace_list[2], NANO_CASE_KEY, _("Case Sens"),
- nano_case_msg, 0, 0, 0, VIEW, 0);
-
- sc_init_one(&replace_list[3], NANO_OTHERSEARCH_KEY, _("No Replace"),
+ sc_init_one(&replace_list[2], NANO_OTHERSEARCH_KEY, _("No Replace"),
nano_whereis_msg, 0, 0, 0, VIEW, do_search);
- sc_init_one(&replace_list[4], NANO_FROMSEARCHTOGOTO_KEY,
+ sc_init_one(&replace_list[3], NANO_FROMSEARCHTOGOTO_KEY,
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
do_gotoline_void);
- sc_init_one(&replace_list[5], NANO_REVERSESEARCH_KEY, _("Backward"),
+ sc_init_one(&replace_list[4], NANO_CANCEL_KEY, _("Cancel"),
+ nano_cancel_msg, 0, 0, 0, VIEW, 0);
+
+ sc_init_one(&replace_list[5], TOGGLE_CASE_KEY, _("Case Sens"),
+ nano_case_msg, 0, 0, 0, VIEW, 0);
+
+ sc_init_one(&replace_list[6], TOGGLE_BACKWARDS_KEY, _("Backward"),
nano_reverse_msg, 0, 0, 0, VIEW, 0);
- sc_init_one(&replace_list[6], NANO_CANCEL_KEY, _("Cancel"),
- nano_cancel_msg, 0, 0, 0, VIEW, 0);
+#ifdef HAVE_REGEX_H
+ sc_init_one(&replace_list[7], TOGGLE_REGEXP_KEY, _("Regexp"),
+ nano_regexp_msg, 0, 0, 0, VIEW, 0);
+#endif
sc_init_one(&replace_list_2[0], NANO_FIRSTLINE_KEY, _("First Line"),
#define SET(bit) flags |= bit
#define UNSET(bit) flags &= ~bit
#define ISSET(bit) (flags & bit)
+#define TOGGLE(bit) flags ^= bit
#ifdef USE_SLANG /* Slang support enabled */
#define NANO_REPLACE_FKEY KEY_F(14)
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
#define NANO_OTHERSEARCH_KEY NANO_CONTROL_R
-#define NANO_REVERSESEARCH_KEY NANO_CONTROL_B
#define NANO_PREVPAGE_KEY NANO_CONTROL_Y
#define NANO_PREVPAGE_FKEY KEY_F(7)
#define NANO_NEXTPAGE_KEY NANO_CONTROL_V
#define NANO_FIRSTLINE_KEY NANO_PREVPAGE_KEY
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
#define NANO_CANCEL_KEY NANO_CONTROL_C
-#define NANO_CASE_KEY NANO_CONTROL_A
#define NANO_REFRESH_KEY NANO_CONTROL_L
#define NANO_JUSTIFY_KEY NANO_CONTROL_J
#define NANO_JUSTIFY_FKEY KEY_F(4)
#define NANO_ENTER_KEY NANO_CONTROL_M
#define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T
#define NANO_TOFILES_KEY NANO_CONTROL_T
-#define NANO_APPEND_KEY NANO_CONTROL_A
+#define NANO_APPEND_KEY NANO_ALT_A
#define TOGGLE_CONST_KEY NANO_ALT_C
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
#define TOGGLE_CUTTOEND_KEY NANO_ALT_K
#define TOGGLE_REGEXP_KEY NANO_ALT_E
#define TOGGLE_WRAP_KEY NANO_ALT_W
+#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
+#define TOGGLE_CASE_KEY NANO_ALT_A
-#define MAIN_LIST_LEN 26
-#define MAIN_VISIBLE 12
+/* Toggle stuff, these static lengths need to go away RSN */
+
+#ifdef HAVE_REGEX_H
+#define TOGGLE_LEN 11
+#define WHEREIS_LIST_LEN 8
+#define REPLACE_LIST_LEN 8
+#else
+#define TOGGLE_LEN 10
#define WHEREIS_LIST_LEN 7
#define REPLACE_LIST_LEN 7
+#endif
+
+#define MAIN_LIST_LEN 26
+#define MAIN_VISIBLE 12
#define REPLACE_LIST_2_LEN 3
#define GOTO_LIST_LEN 3
#define GOTODIR_LIST_LEN 1
#define IMSERTFILE_LIST_LEN 1
#endif
-#ifdef HAVE_REGEX_H
-#define TOGGLE_LEN 9
-#else
-#define TOGGLE_LEN 8
-#endif
-
#define VIEW 1
#define NOVIEW 0
fprintf(stderr, _("Aha! \'%c\' (%d)\n"), kbinput, kbinput);
#endif
- if (kbinput == s[j].val) {
+ if (kbinput == s[j].val && kbinput < 32) {
/* We shouldn't discard the answer it gave, just because
we hit a keystroke, GEEZ! */
break;
#endif
#endif
+ case NANO_HOME_KEY:
case KEY_HOME:
x = x_left;
nanoget_repaint(buf, inputbuf, x);
break;
+ case NANO_END_KEY:
case KEY_END:
x = x_left + strlen(inputbuf);
nanoget_repaint(buf, inputbuf, x);
nodelay(edit, FALSE);
break;
}
+ default:
+
+ for (j = 0; j <= slen - 1; j++) {
+#ifdef DEBUG
+ fprintf(stderr, _("Aha! \'%c\' (%d)\n"), kbinput, kbinput);
+#endif
+ if (kbinput == s[j].val || kbinput == s[j].val - 32) {
+
+ /* We hit an Alt key. Do like above. We don't
+ just ungetch the letter and let it get caught
+ above cause that screws the keypad... */
+ answer = mallocstrcpy(answer, inputbuf);
+ free(inputbuf);
+ return s[j].val;
+ }
+ }
+
}
nanoget_repaint(buf, inputbuf, x);
break;
default:
+
if (kbinput < 32)
break;
{
char description[80];
- snprintf(description, 12, " %-10s", desc);
+ snprintf(description, 12 - (strlen(keystroke) - 2), " %-10s", desc);
wattron(bottomwin, A_REVERSE);
waddstr(bottomwin, keystroke);
wattroff(bottomwin, A_REVERSE);
clear_bottomwin();
wmove(bottomwin, 1, 0);
- for (i = 0; i <= slen - 1; i += 2) {
- snprintf(keystr, 10, "^%c", s[i].val + 64);
+
+ for (i = 0; i <= slen - 2; i += 2) {
+
+ if (s[i].val < 97)
+ snprintf(keystr, 10, "^%c", s[i].val + 64);
+ else
+ snprintf(keystr, 10, "M-%c", s[i].val - 32);
+
onekey(keystr, s[i].desc);
for (j = 0; j < k; j++)
wmove(bottomwin, 2, 0);
for (i = 1; i <= slen - 1; i += 2) {
- snprintf(keystr, 10, "^%c", s[i].val + 64);
+
+ if (s[i].val < 97)
+ snprintf(keystr, 10, "^%c", s[i].val + 64);
+ else
+ snprintf(keystr, 10, "M-%c", s[i].val - 32);
+
onekey(keystr, s[i].desc);
for (j = 0; j < k; j++)