mirror of
git://git.sv.gnu.org/nano.git
synced 2025-01-10 03:22:04 +03:00
prompt: allow the user to copy the answer to the cutbuffer (with M-6)
Since version 2.8.7 the user can paste text at the prompt (with ^U), but the ability to copy what is present at the prompt was overlooked. For feedback, the cursor is moved to the start of the answer -- like it moves to the start of the next line when in the edit buffer. This addresses https://savannah.gnu.org/bugs/?61702. Reported-by: Tasos Papastylianou <tpapastylianou@hotmail.com>
This commit is contained in:
parent
ff5084479b
commit
3b657a26a6
@ -805,7 +805,7 @@ void shortcut_init(void)
|
||||
|
||||
add_to_funcs(do_mark, MMAIN,
|
||||
N_("Set Mark"), WITHORSANS(mark_gist), TOGETHER, VIEW);
|
||||
add_to_funcs(copy_text, MMAIN,
|
||||
add_to_funcs(copy_text, MMOST,
|
||||
N_("Copy"), WITHORSANS(copy_gist), BLANKAFTER, VIEW);
|
||||
#endif
|
||||
|
||||
@ -1240,8 +1240,8 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN, "M-A", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "^6", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "^^", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "M-6", 0, copy_text, 0);
|
||||
add_to_sclist(MMAIN, "M-^", 0, copy_text, 0);
|
||||
add_to_sclist(MMOST, "M-6", 0, copy_text, 0);
|
||||
add_to_sclist(MMOST, "M-^", 0, copy_text, 0);
|
||||
add_to_sclist(MMAIN, "M-}", 0, do_indent, 0);
|
||||
add_to_sclist(MMAIN, "", INDENT_KEY, do_indent, 0);
|
||||
add_to_sclist(MMAIN, "M-{", 0, do_unindent, 0);
|
||||
|
13
src/prompt.c
13
src/prompt.c
@ -166,6 +166,17 @@ void do_statusbar_cut_text(void)
|
||||
answer[typing_x] = '\0';
|
||||
}
|
||||
|
||||
/* Copy the current answer (if any) into the cutbuffer. */
|
||||
void copy_the_answer(void)
|
||||
{
|
||||
if (*answer) {
|
||||
free_lines(cutbuffer);
|
||||
cutbuffer = make_new_node(NULL);
|
||||
cutbuffer->data = copy_of(answer);
|
||||
typing_x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Paste the first line of the cutbuffer into the current answer. */
|
||||
void paste_into_answer(void)
|
||||
{
|
||||
@ -344,6 +355,8 @@ int do_statusbar_input(bool *finished)
|
||||
do_statusbar_delete();
|
||||
else if (shortcut->func == do_backspace)
|
||||
do_statusbar_backspace();
|
||||
else if (shortcut->func == copy_text)
|
||||
copy_the_answer();
|
||||
else if (shortcut->func == paste_text) {
|
||||
if (cutbuffer != NULL)
|
||||
paste_into_answer();
|
||||
|
Loading…
Reference in New Issue
Block a user