add shortcuts to go to the first or last line of the file from the main
list, make all the equivalent shortcuts elsewhere consistent, and simplify input parsing in do_help() git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3406 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
6397b592fb
commit
df45365592
10
ChangeLog
10
ChangeLog
|
@ -73,6 +73,11 @@ CVS code -
|
||||||
instead of "show", for consistency. (DLR)
|
instead of "show", for consistency. (DLR)
|
||||||
- In the main shortcut list, move the "Refresh" shortcut down to
|
- In the main shortcut list, move the "Refresh" shortcut down to
|
||||||
after the "Enter" shortcut, for consistency. (DLR)
|
after the "Enter" shortcut, for consistency. (DLR)
|
||||||
|
- Add the ability to go to the first and last line of the
|
||||||
|
current file from the main list via Meta-/ and Meta-\. Also,
|
||||||
|
make sure all the equivalent shortcuts in the search, replace,
|
||||||
|
and "Go To Line" lists accept both the meta keys and the
|
||||||
|
equivalent function keys. (DLR)
|
||||||
toggle_init()
|
toggle_init()
|
||||||
- In the global toggle list, move the "Constant cursor position
|
- In the global toggle list, move the "Constant cursor position
|
||||||
display" toggle up to after the "Use more space for editing"
|
display" toggle up to after the "Use more space for editing"
|
||||||
|
@ -82,6 +87,11 @@ CVS code -
|
||||||
displayed, followed by toggles that affect editing, followed
|
displayed, followed by toggles that affect editing, followed
|
||||||
by toggles that have to do with peripheral things. (DLR,
|
by toggles that have to do with peripheral things. (DLR,
|
||||||
suggested by Benno Schulenberg)
|
suggested by Benno Schulenberg)
|
||||||
|
- help.c:
|
||||||
|
do_help()
|
||||||
|
- Call get_shortcut() after getting input, so that we only have
|
||||||
|
to check for a main shortcut key instead of both it and all of
|
||||||
|
its equivalents. (DLR)
|
||||||
- nano.c:
|
- nano.c:
|
||||||
renumber()
|
renumber()
|
||||||
- Remove invalid assert. (DLR, found by Filipe Moreira)
|
- Remove invalid assert. (DLR, found by Filipe Moreira)
|
||||||
|
|
48
src/global.c
48
src/global.c
|
@ -650,6 +650,14 @@ void shortcut_init(bool unjustify)
|
||||||
NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void);
|
NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
sc_init_one(&main_list, NANO_NO_KEY, first_line_msg,
|
||||||
|
IFHELP(nano_firstline_msg, NANO_FIRSTLINE_ALTKEY), NANO_NO_KEY,
|
||||||
|
NANO_NO_KEY, VIEW, do_first_line);
|
||||||
|
|
||||||
|
sc_init_one(&main_list, NANO_NO_KEY, last_line_msg,
|
||||||
|
IFHELP(nano_lastline_msg, NANO_LASTLINE_ALTKEY), NANO_NO_KEY,
|
||||||
|
NANO_NO_KEY, VIEW, do_last_line);
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Previous File"),
|
sc_init_one(&main_list, NANO_NO_KEY, N_("Previous File"),
|
||||||
IFHELP(nano_prevfile_msg, NANO_PREVFILE_KEY), NANO_NO_KEY,
|
IFHELP(nano_prevfile_msg, NANO_PREVFILE_KEY), NANO_NO_KEY,
|
||||||
|
@ -708,12 +716,12 @@ void shortcut_init(bool unjustify)
|
||||||
VIEW, NULL);
|
VIEW, NULL);
|
||||||
|
|
||||||
sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
||||||
IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY,
|
IFHELP(nano_firstline_msg, NANO_FIRSTLINE_ALTKEY),
|
||||||
NANO_NO_KEY, VIEW, do_first_line);
|
NANO_FIRSTLINE_FKEY, NANO_NO_KEY, VIEW, do_first_line);
|
||||||
|
|
||||||
sc_init_one(&whereis_list, NANO_LASTLINE_KEY, last_line_msg,
|
sc_init_one(&whereis_list, NANO_LASTLINE_KEY, last_line_msg,
|
||||||
IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_LASTLINE_FKEY,
|
IFHELP(nano_lastline_msg, NANO_LASTLINE_ALTKEY),
|
||||||
NANO_NO_KEY, VIEW, do_last_line);
|
NANO_LASTLINE_FKEY, NANO_NO_KEY, VIEW, do_last_line);
|
||||||
|
|
||||||
sc_init_one(&whereis_list, NANO_TOOTHERSEARCH_KEY, replace_msg,
|
sc_init_one(&whereis_list, NANO_TOOTHERSEARCH_KEY, replace_msg,
|
||||||
IFHELP(nano_replace_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
|
IFHELP(nano_replace_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
|
||||||
|
@ -782,12 +790,12 @@ void shortcut_init(bool unjustify)
|
||||||
VIEW, NULL);
|
VIEW, NULL);
|
||||||
|
|
||||||
sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
||||||
IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY,
|
IFHELP(nano_firstline_msg, NANO_FIRSTLINE_ALTKEY),
|
||||||
NANO_NO_KEY, VIEW, do_first_line);
|
NANO_FIRSTLINE_FKEY, NANO_NO_KEY, VIEW, do_first_line);
|
||||||
|
|
||||||
sc_init_one(&replace_list, NANO_LASTLINE_KEY, last_line_msg,
|
sc_init_one(&replace_list, NANO_LASTLINE_KEY, last_line_msg,
|
||||||
IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_LASTLINE_FKEY,
|
IFHELP(nano_lastline_msg, NANO_LASTLINE_ALTKEY),
|
||||||
NANO_NO_KEY, VIEW, do_last_line);
|
NANO_LASTLINE_FKEY, NANO_NO_KEY, VIEW, do_last_line);
|
||||||
|
|
||||||
/* TRANSLATORS: Try to keep this at most 12 characters. */
|
/* TRANSLATORS: Try to keep this at most 12 characters. */
|
||||||
sc_init_one(&replace_list, NANO_TOOTHERSEARCH_KEY, N_("No Replace"),
|
sc_init_one(&replace_list, NANO_TOOTHERSEARCH_KEY, N_("No Replace"),
|
||||||
|
@ -837,12 +845,12 @@ void shortcut_init(bool unjustify)
|
||||||
VIEW, NULL);
|
VIEW, NULL);
|
||||||
|
|
||||||
sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, first_line_msg,
|
sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, first_line_msg,
|
||||||
IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
IFHELP(nano_firstline_msg, NANO_FIRSTLINE_ALTKEY),
|
||||||
NANO_NO_KEY, VIEW, do_first_line);
|
NANO_FIRSTLINE_FKEY, NANO_NO_KEY, VIEW, do_first_line);
|
||||||
|
|
||||||
sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, last_line_msg,
|
sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, last_line_msg,
|
||||||
IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
IFHELP(nano_lastline_msg, NANO_LASTLINE_ALTKEY),
|
||||||
NANO_NO_KEY, VIEW, do_last_line);
|
NANO_LASTLINE_FKEY, NANO_NO_KEY, VIEW, do_last_line);
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
sc_init_one(&replace_list_2, NANO_PREVLINE_KEY, history_msg,
|
sc_init_one(&replace_list_2, NANO_PREVLINE_KEY, history_msg,
|
||||||
|
@ -867,12 +875,12 @@ void shortcut_init(bool unjustify)
|
||||||
VIEW, NULL);
|
VIEW, NULL);
|
||||||
|
|
||||||
sc_init_one(&gotoline_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
sc_init_one(&gotoline_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
||||||
IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
IFHELP(nano_firstline_msg, NANO_FIRSTLINE_ALTKEY),
|
||||||
NANO_NO_KEY, VIEW, do_first_line);
|
NANO_FIRSTLINE_FKEY, NANO_NO_KEY, VIEW, do_first_line);
|
||||||
|
|
||||||
sc_init_one(&gotoline_list, NANO_LASTLINE_KEY, last_line_msg,
|
sc_init_one(&gotoline_list, NANO_LASTLINE_KEY, last_line_msg,
|
||||||
IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
IFHELP(nano_lastline_msg, NANO_LASTLINE_ALTKEY),
|
||||||
NANO_NO_KEY, VIEW, do_last_line);
|
NANO_LASTLINE_FKEY, NANO_NO_KEY, VIEW, do_last_line);
|
||||||
|
|
||||||
sc_init_one(&gotoline_list, NANO_TOOTHERWHEREIS_KEY,
|
sc_init_one(&gotoline_list, NANO_TOOTHERWHEREIS_KEY,
|
||||||
N_("Go To Text"), IFHELP(nano_whereis_msg, NANO_NO_KEY),
|
N_("Go To Text"), IFHELP(nano_whereis_msg, NANO_NO_KEY),
|
||||||
|
@ -1114,12 +1122,12 @@ void shortcut_init(bool unjustify)
|
||||||
VIEW, NULL);
|
VIEW, NULL);
|
||||||
|
|
||||||
sc_init_one(&whereis_file_list, NANO_FIRSTFILE_KEY, first_file_msg,
|
sc_init_one(&whereis_file_list, NANO_FIRSTFILE_KEY, first_file_msg,
|
||||||
IFHELP(nano_firstfile_msg, NANO_NO_KEY), NANO_FIRSTFILE_FKEY,
|
IFHELP(nano_firstfile_msg, NANO_FIRSTFILE_ALTKEY),
|
||||||
NANO_NO_KEY, VIEW, do_first_file);
|
NANO_FIRSTFILE_FKEY, NANO_NO_KEY, VIEW, do_first_file);
|
||||||
|
|
||||||
sc_init_one(&whereis_file_list, NANO_LASTFILE_KEY, last_file_msg,
|
sc_init_one(&whereis_file_list, NANO_LASTFILE_KEY, last_file_msg,
|
||||||
IFHELP(nano_lastfile_msg, NANO_NO_KEY), NANO_LASTFILE_FKEY,
|
IFHELP(nano_lastfile_msg, NANO_LASTFILE_ALTKEY),
|
||||||
NANO_NO_KEY, VIEW, do_last_file);
|
NANO_LASTFILE_FKEY, NANO_NO_KEY, VIEW, do_last_file);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
sc_init_one(&whereis_file_list, NANO_NO_KEY, case_sens_msg,
|
sc_init_one(&whereis_file_list, NANO_NO_KEY, case_sens_msg,
|
||||||
|
|
|
@ -93,7 +93,6 @@ void do_help(void (*refresh_func)(void))
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case NANO_PREVPAGE_KEY:
|
case NANO_PREVPAGE_KEY:
|
||||||
case NANO_PREVPAGE_FKEY:
|
|
||||||
if (line > 0) {
|
if (line > 0) {
|
||||||
line -= editwinrows - 2;
|
line -= editwinrows - 2;
|
||||||
if (line < 0)
|
if (line < 0)
|
||||||
|
@ -101,7 +100,6 @@ void do_help(void (*refresh_func)(void))
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NANO_NEXTPAGE_KEY:
|
case NANO_NEXTPAGE_KEY:
|
||||||
case NANO_NEXTPAGE_FKEY:
|
|
||||||
if (!no_more)
|
if (!no_more)
|
||||||
line += editwinrows - 2;
|
line += editwinrows - 2;
|
||||||
break;
|
break;
|
||||||
|
@ -145,7 +143,8 @@ void do_help(void (*refresh_func)(void))
|
||||||
|
|
||||||
skip_redisplay:
|
skip_redisplay:
|
||||||
kbinput = get_kbinput(edit, &meta_key, &func_key);
|
kbinput = get_kbinput(edit, &meta_key, &func_key);
|
||||||
} while (kbinput != NANO_EXIT_KEY && kbinput != NANO_EXIT_FKEY);
|
get_shortcut(help_list, &kbinput, &meta_key, &func_key);
|
||||||
|
} while (kbinput != NANO_EXIT_KEY);
|
||||||
|
|
||||||
#ifndef DISABLE_MOUSE
|
#ifndef DISABLE_MOUSE
|
||||||
currshortcut = oldshortcut;
|
currshortcut = oldshortcut;
|
||||||
|
|
|
@ -414,11 +414,13 @@ typedef struct rcoption {
|
||||||
#define NANO_ALT_COMMA ','
|
#define NANO_ALT_COMMA ','
|
||||||
#define NANO_ALT_MINUS '-'
|
#define NANO_ALT_MINUS '-'
|
||||||
#define NANO_ALT_PERIOD '.'
|
#define NANO_ALT_PERIOD '.'
|
||||||
#define NANO_ALT_9 '9'
|
#define NANO_ALT_SLASH '/'
|
||||||
#define NANO_ALT_0 '0'
|
#define NANO_ALT_0 '0'
|
||||||
|
#define NANO_ALT_9 '9'
|
||||||
#define NANO_ALT_LCARAT '<'
|
#define NANO_ALT_LCARAT '<'
|
||||||
#define NANO_ALT_EQUALS '='
|
#define NANO_ALT_EQUALS '='
|
||||||
#define NANO_ALT_RCARAT '>'
|
#define NANO_ALT_RCARAT '>'
|
||||||
|
#define NANO_ALT_BACKSLASH '\\'
|
||||||
#define NANO_ALT_RBRACKET ']'
|
#define NANO_ALT_RBRACKET ']'
|
||||||
#define NANO_ALT_USCORE '_'
|
#define NANO_ALT_USCORE '_'
|
||||||
#define NANO_ALT_A 'a'
|
#define NANO_ALT_A 'a'
|
||||||
|
@ -495,12 +497,16 @@ typedef struct rcoption {
|
||||||
#define NANO_SPELL_FKEY KEY_F(12)
|
#define NANO_SPELL_FKEY KEY_F(12)
|
||||||
#define NANO_FIRSTLINE_KEY NANO_PREVPAGE_KEY
|
#define NANO_FIRSTLINE_KEY NANO_PREVPAGE_KEY
|
||||||
#define NANO_FIRSTLINE_FKEY NANO_PREVPAGE_FKEY
|
#define NANO_FIRSTLINE_FKEY NANO_PREVPAGE_FKEY
|
||||||
|
#define NANO_FIRSTLINE_ALTKEY NANO_ALT_SLASH
|
||||||
#define NANO_FIRSTFILE_KEY NANO_FIRSTLINE_KEY
|
#define NANO_FIRSTFILE_KEY NANO_FIRSTLINE_KEY
|
||||||
#define NANO_FIRSTFILE_FKEY NANO_FIRSTLINE_FKEY
|
#define NANO_FIRSTFILE_FKEY NANO_FIRSTLINE_FKEY
|
||||||
|
#define NANO_FIRSTFILE_ALTKEY NANO_FIRSTLINE_ALTKEY
|
||||||
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
|
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
|
||||||
#define NANO_LASTLINE_FKEY NANO_NEXTPAGE_FKEY
|
#define NANO_LASTLINE_FKEY NANO_NEXTPAGE_FKEY
|
||||||
|
#define NANO_LASTLINE_ALTKEY NANO_ALT_BACKSLASH
|
||||||
#define NANO_LASTFILE_KEY NANO_LASTLINE_KEY
|
#define NANO_LASTFILE_KEY NANO_LASTLINE_KEY
|
||||||
#define NANO_LASTFILE_FKEY NANO_LASTLINE_FKEY
|
#define NANO_LASTFILE_FKEY NANO_LASTLINE_FKEY
|
||||||
|
#define NANO_LASTFILE_ALTKEY NANO_LASTLINE_ALTKEY
|
||||||
#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)
|
||||||
|
|
Loading…
Reference in New Issue