[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] tweaks: remove the now-unneeded code related to bracketed pa
From: |
Benno Schulenberg |
Subject: |
[PATCH 2/2] tweaks: remove the now-unneeded code related to bracketed pasting |
Date: |
Fri, 17 Jan 2020 17:02:32 +0100 |
The suppression of auto-indentation, automatic hard-wrapping, and
tab-to-spaces conversion is now inherent in the way the reading-in
of a bracketed paste is handled by the previous commit: as a single
block of text.
---
src/global.c | 7 ++-----
src/nano.c | 9 +--------
src/text.c | 8 ++++----
src/winio.c | 2 +-
4 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/src/global.c b/src/global.c
index d48fda67..181e28eb 100644
--- a/src/global.c
+++ b/src/global.c
@@ -452,11 +452,8 @@ const keystruct *get_shortcut(int *kbinput)
(*kbinput >= 0xA0 && *kbinput
<= 0xFF)))
return NULL;
- /* During a paste, ignore all command keycodes at a prompt, and
- * allow only <Tab> and <Enter> to pass into the edit window. */
- if (bracketed_paste && *kbinput != BRACKETED_PASTE_MARKER &&
- (currmenu != MMAIN ||
- (*kbinput != TAB_CODE &&
*kbinput != CR_CODE)))
+ /* During a paste at a prompt, ignore all command keycodes. */
+ if (bracketed_paste && *kbinput != BRACKETED_PASTE_MARKER)
return NULL;
for (keystruct *s = sclist; s != NULL; s = s->next) {
diff --git a/src/nano.c b/src/nano.c
index cf87d71d..f584e9d6 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -78,9 +78,6 @@ static linestruct *hindline;
static linestruct *filetail;
/* What was the bottom line of the buffer. */
-static bool pasting_from_outside = FALSE;
- /* Whether a bracketed paste is in progress. */
-
/* Create a new linestruct node. Note that we do not set prevnode->next. */
linestruct *make_new_node(linestruct *prevnode)
{
@@ -1534,9 +1531,6 @@ void do_input(void)
}
#endif
- if (bracketed_paste)
- pasting_from_outside = TRUE;
-
/* Check for a shortcut in the main list. */
shortcut = get_shortcut(&input);
@@ -1578,7 +1572,6 @@ void do_input(void)
* at once, filtering out any ASCII control codes. */
puddle[depth] = '\0';
inject(puddle, depth, TRUE);
- pasting_from_outside = FALSE;
/* Empty the input buffer. */
free(puddle);
@@ -1747,7 +1740,7 @@ void inject(char *output, size_t output_len, bool
filtering)
#ifdef ENABLE_WRAPPING
/* If text gets wrapped, the edit window needs a refresh. */
- if (ISSET(BREAK_LONG_LINES) && !pasting_from_outside &&
do_wrap())
+ if (ISSET(BREAK_LONG_LINES) && do_wrap())
refresh_needed = TRUE;
#endif
}
diff --git a/src/text.c b/src/text.c
index 12953661..99d7d4c5 100644
--- a/src/text.c
+++ b/src/text.c
@@ -68,12 +68,12 @@ void do_mark(void)
void do_tab(void)
{
#ifdef ENABLE_COLOR
- if (openfile->syntax && openfile->syntax->tab && !bracketed_paste)
+ if (openfile->syntax && openfile->syntax->tab)
inject(openfile->syntax->tab, strlen(openfile->syntax->tab),
FALSE);
else
#endif
#ifndef NANO_TINY
- if (ISSET(TABS_TO_SPACES) && !bracketed_paste) {
+ if (ISSET(TABS_TO_SPACES)) {
char *spaces = charalloc(tabsize + 1);
size_t length = tabsize - (xplustabs() % tabsize);
@@ -853,7 +853,7 @@ void do_enter(void)
linestruct *sampleline = openfile->current;
bool allblanks = FALSE;
- if (ISSET(AUTOINDENT) && !bracketed_paste) {
+ if (ISSET(AUTOINDENT)) {
#ifdef ENABLE_JUSTIFY
/* When doing automatic long-line wrapping and the next line is
* in this same paragraph, use its indentation as the model. */
@@ -875,7 +875,7 @@ void do_enter(void)
strcpy(&newnode->data[extra], openfile->current->data +
openfile->current_x);
#ifndef NANO_TINY
- if (ISSET(AUTOINDENT) && !bracketed_paste) {
+ if (ISSET(AUTOINDENT)) {
/* Copy the whitespace from the sample line to the new one. */
strncpy(newnode->data, sampleline->data, extra);
/* If there were only blanks before the cursor, trim them. */
diff --git a/src/winio.c b/src/winio.c
index 380590cc..97a334df 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -657,7 +657,7 @@ int parse_kbinput(WINDOW *win)
#ifndef NANO_TINY
/* When <Tab> is pressed while the mark is on, do an indent. */
if (retval == TAB_CODE && openfile->mark && currmenu == MMAIN &&
- !bracketed_paste && openfile->mark !=
openfile->current)
+ openfile->mark !=
openfile->current)
return INDENT_KEY;
#endif
--
2.24.1