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-d3aeb78583b8master
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
|
width isn't a clean multiple of the column width. Changes to
|
||||||
do_mouseinput() and bottombars(). (Benno Schulenberg, minor
|
do_mouseinput() and bottombars(). (Benno Schulenberg, minor
|
||||||
tweaks by DLR)
|
tweaks by DLR)
|
||||||
- Add several blank entries to the main shortcut list, in order
|
- Add several blank entries to the main shortcut list and the
|
||||||
to make its help text easier to read. Changes to
|
global toggle list, in order to make the help text easier to
|
||||||
sc_init_one() and shortcut_init(). (DLR, suggested by Benno
|
read. Changes to sc_init_one(), toggle_init(),
|
||||||
Schulenberg)
|
toggle_init_one(), shortcut_init(), get_toggle(), and
|
||||||
|
help_init(). (DLR, suggested by Benno Schulenberg)
|
||||||
- files.c:
|
- files.c:
|
||||||
open_file()
|
open_file()
|
||||||
- Remove redundant wording in the error message when we try to
|
- 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
|
- 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"
|
||||||
toggle, for consistency. (DLR)
|
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:
|
- nano.c:
|
||||||
renumber()
|
renumber()
|
||||||
- Remove invalid assert. (DLR, found by Filipe Moreira)
|
- 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->val = val;
|
||||||
u->desc = _(desc);
|
u->desc = (desc == NULL) ? "" : _(desc);
|
||||||
u->flag = flag;
|
u->flag = flag;
|
||||||
u->next = NULL;
|
u->next = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1210,10 +1210,56 @@ void toggle_init(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
toggle_init_one(TOGGLE_NOHELP_KEY, N_("Help mode"), NO_HELP);
|
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,
|
toggle_init_one(TOGGLE_CONST_KEY,
|
||||||
N_("Constant cursor position display"), CONST_UPDATE);
|
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
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
/* If we're using restricted mode, the multibuffer toggle is
|
/* If we're using restricted mode, the multibuffer toggle is
|
||||||
* disabled. It's useless since inserting files is disabled. */
|
* disabled. It's useless since inserting files is disabled. */
|
||||||
|
@ -1221,44 +1267,21 @@ void toggle_init(void)
|
||||||
toggle_init_one(TOGGLE_MULTIBUFFER_KEY,
|
toggle_init_one(TOGGLE_MULTIBUFFER_KEY,
|
||||||
N_("Multiple file buffers"), MULTIBUFFER);
|
N_("Multiple file buffers"), MULTIBUFFER);
|
||||||
#endif
|
#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
|
/* If we're using restricted mode, the DOS/Mac conversion toggle is
|
||||||
* disabled. It's useless since inserting files is disabled. */
|
* disabled. It's useless since inserting files is disabled. */
|
||||||
if (!ISSET(RESTRICTED))
|
if (!ISSET(RESTRICTED))
|
||||||
toggle_init_one(TOGGLE_NOCONVERT_KEY,
|
toggle_init_one(TOGGLE_NOCONVERT_KEY,
|
||||||
N_("No conversion from DOS/Mac format"), NO_CONVERT);
|
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))
|
if (!ISSET(RESTRICTED))
|
||||||
toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"),
|
toggle_init_one(TOGGLE_SUSPEND_KEY, N_("Suspend"), SUSPEND);
|
||||||
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
|
|
||||||
}
|
}
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
|
|
22
src/help.c
22
src/help.c
|
@ -371,13 +371,16 @@ void help_init(void)
|
||||||
|
|
||||||
#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 line has "M-%c\t\t\t", which fills 24 columns, plus a space,
|
* Each non-blank entry has "M-%c\t\t\t", which fills 24 columns,
|
||||||
* plus translated text, plus '\n'. */
|
* plus a space, plus translated text, plus '\n'. Each blank entry
|
||||||
|
* has just '\n'. */
|
||||||
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)
|
||||||
allocsize += 8 + strlen(t->desc) + endis_len;
|
if (t->val != TOGGLE_NO_KEY)
|
||||||
|
allocsize += strlen(t->desc) + endis_len + 7;
|
||||||
|
allocsize++;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -475,11 +478,16 @@ void help_init(void)
|
||||||
*(ptr++) = '\t';
|
*(ptr++) = '\t';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure all the help text starts at the same place. */
|
/* 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) {
|
while (entries < 3) {
|
||||||
entries++;
|
entries++;
|
||||||
*(ptr++) = '\t';
|
*(ptr++) = '\t';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
assert(s->help != NULL);
|
assert(s->help != NULL);
|
||||||
|
|
||||||
|
@ -501,8 +509,10 @@ void help_init(void)
|
||||||
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", toupper(t->val),
|
if (t->val != TOGGLE_NO_KEY)
|
||||||
t->desc, _("enable/disable"));
|
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_FULLJUSTIFY_ALTKEY NANO_ALT_J
|
||||||
#define NANO_VERBATIM_KEY NANO_ALT_V
|
#define NANO_VERBATIM_KEY NANO_ALT_V
|
||||||
|
|
||||||
|
/* Toggles do not exist if NANO_TINY is defined. */
|
||||||
#ifndef NANO_TINY
|
#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_CONST_KEY NANO_ALT_C
|
||||||
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
|
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
|
||||||
#define TOGGLE_SUSPEND_KEY NANO_ALT_Z
|
#define TOGGLE_SUSPEND_KEY NANO_ALT_Z
|
||||||
|
|
|
@ -1711,9 +1711,9 @@ const toggle *get_toggle(int kbinput, bool meta_key)
|
||||||
|
|
||||||
/* Check for toggles. */
|
/* Check for toggles. */
|
||||||
for (; t != NULL; t = t->next) {
|
for (; t != NULL; t = t->next) {
|
||||||
/* We've found a toggle if meta_key is TRUE and the key is in
|
/* We've found a toggle if the key exists, meta_key is TRUE, and
|
||||||
* the meta key toggle list. */
|
* the key is in the meta key toggle list. */
|
||||||
if (meta_key && kbinput == t->val)
|
if (t->val != TOGGLE_NO_KEY && meta_key && kbinput == t->val)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue