another low-level input overhaul: split out low-level mouse input,
remove references to ncurses key values from the global shortcut list and restructure it to specify function key values when needed, hook up verbatim input to the edit window, and do a few miscellaneous cleanups git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1596 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
45cfbece4c
commit
a593f538dd
23
ChangeLog
23
ChangeLog
|
@ -1,4 +1,27 @@
|
||||||
CVS code -
|
CVS code -
|
||||||
|
- General:
|
||||||
|
- Minor overhaul and abstraction of the lowest level of mouse
|
||||||
|
input, mostly adapted from the code in do_mouse() that handles
|
||||||
|
clicking on the shortcut list. New function do_mouseinput();
|
||||||
|
changes to do_mouse(). (DLR) David Benbennick: Add a few
|
||||||
|
efficiency tweaks.
|
||||||
|
- Modify the shortcut structure so that instead of having two
|
||||||
|
miscellaneous key values (misc1 and misc2), there is one key
|
||||||
|
value reserved for function keys (func_key) and one
|
||||||
|
miscellaneous key value (misc), and tweak the
|
||||||
|
shortcut-handling code to deal with this. These changes allow
|
||||||
|
NANO_OPEN(PREV|NEXT)_ALTKEY to work properly when added to the
|
||||||
|
shortcut entries for NANO_OPEN(PREV|NEXT)_KEY. Also remove
|
||||||
|
the values in the shortcut list that were made redundant by
|
||||||
|
the low-level input overhaul, use toupper() instead of
|
||||||
|
subtracting 32 from values for greater code readability, and
|
||||||
|
eliminate use of adding 32 to values when testing for toggles,
|
||||||
|
as get_kbinput_accepted() converts toggle values to lowercase
|
||||||
|
before returning them. (DLR)
|
||||||
|
- Hook up the verbatim input functions so that verbatim input
|
||||||
|
can be used in the edit window. New function
|
||||||
|
do_verbatim_input(); changes to do_char(). (DLR) Additional
|
||||||
|
minor tweaks to do_char() by David Benbennick.
|
||||||
- files.c:
|
- files.c:
|
||||||
do_writeout()
|
do_writeout()
|
||||||
- Prompt the user if we're trying to save an existing file (and
|
- Prompt the user if we're trying to save an existing file (and
|
||||||
|
|
1
TODO
1
TODO
|
@ -7,6 +7,7 @@ For version 1.4:
|
||||||
- Undo/Redo key?
|
- Undo/Redo key?
|
||||||
- Rebindable keys?
|
- Rebindable keys?
|
||||||
- Keystroke to implement "Add next sequence as raw" like vi's ^V.
|
- Keystroke to implement "Add next sequence as raw" like vi's ^V.
|
||||||
|
[DONE for edit window, needs to be done for statusbar prompt]
|
||||||
- Spell check selected text only.
|
- Spell check selected text only.
|
||||||
- Make "To line" (^W^T) and "Read from Command" (^R^X) re-enter their
|
- Make "To line" (^W^T) and "Read from Command" (^R^X) re-enter their
|
||||||
parent menu when their keystroke is entered a second time (^W^T^T and
|
parent menu when their keystroke is entered a second time (^W^T^T and
|
||||||
|
|
|
@ -489,7 +489,7 @@ int do_insertfile(int loading_file)
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
if (i == TOGGLE_LOAD_KEY) {
|
if (i == TOGGLE_MULTIBUFFER_KEY) {
|
||||||
/* Don't allow toggling if we're in view mode. */
|
/* Don't allow toggling if we're in view mode. */
|
||||||
if (!ISSET(VIEW_MODE))
|
if (!ISSET(VIEW_MODE))
|
||||||
TOGGLE(MULTIBUFFER);
|
TOGGLE(MULTIBUFFER);
|
||||||
|
|
283
src/global.c
283
src/global.c
|
@ -172,7 +172,7 @@ void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
const char *help,
|
const char *help,
|
||||||
#endif
|
#endif
|
||||||
int alt, int misc1, int misc2, int view, int (*func) (void))
|
int alt, int func_key, int misc, int view, int (*func) (void))
|
||||||
{
|
{
|
||||||
shortcut *s;
|
shortcut *s;
|
||||||
|
|
||||||
|
@ -192,8 +192,8 @@ void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
||||||
s->help = help;
|
s->help = help;
|
||||||
#endif
|
#endif
|
||||||
s->altval = alt;
|
s->altval = alt;
|
||||||
s->misc1 = misc1;
|
s->func_key = func_key;
|
||||||
s->misc2 = misc2;
|
s->misc = misc;
|
||||||
s->viewok = view;
|
s->viewok = view;
|
||||||
s->func = func;
|
s->func = func;
|
||||||
s->next = NULL;
|
s->next = NULL;
|
||||||
|
@ -235,7 +235,7 @@ void toggle_init(void)
|
||||||
char *toggle_wrap_msg;
|
char *toggle_wrap_msg;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
char *toggle_load_msg;
|
char *toggle_multibuffer_msg;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
char *toggle_syntax_msg;
|
char *toggle_syntax_msg;
|
||||||
|
@ -266,22 +266,22 @@ void toggle_init(void)
|
||||||
toggle_wrap_msg = _("Auto line wrap");
|
toggle_wrap_msg = _("Auto line wrap");
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
toggle_load_msg = _("Multiple file buffers");
|
toggle_multibuffer_msg = _("Multiple file buffers");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
toggle_init_one(TOGGLE_NOHELP_KEY, toggle_nohelp_msg, NO_HELP);
|
||||||
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
|
toggle_init_one(TOGGLE_MULTIBUFFER_KEY, toggle_multibuffer_msg, MULTIBUFFER);
|
||||||
|
#endif
|
||||||
toggle_init_one(TOGGLE_CONST_KEY, toggle_const_msg, CONSTUPDATE);
|
toggle_init_one(TOGGLE_CONST_KEY, toggle_const_msg, CONSTUPDATE);
|
||||||
toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT);
|
toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT);
|
||||||
toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND);
|
|
||||||
toggle_init_one(TOGGLE_NOHELP_KEY, toggle_nohelp_msg, NO_HELP);
|
|
||||||
#ifndef DISABLE_WRAPPING
|
#ifndef DISABLE_WRAPPING
|
||||||
toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP);
|
toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP);
|
||||||
#endif
|
#endif
|
||||||
|
toggle_init_one(TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, CUT_TO_END);
|
||||||
|
toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND);
|
||||||
#ifndef DISABLE_MOUSE
|
#ifndef DISABLE_MOUSE
|
||||||
toggle_init_one(TOGGLE_MOUSE_KEY, toggle_mouse_msg, USE_MOUSE);
|
toggle_init_one(TOGGLE_MOUSE_KEY, toggle_mouse_msg, USE_MOUSE);
|
||||||
#endif
|
|
||||||
toggle_init_one(TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, CUT_TO_END);
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
|
||||||
toggle_init_one(TOGGLE_LOAD_KEY, toggle_load_msg, MULTIBUFFER);
|
|
||||||
#endif
|
#endif
|
||||||
toggle_init_one(TOGGLE_NOCONVERT_KEY, toggle_noconvert_msg, NO_CONVERT);
|
toggle_init_one(TOGGLE_NOCONVERT_KEY, toggle_noconvert_msg, NO_CONVERT);
|
||||||
toggle_init_one(TOGGLE_DOS_KEY, toggle_dos_msg, DOS_FILE);
|
toggle_init_one(TOGGLE_DOS_KEY, toggle_dos_msg, DOS_FILE);
|
||||||
|
@ -321,27 +321,30 @@ void free_shortcutage(shortcut **shortcutage)
|
||||||
void shortcut_init(int unjustify)
|
void shortcut_init(int unjustify)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
const char *nano_help_msg = "", *nano_writeout_msg = "", *nano_exit_msg =
|
const char *nano_help_msg = "", *nano_writeout_msg =
|
||||||
"", *nano_goto_msg = "", *nano_justify_msg =
|
"", *nano_exit_msg = "", *nano_goto_msg =
|
||||||
"", *nano_replace_msg = "", *nano_insert_msg =
|
"", *nano_justify_msg = "", *nano_replace_msg =
|
||||||
"", *nano_whereis_msg = "", *nano_whereis_next_msg =
|
"", *nano_insert_msg = "", *nano_whereis_msg =
|
||||||
"", *nano_prevpage_msg = "", *nano_nextpage_msg =
|
"", *nano_whereis_next_msg = "", *nano_prevpage_msg =
|
||||||
"", *nano_cut_msg = "", *nano_uncut_msg =
|
"", *nano_nextpage_msg = "", *nano_cut_msg =
|
||||||
"", *nano_cursorpos_msg = "", *nano_spell_msg =
|
"", *nano_uncut_msg = "", *nano_cursorpos_msg =
|
||||||
"", *nano_up_msg = "", *nano_down_msg =
|
"", *nano_spell_msg = "", *nano_up_msg =
|
||||||
"", *nano_forward_msg = "", *nano_back_msg = "", *nano_home_msg =
|
"", *nano_down_msg = "", *nano_forward_msg =
|
||||||
|
"", *nano_back_msg = "", *nano_home_msg =
|
||||||
"", *nano_end_msg = "", *nano_firstline_msg =
|
"", *nano_end_msg = "", *nano_firstline_msg =
|
||||||
"", *nano_lastline_msg = "", *nano_refresh_msg =
|
"", *nano_lastline_msg = "", *nano_refresh_msg =
|
||||||
"", *nano_mark_msg = "", *nano_delete_msg =
|
"", *nano_mark_msg = "", *nano_delete_msg =
|
||||||
"", *nano_backspace_msg = "", *nano_tab_msg =
|
"", *nano_backspace_msg = "", *nano_tab_msg =
|
||||||
"", *nano_enter_msg = "", *nano_cancel_msg =
|
"", *nano_enter_msg = "", *nano_prevword_msg =
|
||||||
"", *nano_unjustify_msg = "", *nano_append_msg =
|
"", *nano_nextword_msg = "", *nano_verbatim_msg =
|
||||||
"", *nano_prepend_msg = "", *nano_tofiles_msg =
|
"", *nano_cancel_msg = "", *nano_unjustify_msg =
|
||||||
"", *nano_gotodir_msg = "", *nano_case_msg =
|
"", *nano_append_msg = "", *nano_prepend_msg =
|
||||||
"", *nano_reverse_msg = "", *nano_execute_msg =
|
"", *nano_tofiles_msg = "", *nano_gotodir_msg =
|
||||||
"", *nano_dos_msg = "", *nano_mac_msg =
|
"", *nano_case_msg = "", *nano_reverse_msg =
|
||||||
"", *nano_backup_msg = "", *nano_editstr_msg =
|
"", *nano_execute_msg = "", *nano_dos_msg =
|
||||||
"", *nano_parabegin_msg = "", *nano_paraend_msg = "";
|
"", *nano_mac_msg = "", *nano_backup_msg =
|
||||||
|
"", *nano_editstr_msg = "", *nano_parabegin_msg =
|
||||||
|
"", *nano_paraend_msg = "";
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
const char *nano_openprev_msg = "", *nano_opennext_msg =
|
const char *nano_openprev_msg = "", *nano_opennext_msg =
|
||||||
|
@ -386,6 +389,10 @@ void shortcut_init(int unjustify)
|
||||||
_("Delete the character to the left of the cursor");
|
_("Delete the character to the left of the cursor");
|
||||||
nano_tab_msg = _("Insert a tab character");
|
nano_tab_msg = _("Insert a tab character");
|
||||||
nano_enter_msg = _("Insert a carriage return at the cursor position");
|
nano_enter_msg = _("Insert a carriage return at the cursor position");
|
||||||
|
nano_prevword_msg = _("Move backward one word");
|
||||||
|
nano_nextword_msg = _("Move forward one word");
|
||||||
|
nano_verbatim_msg = _("Insert character(s) verbatim");
|
||||||
|
nano_enter_msg = _("Insert a carriage return at the cursor position");
|
||||||
nano_case_msg =
|
nano_case_msg =
|
||||||
_("Make the current search or replace case (in)sensitive");
|
_("Make the current search or replace case (in)sensitive");
|
||||||
nano_tofiles_msg = _("Go to file browser");
|
nano_tofiles_msg = _("Go to file browser");
|
||||||
|
@ -422,39 +429,41 @@ void shortcut_init(int unjustify)
|
||||||
#else
|
#else
|
||||||
# define IFHELP(help, nextvar) help, nextvar
|
# define IFHELP(help, nextvar) help, nextvar
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&main_list, NANO_HELP_KEY, _("Get Help"),
|
||||||
IFHELP(nano_help_msg, 0), NANO_HELP_FKEY, 0, VIEW,
|
IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
|
||||||
do_help);
|
0, VIEW, do_help);
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
if (open_files != NULL && (open_files->prev != NULL || open_files->next != NULL))
|
if (open_files != NULL && (open_files->prev != NULL || open_files->next != NULL))
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_EXIT_KEY, _("Close"),
|
sc_init_one(&main_list, NANO_EXIT_KEY, _("Close"),
|
||||||
IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
|
IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY,
|
||||||
do_exit);
|
0, VIEW, do_exit);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_EXIT_KEY, _("Exit"),
|
sc_init_one(&main_list, NANO_EXIT_KEY, _("Exit"),
|
||||||
IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
|
IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY,
|
||||||
do_exit);
|
0, VIEW, do_exit);
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_WRITEOUT_KEY, _("WriteOut"),
|
sc_init_one(&main_list, NANO_WRITEOUT_KEY, _("WriteOut"),
|
||||||
IFHELP(nano_writeout_msg, 0),
|
IFHELP(nano_writeout_msg, 0), NANO_WRITEOUT_FKEY,
|
||||||
NANO_WRITEOUT_FKEY, 0, NOVIEW, do_writeout_void);
|
0, NOVIEW, do_writeout_void);
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"),
|
sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"),
|
||||||
IFHELP(nano_justify_msg, 0), NANO_JUSTIFY_FKEY, 0,
|
IFHELP(nano_justify_msg, 0), NANO_JUSTIFY_FKEY,
|
||||||
NOVIEW, do_justify);
|
0, NOVIEW, do_justify);
|
||||||
|
|
||||||
/* this is so we can view multiple files */
|
/* this is so we can view multiple files */
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
|
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
|
||||||
IFHELP(nano_insert_msg, 0), NANO_INSERTFILE_FKEY, 0,
|
IFHELP(nano_insert_msg, 0), NANO_INSERTFILE_FKEY,
|
||||||
|
0,
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
VIEW
|
VIEW
|
||||||
#else
|
#else
|
||||||
|
@ -464,132 +473,126 @@ void shortcut_init(int unjustify)
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_WHEREIS_KEY, _("Where Is"),
|
sc_init_one(&main_list, NANO_WHEREIS_KEY, _("Where Is"),
|
||||||
IFHELP(nano_whereis_msg, 0),
|
IFHELP(nano_whereis_msg, 0), NANO_WHEREIS_FKEY,
|
||||||
NANO_WHEREIS_FKEY, 0, VIEW, do_search);
|
0, VIEW, do_search);
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_PREVPAGE_KEY, _("Prev Page"),
|
sc_init_one(&main_list, NANO_PREVPAGE_KEY, _("Prev Page"),
|
||||||
IFHELP(nano_prevpage_msg, 0),
|
IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
|
||||||
NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, do_page_up);
|
0, VIEW, do_page_up);
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_NEXTPAGE_KEY, _("Next Page"),
|
sc_init_one(&main_list, NANO_NEXTPAGE_KEY, _("Next Page"),
|
||||||
IFHELP(nano_nextpage_msg, 0),
|
IFHELP(nano_nextpage_msg, 0), NANO_NEXTPAGE_FKEY,
|
||||||
NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);
|
0, VIEW, do_page_down);
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_CUT_KEY, _("Cut Text"),
|
sc_init_one(&main_list, NANO_CUT_KEY, _("Cut Text"),
|
||||||
IFHELP(nano_cut_msg, 0),
|
IFHELP(nano_cut_msg, 0), NANO_CUT_FKEY, 0, NOVIEW, do_cut_text);
|
||||||
NANO_CUT_FKEY, 0, NOVIEW, do_cut_text);
|
|
||||||
|
|
||||||
if (unjustify)
|
if (unjustify)
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, _("UnJustify"),
|
sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, _("UnJustify"),
|
||||||
IFHELP(nano_unjustify_msg, 0),
|
IFHELP(nano_unjustify_msg, 0), 0, 0, NOVIEW, do_uncut_text);
|
||||||
0, 0, NOVIEW, do_uncut_text);
|
|
||||||
else
|
else
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_UNCUT_KEY, _("UnCut Txt"),
|
sc_init_one(&main_list, NANO_UNCUT_KEY, _("UnCut Txt"),
|
||||||
IFHELP(nano_uncut_msg, 0),
|
IFHELP(nano_uncut_msg, 0), NANO_UNCUT_FKEY,
|
||||||
NANO_UNCUT_FKEY, 0, NOVIEW, do_uncut_text);
|
0, NOVIEW, do_uncut_text);
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_CURSORPOS_KEY, _("Cur Pos"),
|
sc_init_one(&main_list, NANO_CURSORPOS_KEY, _("Cur Pos"),
|
||||||
IFHELP(nano_cursorpos_msg, 0),
|
IFHELP(nano_cursorpos_msg, 0), NANO_CURSORPOS_FKEY,
|
||||||
NANO_CURSORPOS_FKEY, 0, VIEW, do_cursorpos_void);
|
0, VIEW, do_cursorpos_void);
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_SPELL_KEY, _("To Spell"),
|
sc_init_one(&main_list, NANO_SPELL_KEY, _("To Spell"),
|
||||||
IFHELP(nano_spell_msg, 0),
|
IFHELP(nano_spell_msg, 0), NANO_SPELL_FKEY,
|
||||||
NANO_SPELL_FKEY, 0, NOVIEW, do_spell);
|
0, NOVIEW, do_spell);
|
||||||
|
|
||||||
|
sc_init_one(&main_list, NANO_GOTO_KEY, _("Go To Line"),
|
||||||
|
IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY),
|
||||||
|
NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
|
||||||
|
|
||||||
|
sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"),
|
||||||
|
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
|
||||||
|
NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_UP_KEY, _("Up"),
|
sc_init_one(&main_list, NANO_UP_KEY, _("Up"),
|
||||||
IFHELP(nano_up_msg, 0),
|
IFHELP(nano_up_msg, 0), 0, 0, VIEW, do_up);
|
||||||
KEY_UP, 0, VIEW, do_up);
|
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_DOWN_KEY, _("Down"),
|
sc_init_one(&main_list, NANO_DOWN_KEY, _("Down"),
|
||||||
IFHELP(nano_down_msg, 0),
|
IFHELP(nano_down_msg, 0), 0, 0, VIEW, do_down);
|
||||||
KEY_DOWN, 0, VIEW, do_down);
|
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_FORWARD_KEY, _("Forward"),
|
sc_init_one(&main_list, NANO_FORWARD_KEY, _("Forward"),
|
||||||
IFHELP(nano_forward_msg, 0),
|
IFHELP(nano_forward_msg, 0), 0, 0, VIEW, do_right);
|
||||||
KEY_RIGHT, 0, VIEW, do_right);
|
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_BACK_KEY, _("Back"),
|
sc_init_one(&main_list, NANO_BACK_KEY, _("Back"),
|
||||||
IFHELP(nano_back_msg, 0),
|
IFHELP(nano_back_msg, 0), 0, 0, VIEW, do_left);
|
||||||
KEY_LEFT, 0, VIEW, do_left);
|
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_HOME_KEY, _("Home"),
|
sc_init_one(&main_list, NANO_HOME_KEY, _("Home"),
|
||||||
IFHELP(nano_home_msg, 0),
|
IFHELP(nano_home_msg, 0), 0, 0, VIEW, do_home);
|
||||||
KEY_HOME, 362, VIEW, do_home);
|
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_END_KEY, _("End"),
|
sc_init_one(&main_list, NANO_END_KEY, _("End"),
|
||||||
IFHELP(nano_end_msg, 0),
|
IFHELP(nano_end_msg, 0), 0, 0, VIEW, do_end);
|
||||||
KEY_END, 385, VIEW, do_end);
|
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_REFRESH_KEY, _("Refresh"),
|
sc_init_one(&main_list, NANO_REFRESH_KEY, _("Refresh"),
|
||||||
IFHELP(nano_refresh_msg, 0),
|
IFHELP(nano_refresh_msg, 0), 0, 0, VIEW, total_refresh);
|
||||||
0, 0, VIEW, total_refresh);
|
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_MARK_KEY, _("Mark Text"),
|
sc_init_one(&main_list, NANO_MARK_KEY, _("Mark Text"),
|
||||||
IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY),
|
IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY),
|
||||||
0, 0, NOVIEW, do_mark);
|
0, 0, NOVIEW, do_mark);
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_DELETE_KEY, _("Delete"),
|
sc_init_one(&main_list, NANO_DELETE_KEY, _("Delete"),
|
||||||
IFHELP(nano_delete_msg, 0), KEY_DC,
|
IFHELP(nano_delete_msg, 0), 0, 0, NOVIEW, do_delete);
|
||||||
NANO_CONTROL_D, NOVIEW, do_delete);
|
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_BACKSPACE_KEY, _("Backspace"),
|
sc_init_one(&main_list, NANO_BACKSPACE_KEY, _("Backspace"),
|
||||||
IFHELP(nano_backspace_msg, 0),
|
IFHELP(nano_backspace_msg, 0), 0, 0, NOVIEW, do_backspace);
|
||||||
KEY_BACKSPACE, 127, NOVIEW, do_backspace);
|
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_TAB_KEY, _("Tab"),
|
sc_init_one(&main_list, NANO_TAB_KEY, _("Tab"),
|
||||||
IFHELP(nano_tab_msg, 0), 0, 0, NOVIEW, do_tab);
|
IFHELP(nano_tab_msg, 0), 0, 0, NOVIEW, do_tab);
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"),
|
|
||||||
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
|
|
||||||
NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
|
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"),
|
sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"),
|
||||||
IFHELP(nano_enter_msg, 0),
|
IFHELP(nano_enter_msg, 0), 0, 0, NOVIEW, do_enter);
|
||||||
KEY_ENTER, NANO_CONTROL_M, NOVIEW, do_enter);
|
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_GOTO_KEY, _("Go To Line"),
|
|
||||||
IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY),
|
|
||||||
NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
|
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"),
|
sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"),
|
||||||
IFHELP(_("Move forward one word"), 0),
|
IFHELP(nano_nextword_msg, 0), 0, 0, VIEW, do_next_word);
|
||||||
0, 0, VIEW, do_next_word);
|
|
||||||
|
|
||||||
sc_init_one(&main_list, -9, _("Prev Word"),
|
sc_init_one(&main_list, -1, _("Prev Word"),
|
||||||
IFHELP(_("Move backward one word"), NANO_PREVWORD_KEY), 0, 0,
|
IFHELP(nano_prevword_msg, NANO_PREVWORD_KEY),
|
||||||
VIEW, do_prev_word);
|
0, 0, VIEW, do_prev_word);
|
||||||
#endif
|
|
||||||
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
|
|
||||||
sc_init_one(&main_list, -9, _("Find Other Bracket"),
|
|
||||||
IFHELP(nano_bracket_msg, NANO_BRACKET_KEY),
|
|
||||||
0, 0, VIEW, do_find_bracket);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sc_init_one(&main_list, -9, _("Where Is Next"),
|
sc_init_one(&main_list, -1, _("Verbatim Input"),
|
||||||
IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY), 0, 0,
|
IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY),
|
||||||
VIEW, do_research);
|
0, 0, VIEW, do_verbatim_input);
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
sc_init_one(&main_list, -9, _("Previous File"),
|
sc_init_one(&main_list, -1, _("Previous File"),
|
||||||
IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY),
|
IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY),
|
||||||
0, 0, VIEW, open_prevfile_void);
|
0, NANO_OPENPREV_ALTKEY, VIEW, open_prevfile_void);
|
||||||
sc_init_one(&main_list, -9, _("Next File"),
|
|
||||||
IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY),
|
sc_init_one(&main_list, -1, _("Next File"),
|
||||||
0, 0, VIEW, open_nextfile_void);
|
IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY),
|
||||||
|
0, NANO_OPENNEXT_ALTKEY, VIEW, open_nextfile_void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
|
||||||
|
sc_init_one(&main_list, -1, _("Find Other Bracket"),
|
||||||
|
IFHELP(nano_bracket_msg, NANO_BRACKET_KEY),
|
||||||
|
0, 0, VIEW, do_find_bracket);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sc_init_one(&main_list, -1, _("Where Is Next"),
|
||||||
|
IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
|
||||||
|
0, 0, VIEW, do_research);
|
||||||
|
|
||||||
free_shortcutage(&whereis_list);
|
free_shortcutage(&whereis_list);
|
||||||
|
|
||||||
sc_init_one(&whereis_list, NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&whereis_list, NANO_HELP_KEY, _("Get Help"),
|
||||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
|
||||||
|
0, VIEW, do_help);
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&whereis_list, NANO_CANCEL_KEY, _("Cancel"),
|
sc_init_one(&whereis_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||||
|
@ -597,8 +600,7 @@ void shortcut_init(int unjustify)
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, _("First Line"),
|
sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, _("First Line"),
|
||||||
IFHELP(nano_firstline_msg, 0),
|
IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);
|
||||||
0, 0, VIEW, do_first_line);
|
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&whereis_list, NANO_LASTLINE_KEY, _("Last Line"),
|
sc_init_one(&whereis_list, NANO_LASTLINE_KEY, _("Last Line"),
|
||||||
|
@ -606,11 +608,13 @@ void shortcut_init(int unjustify)
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, _("Replace"),
|
sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, _("Replace"),
|
||||||
IFHELP(nano_replace_msg, 0), 0, 0, VIEW, do_replace);
|
IFHELP(nano_replace_msg, 0), NANO_REPLACE_FKEY,
|
||||||
|
0, VIEW, do_replace);
|
||||||
|
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
|
sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
|
||||||
IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void);
|
IFHELP(nano_goto_msg, 0), NANO_GOTO_FKEY,
|
||||||
|
0, VIEW, do_gotoline_void);
|
||||||
|
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
|
@ -639,8 +643,8 @@ void shortcut_init(int unjustify)
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&whereis_list, KEY_UP, _("History"),
|
sc_init_one(&whereis_list, NANO_UP_KEY, _("History"),
|
||||||
IFHELP(nano_editstr_msg, 0), NANO_UP_KEY, 0, VIEW, 0);
|
IFHELP(nano_editstr_msg, 0), 0, NANO_DOWN_KEY, VIEW, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_SMALL */
|
||||||
|
@ -648,7 +652,8 @@ void shortcut_init(int unjustify)
|
||||||
free_shortcutage(&replace_list);
|
free_shortcutage(&replace_list);
|
||||||
|
|
||||||
sc_init_one(&replace_list, NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&replace_list, NANO_HELP_KEY, _("Get Help"),
|
||||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
|
||||||
|
0, VIEW, do_help);
|
||||||
|
|
||||||
sc_init_one(&replace_list, NANO_CANCEL_KEY, _("Cancel"),
|
sc_init_one(&replace_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||||
|
@ -661,10 +666,12 @@ void shortcut_init(int unjustify)
|
||||||
|
|
||||||
/* Translators: try to keep this string under 12 characters long */
|
/* Translators: try to keep this string under 12 characters long */
|
||||||
sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, _("No Replace"),
|
sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, _("No Replace"),
|
||||||
IFHELP(nano_whereis_msg, 0), 0, 0, VIEW, do_search);
|
IFHELP(nano_whereis_msg, 0), NANO_REPLACE_FKEY,
|
||||||
|
0, VIEW, do_search);
|
||||||
|
|
||||||
sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
|
sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
|
||||||
IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void);
|
IFHELP(nano_goto_msg, 0), NANO_GOTO_FKEY,
|
||||||
|
0, VIEW, do_gotoline_void);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
sc_init_one(&replace_list, TOGGLE_CASE_KEY, _("Case Sens"),
|
sc_init_one(&replace_list, TOGGLE_CASE_KEY, _("Case Sens"),
|
||||||
|
@ -678,14 +685,15 @@ void shortcut_init(int unjustify)
|
||||||
IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0);
|
IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sc_init_one(&replace_list, KEY_UP, _("History"),
|
sc_init_one(&replace_list, NANO_UP_KEY, _("History"),
|
||||||
IFHELP(nano_editstr_msg, 0), NANO_UP_KEY, 0, VIEW, 0);
|
IFHELP(nano_editstr_msg, 0), 0, NANO_DOWN_KEY, VIEW, 0);
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_SMALL */
|
||||||
|
|
||||||
free_shortcutage(&replace_list_2);
|
free_shortcutage(&replace_list_2);
|
||||||
|
|
||||||
sc_init_one(&replace_list_2, NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&replace_list_2, NANO_HELP_KEY, _("Get Help"),
|
||||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
|
||||||
|
0, VIEW, do_help);
|
||||||
|
|
||||||
sc_init_one(&replace_list_2, NANO_CANCEL_KEY, _("Cancel"),
|
sc_init_one(&replace_list_2, NANO_CANCEL_KEY, _("Cancel"),
|
||||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||||
|
@ -697,14 +705,15 @@ void shortcut_init(int unjustify)
|
||||||
IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
|
IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
sc_init_one(&replace_list_2, KEY_UP, _("History"),
|
sc_init_one(&replace_list_2, NANO_UP_KEY, _("History"),
|
||||||
IFHELP(nano_editstr_msg, 0), NANO_UP_KEY, 0, VIEW, 0);
|
IFHELP(nano_editstr_msg, 0), 0, NANO_DOWN_KEY, VIEW, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
free_shortcutage(&goto_list);
|
free_shortcutage(&goto_list);
|
||||||
|
|
||||||
sc_init_one(&goto_list, NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&goto_list, NANO_HELP_KEY, _("Get Help"),
|
||||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
|
||||||
|
0, VIEW, do_help);
|
||||||
|
|
||||||
sc_init_one(&goto_list, NANO_CANCEL_KEY, _("Cancel"),
|
sc_init_one(&goto_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||||
|
@ -720,21 +729,22 @@ void shortcut_init(int unjustify)
|
||||||
|
|
||||||
sc_init_one(&help_list, NANO_PREVPAGE_KEY, _("Prev Page"),
|
sc_init_one(&help_list, NANO_PREVPAGE_KEY, _("Prev Page"),
|
||||||
IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
|
IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
|
||||||
KEY_PPAGE, VIEW, do_page_up);
|
0, VIEW, do_page_up);
|
||||||
|
|
||||||
sc_init_one(&help_list, NANO_NEXTPAGE_KEY, _("Next Page"),
|
sc_init_one(&help_list, NANO_NEXTPAGE_KEY, _("Next Page"),
|
||||||
IFHELP(nano_nextpage_msg, 0),
|
IFHELP(nano_nextpage_msg, 0), NANO_NEXTPAGE_FKEY,
|
||||||
NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);
|
0, VIEW, do_page_down);
|
||||||
|
|
||||||
sc_init_one(&help_list, NANO_EXIT_KEY, _("Exit"),
|
sc_init_one(&help_list, NANO_EXIT_KEY, _("Exit"),
|
||||||
IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
|
IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY,
|
||||||
do_exit);
|
0, VIEW, do_exit);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
free_shortcutage(&writefile_list);
|
free_shortcutage(&writefile_list);
|
||||||
|
|
||||||
sc_init_one(&writefile_list, NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&writefile_list, NANO_HELP_KEY, _("Get Help"),
|
||||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
|
||||||
|
0, VIEW, do_help);
|
||||||
|
|
||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
/* Translators: try to keep this string under 16 characters long */
|
/* Translators: try to keep this string under 16 characters long */
|
||||||
|
@ -772,7 +782,8 @@ void shortcut_init(int unjustify)
|
||||||
free_shortcutage(&insertfile_list);
|
free_shortcutage(&insertfile_list);
|
||||||
|
|
||||||
sc_init_one(&insertfile_list, NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&insertfile_list, NANO_HELP_KEY, _("Get Help"),
|
||||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
|
||||||
|
0, VIEW, do_help);
|
||||||
|
|
||||||
sc_init_one(&insertfile_list, NANO_CANCEL_KEY, _("Cancel"),
|
sc_init_one(&insertfile_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||||
|
@ -781,13 +792,15 @@ void shortcut_init(int unjustify)
|
||||||
sc_init_one(&insertfile_list, NANO_TOFILES_KEY, _("To Files"),
|
sc_init_one(&insertfile_list, NANO_TOFILES_KEY, _("To Files"),
|
||||||
IFHELP(nano_tofiles_msg, 0), 0, 0, NOVIEW, 0);
|
IFHELP(nano_tofiles_msg, 0), 0, 0, NOVIEW, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
/* Translators: try to keep this string under 22 characters long */
|
/* Translators: try to keep this string under 22 characters long */
|
||||||
sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, _("Execute Command"),
|
sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, _("Execute Command"),
|
||||||
IFHELP(nano_execute_msg, 0), 0, 0, NOVIEW, 0);
|
IFHELP(nano_execute_msg, 0), 0, 0, NOVIEW, 0);
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
/* Translators: try to keep this string under 22 characters long */
|
/* Translators: try to keep this string under 22 characters long */
|
||||||
sc_init_one(&insertfile_list, TOGGLE_LOAD_KEY, _("New Buffer"),
|
sc_init_one(&insertfile_list, TOGGLE_MULTIBUFFER_KEY, _("New Buffer"),
|
||||||
IFHELP(nano_multibuffer_msg, 0), 0, 0, NOVIEW, 0);
|
IFHELP(nano_multibuffer_msg, 0), 0, 0, NOVIEW, 0);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -796,7 +809,8 @@ void shortcut_init(int unjustify)
|
||||||
free_shortcutage(&spell_list);
|
free_shortcutage(&spell_list);
|
||||||
|
|
||||||
sc_init_one(&spell_list, NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&spell_list, NANO_HELP_KEY, _("Get Help"),
|
||||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
|
||||||
|
0, VIEW, do_help);
|
||||||
|
|
||||||
sc_init_one(&spell_list, NANO_CANCEL_KEY, _("Cancel"),
|
sc_init_one(&spell_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||||
|
@ -806,7 +820,8 @@ void shortcut_init(int unjustify)
|
||||||
free_shortcutage(&extcmd_list);
|
free_shortcutage(&extcmd_list);
|
||||||
|
|
||||||
sc_init_one(&extcmd_list, NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&extcmd_list, NANO_HELP_KEY, _("Get Help"),
|
||||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
|
||||||
|
0, VIEW, do_help);
|
||||||
|
|
||||||
sc_init_one(&extcmd_list, NANO_CANCEL_KEY, _("Cancel"),
|
sc_init_one(&extcmd_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||||
|
@ -816,18 +831,19 @@ void shortcut_init(int unjustify)
|
||||||
free_shortcutage(&browser_list);
|
free_shortcutage(&browser_list);
|
||||||
|
|
||||||
sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"),
|
||||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
|
||||||
|
0, VIEW, do_help);
|
||||||
|
|
||||||
sc_init_one(&browser_list, NANO_CANCEL_KEY, _("Cancel"),
|
sc_init_one(&browser_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||||
IFHELP(nano_cancel_msg, 0), NANO_EXIT_FKEY, 0, VIEW, 0);
|
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||||
|
|
||||||
sc_init_one(&browser_list, NANO_PREVPAGE_KEY, _("Prev Page"),
|
sc_init_one(&browser_list, NANO_PREVPAGE_KEY, _("Prev Page"),
|
||||||
IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
|
IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
|
||||||
KEY_PPAGE, VIEW, 0);
|
0, VIEW, 0);
|
||||||
|
|
||||||
sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, _("Next Page"),
|
sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, _("Next Page"),
|
||||||
IFHELP(nano_nextpage_msg, 0), NANO_NEXTPAGE_FKEY,
|
IFHELP(nano_nextpage_msg, 0), NANO_NEXTPAGE_FKEY,
|
||||||
KEY_NPAGE, VIEW, 0);
|
0, VIEW, 0);
|
||||||
|
|
||||||
/* Translators: try to keep this string under 22 characters long */
|
/* Translators: try to keep this string under 22 characters long */
|
||||||
sc_init_one(&browser_list, NANO_GOTO_KEY, _("Go To Dir"),
|
sc_init_one(&browser_list, NANO_GOTO_KEY, _("Go To Dir"),
|
||||||
|
@ -837,7 +853,8 @@ void shortcut_init(int unjustify)
|
||||||
free_shortcutage(&gotodir_list);
|
free_shortcutage(&gotodir_list);
|
||||||
|
|
||||||
sc_init_one(&gotodir_list, NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&gotodir_list, NANO_HELP_KEY, _("Get Help"),
|
||||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
|
||||||
|
0, VIEW, do_help);
|
||||||
|
|
||||||
sc_init_one(&gotodir_list, NANO_CANCEL_KEY, _("Cancel"),
|
sc_init_one(&gotodir_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||||
|
|
327
src/nano.c
327
src/nano.c
|
@ -406,40 +406,44 @@ void help_init(void)
|
||||||
/* true if the character in s->altval is shown in first column */
|
/* true if the character in s->altval is shown in first column */
|
||||||
int meta_shortcut = 0;
|
int meta_shortcut = 0;
|
||||||
|
|
||||||
if (s->val > 0 && s->val < 32)
|
|
||||||
ptr += sprintf(ptr, "^%c", s->val + 64);
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
else if (s->val == NANO_CONTROL_SPACE)
|
if (s->val == NANO_UP_KEY && s->misc == NANO_DOWN_KEY)
|
||||||
ptr += sprintf(ptr, "^%.6s", _("Space"));
|
ptr += sprintf(ptr, "%.2s", _("Up"));
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
if (is_cntrl_char(s->val)) {
|
||||||
|
if (s->val == NANO_CONTROL_SPACE)
|
||||||
|
ptr += sprintf(ptr, "^%.6s", _("Space"));
|
||||||
|
else if (s->val == NANO_CONTROL_8)
|
||||||
|
ptr += sprintf(ptr, "^?");
|
||||||
|
else
|
||||||
|
ptr += sprintf(ptr, "^%c", s->val + 64);
|
||||||
|
}
|
||||||
|
#ifndef NANO_SMALL
|
||||||
else if (s->altval == NANO_ALT_SPACE) {
|
else if (s->altval == NANO_ALT_SPACE) {
|
||||||
meta_shortcut = 1;
|
meta_shortcut = 1;
|
||||||
ptr += sprintf(ptr, "M-%.5s", _("Space"));
|
ptr += sprintf(ptr, "M-%.5s", _("Space"));
|
||||||
} else if (s->val == KEY_UP)
|
|
||||||
ptr += sprintf(ptr, "%.2s", _("Up"));
|
|
||||||
#endif
|
|
||||||
else if (s->altval > 0) {
|
|
||||||
meta_shortcut = 1;
|
|
||||||
ptr += sprintf(ptr, "M-%c", s->altval -
|
|
||||||
(('A' <= s->altval && s->altval <= 'Z') ||
|
|
||||||
'a' <= s->altval ? 32 : 0));
|
|
||||||
}
|
}
|
||||||
/* Hack */
|
#endif
|
||||||
else if (s->val >= 'a') {
|
else if (s->val > 0) {
|
||||||
meta_shortcut = 1;
|
meta_shortcut = 1;
|
||||||
ptr += sprintf(ptr, "M-%c", s->val - 32);
|
ptr += sprintf(ptr, "M-%c", toupper(s->val));
|
||||||
|
} else if (s->altval > 0) {
|
||||||
|
meta_shortcut = 1;
|
||||||
|
ptr += sprintf(ptr, "M-%c", toupper(s->altval));
|
||||||
}
|
}
|
||||||
|
|
||||||
*(ptr++) = '\t';
|
*(ptr++) = '\t';
|
||||||
|
|
||||||
if (s->misc1 > KEY_F0 && s->misc1 <= KEY_F(64))
|
if (s->func_key > KEY_F0 && s->func_key <= KEY_F(64))
|
||||||
ptr += sprintf(ptr, "(F%d)", s->misc1 - KEY_F0);
|
ptr += sprintf(ptr, "(F%d)", s->func_key - KEY_F0);
|
||||||
|
|
||||||
*(ptr++) = '\t';
|
*(ptr++) = '\t';
|
||||||
|
|
||||||
if (!meta_shortcut && s->altval > 0)
|
if (!meta_shortcut && s->altval > 0)
|
||||||
ptr += sprintf(ptr, "(M-%c)", s->altval -
|
ptr += sprintf(ptr, "(M-%c)", toupper(s->altval));
|
||||||
(('A' <= s->altval && s->altval <= 'Z') || 'a' <= s->altval
|
else if (meta_shortcut && s->misc > 0)
|
||||||
? 32 : 0));
|
ptr += sprintf(ptr, "(M-%c)", toupper(s->misc));
|
||||||
|
|
||||||
*(ptr++) = '\t';
|
*(ptr++) = '\t';
|
||||||
|
|
||||||
|
@ -452,7 +456,7 @@ void help_init(void)
|
||||||
if (currshortcut == main_list)
|
if (currshortcut == main_list)
|
||||||
for (t = toggles; t != NULL; t = t->next) {
|
for (t = toggles; t != NULL; t = t->next) {
|
||||||
assert(t->desc != NULL);
|
assert(t->desc != NULL);
|
||||||
ptr += sprintf(ptr, "M-%c\t\t\t%s %s\n", t->val - 32, t->desc,
|
ptr += sprintf(ptr, "M-%c\t\t\t%s %s\n", toupper(t->val), t->desc,
|
||||||
_("enable/disable"));
|
_("enable/disable"));
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_SMALL */
|
||||||
|
@ -774,7 +778,7 @@ void nano_disabled_msg(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
static int pid; /* This is the PID of the newly forked process
|
static int pid; /* This is the PID of the newly forked process
|
||||||
* below. It must be global since the signal
|
* below. It must be global since the signal
|
||||||
* handler needs it. */
|
* handler needs it. */
|
||||||
RETSIGTYPE cancel_fork(int signal)
|
RETSIGTYPE cancel_fork(int signal)
|
||||||
|
@ -890,87 +894,56 @@ int open_pipe(const char *command)
|
||||||
#ifndef DISABLE_MOUSE
|
#ifndef DISABLE_MOUSE
|
||||||
void do_mouse(void)
|
void do_mouse(void)
|
||||||
{
|
{
|
||||||
MEVENT mevent;
|
int mouse_x, mouse_y;
|
||||||
int currslen;
|
|
||||||
const shortcut *s = currshortcut;
|
|
||||||
|
|
||||||
if (getmouse(&mevent) == ERR)
|
if (get_mouseinput(&mouse_x, &mouse_y) == 0) {
|
||||||
return;
|
|
||||||
|
|
||||||
/* If mouse not in edit or bottom window, return */
|
/* Click in the edit window to move the cursor, but only when
|
||||||
if (wenclose(edit, mevent.y, mevent.x) && currshortcut == main_list) {
|
we're not in a subfunction. */
|
||||||
int sameline;
|
if (wenclose(edit, mouse_y, mouse_x) && currshortcut == main_list) {
|
||||||
/* Did they click on the line with the cursor? If they
|
int sameline;
|
||||||
clicked on the cursor, we set the mark. */
|
/* Did they click on the line with the cursor? If they
|
||||||
size_t xcur;
|
clicked on the cursor, we set the mark. */
|
||||||
/* The character they clicked on. */
|
size_t xcur;
|
||||||
|
/* The character they clicked on. */
|
||||||
|
|
||||||
/* Subtract out size of topwin. Perhaps we need a constant
|
/* Subtract out size of topwin. Perhaps we need a constant
|
||||||
* somewhere? */
|
somewhere? */
|
||||||
mevent.y -= 2;
|
mouse_y -= 2;
|
||||||
|
|
||||||
sameline = mevent.y == current_y;
|
sameline = (mouse_y == current_y);
|
||||||
|
|
||||||
/* Move to where the click occurred. */
|
/* Move to where the click occurred. */
|
||||||
for (; current_y < mevent.y && current->next != NULL; current_y++)
|
for (; current_y < mouse_y && current->next != NULL; current_y++)
|
||||||
current = current->next;
|
current = current->next;
|
||||||
for (; current_y > mevent.y && current->prev != NULL; current_y--)
|
for (; current_y > mouse_y && current->prev != NULL; current_y--)
|
||||||
current = current->prev;
|
current = current->prev;
|
||||||
|
|
||||||
xcur = actual_x(current->data, get_page_start(xplustabs()) + mevent.x);
|
xcur = actual_x(current->data, get_page_start(xplustabs()) +
|
||||||
|
mouse_x);
|
||||||
|
|
||||||
/* Selecting where the cursor is toggles the mark. As does
|
/* Selecting where the cursor is toggles the mark. As does
|
||||||
selecting beyond the line length with the cursor at the end of
|
selecting beyond the line length with the cursor at the
|
||||||
the line. */
|
end of the line. */
|
||||||
if (sameline && xcur == current_x) {
|
if (sameline && xcur == current_x) {
|
||||||
if (ISSET(VIEW_MODE)) {
|
if (ISSET(VIEW_MODE)) {
|
||||||
print_view_warning();
|
print_view_warning();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
do_mark();
|
||||||
}
|
}
|
||||||
do_mark();
|
|
||||||
|
current_x = xcur;
|
||||||
|
placewewant = xplustabs();
|
||||||
|
edit_refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
current_x = xcur;
|
|
||||||
placewewant = xplustabs();
|
|
||||||
edit_refresh();
|
|
||||||
} else if (wenclose(bottomwin, mevent.y, mevent.x) && !ISSET(NO_HELP)) {
|
|
||||||
int i, k;
|
|
||||||
|
|
||||||
if (currshortcut == main_list)
|
|
||||||
currslen = MAIN_VISIBLE;
|
|
||||||
else
|
|
||||||
currslen = length_of_list(currshortcut);
|
|
||||||
|
|
||||||
if (currslen < 2)
|
|
||||||
k = COLS / 6;
|
|
||||||
else
|
|
||||||
k = COLS / ((currslen + (currslen %2)) / 2);
|
|
||||||
|
|
||||||
/* Determine what shortcut list was clicked */
|
|
||||||
mevent.y -= (editwinrows + 3);
|
|
||||||
|
|
||||||
if (mevent.y < 0) /* They clicked on the statusbar */
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Don't select stuff beyond list length */
|
|
||||||
if (mevent.x / k >= currslen)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; i < (mevent.x / k) * 2 + mevent.y; i++)
|
|
||||||
s = s->next;
|
|
||||||
|
|
||||||
/* And ungetch that value */
|
|
||||||
ungetch(s->val);
|
|
||||||
|
|
||||||
/* And if it's an alt-key sequence, we should probably send alt
|
|
||||||
too ;-) */
|
|
||||||
if (s->val >= 'a' && s->val <= 'z')
|
|
||||||
ungetch(27);
|
|
||||||
}
|
}
|
||||||
|
/* FIXME: If we clicked on a location in the statusbar, the cursor
|
||||||
|
should move to the location we clicked on. */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The user typed a printable character; add it to the edit buffer. */
|
/* The user typed a character; add it to the edit buffer. */
|
||||||
void do_char(char ch)
|
void do_char(char ch)
|
||||||
{
|
{
|
||||||
size_t current_len = strlen(current->data);
|
size_t current_len = strlen(current->data);
|
||||||
|
@ -980,25 +953,33 @@ void do_char(char ch)
|
||||||
* update_line()? */
|
* update_line()? */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* magic-line: when a character is inserted on the current magic line,
|
if (ch == '\0') /* Null to newline, if needed. */
|
||||||
* it means we need a new one! */
|
ch = '\n';
|
||||||
if (filebot == current && current->data[0] == '\0') {
|
else if (ch == '\n') { /* Newline to Enter, if needed. */
|
||||||
|
do_enter();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(current != NULL && current->data != NULL);
|
||||||
|
|
||||||
|
/* When a character is inserted on the current magicline, it means
|
||||||
|
* we need a new one! */
|
||||||
|
if (filebot == current) {
|
||||||
new_magicline();
|
new_magicline();
|
||||||
fix_editbot();
|
fix_editbot();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* more dangerousness fun =) */
|
/* More dangerousness fun =) */
|
||||||
current->data = charealloc(current->data, current_len + 2);
|
current->data = charealloc(current->data, current_len + 2);
|
||||||
assert(current_x <= current_len);
|
assert(current_x <= current_len);
|
||||||
charmove(¤t->data[current_x + 1],
|
charmove(¤t->data[current_x + 1], ¤t->data[current_x],
|
||||||
¤t->data[current_x],
|
current_len - current_x + 1);
|
||||||
current_len - current_x + 1);
|
|
||||||
current->data[current_x] = ch;
|
current->data[current_x] = ch;
|
||||||
totsize++;
|
totsize++;
|
||||||
set_modified();
|
set_modified();
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
/* note that current_x has not yet been incremented */
|
/* Note that current_x has not yet been incremented. */
|
||||||
if (current == mark_beginbuf && current_x < mark_beginx)
|
if (current == mark_beginbuf && current_x < mark_beginx)
|
||||||
mark_beginx++;
|
mark_beginx++;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1020,6 +1001,48 @@ void do_char(char ch)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int do_verbatim_input(void)
|
||||||
|
{
|
||||||
|
char *verbatim_kbinput; /* Used to hold verbatim input */
|
||||||
|
int verbatim_len; /* Length of verbatim input */
|
||||||
|
int old_preserve = ISSET(PRESERVE), old_suspend = ISSET(SUSPEND);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Turn off Ctrl-Q (XON), Ctrl-S (XOFF), and Ctrl-Z (suspend) if
|
||||||
|
* they're on, so that we can use them to insert ^Q, ^S, and ^Z
|
||||||
|
* verbatim. */
|
||||||
|
if (old_preserve)
|
||||||
|
UNSET(PRESERVE);
|
||||||
|
if (old_suspend)
|
||||||
|
UNSET(SUSPEND);
|
||||||
|
if (old_preserve || old_suspend)
|
||||||
|
signal_init();
|
||||||
|
|
||||||
|
statusbar(_("Verbatim input"));
|
||||||
|
verbatim_kbinput = get_verbatim_kbinput(edit, &verbatim_len);
|
||||||
|
|
||||||
|
/* Turn on DISABLE_CURPOS while inserting character(s) and turn it
|
||||||
|
* off afterwards, so that if constant cursor position display is
|
||||||
|
* on, it will be updated properly. */
|
||||||
|
SET(DISABLE_CURPOS);
|
||||||
|
for (i = 0; i < verbatim_len; i++)
|
||||||
|
do_char(verbatim_kbinput[i]);
|
||||||
|
UNSET(DISABLE_CURPOS);
|
||||||
|
|
||||||
|
free(verbatim_kbinput);
|
||||||
|
|
||||||
|
/* Turn Ctrl-Q, Ctrl-S, and Ctrl-Z back on if they were on
|
||||||
|
* before. */
|
||||||
|
if (old_preserve)
|
||||||
|
SET(PRESERVE);
|
||||||
|
if (old_suspend)
|
||||||
|
SET(SUSPEND);
|
||||||
|
if (old_preserve || old_suspend)
|
||||||
|
signal_init();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int do_backspace(void)
|
int do_backspace(void)
|
||||||
{
|
{
|
||||||
if (current != fileage || current_x > 0) {
|
if (current != fileage || current_x > 0) {
|
||||||
|
@ -2876,7 +2899,7 @@ RETSIGTYPE do_cont(int signal)
|
||||||
doupdate();
|
doupdate();
|
||||||
|
|
||||||
/* The Hurd seems to need this, otherwise a ^Y after a ^Z will
|
/* The Hurd seems to need this, otherwise a ^Y after a ^Z will
|
||||||
start suspending again. */
|
start suspending again. */
|
||||||
signal_init();
|
signal_init();
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
|
@ -3497,65 +3520,10 @@ int main(int argc, char *argv[])
|
||||||
fprintf(stderr, "AHA! %c (%d)\n", kbinput, kbinput);
|
fprintf(stderr, "AHA! %c (%d)\n", kbinput, kbinput);
|
||||||
#endif
|
#endif
|
||||||
if (meta == 1) {
|
if (meta == 1) {
|
||||||
switch (kbinput) {
|
/* Check for the altkey and misc defs... */
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
for (s = main_list; s != NULL; s = s->next)
|
||||||
case NANO_OPENPREV_KEY:
|
if ((s->altval > 0 && kbinput == s->altval) ||
|
||||||
case NANO_OPENPREV_ALTKEY:
|
(s->misc > 0 && kbinput == s->misc)) {
|
||||||
open_prevfile_void();
|
|
||||||
keyhandled = 1;
|
|
||||||
break;
|
|
||||||
case NANO_OPENNEXT_KEY:
|
|
||||||
case NANO_OPENNEXT_ALTKEY:
|
|
||||||
open_nextfile_void();
|
|
||||||
keyhandled = 1;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
/* Check for the altkey defs.... */
|
|
||||||
for (s = main_list; s != NULL; s = s->next)
|
|
||||||
if (kbinput == s->altval || (kbinput >= 'A' &&
|
|
||||||
kbinput <= 'Z' && kbinput == s->altval - 32)) {
|
|
||||||
if (ISSET(VIEW_MODE) && !s->viewok)
|
|
||||||
print_view_warning();
|
|
||||||
else {
|
|
||||||
if (s->func != do_cut_text)
|
|
||||||
UNSET(KEEP_CUTBUFFER);
|
|
||||||
s->func();
|
|
||||||
}
|
|
||||||
keyhandled = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#ifndef NANO_SMALL
|
|
||||||
if (!keyhandled)
|
|
||||||
/* And for toggle switches */
|
|
||||||
for (t = toggles; t != NULL; t = t->next)
|
|
||||||
if (kbinput == t->val || (t->val >= 'a' &&
|
|
||||||
t->val <= 'z' && kbinput == t->val - 32)) {
|
|
||||||
UNSET(KEEP_CUTBUFFER);
|
|
||||||
do_toggle(t);
|
|
||||||
keyhandled = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef DEBUG
|
|
||||||
fprintf(stderr, "I got Alt-%c! (%d)\n", kbinput,
|
|
||||||
kbinput);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Look through the main shortcut list to see if we've hit a
|
|
||||||
shortcut key */
|
|
||||||
|
|
||||||
if (!keyhandled)
|
|
||||||
#if !defined(DISABLE_BROWSER) || !defined (DISABLE_HELP) || !defined(DISABLE_MOUSE)
|
|
||||||
for (s = currshortcut; s != NULL && !keyhandled; s = s->next) {
|
|
||||||
#else
|
|
||||||
for (s = main_list; s != NULL && !keyhandled; s = s->next) {
|
|
||||||
#endif
|
|
||||||
if (kbinput == s->val ||
|
|
||||||
(s->misc1 && kbinput == s->misc1) ||
|
|
||||||
(s->misc2 && kbinput == s->misc2)) {
|
|
||||||
if (ISSET(VIEW_MODE) && !s->viewok)
|
if (ISSET(VIEW_MODE) && !s->viewok)
|
||||||
print_view_warning();
|
print_view_warning();
|
||||||
else {
|
else {
|
||||||
|
@ -3564,10 +3532,44 @@ int main(int argc, char *argv[])
|
||||||
s->func();
|
s->func();
|
||||||
}
|
}
|
||||||
keyhandled = 1;
|
keyhandled = 1;
|
||||||
/* Rarely, the value of s can change after
|
}
|
||||||
s->func(), leading to problems; get around this
|
#ifndef NANO_SMALL
|
||||||
by breaking out explicitly once we successfully
|
if (!keyhandled)
|
||||||
handle a shortcut */
|
/* And for toggle switches */
|
||||||
|
for (t = toggles; t != NULL; t = t->next)
|
||||||
|
if (kbinput == t->val) {
|
||||||
|
UNSET(KEEP_CUTBUFFER);
|
||||||
|
do_toggle(t);
|
||||||
|
keyhandled = 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr, "I got Alt-%c! (%d)\n", kbinput,
|
||||||
|
kbinput);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Look through the main shortcut list to see if we've hit a
|
||||||
|
shortcut key or function key */
|
||||||
|
|
||||||
|
if (!keyhandled)
|
||||||
|
#if !defined(DISABLE_BROWSER) || !defined (DISABLE_HELP) || !defined(DISABLE_MOUSE)
|
||||||
|
for (s = currshortcut; s != NULL && !keyhandled; s = s->next) {
|
||||||
|
#else
|
||||||
|
for (s = main_list; s != NULL && !keyhandled; s = s->next) {
|
||||||
|
#endif
|
||||||
|
if ((s->val >= 0 && kbinput == s->val) ||
|
||||||
|
(s->func_key > 0 && kbinput == s->func_key)) {
|
||||||
|
if (ISSET(VIEW_MODE) && !s->viewok)
|
||||||
|
print_view_warning();
|
||||||
|
else {
|
||||||
|
if (s->func != do_cut_text)
|
||||||
|
UNSET(KEEP_CUTBUFFER);
|
||||||
|
s->func();
|
||||||
|
}
|
||||||
|
keyhandled = 1;
|
||||||
|
/* Break out explicitly once we successfully handle
|
||||||
|
a shortcut */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3607,6 +3609,7 @@ int main(int argc, char *argv[])
|
||||||
* have been handled before we
|
* have been handled before we
|
||||||
* got here */
|
* got here */
|
||||||
case NANO_CONTROL_5: /* Ctrl-] */
|
case NANO_CONTROL_5: /* Ctrl-] */
|
||||||
|
case NANO_CONTROL_8: /* Ctrl-? (Delete) */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
30
src/nano.h
30
src/nano.h
|
@ -112,12 +112,14 @@
|
||||||
#define KEY_SUSPEND -5
|
#define KEY_SUSPEND -5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Snatch these out of the ncurses defs, so we can use them in search
|
/* Non-ncurses may not support KEY_UP and KEY_DOWN */
|
||||||
history regardless of whether we're using ncurses or not */
|
#ifndef KEY_UP
|
||||||
#if !defined(KEY_UP) || !defined(KEY_DOWN)
|
#define KEY_UP -6
|
||||||
#define KEY_UP 0403
|
#endif
|
||||||
#define KEY_DOWN 0402
|
|
||||||
#endif /* !KEY_UP || !KEY_DOWN */
|
#ifndef KEY_DOWN
|
||||||
|
#define KEY_DOWN -7
|
||||||
|
#endif
|
||||||
|
|
||||||
#define VERMSG "GNU nano " VERSION
|
#define VERMSG "GNU nano " VERSION
|
||||||
|
|
||||||
|
@ -166,10 +168,11 @@ typedef struct openfilestruct {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct shortcut {
|
typedef struct shortcut {
|
||||||
int val; /* Actual sequence that generates the keystroke */
|
int val; /* Actual sequence that generates the keystroke,
|
||||||
int altval; /* Alt key # for this function, or 0 for none */
|
or -1 for none */
|
||||||
int misc1; /* Other int functions we want bound */
|
int altval; /* Alt key for this function, or 0 for none */
|
||||||
int misc2;
|
int func_key; /* Function key we want bound */
|
||||||
|
int misc; /* Other Alt key we want bound, or 0 for none */
|
||||||
int viewok; /* is this function legal in view mode? */
|
int viewok; /* is this function legal in view mode? */
|
||||||
int (*func) (void); /* Function to call when we catch this key */
|
int (*func) (void); /* Function to call when we catch this key */
|
||||||
const char *desc; /* Description, e.g. "Page Up" */
|
const char *desc; /* Description, e.g. "Page Up" */
|
||||||
|
@ -339,7 +342,7 @@ typedef struct historyheadtype {
|
||||||
#define NANO_ALT_COMMA ','
|
#define NANO_ALT_COMMA ','
|
||||||
#define NANO_ALT_LCARAT '<'
|
#define NANO_ALT_LCARAT '<'
|
||||||
#define NANO_ALT_RCARAT '>'
|
#define NANO_ALT_RCARAT '>'
|
||||||
#define NANO_ALT_BRACKET ']'
|
#define NANO_ALT_RBRACKET ']'
|
||||||
#define NANO_ALT_SPACE ' '
|
#define NANO_ALT_SPACE ' '
|
||||||
|
|
||||||
/* Some semi-changeable keybindings; don't play with unless you're sure
|
/* Some semi-changeable keybindings; don't play with unless you're sure
|
||||||
|
@ -403,12 +406,13 @@ typedef struct historyheadtype {
|
||||||
#define NANO_OPENNEXT_KEY NANO_ALT_RCARAT
|
#define NANO_OPENNEXT_KEY NANO_ALT_RCARAT
|
||||||
#define NANO_OPENPREV_ALTKEY NANO_ALT_COMMA
|
#define NANO_OPENPREV_ALTKEY NANO_ALT_COMMA
|
||||||
#define NANO_OPENNEXT_ALTKEY NANO_ALT_PERIOD
|
#define NANO_OPENNEXT_ALTKEY NANO_ALT_PERIOD
|
||||||
#define NANO_BRACKET_KEY NANO_ALT_BRACKET
|
#define NANO_BRACKET_KEY NANO_ALT_RBRACKET
|
||||||
#define NANO_EXTCMD_KEY NANO_CONTROL_X
|
#define NANO_EXTCMD_KEY NANO_CONTROL_X
|
||||||
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
|
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
|
||||||
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
|
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
|
||||||
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
|
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
|
||||||
#define NANO_PARAEND_KEY NANO_CONTROL_O
|
#define NANO_PARAEND_KEY NANO_CONTROL_O
|
||||||
|
#define NANO_VERBATIM_KEY NANO_ALT_V
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
/* Toggles do not exist with NANO_SMALL. */
|
/* Toggles do not exist with NANO_SMALL. */
|
||||||
|
@ -422,7 +426,7 @@ typedef struct historyheadtype {
|
||||||
#define TOGGLE_WRAP_KEY NANO_ALT_L
|
#define TOGGLE_WRAP_KEY NANO_ALT_L
|
||||||
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
|
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
|
||||||
#define TOGGLE_CASE_KEY NANO_ALT_C
|
#define TOGGLE_CASE_KEY NANO_ALT_C
|
||||||
#define TOGGLE_LOAD_KEY NANO_ALT_F
|
#define TOGGLE_MULTIBUFFER_KEY NANO_ALT_F
|
||||||
#define TOGGLE_DOS_KEY NANO_ALT_D
|
#define TOGGLE_DOS_KEY NANO_ALT_D
|
||||||
#define TOGGLE_MAC_KEY NANO_ALT_O
|
#define TOGGLE_MAC_KEY NANO_ALT_O
|
||||||
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
|
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
|
||||||
|
|
|
@ -207,7 +207,7 @@ void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
const char *help,
|
const char *help,
|
||||||
#endif
|
#endif
|
||||||
int alt, int misc1, int misc2, int view, int (*func) (void));
|
int alt, int func_key, int misc, int view, int (*func) (void));
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
void toggle_init_one(int val, const char *desc, int flag);
|
void toggle_init_one(int val, const char *desc, int flag);
|
||||||
void toggle_init(void);
|
void toggle_init(void);
|
||||||
|
@ -271,6 +271,7 @@ int open_pipe(const char *command);
|
||||||
void do_mouse(void);
|
void do_mouse(void);
|
||||||
#endif
|
#endif
|
||||||
void do_char(char ch);
|
void do_char(char ch);
|
||||||
|
int do_verbatim_input(void);
|
||||||
int do_backspace(void);
|
int do_backspace(void);
|
||||||
int do_delete(void);
|
int do_delete(void);
|
||||||
int do_tab(void);
|
int do_tab(void);
|
||||||
|
@ -443,6 +444,7 @@ int get_accepted_kbinput(WINDOW *win, int kbinput, int *meta,
|
||||||
int get_ascii_kbinput(WINDOW *win, int kbinput);
|
int get_ascii_kbinput(WINDOW *win, int kbinput);
|
||||||
int get_escape_seq_kbinput(WINDOW *win, int kbinput);
|
int get_escape_seq_kbinput(WINDOW *win, int kbinput);
|
||||||
int get_skip_tilde_kbinput(WINDOW *win, int errval, int retval);
|
int get_skip_tilde_kbinput(WINDOW *win, int errval, int retval);
|
||||||
|
int get_mouseinput(int *mouse_x, int *mouse_y);
|
||||||
int do_first_line(void);
|
int do_first_line(void);
|
||||||
int do_last_line(void);
|
int do_last_line(void);
|
||||||
int xpt(const filestruct *fileptr, int index);
|
int xpt(const filestruct *fileptr, int index);
|
||||||
|
|
95
src/winio.c
95
src/winio.c
|
@ -317,6 +317,86 @@ int get_skip_tilde_kbinput(WINDOW *win, int errval, int retval)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DISABLE_MOUSE
|
||||||
|
/* Check for a mouse event. If it took place on the shortcut list on
|
||||||
|
* the bottom two lines of the screen (assuming that the shortcut list is
|
||||||
|
* visible), figure out which shortcut was clicked and ungetch() the
|
||||||
|
* equivalent keystroke(s), otherwise do nothing. Return 0 if no
|
||||||
|
* keystrokes were ungetch()ed, or 1 if at least one was. Also, return
|
||||||
|
* the screen coordinates where the mouse event took place in *mouse_x
|
||||||
|
* and *mouse_y. Assume that KEY_MOUSE has already been read in. */
|
||||||
|
int get_mouseinput(int *mouse_x, int *mouse_y)
|
||||||
|
{
|
||||||
|
MEVENT mevent;
|
||||||
|
|
||||||
|
*mouse_x = -1;
|
||||||
|
*mouse_y = -1;
|
||||||
|
|
||||||
|
/* First, get the actual mouse event. */
|
||||||
|
if (getmouse(&mevent) == ERR)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Save the screen coordinates where the mouse event took place. */
|
||||||
|
*mouse_x = mevent.x;
|
||||||
|
*mouse_y = mevent.y;
|
||||||
|
|
||||||
|
/* If the current shortcut list is being displayed on the last two
|
||||||
|
* lines of the screen and the mouse event took place inside it,
|
||||||
|
* we need to figure out which shortcut was clicked and ungetch()
|
||||||
|
* the equivalent keystroke(s) for it. */
|
||||||
|
if (!ISSET(NO_HELP) && wenclose(bottomwin, *mouse_y, *mouse_x)) {
|
||||||
|
int i, j;
|
||||||
|
int currslen;
|
||||||
|
/* The number of shortcuts in the current shortcut list. */
|
||||||
|
const shortcut *s = currshortcut;
|
||||||
|
/* The actual shortcut we clicked on, starting at the first
|
||||||
|
* one in the current shortcut list. */
|
||||||
|
|
||||||
|
/* Get the shortcut lists' length. */
|
||||||
|
if (currshortcut == main_list)
|
||||||
|
currslen = MAIN_VISIBLE;
|
||||||
|
else
|
||||||
|
currslen = length_of_list(currshortcut);
|
||||||
|
|
||||||
|
/* Calculate the width of each shortcut in the list (it's the
|
||||||
|
* same for all of them). */
|
||||||
|
if (currslen < 2)
|
||||||
|
i = COLS / 6;
|
||||||
|
else
|
||||||
|
i = COLS / ((currslen / 2) + (currslen % 2));
|
||||||
|
|
||||||
|
/* Calculate the y-coordinates relative to the beginning of
|
||||||
|
* bottomwin, i.e, the bottom three lines of the screen. */
|
||||||
|
j = *mouse_y - (editwinrows + 3);
|
||||||
|
|
||||||
|
/* If we're on the statusbar, beyond the end of the shortcut
|
||||||
|
* list, or beyond the end of a shortcut on the right side of
|
||||||
|
* the screen, don't do anything. */
|
||||||
|
if (j < 0 || (*mouse_x / i) >= currslen)
|
||||||
|
return 0;
|
||||||
|
j = (*mouse_x / i) * 2 + j;
|
||||||
|
if (j >= currslen)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Go through the shortcut list to determine which shortcut was
|
||||||
|
* clicked. */
|
||||||
|
for (; j > 0; j--)
|
||||||
|
s = s->next;
|
||||||
|
|
||||||
|
/* And ungetch() the equivalent keystroke. */
|
||||||
|
ungetch(s->val);
|
||||||
|
|
||||||
|
/* If it's not a control character, assume it's a Meta key
|
||||||
|
* sequence, in which case we need to ungetch() Escape too. */
|
||||||
|
if (!is_cntrl_char(s->val))
|
||||||
|
ungetch(NANO_CONTROL_3);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int do_first_line(void)
|
int do_first_line(void)
|
||||||
{
|
{
|
||||||
current = fileage;
|
current = fileage;
|
||||||
|
@ -605,7 +685,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||||
fprintf(stderr, "Aha! \'%c\' (%d)\n", kbinput, kbinput);
|
fprintf(stderr, "Aha! \'%c\' (%d)\n", kbinput, kbinput);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (kbinput == t->val && (kbinput < 32 || kbinput == 127)) {
|
if (kbinput == t->val && is_cntrl_char(kbinput)) {
|
||||||
|
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
/* Have to do this here, it would be too late to do it
|
/* Have to do this here, it would be too late to do it
|
||||||
|
@ -615,6 +695,11 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
/* Have to handle these here too, for the time being */
|
||||||
|
if (kbinput == NANO_UP_KEY || kbinput == NANO_DOWN_KEY)
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
return t->val;
|
return t->val;
|
||||||
}
|
}
|
||||||
|
@ -787,7 +872,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||||
fprintf(stderr, "Aha! \'%c\' (%d)\n", kbinput,
|
fprintf(stderr, "Aha! \'%c\' (%d)\n", kbinput,
|
||||||
kbinput);
|
kbinput);
|
||||||
#endif
|
#endif
|
||||||
if (meta == 1 && (kbinput == t->val || kbinput == t->val - 32))
|
if (meta == 1 && kbinput == t->val)
|
||||||
/* We hit an Alt key. Do like above. We don't
|
/* We hit an Alt key. Do like above. We don't
|
||||||
just ungetch() the letter and let it get
|
just ungetch() the letter and let it get
|
||||||
caught above cause that screws the
|
caught above cause that screws the
|
||||||
|
@ -795,7 +880,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||||
return t->val;
|
return t->val;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kbinput < 32 || kbinput == 127)
|
if (is_cntrl_char(kbinput))
|
||||||
break;
|
break;
|
||||||
answer = charealloc(answer, xend + 2);
|
answer = charealloc(answer, xend + 2);
|
||||||
charmove(answer + x + 1, answer + x, xend - x + 1);
|
charmove(answer + x + 1, answer + x, xend - x + 1);
|
||||||
|
@ -911,14 +996,14 @@ void bottombars(const shortcut *s)
|
||||||
if (s->val == NANO_CONTROL_SPACE)
|
if (s->val == NANO_CONTROL_SPACE)
|
||||||
strcpy(keystr, "^ ");
|
strcpy(keystr, "^ ");
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
else if (s->val == KEY_UP)
|
else if (s->val == NANO_UP_KEY && s->misc == NANO_DOWN_KEY)
|
||||||
strncpy(keystr, _("Up"), 8);
|
strncpy(keystr, _("Up"), 8);
|
||||||
#endif /* NANO_SMALL */
|
#endif /* NANO_SMALL */
|
||||||
else if (s->val > 0) {
|
else if (s->val > 0) {
|
||||||
if (s->val < 64)
|
if (s->val < 64)
|
||||||
sprintf(keystr, "^%c", s->val + 64);
|
sprintf(keystr, "^%c", s->val + 64);
|
||||||
else
|
else
|
||||||
sprintf(keystr, "M-%c", s->val - 32);
|
sprintf(keystr, "M-%c", toupper(s->val));
|
||||||
} else if (s->altval > 0)
|
} else if (s->altval > 0)
|
||||||
sprintf(keystr, "M-%c", s->altval);
|
sprintf(keystr, "M-%c", s->altval);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue