Moved extension functions to meta keys, new macro TOGGLE() for toggling flags
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@686 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
e4933a393a
commit
658399aeb9
4
BUGS
4
BUGS
|
@ -120,4 +120,8 @@
|
||||||
|
|
||||||
** Open BUGS **
|
** Open BUGS **
|
||||||
|
|
||||||
|
Informal note - when using marked write to file, if there's only one
|
||||||
|
line of text hilighted, it writes the whole rest of the ifle to disk and
|
||||||
|
goes bonkers. Delete this message when fixed.
|
||||||
|
|
||||||
$Id$
|
$Id$
|
||||||
|
|
11
ChangeLog
11
ChangeLog
|
@ -40,6 +40,17 @@ Cvs code -
|
||||||
nano_reverse_msg, new functions revstrstr and revstrcasestr,
|
nano_reverse_msg, new functions revstrstr and revstrcasestr,
|
||||||
many changes to search functions. Not too big a code size
|
many changes to search functions. Not too big a code size
|
||||||
increase!
|
increase!
|
||||||
|
- Moved extension functions (Case Sensitive, Regexp, and Backwards
|
||||||
|
Search, Append key in write file function) to Meta keys, as
|
||||||
|
people are complaining loudly about nano not being control-key
|
||||||
|
compatible with Pico, which is a Bag Thing (TM). Changes to
|
||||||
|
shortcut_init, toggle_init, new toggles for backwards and regexp
|
||||||
|
(and you can now toggle all search options including regexp at
|
||||||
|
the Search: prompt!) Changes to nanogetstr to enable Meta
|
||||||
|
keys to be grabbed, changes to onekey to print M-style shortcuts.
|
||||||
|
- New macro TOGGLE which just toggles, no more silly checking
|
||||||
|
ISSET and then using SET or UNSET when we want a simple toggle
|
||||||
|
for a flag.
|
||||||
- configure.in:
|
- configure.in:
|
||||||
- New option, --enable-nanorc, which allows people to have a .nanorc
|
- New option, --enable-nanorc, which allows people to have a .nanorc
|
||||||
initialization file and set options normally used on the command
|
initialization file and set options normally used on the command
|
||||||
|
|
58
global.c
58
global.c
|
@ -139,7 +139,8 @@ void toggle_init(void)
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
|
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
|
||||||
*toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_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
|
#ifdef HAVE_REGEX_H
|
||||||
char *toggle_regexp_msg;
|
char *toggle_regexp_msg;
|
||||||
#endif
|
#endif
|
||||||
|
@ -151,6 +152,8 @@ void toggle_init(void)
|
||||||
toggle_picomode_msg = _("Pico mode");
|
toggle_picomode_msg = _("Pico mode");
|
||||||
toggle_mouse_msg = _("Mouse support");
|
toggle_mouse_msg = _("Mouse support");
|
||||||
toggle_cuttoend_msg = _("Cut to end");
|
toggle_cuttoend_msg = _("Cut to end");
|
||||||
|
toggle_backwards_msg = _("Backwards Search");
|
||||||
|
toggle_case_msg = _("Case Sensitive Search");
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
toggle_regexp_msg = _("Regular expressions");
|
toggle_regexp_msg = _("Regular expressions");
|
||||||
#endif
|
#endif
|
||||||
|
@ -172,8 +175,12 @@ void toggle_init(void)
|
||||||
USE_MOUSE);
|
USE_MOUSE);
|
||||||
toggle_init_one(&toggles[7], TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg,
|
toggle_init_one(&toggles[7], TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg,
|
||||||
CUT_TO_END);
|
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
|
#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);
|
USE_REGEXP);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -194,7 +201,8 @@ void shortcut_init(int unjustify)
|
||||||
"", *nano_backspace_msg = "", *nano_tab_msg =
|
"", *nano_backspace_msg = "", *nano_tab_msg =
|
||||||
"", *nano_enter_msg = "", *nano_case_msg =
|
"", *nano_enter_msg = "", *nano_case_msg =
|
||||||
"", *nano_cancel_msg = "", *nano_unjustify_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
|
#ifndef NANO_SMALL
|
||||||
char *nano_tofiles_msg = "";
|
char *nano_tofiles_msg = "";
|
||||||
|
@ -237,6 +245,7 @@ void shortcut_init(int unjustify)
|
||||||
nano_cancel_msg = _("Cancel the current function");
|
nano_cancel_msg = _("Cancel the current function");
|
||||||
nano_append_msg = _("Append to the current file");
|
nano_append_msg = _("Append to the current file");
|
||||||
nano_reverse_msg = _("Search Backwards");
|
nano_reverse_msg = _("Search Backwards");
|
||||||
|
nano_regexp_msg = _("Use Regular Expressions");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sc_init_one(&main_list[0], NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&main_list[0], NANO_HELP_KEY, _("Get Help"),
|
||||||
|
@ -359,22 +368,26 @@ void shortcut_init(int unjustify)
|
||||||
sc_init_one(&whereis_list[1], NANO_LASTLINE_KEY, _("Last Line"),
|
sc_init_one(&whereis_list[1], NANO_LASTLINE_KEY, _("Last Line"),
|
||||||
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
|
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
|
||||||
|
|
||||||
sc_init_one(&whereis_list[2], NANO_CASE_KEY, _("Case Sens"),
|
sc_init_one(&whereis_list[2], NANO_OTHERSEARCH_KEY, _("Replace"),
|
||||||
nano_case_msg, 0, 0, 0, VIEW, 0);
|
|
||||||
|
|
||||||
|
|
||||||
sc_init_one(&whereis_list[3], NANO_OTHERSEARCH_KEY, _("Replace"),
|
|
||||||
nano_replace_msg, 0, 0, 0, VIEW, do_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,
|
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
|
||||||
do_gotoline_void);
|
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);
|
nano_reverse_msg, 0, 0, 0, VIEW, 0);
|
||||||
|
|
||||||
sc_init_one(&whereis_list[6], NANO_CANCEL_KEY, _("Cancel"),
|
#ifdef HAVE_REGEX_H
|
||||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
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"),
|
sc_init_one(&replace_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||||
nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
|
nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
|
||||||
|
@ -382,21 +395,26 @@ void shortcut_init(int unjustify)
|
||||||
sc_init_one(&replace_list[1], NANO_LASTLINE_KEY, _("Last Line"),
|
sc_init_one(&replace_list[1], NANO_LASTLINE_KEY, _("Last Line"),
|
||||||
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
|
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
|
||||||
|
|
||||||
sc_init_one(&replace_list[2], NANO_CASE_KEY, _("Case Sens"),
|
sc_init_one(&replace_list[2], NANO_OTHERSEARCH_KEY, _("No Replace"),
|
||||||
nano_case_msg, 0, 0, 0, VIEW, 0);
|
|
||||||
|
|
||||||
sc_init_one(&replace_list[3], NANO_OTHERSEARCH_KEY, _("No Replace"),
|
|
||||||
nano_whereis_msg, 0, 0, 0, VIEW, do_search);
|
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,
|
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
|
||||||
do_gotoline_void);
|
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);
|
nano_reverse_msg, 0, 0, 0, VIEW, 0);
|
||||||
|
|
||||||
sc_init_one(&replace_list[6], NANO_CANCEL_KEY, _("Cancel"),
|
#ifdef HAVE_REGEX_H
|
||||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
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"),
|
sc_init_one(&replace_list_2[0], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||||
|
|
6
nano.c
6
nano.c
|
@ -2146,10 +2146,8 @@ void do_toggle(int which)
|
||||||
char *enabled = _("enabled");
|
char *enabled = _("enabled");
|
||||||
char *disabled = _("disabled");
|
char *disabled = _("disabled");
|
||||||
|
|
||||||
if (ISSET(toggles[which].flag))
|
/* Even easier! */
|
||||||
UNSET(toggles[which].flag);
|
TOGGLE(toggles[which].flag);
|
||||||
else
|
|
||||||
SET(toggles[which].flag);
|
|
||||||
|
|
||||||
switch (toggles[which].val) {
|
switch (toggles[which].val) {
|
||||||
case TOGGLE_PICOMODE_KEY:
|
case TOGGLE_PICOMODE_KEY:
|
||||||
|
|
27
nano.h
27
nano.h
|
@ -34,6 +34,7 @@
|
||||||
#define SET(bit) flags |= bit
|
#define SET(bit) flags |= bit
|
||||||
#define UNSET(bit) flags &= ~bit
|
#define UNSET(bit) flags &= ~bit
|
||||||
#define ISSET(bit) (flags & bit)
|
#define ISSET(bit) (flags & bit)
|
||||||
|
#define TOGGLE(bit) flags ^= bit
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_SLANG /* Slang support enabled */
|
#ifdef USE_SLANG /* Slang support enabled */
|
||||||
|
@ -206,7 +207,6 @@ know what you're doing */
|
||||||
#define NANO_REPLACE_FKEY KEY_F(14)
|
#define NANO_REPLACE_FKEY KEY_F(14)
|
||||||
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
|
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
|
||||||
#define NANO_OTHERSEARCH_KEY NANO_CONTROL_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_KEY NANO_CONTROL_Y
|
||||||
#define NANO_PREVPAGE_FKEY KEY_F(7)
|
#define NANO_PREVPAGE_FKEY KEY_F(7)
|
||||||
#define NANO_NEXTPAGE_KEY NANO_CONTROL_V
|
#define NANO_NEXTPAGE_KEY NANO_CONTROL_V
|
||||||
|
@ -222,7 +222,6 @@ know what you're doing */
|
||||||
#define NANO_FIRSTLINE_KEY NANO_PREVPAGE_KEY
|
#define NANO_FIRSTLINE_KEY NANO_PREVPAGE_KEY
|
||||||
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
|
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
|
||||||
#define NANO_CANCEL_KEY NANO_CONTROL_C
|
#define NANO_CANCEL_KEY NANO_CONTROL_C
|
||||||
#define NANO_CASE_KEY NANO_CONTROL_A
|
|
||||||
#define NANO_REFRESH_KEY NANO_CONTROL_L
|
#define NANO_REFRESH_KEY NANO_CONTROL_L
|
||||||
#define NANO_JUSTIFY_KEY NANO_CONTROL_J
|
#define NANO_JUSTIFY_KEY NANO_CONTROL_J
|
||||||
#define NANO_JUSTIFY_FKEY KEY_F(4)
|
#define NANO_JUSTIFY_FKEY KEY_F(4)
|
||||||
|
@ -241,7 +240,7 @@ know what you're doing */
|
||||||
#define NANO_ENTER_KEY NANO_CONTROL_M
|
#define NANO_ENTER_KEY NANO_CONTROL_M
|
||||||
#define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T
|
#define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T
|
||||||
#define NANO_TOFILES_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_CONST_KEY NANO_ALT_C
|
||||||
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
|
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
|
||||||
|
@ -252,11 +251,23 @@ know what you're doing */
|
||||||
#define TOGGLE_CUTTOEND_KEY NANO_ALT_K
|
#define TOGGLE_CUTTOEND_KEY NANO_ALT_K
|
||||||
#define TOGGLE_REGEXP_KEY NANO_ALT_E
|
#define TOGGLE_REGEXP_KEY NANO_ALT_E
|
||||||
#define TOGGLE_WRAP_KEY NANO_ALT_W
|
#define TOGGLE_WRAP_KEY NANO_ALT_W
|
||||||
|
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
|
||||||
|
#define TOGGLE_CASE_KEY NANO_ALT_A
|
||||||
|
|
||||||
|
/* 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_LIST_LEN 26
|
||||||
#define MAIN_VISIBLE 12
|
#define MAIN_VISIBLE 12
|
||||||
#define WHEREIS_LIST_LEN 7
|
|
||||||
#define REPLACE_LIST_LEN 7
|
|
||||||
#define REPLACE_LIST_2_LEN 3
|
#define REPLACE_LIST_2_LEN 3
|
||||||
#define GOTO_LIST_LEN 3
|
#define GOTO_LIST_LEN 3
|
||||||
#define GOTODIR_LIST_LEN 1
|
#define GOTODIR_LIST_LEN 1
|
||||||
|
@ -272,12 +283,6 @@ know what you're doing */
|
||||||
#define IMSERTFILE_LIST_LEN 1
|
#define IMSERTFILE_LIST_LEN 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
|
||||||
#define TOGGLE_LEN 9
|
|
||||||
#else
|
|
||||||
#define TOGGLE_LEN 8
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define VIEW 1
|
#define VIEW 1
|
||||||
#define NOVIEW 0
|
#define NOVIEW 0
|
||||||
|
|
||||||
|
|
38
search.c
38
search.c
|
@ -72,7 +72,7 @@ void search_init_globals(void)
|
||||||
*/
|
*/
|
||||||
int search_init(int replacing)
|
int search_init(int replacing)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0, j;
|
||||||
char *buf;
|
char *buf;
|
||||||
char *prompt;
|
char *prompt;
|
||||||
static char *backupstring = NULL;
|
static char *backupstring = NULL;
|
||||||
|
@ -137,7 +137,10 @@ int search_init(int replacing)
|
||||||
free(backupstring);
|
free(backupstring);
|
||||||
backupstring = NULL;
|
backupstring = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
} else if (i == -2) { /* Same string */
|
} else
|
||||||
|
switch (i) {
|
||||||
|
|
||||||
|
case -2: /* Same string */
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
if (ISSET(USE_REGEXP)) {
|
if (ISSET(USE_REGEXP)) {
|
||||||
|
|
||||||
|
@ -147,10 +150,9 @@ int search_init(int replacing)
|
||||||
else
|
else
|
||||||
regexp_init(answer);
|
regexp_init(answer);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
;
|
|
||||||
#endif
|
#endif
|
||||||
} else if (i == 0) { /* They entered something new */
|
break;
|
||||||
|
case 0: /* They entered something new */
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
if (ISSET(USE_REGEXP))
|
if (ISSET(USE_REGEXP))
|
||||||
regexp_init(answer);
|
regexp_init(answer);
|
||||||
|
@ -158,37 +160,41 @@ int search_init(int replacing)
|
||||||
free(backupstring);
|
free(backupstring);
|
||||||
backupstring = NULL;
|
backupstring = NULL;
|
||||||
last_replace[0] = '\0';
|
last_replace[0] = '\0';
|
||||||
} else if (i == NANO_CASE_KEY) { /* They want it case sensitive */
|
break;
|
||||||
|
case TOGGLE_CASE_KEY:
|
||||||
|
case TOGGLE_BACKWARDS_KEY:
|
||||||
|
#ifdef HAVE_REGEX_H
|
||||||
|
case TOGGLE_REGEXP_KEY:
|
||||||
|
#endif
|
||||||
free(backupstring);
|
free(backupstring);
|
||||||
backupstring = NULL;
|
backupstring = NULL;
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
|
|
||||||
if (ISSET(CASE_SENSITIVE))
|
for (j = 0; j <= TOGGLE_LEN - 1; j++)
|
||||||
UNSET(CASE_SENSITIVE);
|
if (i == toggles[j].val)
|
||||||
else
|
TOGGLE(toggles[j].flag);
|
||||||
SET(CASE_SENSITIVE);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
} else if (i == NANO_OTHERSEARCH_KEY) {
|
case NANO_OTHERSEARCH_KEY:
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
return -2; /* Call the opposite search function */
|
return -2; /* Call the opposite search function */
|
||||||
|
/*
|
||||||
} else if (i == NANO_REVERSESEARCH_KEY) {
|
} else if (i == NANO_REVERSESEARCH_KEY) {
|
||||||
free(backupstring);
|
free(backupstring);
|
||||||
backupstring = NULL;
|
backupstring = NULL;
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
|
|
||||||
if (ISSET(REVERSE_SEARCH))
|
TOGGLE(REVERSE_SEARCH);
|
||||||
UNSET(REVERSE_SEARCH);
|
|
||||||
else
|
|
||||||
SET(REVERSE_SEARCH);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
} else if (i == NANO_FROMSEARCHTOGOTO_KEY) {
|
} else if (i == NANO_FROMSEARCHTOGOTO_KEY) {
|
||||||
|
*/
|
||||||
|
case NANO_FROMSEARCHTOGOTO_KEY:
|
||||||
free(backupstring);
|
free(backupstring);
|
||||||
backupstring = NULL;
|
backupstring = NULL;
|
||||||
do_gotoline_void();
|
do_gotoline_void();
|
||||||
return -3;
|
return -3;
|
||||||
} else { /* First line key, etc. */
|
default:
|
||||||
do_early_abort();
|
do_early_abort();
|
||||||
free(backupstring);
|
free(backupstring);
|
||||||
backupstring = NULL;
|
backupstring = NULL;
|
||||||
|
|
37
winio.c
37
winio.c
|
@ -291,7 +291,7 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||||
fprintf(stderr, _("Aha! \'%c\' (%d)\n"), kbinput, kbinput);
|
fprintf(stderr, _("Aha! \'%c\' (%d)\n"), kbinput, kbinput);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (kbinput == s[j].val) {
|
if (kbinput == s[j].val && kbinput < 32) {
|
||||||
|
|
||||||
/* We shouldn't discard the answer it gave, just because
|
/* We shouldn't discard the answer it gave, just because
|
||||||
we hit a keystroke, GEEZ! */
|
we hit a keystroke, GEEZ! */
|
||||||
|
@ -327,10 +327,12 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
case NANO_HOME_KEY:
|
||||||
case KEY_HOME:
|
case KEY_HOME:
|
||||||
x = x_left;
|
x = x_left;
|
||||||
nanoget_repaint(buf, inputbuf, x);
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
break;
|
break;
|
||||||
|
case NANO_END_KEY:
|
||||||
case KEY_END:
|
case KEY_END:
|
||||||
x = x_left + strlen(inputbuf);
|
x = x_left + strlen(inputbuf);
|
||||||
nanoget_repaint(buf, inputbuf, x);
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
|
@ -450,11 +452,29 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||||
nodelay(edit, FALSE);
|
nodelay(edit, FALSE);
|
||||||
break;
|
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);
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
if (kbinput < 32)
|
if (kbinput < 32)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -553,7 +573,7 @@ void onekey(char *keystroke, char *desc)
|
||||||
{
|
{
|
||||||
char description[80];
|
char description[80];
|
||||||
|
|
||||||
snprintf(description, 12, " %-10s", desc);
|
snprintf(description, 12 - (strlen(keystroke) - 2), " %-10s", desc);
|
||||||
wattron(bottomwin, A_REVERSE);
|
wattron(bottomwin, A_REVERSE);
|
||||||
waddstr(bottomwin, keystroke);
|
waddstr(bottomwin, keystroke);
|
||||||
wattroff(bottomwin, A_REVERSE);
|
wattroff(bottomwin, A_REVERSE);
|
||||||
|
@ -586,8 +606,14 @@ void bottombars(shortcut s[], int slen)
|
||||||
|
|
||||||
clear_bottomwin();
|
clear_bottomwin();
|
||||||
wmove(bottomwin, 1, 0);
|
wmove(bottomwin, 1, 0);
|
||||||
for (i = 0; i <= slen - 1; i += 2) {
|
|
||||||
|
for (i = 0; i <= slen - 2; i += 2) {
|
||||||
|
|
||||||
|
if (s[i].val < 97)
|
||||||
snprintf(keystr, 10, "^%c", s[i].val + 64);
|
snprintf(keystr, 10, "^%c", s[i].val + 64);
|
||||||
|
else
|
||||||
|
snprintf(keystr, 10, "M-%c", s[i].val - 32);
|
||||||
|
|
||||||
onekey(keystr, s[i].desc);
|
onekey(keystr, s[i].desc);
|
||||||
|
|
||||||
for (j = 0; j < k; j++)
|
for (j = 0; j < k; j++)
|
||||||
|
@ -596,7 +622,12 @@ void bottombars(shortcut s[], int slen)
|
||||||
|
|
||||||
wmove(bottomwin, 2, 0);
|
wmove(bottomwin, 2, 0);
|
||||||
for (i = 1; i <= slen - 1; i += 2) {
|
for (i = 1; i <= slen - 1; i += 2) {
|
||||||
|
|
||||||
|
if (s[i].val < 97)
|
||||||
snprintf(keystr, 10, "^%c", s[i].val + 64);
|
snprintf(keystr, 10, "^%c", s[i].val + 64);
|
||||||
|
else
|
||||||
|
snprintf(keystr, 10, "M-%c", s[i].val - 32);
|
||||||
|
|
||||||
onekey(keystr, s[i].desc);
|
onekey(keystr, s[i].desc);
|
||||||
|
|
||||||
for (j = 0; j < k; j++)
|
for (j = 0; j < k; j++)
|
||||||
|
|
Loading…
Reference in New Issue