1
1

Keeping a pointer to the Uncut item in the functions list, to be able

to change its description to Unjustify at the appropriate moment.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4739 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
Benno Schulenberg 2014-04-07 09:02:22 +00:00
родитель 2ff9dc7090
Коммит bc6e9aa926
4 изменённых файлов: 27 добавлений и 12 удалений

Просмотреть файл

@ -1,3 +1,11 @@
2014-04-07 Benno Schulenberg <bensberg@justemail.net>
* src/{proto.h,global.c,text.c}: Keep a pointer to the Uncut item in
the functions list, to be able to change its description to Unjustify
at the appropriate moment. This avoids having to fully repopulate
the functions and shortcuts lists before and after every Justify.
Also, look for ^U only in the main menu, to which ^W M-J factually
returns and which shortcut_init() "sneakily" sets.
2014-04-06 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (shortcut_init): Limit M-T (cut-till-end-of-file) to
the main menu, and M-J (full-justify) to the main and search menus.

Просмотреть файл

@ -170,6 +170,8 @@ sc *sclist = NULL;
/* Struct for the shortcut-key list. */
subnfunc *allfuncs = NULL;
/* Struct for the function list. */
subnfunc *uncutfunc;
/* Pointer to the special Uncut/Unjustify item. */
#ifndef NANO_TINY
filestruct *search_history = NULL;
@ -510,8 +512,12 @@ const char *backwards_msg = N_("Backwards");
const char *regexp_msg = N_("Regexp");
#endif
/* TRANSLATORS: Try to keep the next four strings at most 10 characters. */
const char *uncut_tag = N_("Uncut Text");
#ifndef DISABLE_JUSITIFY
const char *unjust_tag = N_("Unjustify");
#endif
#ifndef NANO_TINY
/* TRANSLATORS: Try to keep the next two strings at most 10 characters. */
const char *prev_history_msg = N_("PrevHstory");
const char *next_history_msg = N_("NextHstory");
/* TRANSLATORS: Try to keep the next four strings at most 12 characters. */
@ -804,14 +810,12 @@ void shortcut_init(bool unjustify)
add_to_funcs(do_cut_text_void, MMAIN, N_("Cut Text"), IFSCHELP(nano_cut_msg),
FALSE, NOVIEW);
if (unjustify)
/* TRANSLATORS: Try to keep this at most 10 characters. */
add_to_funcs(do_uncut_text, MMAIN, N_("Unjustify"), "",
FALSE, NOVIEW);
else
/* TRANSLATORS: Try to keep this at most 10 characters. */
add_to_funcs(do_uncut_text, MMAIN, N_("Uncut Text"), IFSCHELP(nano_uncut_msg),
FALSE, NOVIEW);
add_to_funcs(do_uncut_text, MMAIN, uncut_tag, IFSCHELP(nano_uncut_msg),
FALSE, NOVIEW);
/* Remember the entry for Uncut, to be able to replace it with Unjustify. */
for (uncutfunc = allfuncs; uncutfunc->next != NULL; uncutfunc = uncutfunc->next)
;
#ifndef NANO_TINY
/* TRANSLATORS: Try to keep this at most 10 characters. */

Просмотреть файл

@ -66,7 +66,9 @@ extern int whitespace_len[2];
extern undo_type last_action;
#endif
extern const char *uncut_tag;
#ifndef DISABLE_JUSTIFY
extern const char *unjust_tag;
extern char *punct;
extern char *brackets;
extern char *quotestr;
@ -99,6 +101,7 @@ extern char *alt_speller;
extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *uncutfunc;
#ifndef DISABLE_COLOR
extern syntaxtype *syntaxes;
extern char *syntaxstr;

Просмотреть файл

@ -2281,14 +2281,14 @@ void do_justify(bool full_justify)
do_cursorpos(TRUE);
/* Display the shortcut list with UnJustify. */
shortcut_init(TRUE);
uncutfunc->desc = unjust_tag;
display_main_list();
/* Now get a keystroke and see if it's unjustify. If not, put back
* the keystroke and return. */
kbinput = do_input(&meta_key, &func_key, &s_or_t, &ran_func,
&finished, FALSE);
s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key);
s = get_shortcut(MMAIN, &kbinput, &meta_key, &func_key);
if (s && s->scfunc == do_uncut_text) {
/* Splice the justify buffer back into the file, but only if we
@ -2351,7 +2351,7 @@ void do_justify(bool full_justify)
blank_statusbar();
/* Display the shortcut list with UnCut. */
shortcut_init(FALSE);
uncutfunc->desc = uncut_tag;
display_main_list();
#ifndef NANO_TINY