3 ms·
> Aside: Is there a similar tool for macOS? I don't know the state of Windows terminal emulators, but it seems strange to describe the problem without mentioni
by JadeNB 6y ago
> Aside: Is there a similar tool for macOS?
I don't know the state of Windows terminal emulators, but it seems strange to describe the problem without mentioning the term for the solution, which is 'bracketed paste'. This article discusses how bracketed-paste mode is signalled using ANSI escape sequences, which I guess can work in most macOS terminal emulators (although it's up to the shell to respond): https://cirw.in/blog/bracketed-paste https://cirw.in/blog/bracketed-paste . (I guess that Win+Ins is doing something similar on Windows?)
- noseratio 6y ago> I guess that Win+Ins is doing something similar on Windows? By default Win+Ins does nothing on Windows. I had to implemented this feature in DevComrade. I wish it was all part of Windows so I didn't have to maintain it :) Happy if they take the source, it's an Apache 2.0 license.
- AnonHP 6y agoThanks for this. I’ll check out bracketed pasting mode in terminal next time (not near one right now), though I have to admit that even after reading that post, I didn’t understand what exactly happens when it’s used. I understood that the command does not get executed, but what happens in the shell (I looked this up on Wikipedia too)? Does it just display the line and allow the user to edit it so that the starting and ending escape sequences can be removed along with any other edits and then the command executed?
- JadeNB 6y ago> I understood that the command does not get executed, but what happens in the shell (I looked this up on Wikipedia too)? Does it just display the line and allow the user to edit it so that the starting and ending escape sequences can be removed along with any other edits and then the command executed? My understanding is that it's up to the shell, or whatever program, to decide how to handle it. (I didn't make this clear in my original post, and have updated it accordingly.) All bracketed paste is doing is providing a mode that tells the program "everything between these two symbols should be interpreted as input, not as commands"; it's then up to the program to decide how it wants to respond to the user's intention. At least for me, with Terminal.app and bash 5.0 (where it's not enabled by default), it behaves es you describe when enabled by `set enable-bracketed-paste on` in `.inputrc`. For vim, I believe the plugin is essentially doing the equivalent of `set paste` before and `set nopaste` after.