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
- 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)
}
u->val = val;
- u->desc = _(desc);
+ u->desc = (desc == NULL) ? "" : _(desc);
u->flag = flag;
u->next = NULL;
}
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);
-#ifdef ENABLE_MULTIBUFFER
- /* If we're using restricted mode, the multibuffer toggle is
- * disabled. It's useless since inserting files is disabled. */
- if (!ISSET(RESTRICTED))
- toggle_init_one(TOGGLE_MULTIBUFFER_KEY,
- N_("Multiple file buffers"), MULTIBUFFER);
+
+ 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
-#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);
+
+ /* 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);
- 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);
+
+#ifdef ENABLE_MULTIBUFFER
+ /* If we're using restricted mode, the multibuffer toggle is
+ * disabled. It's useless since inserting files is disabled. */
+ if (!ISSET(RESTRICTED))
+ toggle_init_one(TOGGLE_MULTIBUFFER_KEY,
+ N_("Multiple file buffers"), MULTIBUFFER);
#endif
-#ifdef ENABLE_NANORC
- toggle_init_one(TOGGLE_WHITESPACE_KEY, N_("Whitespace display"),
- WHITESPACE_DISPLAY);
+
+ /* 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);
+
+#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);
}
#endif /* !NANO_TINY */
#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
*(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);
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");
}
}