tweaks: remove the now-unneeded code related to bracketed pasting

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.
master
Benno Schulenberg 2020-01-16 19:01:45 +01:00
parent 0e6d693dc8
commit 092711e412
3 changed files with 7 additions and 17 deletions

View File

@ -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) {

View File

@ -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
}

View File

@ -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. */