nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 97c8140ceab05f4ddc620632774abe40833774d9
parent c5b03ca4ae658949996d0806930aa0f9c9dd461d
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed,  8 Jan 2020 11:09:57 +0100

tweaks: rename two functions, to make more sense

Diffstat:
Msrc/nano.c | 4++--
Msrc/prompt.c | 7+++----
Msrc/proto.h | 4++--
Msrc/text.c | 10+++++-----
4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/nano.c b/src/nano.c @@ -1690,7 +1690,7 @@ void do_input(void) /* Insert all bytes in the input buffer into the edit buffer * at once, filtering out any ASCII control codes. */ puddle[depth] = '\0'; - do_output(puddle, depth, TRUE); + inject(puddle, depth, TRUE); /* Empty the input buffer. */ free(puddle); @@ -1776,7 +1776,7 @@ void do_input(void) /* The user typed output_len multibyte characters. Add them to the edit * buffer, filtering out ASCII control characters when filtering is TRUE. */ -void do_output(char *output, size_t output_len, bool filtering) +void inject(char *output, size_t output_len, bool filtering) { char onechar[MAXCHARLEN]; int charlen; diff --git a/src/prompt.c b/src/prompt.c @@ -115,7 +115,7 @@ int do_statusbar_input(bool *finished) if ((shortcut || get_key_buffer_len() == 0) && kbinput != NULL) { /* Inject all characters in the input buffer at once, filtering out * control characters. */ - do_statusbar_output(kbinput, kbinput_len, TRUE); + inject_into_answer(kbinput, kbinput_len, TRUE); /* Empty the input buffer. */ kbinput_len = 0; @@ -185,8 +185,7 @@ int do_statusbar_input(bool *finished) /* The user typed input_len multibyte characters. Add them to the answer, * filtering out ASCII control characters if filtering is TRUE. */ -void do_statusbar_output(int *the_input, size_t input_len, - bool filtering) +void inject_into_answer(int *the_input, size_t input_len, bool filtering) { char *output = charalloc(input_len + 1); char onechar[MAXCHARLEN]; @@ -340,7 +339,7 @@ void do_statusbar_verbatim_input(void) kbinput = get_verbatim_kbinput(bottomwin, &kbinput_len); - do_statusbar_output(kbinput, kbinput_len, FALSE); + inject_into_answer(kbinput, kbinput_len, FALSE); free(kbinput); } diff --git a/src/proto.h b/src/proto.h @@ -438,10 +438,10 @@ void confirm_margin(void); #endif void unbound_key(int code); bool okay_for_view(const keystruct *shortcut); -void do_output(char *output, size_t output_len, bool allow_cntrls); +void inject(char *output, size_t output_len, bool filtering); /* Most functions in prompt.c. */ -void do_statusbar_output(int *the_input, size_t input_len, bool filtering); +void inject_into_answer(int *the_input, size_t input_len, bool filtering); void do_statusbar_home(void); void do_statusbar_end(void); void do_statusbar_left(void); diff --git a/src/text.c b/src/text.c @@ -69,7 +69,7 @@ void do_tab(void) { #ifdef ENABLE_COLOR if (openfile->syntax && openfile->syntax->tab) - do_output(openfile->syntax->tab, strlen(openfile->syntax->tab), FALSE); + inject(openfile->syntax->tab, strlen(openfile->syntax->tab), FALSE); else #endif #ifndef NANO_TINY @@ -80,12 +80,12 @@ void do_tab(void) memset(spaces, ' ', length); spaces[length] = '\0'; - do_output(spaces, length, FALSE); + inject(spaces, length, FALSE); free(spaces); } else #endif - do_output((char *)"\t", 1, FALSE); + inject((char *)"\t", 1, FALSE); } #ifndef NANO_TINY @@ -3151,7 +3151,7 @@ void do_verbatim_input(void) keycodes[count] = '\0'; /* Insert the keystroke verbatim, without filtering control characters. */ - do_output(keycodes, count, FALSE); + inject(keycodes, count, FALSE); free(keycodes); free(kbinput); @@ -3298,7 +3298,7 @@ void complete_a_word(void) UNSET(BREAK_LONG_LINES); #endif /* Inject the completion into the buffer. */ - do_output(&completion[shard_length], + inject(&completion[shard_length], strlen(completion) - shard_length, TRUE); #ifdef ENABLE_WRAPPING /* If needed, reenable wrapping and wrap the current line. */