general: include the Copy function (M-6 or ^C) into the tiny version
When using --modernbindings with the tiny version, it was strange that ^X cuts and ^V pastes but ^C complains about being unbound. Fix that.
This commit is contained in:
parent
d0a1bc361a
commit
b84f6fc15f
13
src/cut.c
13
src/cut.c
@ -634,6 +634,7 @@ void copy_marked_region(void)
|
|||||||
botline->data[bot_x] = saved_byte;
|
botline->data[bot_x] = saved_byte;
|
||||||
botline->next = afterline;
|
botline->next = afterline;
|
||||||
}
|
}
|
||||||
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
/* Copy text from the current buffer into the cutbuffer. The text is either
|
/* Copy text from the current buffer into the cutbuffer. The text is either
|
||||||
* the marked region, the whole line, the text from cursor to end-of-line,
|
* the marked region, the whole line, the text from cursor to end-of-line,
|
||||||
@ -646,17 +647,24 @@ void copy_text(void)
|
|||||||
linestruct *was_current = openfile->current;
|
linestruct *was_current = openfile->current;
|
||||||
linestruct *addition;
|
linestruct *addition;
|
||||||
|
|
||||||
if (openfile->mark || openfile->last_action != COPY || !keep_cutbuffer) {
|
#ifndef NANO_TINY
|
||||||
|
if (openfile->mark || openfile->last_action != COPY)
|
||||||
|
keep_cutbuffer = FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!keep_cutbuffer) {
|
||||||
free_lines(cutbuffer);
|
free_lines(cutbuffer);
|
||||||
cutbuffer = NULL;
|
cutbuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wipe_statusbar();
|
wipe_statusbar();
|
||||||
|
|
||||||
|
#ifndef NANO_TINY
|
||||||
if (openfile->mark) {
|
if (openfile->mark) {
|
||||||
copy_marked_region();
|
copy_marked_region();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* When at the very end of the buffer, there is nothing to do. */
|
/* When at the very end of the buffer, there is nothing to do. */
|
||||||
if (openfile->current->next == NULL && at_eol && (ISSET(CUT_FROM_CURSOR) ||
|
if (openfile->current->next == NULL && at_eol && (ISSET(CUT_FROM_CURSOR) ||
|
||||||
@ -706,10 +714,11 @@ void copy_text(void)
|
|||||||
|
|
||||||
edit_redraw(was_current, FLOWING);
|
edit_redraw(was_current, FLOWING);
|
||||||
|
|
||||||
|
#ifndef NANO_TINY
|
||||||
openfile->last_action = COPY;
|
openfile->last_action = COPY;
|
||||||
|
#endif
|
||||||
keep_cutbuffer = TRUE;
|
keep_cutbuffer = TRUE;
|
||||||
}
|
}
|
||||||
#endif /* !NANO_TINY */
|
|
||||||
|
|
||||||
/* Copy text from the cutbuffer into the current buffer. */
|
/* Copy text from the cutbuffer into the current buffer. */
|
||||||
void paste_text(void)
|
void paste_text(void)
|
||||||
|
|||||||
13
src/global.c
13
src/global.c
@ -561,6 +561,8 @@ void shortcut_init(void)
|
|||||||
N_("Search backward for a string or a regular expression");
|
N_("Search backward for a string or a regular expression");
|
||||||
const char *cut_gist =
|
const char *cut_gist =
|
||||||
N_("Cut current line (or marked region) and store it in cutbuffer");
|
N_("Cut current line (or marked region) and store it in cutbuffer");
|
||||||
|
const char *copy_gist =
|
||||||
|
N_("Copy current line (or marked region) and store it in cutbuffer");
|
||||||
const char *paste_gist =
|
const char *paste_gist =
|
||||||
N_("Paste the contents of cutbuffer at current cursor position");
|
N_("Paste the contents of cutbuffer at current cursor position");
|
||||||
const char *cursorpos_gist = N_("Display the position of the cursor");
|
const char *cursorpos_gist = N_("Display the position of the cursor");
|
||||||
@ -571,8 +573,6 @@ void shortcut_init(void)
|
|||||||
const char *gotoline_gist = N_("Go to line and column number");
|
const char *gotoline_gist = N_("Go to line and column number");
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
const char *mark_gist = N_("Mark text starting from the cursor position");
|
const char *mark_gist = N_("Mark text starting from the cursor position");
|
||||||
const char *copy_gist =
|
|
||||||
N_("Copy current line (or marked region) and store it in cutbuffer");
|
|
||||||
const char *zap_gist = N_("Throw away the current line (or marked region)");
|
const char *zap_gist = N_("Throw away the current line (or marked region)");
|
||||||
const char *indent_gist = N_("Indent the current line (or marked lines)");
|
const char *indent_gist = N_("Indent the current line (or marked lines)");
|
||||||
const char *unindent_gist = N_("Unindent the current line (or marked lines)");
|
const char *unindent_gist = N_("Unindent the current line (or marked lines)");
|
||||||
@ -982,6 +982,9 @@ void shortcut_init(void)
|
|||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
add_to_funcs(count_lines_words_and_characters, MMAIN,
|
add_to_funcs(count_lines_words_and_characters, MMAIN,
|
||||||
N_("Word Count"), WHENHELP(wordcount_gist), TOGETHER);
|
N_("Word Count"), WHENHELP(wordcount_gist), TOGETHER);
|
||||||
|
#else
|
||||||
|
add_to_funcs(copy_text, MMAIN,
|
||||||
|
N_("Copy"), WHENHELP(copy_gist), BLANKAFTER);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
add_to_funcs(do_verbatim_input, MMAIN,
|
add_to_funcs(do_verbatim_input, MMAIN,
|
||||||
@ -1191,9 +1194,9 @@ void shortcut_init(void)
|
|||||||
add_to_sclist(MMAIN, "^Z", 0, do_undo, 0);
|
add_to_sclist(MMAIN, "^Z", 0, do_undo, 0);
|
||||||
add_to_sclist(MMAIN, "^Y", 0, do_redo, 0);
|
add_to_sclist(MMAIN, "^Y", 0, do_redo, 0);
|
||||||
add_to_sclist(MMAIN, "^A", 0, do_mark, 0);
|
add_to_sclist(MMAIN, "^A", 0, do_mark, 0);
|
||||||
add_to_sclist(MMAIN, "^C", 0, copy_text, 0);
|
|
||||||
#endif
|
#endif
|
||||||
add_to_sclist(MMAIN, "^X", 0, cut_text, 0);
|
add_to_sclist(MMAIN, "^X", 0, cut_text, 0);
|
||||||
|
add_to_sclist(MMAIN, "^C", 0, copy_text, 0);
|
||||||
add_to_sclist(MMAIN, "^V", 0, paste_text, 0);
|
add_to_sclist(MMAIN, "^V", 0, paste_text, 0);
|
||||||
} else {
|
} else {
|
||||||
add_to_sclist((MMOST|MBROWSER) & ~MFINDINHELP, "^G", 0, do_help, 0);
|
add_to_sclist((MMOST|MBROWSER) & ~MFINDINHELP, "^G", 0, do_help, 0);
|
||||||
@ -1224,6 +1227,8 @@ void shortcut_init(void)
|
|||||||
add_to_sclist(MMAIN, "^\\", 0, do_replace, 0);
|
add_to_sclist(MMAIN, "^\\", 0, do_replace, 0);
|
||||||
add_to_sclist(MMAIN, "M-R", 0, do_replace, 0);
|
add_to_sclist(MMAIN, "M-R", 0, do_replace, 0);
|
||||||
add_to_sclist(MMOST, "^K", 0, cut_text, 0);
|
add_to_sclist(MMOST, "^K", 0, cut_text, 0);
|
||||||
|
add_to_sclist(MMOST, "M-6", 0, copy_text, 0);
|
||||||
|
add_to_sclist(MMOST, "M-^", 0, copy_text, 0);
|
||||||
#ifdef NANO_TINY
|
#ifdef NANO_TINY
|
||||||
add_to_sclist(MMAIN, "^U", 0, paste_text, 0);
|
add_to_sclist(MMAIN, "^U", 0, paste_text, 0);
|
||||||
#ifdef ENABLE_SPELLER
|
#ifdef ENABLE_SPELLER
|
||||||
@ -1275,8 +1280,6 @@ void shortcut_init(void)
|
|||||||
add_to_sclist(MMAIN, "M-A", 0, do_mark, 0);
|
add_to_sclist(MMAIN, "M-A", 0, do_mark, 0);
|
||||||
add_to_sclist(MMAIN, "^6", 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, "^^", 0, do_mark, 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, "M-}", 0, do_indent, 0);
|
||||||
add_to_sclist(MMAIN, "", INDENT_KEY, do_indent, 0);
|
add_to_sclist(MMAIN, "", INDENT_KEY, do_indent, 0);
|
||||||
add_to_sclist(MMAIN, "M-{", 0, do_unindent, 0);
|
add_to_sclist(MMAIN, "M-{", 0, do_unindent, 0);
|
||||||
|
|||||||
@ -1645,9 +1645,9 @@ void process_a_keystroke(void)
|
|||||||
give_a_hint = FALSE;
|
give_a_hint = FALSE;
|
||||||
|
|
||||||
/* When not cutting or copying text, drop the cutbuffer the next time. */
|
/* When not cutting or copying text, drop the cutbuffer the next time. */
|
||||||
if (function != cut_text) {
|
if (function != cut_text && function != copy_text) {
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (function != copy_text && function != zap_text)
|
if (function != zap_text)
|
||||||
#endif
|
#endif
|
||||||
keep_cutbuffer = FALSE;
|
keep_cutbuffer = FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -270,8 +270,8 @@ void cut_text(void);
|
|||||||
void cut_till_eof(void);
|
void cut_till_eof(void);
|
||||||
void zap_text(void);
|
void zap_text(void);
|
||||||
void copy_marked_region(void);
|
void copy_marked_region(void);
|
||||||
void copy_text(void);
|
|
||||||
#endif
|
#endif
|
||||||
|
void copy_text(void);
|
||||||
void paste_text(void);
|
void paste_text(void);
|
||||||
|
|
||||||
/* Most functions in files.c. */
|
/* Most functions in files.c. */
|
||||||
|
|||||||
@ -245,6 +245,8 @@ keystruct *strtosc(const char *input)
|
|||||||
s->func = do_replace;
|
s->func = do_replace;
|
||||||
else if (!strcmp(input, "cut"))
|
else if (!strcmp(input, "cut"))
|
||||||
s->func = cut_text;
|
s->func = cut_text;
|
||||||
|
else if (!strcmp(input, "copy"))
|
||||||
|
s->func = copy_text;
|
||||||
else if (!strcmp(input, "paste"))
|
else if (!strcmp(input, "paste"))
|
||||||
s->func = paste_text;
|
s->func = paste_text;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
@ -252,8 +254,6 @@ keystruct *strtosc(const char *input)
|
|||||||
s->func = do_execute;
|
s->func = do_execute;
|
||||||
else if (!strcmp(input, "cutrestoffile"))
|
else if (!strcmp(input, "cutrestoffile"))
|
||||||
s->func = cut_till_eof;
|
s->func = cut_till_eof;
|
||||||
else if (!strcmp(input, "copy"))
|
|
||||||
s->func = copy_text;
|
|
||||||
else if (!strcmp(input, "zap"))
|
else if (!strcmp(input, "zap"))
|
||||||
s->func = zap_text;
|
s->func = zap_text;
|
||||||
else if (!strcmp(input, "mark"))
|
else if (!strcmp(input, "mark"))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user