1
1

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.
Этот коммит содержится в:
Benno Schulenberg 2020-01-16 19:01:45 +01:00
родитель 0e6d693dc8
Коммит 092711e412
3 изменённых файлов: 7 добавлений и 17 удалений

Просмотреть файл

@ -452,11 +452,8 @@ const keystruct *get_shortcut(int *kbinput)
(*kbinput >= 0xA0 && *kbinput <= 0xFF))) (*kbinput >= 0xA0 && *kbinput <= 0xFF)))
return NULL; return NULL;
/* During a paste, ignore all command keycodes at a prompt, and /* During a paste at a prompt, ignore all command keycodes. */
* allow only <Tab> and <Enter> to pass into the edit window. */ if (bracketed_paste && *kbinput != BRACKETED_PASTE_MARKER)
if (bracketed_paste && *kbinput != BRACKETED_PASTE_MARKER &&
(currmenu != MMAIN ||
(*kbinput != TAB_CODE && *kbinput != CR_CODE)))
return NULL; return NULL;
for (keystruct *s = sclist; s != NULL; s = s->next) { for (keystruct *s = sclist; s != NULL; s = s->next) {

Просмотреть файл

@ -78,9 +78,6 @@ static linestruct *hindline;
static linestruct *filetail; static linestruct *filetail;
/* What was the bottom line of the buffer. */ /* 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. */ /* Create a new linestruct node. Note that we do not set prevnode->next. */
linestruct *make_new_node(linestruct *prevnode) linestruct *make_new_node(linestruct *prevnode)
{ {
@ -1534,9 +1531,6 @@ void do_input(void)
} }
#endif #endif
if (bracketed_paste)
pasting_from_outside = TRUE;
/* Check for a shortcut in the main list. */ /* Check for a shortcut in the main list. */
shortcut = get_shortcut(&input); shortcut = get_shortcut(&input);
@ -1578,7 +1572,6 @@ void do_input(void)
* at once, filtering out any ASCII control codes. */ * at once, filtering out any ASCII control codes. */
puddle[depth] = '\0'; puddle[depth] = '\0';
inject(puddle, depth, TRUE); inject(puddle, depth, TRUE);
pasting_from_outside = FALSE;
/* Empty the input buffer. */ /* Empty the input buffer. */
free(puddle); free(puddle);
@ -1747,7 +1740,7 @@ void inject(char *output, size_t output_len, bool filtering)
#ifdef ENABLE_WRAPPING #ifdef ENABLE_WRAPPING
/* If text gets wrapped, the edit window needs a refresh. */ /* 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; refresh_needed = TRUE;
#endif #endif
} }

Просмотреть файл

@ -68,12 +68,12 @@ void do_mark(void)
void do_tab(void) void do_tab(void)
{ {
#ifdef ENABLE_COLOR #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); inject(openfile->syntax->tab, strlen(openfile->syntax->tab), FALSE);
else else
#endif #endif
#ifndef NANO_TINY #ifndef NANO_TINY
if (ISSET(TABS_TO_SPACES) && !bracketed_paste) { if (ISSET(TABS_TO_SPACES)) {
char *spaces = charalloc(tabsize + 1); char *spaces = charalloc(tabsize + 1);
size_t length = tabsize - (xplustabs() % tabsize); size_t length = tabsize - (xplustabs() % tabsize);
@ -853,7 +853,7 @@ void do_enter(void)
linestruct *sampleline = openfile->current; linestruct *sampleline = openfile->current;
bool allblanks = FALSE; bool allblanks = FALSE;
if (ISSET(AUTOINDENT) && !bracketed_paste) { if (ISSET(AUTOINDENT)) {
#ifdef ENABLE_JUSTIFY #ifdef ENABLE_JUSTIFY
/* When doing automatic long-line wrapping and the next line is /* When doing automatic long-line wrapping and the next line is
* in this same paragraph, use its indentation as the model. */ * 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 + strcpy(&newnode->data[extra], openfile->current->data +
openfile->current_x); openfile->current_x);
#ifndef NANO_TINY #ifndef NANO_TINY
if (ISSET(AUTOINDENT) && !bracketed_paste) { if (ISSET(AUTOINDENT)) {
/* Copy the whitespace from the sample line to the new one. */ /* Copy the whitespace from the sample line to the new one. */
strncpy(newnode->data, sampleline->data, extra); strncpy(newnode->data, sampleline->data, extra);
/* If there were only blanks before the cursor, trim them. */ /* If there were only blanks before the cursor, trim them. */