kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
22.14k stars 907 forks source link

Allow to treat newline (\n) as safe terminal control code when pasting with confirm action #7374

Closed Jackenmen closed 3 weeks ago

Jackenmen commented 3 weeks ago

Is your feature request related to a problem? Please describe. Right now, kitty prompts the user when the text they're pasting contains terminal control codes and that includes the newline character (\n). I do appreciate that the feature exists and would want to use it but the current behavior makes it impractical and will end up with me just always clicking the "Paste anyway" option due to popup fatigue.

Describe the solution you'd like I would want to be able to compromise slightly and have kitty treat the newline character (\n) as a safe character, regardless of whether the bracketed paste mode is used by the program. An option for such behavior would be the solution I would like.

Describe alternatives you've considered I could compromise more and just disable the prompt about terminal control codes entirely - this is already possible by changing the paste actions to not include the confirm action.

Additional context Kitty's behavior was reported as a bug in #6872 and was considered intended behavior. This is why I am instead making a feature request to allow me to configure kitty such that I can keep the prompt but only if it contains a terminal code that isn't the newline character (\n).

Also interestingly, the replace-dangerous-control-codes action does not replace the newline character (\n), while the confirm action does.

kovidgoyal commented 3 weeks ago

Add replace-newline to paste_actions or get your shell top turn on bracketed paste and kitty wont prompt about newlines.

Jackenmen commented 3 weeks ago

Python REPL doesn't support bracketed paste: https://github.com/python/cpython/issues/84001

Adding replace-newline (full line: paste_actions quote-urls-at-prompt,replace-newline,confirm) to the paste actions doesn't change that kitty prompts me about pasted text containing terminal codes when the only special thing it contains is newline character.

And as I said in the feature request, I don't want to disable confirm completely, I only don't want it to be triggered by newline characters since it will annoy me to a point of popup fatigue (or will require me to disable the feature and lose the entire security gain from it).

kovidgoyal commented 3 weeks ago

Use ipython instead, it does support bracketed paste. python's builtin REPL is quite limited.