edit_update(), rename open_the_file() to open_file() since the
latter has been removed, and rename load_a_file() to
load_buffer().
+ - Add alternative shortcuts for moving to the beginning and end
+ of a paragraph and justifying the entire file: Meta-(
+ (Meta-9), Meta-) (Meta-0), and Meta-J, respectively. Also add
+ these functions to the main shortcut list, as Pico's practice
+ of putting them in the search menu is rather odd. (DLR)
- files.c:
do_insertfile()
- Readd the NANO_SMALL #ifdef around the start_again: label to
die_save_file()
- Clarify the error message when there are too many backup files
and the current one can't be written. (DLR)
+ help_init()
+ - Rework to be a bit more flexible. Only add tabs for shortcut
+ key entries if those entries exist, and if there's only one
+ entry left but there's room for more than one, add enough tabs
+ to put that entry at the end. These changes allow e.g. the
+ miscellaneous meta key sequence to be displayed in a shortcut
+ that has a control key, a primary meta key sequence, and a
+ miscellaneous meta key sequence, but no function key. (DLR)
justify_format()
- For more compatibility with Pico, remove extra space after a
character in punct if that character is the same as the one
const char *cancel_msg = N_("Cancel");
const char *first_line_msg = N_("First Line");
const char *last_line_msg = N_("Last Line");
+#ifndef DISABLE_JUSTIFY
+ const char *beg_of_par_msg = N_("Beg of Par");
+ const char *end_of_par_msg = N_("End of Par");
+ const char *fulljstify_msg = N_("FullJstify");
+#endif
#ifndef NANO_SMALL
const char *case_sens_msg = N_("Case Sens");
const char *direction_msg = N_("Direction");
const char *nano_nextword_msg = N_("Move forward one word");
const char *nano_prevword_msg = N_("Move backward one word");
#endif
- const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
+#ifndef DISABLE_JUSTIFY
+ const char *nano_parabegin_msg =
+ N_("Go to the beginning of the current paragraph");
+ const char *nano_paraend_msg =
+ N_("Go to the end of the current paragraph");
+#endif
#ifdef ENABLE_MULTIBUFFER
- const char *nano_openprev_msg = N_("Switch to previous file buffer");
- const char *nano_opennext_msg = N_("Switch to next file buffer");
+ const char *nano_openprev_msg = N_("Switch to the previous file buffer");
+ const char *nano_opennext_msg = N_("Switch to the next file buffer");
+#endif
+ const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
+#ifndef DISABLE_JUSTIFY
+ const char *nano_fulljustify_msg = N_("Justify the entire file");
#endif
#ifndef NANO_SMALL
#ifdef HAVE_REGEX_H
const char *nano_cancel_msg = N_("Cancel the current function");
const char *nano_firstline_msg = N_("Go to the first line of the file");
const char *nano_lastline_msg = N_("Go to the last line of the file");
-#ifndef DISABLE_JUSTIFY
- const char *nano_parabegin_msg =
- N_("Go to the beginning of the current paragraph");
- const char *nano_paraend_msg =
- N_("Go to the end of the current paragraph");
- const char *nano_fulljustify_msg = N_("Justify the entire file");
-#endif
#ifndef NANO_SMALL
const char *nano_case_msg =
N_("Make the current search/replace case (in)sensitive");
NANO_NO_KEY, VIEW, do_prev_word);
#endif
- sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"),
- IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
- NANO_NO_KEY, NOVIEW, do_verbatim_input);
+#ifndef DISABLE_JUSTIFY
+ /* Translators: try to keep this string under 10 characters long */
+ sc_init_one(&main_list, NANO_NO_KEY, beg_of_par_msg,
+ IFHELP(nano_parabegin_msg, NANO_PARABEGIN_ALTKEY1), NANO_NO_KEY,
+ NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin);
+
+ /* Translators: try to keep this string under 10 characters long */
+ sc_init_one(&main_list, NANO_NO_KEY, end_of_par_msg,
+ IFHELP(nano_paraend_msg, NANO_PARAEND_ALTKEY1), NANO_NO_KEY,
+ NANO_PARAEND_ALTKEY2, VIEW, do_para_end);
+#endif
#ifdef ENABLE_MULTIBUFFER
sc_init_one(&main_list, NANO_NO_KEY, N_("Previous File"),
NANO_OPENNEXT_ALTKEY, VIEW, open_nextfile_void);
#endif
+ sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"),
+ IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, do_verbatim_input);
+
+#ifndef DISABLE_JUSTIFY
+ /* Translators: try to keep this string under 10 characters long */
+ sc_init_one(&main_list, NANO_NO_KEY, fulljstify_msg,
+ IFHELP(nano_fulljustify_msg, NANO_FULLJUSTIFY_ALTKEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, do_full_justify);
+#endif
+
#ifndef NANO_SMALL
#ifdef HAVE_REGEX_H
sc_init_one(&main_list, NANO_NO_KEY, N_("Find Other Bracket"),
#ifndef DISABLE_JUSTIFY
/* Translators: try to keep this string under 10 characters long */
- sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, N_("Beg of Par"),
- IFHELP(nano_parabegin_msg, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, do_para_begin);
+ sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, beg_of_par_msg,
+ IFHELP(nano_parabegin_msg, NANO_PARABEGIN_ALTKEY1), NANO_NO_KEY,
+ NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin);
/* Translators: try to keep this string under 10 characters long */
- sc_init_one(&whereis_list, NANO_PARAEND_KEY, N_("End of Par"),
- IFHELP(nano_paraend_msg, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, do_para_end);
+ sc_init_one(&whereis_list, NANO_PARAEND_KEY, end_of_par_msg,
+ IFHELP(nano_paraend_msg, NANO_PARAEND_ALTKEY1), NANO_NO_KEY,
+ NANO_PARAEND_ALTKEY2, VIEW, do_para_end);
/* Translators: try to keep this string under 10 characters long */
- sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, N_("FullJstify"),
- IFHELP(nano_fulljustify_msg, NANO_NO_KEY), NANO_NO_KEY,
+ sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, fulljstify_msg,
+ IFHELP(nano_fulljustify_msg, NANO_FULLJUSTIFY_ALTKEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, do_full_justify);
#endif
strcpy(help_text, htx);
ptr = help_text + strlen(help_text);
- /* Now add our shortcut info. */
+ /* Now add our shortcut info. Assume that each shortcut has, at the
+ * very least, an equivalent control key, an equivalent primary meta
+ * key sequence, or both. Also assume that the meta key values are
+ * not control characters. We can display a maximum of 3 shortcut
+ * entries. */
for (s = currshortcut; s != NULL; s = s->next) {
- bool meta_shortcut = FALSE;
- /* TRUE if the character in s->metaval is shown in the
- * first column. */
+ int entries = 0;
+ /* Control key. */
if (s->ctrlval != NANO_NO_KEY) {
+ entries++;
#ifndef NANO_SMALL
if (s->ctrlval == NANO_HISTORY_KEY)
ptr += sprintf(ptr, "%.7s", _("Up"));
ptr += sprintf(ptr, "^?");
else
ptr += sprintf(ptr, "^%c", s->ctrlval + 64);
+ *(ptr++) = '\t';
}
-#ifndef NANO_SMALL
- else if (s->metaval != NANO_NO_KEY) {
- meta_shortcut = TRUE;
- if (s->metaval == NANO_ALT_SPACE)
- ptr += sprintf(ptr, "M-%.5s", _("Space"));
- else
- ptr += sprintf(ptr, "M-%c", toupper(s->metaval));
- }
-#endif
-
- *(ptr++) = '\t';
- if (s->funcval != NANO_NO_KEY)
+ /* Function key. */
+ if (s->funcval != NANO_NO_KEY) {
+ entries++;
ptr += sprintf(ptr, "(F%d)", s->funcval - KEY_F0);
+ *(ptr++) = '\t';
+ }
- *(ptr++) = '\t';
+ /* Primary meta key sequence. */
+ if (s->metaval != NANO_NO_KEY) {
+ entries++;
+ /* If this is the last entry, put it at the end. */
+ if (entries == 2 && s->miscval == NANO_NO_KEY) {
+ entries++;
+ *(ptr++) = '\t';
+ }
+ /* If the primary meta key sequence is the first entry,
+ * don't put parentheses around it. */
+ if (entries == 1 && s->metaval == NANO_ALT_SPACE)
+ ptr += sprintf(ptr, "M-%.5s", _("Space"));
+ else
+ ptr += sprintf(ptr, entries == 1 ? "M-%c" : "(M-%c)",
+ toupper(s->metaval));
+ *(ptr++) = '\t';
+ }
- if (!meta_shortcut && s->metaval != NANO_NO_KEY)
- ptr += sprintf(ptr, "(M-%c)", toupper(s->metaval));
- else if (meta_shortcut && s->miscval != NANO_NO_KEY)
+ /* Miscellaneous meta key sequence. */
+ if (entries < 3 && s->miscval != NANO_NO_KEY) {
+ entries++;
+ /* If this is the last entry, put it at the end. */
+ if (entries == 2) {
+ entries++;
+ *(ptr++) = '\t';
+ }
ptr += sprintf(ptr, "(M-%c)", toupper(s->miscval));
+ *(ptr++) = '\t';
+ }
- *(ptr++) = '\t';
+ /* Make sure all the help text starts at the same place. */
+ while (entries < 3) {
+ entries++;
+ *(ptr++) = '\t';
+ }
assert(s->help != NULL);
ptr += sprintf(ptr, "%.*s\n", COLS > 24 ? COLS - 24 : 0, s->help);