commit bf39ffe90343275a190aca12c36acb794044ea16
parent f2c30aa4374c04f6c3c58b56c31224162da1c5c2
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 12 Mar 2025 16:50:21 +0100
prompt: accept tabs in an external paste as literal tabs
This fixes https://savannah.gnu.org/bugs/?66892.
Buglet existed since before version 2.0.0.
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/prompt.c b/src/prompt.c
@@ -261,7 +261,7 @@ void absorb_character(int input, functionptrtype function)
* Apart from that, only accept input when not in restricted mode, or when
* not at the "Write File" prompt, or when there is no filename yet. */
if (!function) {
- if (input < 0x20 || input > 0xFF || meta_key)
+ if ((input < 0x20 && input != '\t') || meta_key || input > 0xFF)
beep();
else if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE ||
openfile->filename[0] == '\0') {
@@ -467,7 +467,11 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
/* Check for a shortcut in the current list. */
shortcut = get_shortcut(input);
function = (shortcut ? shortcut->func : NULL);
-
+#ifndef NANO_TINY
+ /* Tabs in an external paste are not commands. */
+ if (input == '\t' && bracketed_paste)
+ function = NULL;
+#endif
/* When it's a normal character, add it to the answer. */
absorb_character(input, function);