reorganize the main shortcut list to make it easier for new users, per
Benno Schulenberg's suggestion git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3410 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
d7b804ab6d
commit
1df3e2d0bf
10
ChangeLog
10
ChangeLog
|
@ -78,6 +78,16 @@ CVS code -
|
||||||
(Meta-?). Also, make sure all the equivalent shortcuts in the
|
(Meta-?). Also, make sure all the equivalent shortcuts in the
|
||||||
search, replace, and "Go To Line" lists accept both the meta
|
search, replace, and "Go To Line" lists accept both the meta
|
||||||
keys and the equivalent function keys. (DLR)
|
keys and the equivalent function keys. (DLR)
|
||||||
|
- Reorganize the main shortcut list to make it easier for new
|
||||||
|
users. It now lists the twelve Pico-compatible default
|
||||||
|
operations, followed by search and replace shortcuts, followed
|
||||||
|
by cut and paste shortcuts, followed by marking shortcuts,
|
||||||
|
followed by back and forth movement shortcuts, followed by
|
||||||
|
start and end movement shortcuts, followed by buffer-switching
|
||||||
|
shortcuts, followed by insertion and deletion shortcuts,
|
||||||
|
followed by special movement shortcuts, followed by advanced
|
||||||
|
word and paragraph shortcuts, followed by display shortcuts.
|
||||||
|
(DLR, suggested by Benno Schulenberg)
|
||||||
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"
|
||||||
|
|
572
src/global.c
572
src/global.c
File diff suppressed because it is too large
Load Diff
20
src/help.c
20
src/help.c
|
@ -364,21 +364,21 @@ void help_init(void)
|
||||||
allocsize += strlen(htx[2]);
|
allocsize += strlen(htx[2]);
|
||||||
|
|
||||||
/* The space needed for the shortcut lists, at most COLS characters,
|
/* The space needed for the shortcut lists, at most COLS characters,
|
||||||
* plus '\n'. */
|
* plus one or two '\n's. */
|
||||||
allocsize += (COLS < 24 ? (24 * mb_cur_max()) :
|
allocsize += (COLS < 24 ? (24 * mb_cur_max()) :
|
||||||
((COLS + 1) * mb_cur_max())) * length_of_list(currshortcut);
|
((COLS + 2) * mb_cur_max())) * length_of_list(currshortcut);
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* If we're on the main list, we also count the toggle help text.
|
/* If we're on the main list, we also count the toggle help text.
|
||||||
* Each non-blank entry has "M-%c\t\t\t", which fills 24 columns,
|
* Each non-blank entry has "M-%c\t\t\t", which fills 24 columns,
|
||||||
* plus a space, plus translated text, plus '\n'. Each blank entry
|
* plus a space, plus translated text, plus one or two '\n's. Each
|
||||||
* has just '\n'. */
|
* blank entry has just one or two '\n's. */
|
||||||
if (currshortcut == main_list) {
|
if (currshortcut == main_list) {
|
||||||
size_t endis_len = strlen(_("enable/disable"));
|
size_t endis_len = strlen(_("enable/disable"));
|
||||||
|
|
||||||
for (t = toggles; t != NULL; t = t->next)
|
for (t = toggles; t != NULL; t = t->next)
|
||||||
if (t->val != TOGGLE_NO_KEY)
|
if (t->val != TOGGLE_NO_KEY)
|
||||||
allocsize += strlen(t->desc) + endis_len + 7;
|
allocsize += strlen(t->desc) + endis_len + 8;
|
||||||
allocsize++;
|
allocsize++;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -488,8 +488,6 @@ void help_init(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(s->help != NULL);
|
|
||||||
|
|
||||||
if (COLS > 24) {
|
if (COLS > 24) {
|
||||||
char *help_ptr = display_string(s->help, 0, COLS - 24,
|
char *help_ptr = display_string(s->help, 0, COLS - 24,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
@ -500,18 +498,22 @@ void help_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr += sprintf(ptr, "\n");
|
ptr += sprintf(ptr, "\n");
|
||||||
|
|
||||||
|
if (s->blank_after)
|
||||||
|
ptr += sprintf(ptr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* And the toggles... */
|
/* And the toggles... */
|
||||||
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);
|
|
||||||
|
|
||||||
if (t->val != TOGGLE_NO_KEY)
|
if (t->val != TOGGLE_NO_KEY)
|
||||||
ptr += sprintf(ptr, "M-%c\t\t\t%s %s",
|
ptr += sprintf(ptr, "M-%c\t\t\t%s %s",
|
||||||
toupper(t->val), t->desc, _("enable/disable"));
|
toupper(t->val), t->desc, _("enable/disable"));
|
||||||
ptr += sprintf(ptr, "\n");
|
ptr += sprintf(ptr, "\n");
|
||||||
|
|
||||||
|
if (t->blank_after)
|
||||||
|
ptr += sprintf(ptr, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
30
src/nano.h
30
src/nano.h
|
@ -290,6 +290,15 @@ typedef struct openfilestruct {
|
||||||
} openfilestruct;
|
} openfilestruct;
|
||||||
|
|
||||||
typedef struct shortcut {
|
typedef struct shortcut {
|
||||||
|
const char *desc;
|
||||||
|
/* The function's description, e.g. "Page Up". */
|
||||||
|
#ifndef DISABLE_HELP
|
||||||
|
const char *help;
|
||||||
|
/* The help file entry text for this function. */
|
||||||
|
#endif
|
||||||
|
bool blank_after;
|
||||||
|
/* Whether there should be a blank line after the help entry
|
||||||
|
* text for this function. */
|
||||||
/* Key values that aren't used should be set to NANO_NO_KEY. */
|
/* Key values that aren't used should be set to NANO_NO_KEY. */
|
||||||
int ctrlval;
|
int ctrlval;
|
||||||
/* The special sentinel key or control key we want bound, if
|
/* The special sentinel key or control key we want bound, if
|
||||||
|
@ -304,12 +313,6 @@ typedef struct shortcut {
|
||||||
/* Is this function allowed when in view mode? */
|
/* Is this function allowed when in view mode? */
|
||||||
void (*func)(void);
|
void (*func)(void);
|
||||||
/* The function to call when we get this key. */
|
/* The function to call when we get this key. */
|
||||||
const char *desc;
|
|
||||||
/* The function's description, e.g. "Page Up". */
|
|
||||||
#ifndef DISABLE_HELP
|
|
||||||
const char *help;
|
|
||||||
/* The help file entry text for this function. */
|
|
||||||
#endif
|
|
||||||
struct shortcut *next;
|
struct shortcut *next;
|
||||||
/* Next shortcut. */
|
/* Next shortcut. */
|
||||||
} shortcut;
|
} shortcut;
|
||||||
|
@ -319,8 +322,11 @@ typedef struct toggle {
|
||||||
int val;
|
int val;
|
||||||
/* The sequence to toggle the key. We should only need one. */
|
/* The sequence to toggle the key. We should only need one. */
|
||||||
const char *desc;
|
const char *desc;
|
||||||
/* The description for when the toggle is, uh, toggled, e.g.
|
/* The description of the toggle, e.g. "Cut to end"; we'll
|
||||||
* "Cut to end"; we'll append Enabled or Disabled. */
|
* append Enabled or Disabled to it. */
|
||||||
|
bool blank_after;
|
||||||
|
/* Whether there should be a blank line after the description of
|
||||||
|
* the toggle. */
|
||||||
long flag;
|
long flag;
|
||||||
/* Which flag actually gets toggled. */
|
/* Which flag actually gets toggled. */
|
||||||
struct toggle *next;
|
struct toggle *next;
|
||||||
|
@ -550,11 +556,11 @@ typedef struct rcoption {
|
||||||
#define NANO_CUTTILLEND_KEY NANO_CONTROL_X
|
#define NANO_CUTTILLEND_KEY NANO_CONTROL_X
|
||||||
#define NANO_CUTTILLEND_ALTKEY NANO_ALT_T
|
#define NANO_CUTTILLEND_ALTKEY NANO_ALT_T
|
||||||
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
|
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
|
||||||
#define NANO_PARABEGIN_ALTKEY1 NANO_ALT_LPAREN
|
#define NANO_PARABEGIN_ALTKEY NANO_ALT_LPAREN
|
||||||
#define NANO_PARABEGIN_ALTKEY2 NANO_ALT_9
|
#define NANO_PARABEGIN_ALTKEY NANO_ALT_9
|
||||||
#define NANO_PARAEND_KEY NANO_CONTROL_O
|
#define NANO_PARAEND_KEY NANO_CONTROL_O
|
||||||
#define NANO_PARAEND_ALTKEY1 NANO_ALT_RPAREN
|
#define NANO_PARAEND_ALTKEY NANO_ALT_RPAREN
|
||||||
#define NANO_PARAEND_ALTKEY2 NANO_ALT_0
|
#define NANO_PARAEND_ALTKEY NANO_ALT_0
|
||||||
#define NANO_FULLJUSTIFY_KEY NANO_CONTROL_U
|
#define NANO_FULLJUSTIFY_KEY NANO_CONTROL_U
|
||||||
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
|
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
|
||||||
#define NANO_VERBATIM_KEY NANO_ALT_V
|
#define NANO_VERBATIM_KEY NANO_ALT_V
|
||||||
|
|
|
@ -327,15 +327,16 @@ void save_history(void);
|
||||||
/* Public functions in global.c. */
|
/* Public functions in global.c. */
|
||||||
size_t length_of_list(const shortcut *s);
|
size_t length_of_list(const shortcut *s);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
void toggle_init_one(int val, const char *desc, long flag);
|
void toggle_init_one(int val, const char *desc, bool blank_after, long
|
||||||
|
flag);
|
||||||
void toggle_init(void);
|
void toggle_init(void);
|
||||||
#endif
|
#endif
|
||||||
void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
const char *help,
|
const char *help,
|
||||||
#endif
|
#endif
|
||||||
int metaval, int funcval, int miscval, bool view, void
|
bool blank_after, int metaval, int funcval, int miscval, bool
|
||||||
(*func)(void));
|
view, void (*func)(void));
|
||||||
void shortcut_init(bool unjustify);
|
void shortcut_init(bool unjustify);
|
||||||
void free_shortcutage(shortcut **shortcutage);
|
void free_shortcutage(shortcut **shortcutage);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
|
@ -1713,11 +1713,7 @@ const toggle *get_toggle(int kbinput, bool meta_key)
|
||||||
for (; t != NULL; t = t->next) {
|
for (; t != NULL; t = t->next) {
|
||||||
/* We've found a toggle if the key exists, meta_key is TRUE, and
|
/* We've found a toggle if the key exists, meta_key is TRUE, and
|
||||||
* the key is in the meta key toggle list. */
|
* the key is in the meta key toggle list. */
|
||||||
if (
|
if (t->val != TOGGLE_NO_KEY && meta_key && kbinput == t->val)
|
||||||
#ifndef DISABLE_HELP
|
|
||||||
t->val != TOGGLE_NO_KEY &&
|
|
||||||
#endif
|
|
||||||
meta_key && kbinput == t->val)
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue