mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-25 14:20:46 +03:00
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-d3aeb78583b8
This commit is contained in:
parent
d7b804ab6d
commit
1df3e2d0bf
10
ChangeLog
10
ChangeLog
@ -78,6 +78,16 @@ CVS code -
|
||||
(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)
|
||||
- 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()
|
||||
- In the global toggle list, move the "Constant cursor position
|
||||
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]);
|
||||
|
||||
/* 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()) :
|
||||
((COLS + 1) * mb_cur_max())) * length_of_list(currshortcut);
|
||||
((COLS + 2) * mb_cur_max())) * length_of_list(currshortcut);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* 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,
|
||||
* plus a space, plus translated text, plus '\n'. Each blank entry
|
||||
* has just '\n'. */
|
||||
* plus a space, plus translated text, plus one or two '\n's. Each
|
||||
* blank entry has just one or two '\n's. */
|
||||
if (currshortcut == main_list) {
|
||||
size_t endis_len = strlen(_("enable/disable"));
|
||||
|
||||
for (t = toggles; t != NULL; t = t->next)
|
||||
if (t->val != TOGGLE_NO_KEY)
|
||||
allocsize += strlen(t->desc) + endis_len + 7;
|
||||
allocsize += strlen(t->desc) + endis_len + 8;
|
||||
allocsize++;
|
||||
}
|
||||
#endif
|
||||
@ -488,8 +488,6 @@ void help_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
assert(s->help != NULL);
|
||||
|
||||
if (COLS > 24) {
|
||||
char *help_ptr = display_string(s->help, 0, COLS - 24,
|
||||
FALSE);
|
||||
@ -500,18 +498,22 @@ void help_init(void)
|
||||
}
|
||||
|
||||
ptr += sprintf(ptr, "\n");
|
||||
|
||||
if (s->blank_after)
|
||||
ptr += sprintf(ptr, "\n");
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* And the toggles... */
|
||||
if (currshortcut == main_list) {
|
||||
for (t = toggles; t != NULL; t = t->next) {
|
||||
assert(t->desc != NULL);
|
||||
|
||||
if (t->val != TOGGLE_NO_KEY)
|
||||
ptr += sprintf(ptr, "M-%c\t\t\t%s %s",
|
||||
toupper(t->val), t->desc, _("enable/disable"));
|
||||
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;
|
||||
|
||||
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. */
|
||||
int ctrlval;
|
||||
/* 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? */
|
||||
void (*func)(void);
|
||||
/* 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;
|
||||
/* Next shortcut. */
|
||||
} shortcut;
|
||||
@ -319,8 +322,11 @@ typedef struct toggle {
|
||||
int val;
|
||||
/* The sequence to toggle the key. We should only need one. */
|
||||
const char *desc;
|
||||
/* The description for when the toggle is, uh, toggled, e.g.
|
||||
* "Cut to end"; we'll append Enabled or Disabled. */
|
||||
/* The description of the toggle, e.g. "Cut to end"; we'll
|
||||
* append Enabled or Disabled to it. */
|
||||
bool blank_after;
|
||||
/* Whether there should be a blank line after the description of
|
||||
* the toggle. */
|
||||
long flag;
|
||||
/* Which flag actually gets toggled. */
|
||||
struct toggle *next;
|
||||
@ -550,11 +556,11 @@ typedef struct rcoption {
|
||||
#define NANO_CUTTILLEND_KEY NANO_CONTROL_X
|
||||
#define NANO_CUTTILLEND_ALTKEY NANO_ALT_T
|
||||
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
|
||||
#define NANO_PARABEGIN_ALTKEY1 NANO_ALT_LPAREN
|
||||
#define NANO_PARABEGIN_ALTKEY2 NANO_ALT_9
|
||||
#define NANO_PARABEGIN_ALTKEY NANO_ALT_LPAREN
|
||||
#define NANO_PARABEGIN_ALTKEY NANO_ALT_9
|
||||
#define NANO_PARAEND_KEY NANO_CONTROL_O
|
||||
#define NANO_PARAEND_ALTKEY1 NANO_ALT_RPAREN
|
||||
#define NANO_PARAEND_ALTKEY2 NANO_ALT_0
|
||||
#define NANO_PARAEND_ALTKEY NANO_ALT_RPAREN
|
||||
#define NANO_PARAEND_ALTKEY NANO_ALT_0
|
||||
#define NANO_FULLJUSTIFY_KEY NANO_CONTROL_U
|
||||
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
|
||||
#define NANO_VERBATIM_KEY NANO_ALT_V
|
||||
|
@ -327,15 +327,16 @@ void save_history(void);
|
||||
/* Public functions in global.c. */
|
||||
size_t length_of_list(const shortcut *s);
|
||||
#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);
|
||||
#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
|
||||
const char *help,
|
||||
#endif
|
||||
int metaval, int funcval, int miscval, bool view, void
|
||||
(*func)(void));
|
||||
bool blank_after, int metaval, int funcval, int miscval, bool
|
||||
view, void (*func)(void));
|
||||
void shortcut_init(bool unjustify);
|
||||
void free_shortcutage(shortcut **shortcutage);
|
||||
#ifdef DEBUG
|
||||
|
@ -1713,11 +1713,7 @@ const toggle *get_toggle(int kbinput, bool meta_key)
|
||||
for (; t != NULL; t = t->next) {
|
||||
/* We've found a toggle if the key exists, meta_key is TRUE, and
|
||||
* the key is in the meta key toggle list. */
|
||||
if (
|
||||
#ifndef DISABLE_HELP
|
||||
t->val != TOGGLE_NO_KEY &&
|
||||
#endif
|
||||
meta_key && kbinput == t->val)
|
||||
if (t->val != TOGGLE_NO_KEY && meta_key && kbinput == t->val)
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user