mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 12:51:23 +03:00
reorganize the global toggle list to make it easier for new users, per
Benno Schulenberg's suggestion git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3404 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
4879660c9a
commit
e313f5b2c8
14
ChangeLog
14
ChangeLog
@ -44,10 +44,11 @@ CVS code -
|
||||
width isn't a clean multiple of the column width. Changes to
|
||||
do_mouseinput() and bottombars(). (Benno Schulenberg, minor
|
||||
tweaks by DLR)
|
||||
- Add several blank entries to the main shortcut list, in order
|
||||
to make its help text easier to read. Changes to
|
||||
sc_init_one() and shortcut_init(). (DLR, suggested by Benno
|
||||
Schulenberg)
|
||||
- Add several blank entries to the main shortcut list and the
|
||||
global toggle list, in order to make the help text easier to
|
||||
read. Changes to sc_init_one(), toggle_init(),
|
||||
toggle_init_one(), shortcut_init(), get_toggle(), and
|
||||
help_init(). (DLR, suggested by Benno Schulenberg)
|
||||
- files.c:
|
||||
open_file()
|
||||
- Remove redundant wording in the error message when we try to
|
||||
@ -76,6 +77,11 @@ CVS code -
|
||||
- In the global toggle list, move the "Constant cursor position
|
||||
display" toggle up to after the "Use more space for editing"
|
||||
toggle, for consistency. (DLR)
|
||||
- Reorganize the global toggle list to make it easier for new
|
||||
users. It now lists toggles that affect the way things are
|
||||
displayed, followed by toggles that affect editing, followed
|
||||
by toggles that have to do with peripheral things. (DLR,
|
||||
suggested by Benno Schulenberg)
|
||||
- nano.c:
|
||||
renumber()
|
||||
- Remove invalid assert. (DLR, found by Filipe Moreira)
|
||||
|
93
src/global.c
93
src/global.c
@ -1196,7 +1196,7 @@ void toggle_init_one(int val, const char *desc, long flag)
|
||||
}
|
||||
|
||||
u->val = val;
|
||||
u->desc = _(desc);
|
||||
u->desc = (desc == NULL) ? "" : _(desc);
|
||||
u->flag = flag;
|
||||
u->next = NULL;
|
||||
}
|
||||
@ -1210,10 +1210,56 @@ void toggle_init(void)
|
||||
return;
|
||||
|
||||
toggle_init_one(TOGGLE_NOHELP_KEY, N_("Help mode"), NO_HELP);
|
||||
toggle_init_one(TOGGLE_MORESPACE_KEY,
|
||||
N_("Use of more space for editing"), MORE_SPACE);
|
||||
|
||||
toggle_init_one(TOGGLE_CONST_KEY,
|
||||
N_("Constant cursor position display"), CONST_UPDATE);
|
||||
|
||||
toggle_init_one(TOGGLE_MORESPACE_KEY,
|
||||
N_("Use of more space for editing"), MORE_SPACE);
|
||||
|
||||
toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"),
|
||||
SMOOTH_SCROLL);
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
toggle_init_one(TOGGLE_WHITESPACE_KEY, N_("Whitespace display"),
|
||||
WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
toggle_init_one(TOGGLE_SYNTAX_KEY, N_("Color syntax highlighting"),
|
||||
NO_COLOR_SYNTAX);
|
||||
#endif
|
||||
|
||||
/* This entry is blank, in order to make the help text easier to
|
||||
* read. */
|
||||
toggle_init_one(TOGGLE_NO_KEY, NULL, 0);
|
||||
|
||||
toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"),
|
||||
SMART_HOME);
|
||||
|
||||
toggle_init_one(TOGGLE_AUTOINDENT_KEY, N_("Auto indent"),
|
||||
AUTOINDENT);
|
||||
|
||||
toggle_init_one(TOGGLE_CUTTOEND_KEY, N_("Cut to end"), CUT_TO_END);
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
toggle_init_one(TOGGLE_WRAP_KEY, N_("Long line wrapping"),
|
||||
NO_WRAP);
|
||||
#endif
|
||||
|
||||
toggle_init_one(TOGGLE_TABSTOSPACES_KEY,
|
||||
N_("Conversion of typed tabs to spaces"), TABS_TO_SPACES);
|
||||
|
||||
/* This entry is blank, in order to make the help text easier to
|
||||
* read. */
|
||||
toggle_init_one(TOGGLE_NO_KEY, NULL, 0);
|
||||
|
||||
/* If we're using restricted mode, the backup toggle is disabled.
|
||||
* It's useless since backups are disabled. */
|
||||
if (!ISSET(RESTRICTED))
|
||||
toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"),
|
||||
BACKUP_FILE);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* If we're using restricted mode, the multibuffer toggle is
|
||||
* disabled. It's useless since inserting files is disabled. */
|
||||
@ -1221,44 +1267,21 @@ void toggle_init(void)
|
||||
toggle_init_one(TOGGLE_MULTIBUFFER_KEY,
|
||||
N_("Multiple file buffers"), MULTIBUFFER);
|
||||
#endif
|
||||
toggle_init_one(TOGGLE_CUTTOEND_KEY, N_("Cut to end"), CUT_TO_END);
|
||||
#ifndef DISABLE_WRAPPING
|
||||
toggle_init_one(TOGGLE_WRAP_KEY, N_("Long line wrapping"),
|
||||
NO_WRAP);
|
||||
#endif
|
||||
#ifndef DISABLE_MOUSE
|
||||
toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), USE_MOUSE);
|
||||
#endif
|
||||
/* If we're using restricted mode, the suspend toggle is disabled.
|
||||
* It's useless since suspending is disabled. */
|
||||
if (!ISSET(RESTRICTED))
|
||||
toggle_init_one(TOGGLE_SUSPEND_KEY, N_("Suspend"), SUSPEND);
|
||||
toggle_init_one(TOGGLE_AUTOINDENT_KEY, N_("Auto indent"),
|
||||
AUTOINDENT);
|
||||
toggle_init_one(TOGGLE_TABSTOSPACES_KEY,
|
||||
N_("Conversion of typed tabs to spaces"), TABS_TO_SPACES);
|
||||
|
||||
/* If we're using restricted mode, the DOS/Mac conversion toggle is
|
||||
* disabled. It's useless since inserting files is disabled. */
|
||||
if (!ISSET(RESTRICTED))
|
||||
toggle_init_one(TOGGLE_NOCONVERT_KEY,
|
||||
N_("No conversion from DOS/Mac format"), NO_CONVERT);
|
||||
/* If we're using restricted mode, the backup toggle is disabled.
|
||||
* It's useless since backups are disabled. */
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), USE_MOUSE);
|
||||
#endif
|
||||
|
||||
/* If we're using restricted mode, the suspend toggle is disabled.
|
||||
* It's useless since suspending is disabled. */
|
||||
if (!ISSET(RESTRICTED))
|
||||
toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"),
|
||||
BACKUP_FILE);
|
||||
toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"),
|
||||
SMOOTH_SCROLL);
|
||||
toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"),
|
||||
SMART_HOME);
|
||||
#ifdef ENABLE_COLOR
|
||||
toggle_init_one(TOGGLE_SYNTAX_KEY, N_("Color syntax highlighting"),
|
||||
NO_COLOR_SYNTAX);
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
toggle_init_one(TOGGLE_WHITESPACE_KEY, N_("Whitespace display"),
|
||||
WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
toggle_init_one(TOGGLE_SUSPEND_KEY, N_("Suspend"), SUSPEND);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
|
28
src/help.c
28
src/help.c
@ -371,13 +371,16 @@ void help_init(void)
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If we're on the main list, we also count the toggle help text.
|
||||
* Each line has "M-%c\t\t\t", which fills 24 columns, plus a space,
|
||||
* plus translated text, plus '\n'. */
|
||||
* 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'. */
|
||||
if (currshortcut == main_list) {
|
||||
size_t endis_len = strlen(_("enable/disable"));
|
||||
|
||||
for (t = toggles; t != NULL; t = t->next)
|
||||
allocsize += 8 + strlen(t->desc) + endis_len;
|
||||
if (t->val != TOGGLE_NO_KEY)
|
||||
allocsize += strlen(t->desc) + endis_len + 7;
|
||||
allocsize++;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -475,10 +478,15 @@ void help_init(void)
|
||||
*(ptr++) = '\t';
|
||||
}
|
||||
|
||||
/* Make sure all the help text starts at the same place. */
|
||||
while (entries < 3) {
|
||||
entries++;
|
||||
*(ptr++) = '\t';
|
||||
/* If this entry isn't blank, make sure all the help text starts
|
||||
* at the same place. */
|
||||
if (s->ctrlval != NANO_NO_KEY || s->funcval != NANO_NO_KEY ||
|
||||
s->metaval != NANO_NO_KEY || s->miscval !=
|
||||
NANO_NO_KEY) {
|
||||
while (entries < 3) {
|
||||
entries++;
|
||||
*(ptr++) = '\t';
|
||||
}
|
||||
}
|
||||
|
||||
assert(s->help != NULL);
|
||||
@ -501,8 +509,10 @@ void help_init(void)
|
||||
for (t = toggles; t != NULL; t = t->next) {
|
||||
assert(t->desc != NULL);
|
||||
|
||||
ptr += sprintf(ptr, "M-%c\t\t\t%s %s\n", toupper(t->val),
|
||||
t->desc, _("enable/disable"));
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,8 +547,13 @@ typedef struct rcoption {
|
||||
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
|
||||
#define NANO_VERBATIM_KEY NANO_ALT_V
|
||||
|
||||
/* Toggles do not exist if NANO_TINY is defined. */
|
||||
#ifndef NANO_TINY
|
||||
/* Toggles do not exist with NANO_TINY. */
|
||||
|
||||
/* No toggle at all. */
|
||||
#define TOGGLE_NO_KEY -2
|
||||
|
||||
/* Normal toggles. */
|
||||
#define TOGGLE_CONST_KEY NANO_ALT_C
|
||||
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
|
||||
#define TOGGLE_SUSPEND_KEY NANO_ALT_Z
|
||||
|
@ -1711,9 +1711,9 @@ const toggle *get_toggle(int kbinput, bool meta_key)
|
||||
|
||||
/* Check for toggles. */
|
||||
for (; t != NULL; t = t->next) {
|
||||
/* We've found a toggle if meta_key is TRUE and the key is in
|
||||
* the meta key toggle list. */
|
||||
if (meta_key && kbinput == t->val)
|
||||
/* We've found a toggle if the key exists, meta_key is TRUE, and
|
||||
* the key is in the meta key toggle list. */
|
||||
if (t->val != TOGGLE_NO_KEY && meta_key && kbinput == t->val)
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user