a workaround for when unjustified text is stored in the justify buffer
and either the justify or the full justify shortcut is hit
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2128
35c25a1d-7b9e-4130-9fde-
d3aeb78583b8
do_justify()
- For consistency, preserve placewewant if we didn't unjustify
instead of setting it to 0. (DLR)
-- winio.c:
- get_edit_input()
- - Remove parameter allow_funcs, as it was only needed as a
- workaround for when justified text was stored in the cutbuffer
- and the cut shortcut was hit at the "Can now UnJustify!"
- prompt. (DLR)
GNU nano 1.3.5 - 2004.11.22
- General:
/* Now get a keystroke and see if it's unjustify; if not, unget the
* keystroke and return. */
- kbinput = get_edit_input(&meta_key, &func_key);
+ kbinput = get_edit_input(&meta_key, &func_key, FALSE);
if (!meta_key && !func_key && kbinput == NANO_UNJUSTIFY_KEY) {
/* Restore the justify we just did (ungrateful user!). */
edit_refresh();
}
} else {
+ unget_kbinput(kbinput, meta_key, func_key);
+
/* Blow away the text in the justify buffer.*/
free_filestruct(jusbuffer);
jusbuffer = NULL;
currshortcut = main_list;
#endif
- kbinput = get_edit_input(&meta_key, &func_key);
+ kbinput = get_edit_input(&meta_key, &func_key, TRUE);
/* Last gasp, stuff that's not in the main lists. */
if (kbinput != ERR && !is_cntrl_char(kbinput)) {
#ifndef NANO_SMALL
const toggle *get_toggle(int kbinput, bool meta_key);
#endif
-int get_edit_input(bool *meta_key, bool *func_key);
+int get_edit_input(bool *meta_key, bool *func_key, bool allow_funcs);
#ifndef DISABLE_MOUSE
bool get_edit_mouse(void);
#endif
}
#endif /* !NANO_SMALL */
-int get_edit_input(bool *meta_key, bool *func_key)
+int get_edit_input(bool *meta_key, bool *func_key, bool allow_funcs)
{
bool keyhandled = FALSE;
int kbinput, retval;
if (s->func != do_cut_text)
cutbuffer_reset();
if (s->func != NULL) {
- if (ISSET(VIEW_MODE) && !s->viewok)
- print_view_warning();
- else
- s->func();
+ if (allow_funcs) {
+ if (ISSET(VIEW_MODE) && !s->viewok)
+ print_view_warning();
+ else
+ s->func();
+ }
keyhandled = TRUE;
}
}
* corresponding flag. */
if (t != NULL) {
cutbuffer_reset();
- do_toggle(t);
+ if (allow_funcs)
+ do_toggle(t);
keyhandled = TRUE;
}
}
/* If we got a shortcut with a corresponding function or a toggle,
* reset meta_key and retval. If we didn't, keep the value of
* meta_key and return the key we got in retval. */
- if (keyhandled) {
+ if (allow_funcs && keyhandled) {
*meta_key = FALSE;
retval = ERR;
} else {