From 954c4d03acb03d4351a97079192f7d6e8bfc312e Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 3 May 2019 19:47:08 +0200 Subject: [PATCH] tweaks: rename two functions, to be simpler --- src/cut.c | 4 ++-- src/global.c | 16 ++++++++-------- src/nano.c | 2 +- src/prompt.c | 4 ++-- src/proto.h | 4 ++-- src/rcfile.c | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/cut.c b/src/cut.c index f5eb8b83..d0c90311 100644 --- a/src/cut.c +++ b/src/cut.c @@ -398,7 +398,7 @@ void do_cut_text_void(void) /* Move text from the current buffer into the cutbuffer, and copy it * back into the buffer afterward. If the mark is set or the cursor * was moved, blow away previous contents of the cutbuffer. */ -void do_copy_text(void) +void copy_text(void) { bool mark_is_set = (openfile->mark != NULL); @@ -467,7 +467,7 @@ void zap_text(void) #endif /* !NANO_TINY */ /* Copy text from the cutbuffer into the current buffer. */ -void do_uncut_text(void) +void paste_text(void) { ssize_t was_lineno = openfile->current->lineno; /* The line number where we started the paste. */ diff --git a/src/global.c b/src/global.c index 5e3ce249..0364eee0 100644 --- a/src/global.c +++ b/src/global.c @@ -764,7 +764,7 @@ void shortcut_init(void) add_to_funcs(do_cut_text_void, MMAIN, N_("Cut Text"), WITHORSANS(cut_gist), TOGETHER, NOVIEW); - add_to_funcs(do_uncut_text, MMAIN, + add_to_funcs(paste_text, MMAIN, N_("Paste Text"), WITHORSANS(uncut_gist), BLANKAFTER, NOVIEW); if (!ISSET(RESTRICTED)) { @@ -797,7 +797,7 @@ void shortcut_init(void) add_to_funcs(do_mark, MMAIN, N_("Mark Text"), WITHORSANS(mark_gist), TOGETHER, VIEW); - add_to_funcs(do_copy_text, MMAIN, + add_to_funcs(copy_text, MMAIN, N_("Copy Text"), WITHORSANS(copy_gist), BLANKAFTER, NOVIEW); #endif @@ -1115,7 +1115,7 @@ void shortcut_init(void) add_to_sclist(MMAIN, "^\\", 0, do_replace, 0); add_to_sclist(MMAIN, "M-R", 0, do_replace, 0); add_to_sclist(MMOST, "^K", 0, do_cut_text_void, 0); - add_to_sclist(MMOST, "^U", 0, do_uncut_text, 0); + add_to_sclist(MMOST, "^U", 0, paste_text, 0); #ifdef ENABLE_JUSTIFY add_to_sclist(MMAIN, "^J", 0, do_justify_void, 0); #endif @@ -1146,8 +1146,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, do_copy_text, 0); - add_to_sclist(MMAIN, "M-^", 0, do_copy_text, 0); + add_to_sclist(MMAIN, "M-6", 0, copy_text, 0); + add_to_sclist(MMAIN, "M-^", 0, copy_text, 0); add_to_sclist(MMAIN, "M-}", 0, do_indent, 0); add_to_sclist(MMAIN, "Tab", TAB_CODE, do_indent, 0); add_to_sclist(MMAIN, "M-{", 0, do_unindent, 0); @@ -1384,7 +1384,7 @@ void shortcut_init(void) add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F7", 0, do_page_up, 0); add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F8", 0, do_page_down, 0); add_to_sclist(MMOST, "F9", 0, do_cut_text_void, 0); - add_to_sclist(MMOST, "F10", 0, do_uncut_text, 0); + add_to_sclist(MMOST, "F10", 0, paste_text, 0); add_to_sclist(MMAIN, "F11", 0, do_cursorpos_void, 0); #ifdef ENABLE_SPELLER add_to_sclist(MMAIN, "F12", 0, do_spell, 0); @@ -1485,12 +1485,12 @@ keystruct *strtosc(const char *input) else if (!strcasecmp(input, "cut")) s->func = do_cut_text_void; else if (!strcasecmp(input, "paste")) - s->func = do_uncut_text; + s->func = paste_text; #ifndef NANO_TINY else if (!strcasecmp(input, "cutrestoffile")) s->func = do_cut_till_eof; else if (!strcasecmp(input, "copy")) - s->func = do_copy_text; + s->func = copy_text; else if (!strcasecmp(input, "zap")) s->func = zap_text; else if (!strcasecmp(input, "mark")) diff --git a/src/nano.c b/src/nano.c index f731e04f..01cfb62e 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1723,7 +1723,7 @@ void do_input(void) /* When not cutting or copying text, drop the cutbuffer the next time. */ if (shortcut->func != do_cut_text_void) { #ifndef NANO_TINY - if (shortcut->func != do_copy_text && shortcut->func != zap_text) + if (shortcut->func != copy_text && shortcut->func != zap_text) #endif keep_cutbuffer = FALSE; } diff --git a/src/prompt.c b/src/prompt.c index 0c3eecf0..8a8d4dc2 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -151,7 +151,7 @@ int do_statusbar_input(bool *finished) openfile->filename[0] != '\0' && (shortcut->func == do_verbatim_input || shortcut->func == do_cut_text_void || - shortcut->func == do_uncut_text || + shortcut->func == paste_text || shortcut->func == do_delete || shortcut->func == do_backspace)) ; @@ -167,7 +167,7 @@ int do_statusbar_input(bool *finished) do_statusbar_delete(); else if (shortcut->func == do_backspace) do_statusbar_backspace(); - else if (shortcut->func == do_uncut_text) { + else if (shortcut->func == paste_text) { if (cutbuffer != NULL) do_statusbar_uncut_text(); } else { diff --git a/src/proto.h b/src/proto.h index ccdc8bb9..410d7a4d 100644 --- a/src/proto.h +++ b/src/proto.h @@ -258,11 +258,11 @@ void do_cut_text(bool copying, bool marked, bool until_eof, bool append); bool is_cuttable(bool test_cliff); void do_cut_text_void(void); #ifndef NANO_TINY -void do_copy_text(void); +void copy_text(void); void do_cut_till_eof(void); void zap_text(void); #endif -void do_uncut_text(void); +void paste_text(void); /* Most functions in files.c. */ void initialize_buffer_text(void); diff --git a/src/rcfile.c b/src/rcfile.c index 087acd99..25ffa40f 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -338,7 +338,7 @@ bool is_universal(void (*func)(void)) func == do_prev_word_void || func == do_next_word_void || #endif func == do_delete || func == do_backspace || - func == do_cut_text_void || func == do_uncut_text || + func == do_cut_text_void || func == paste_text || func == do_tab || func == do_enter || func == do_verbatim_input); }