microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.4k stars 8.3k forks source link

Paste Slowly - A new type of Action #11020

Open fischerdouglas opened 3 years ago

fischerdouglas commented 3 years ago

Description of the new feature/enhancement

Paste Slowly - A new type of Action

Is needed to allow the use of Windows Terminal to operate remote devices based on SSH/Telnet/Serial connections. The buffers of some remote consoles do not deal very well with to quick insertion of caracteres.

Example: When configuring a Cisco/Juniper or similar device thought Serial Ports with low-speed connections (like 9600-8-n-1), if you paste a substantial number of configuration lines, is highly likely that some characters will be swallowed, resulting on errors at the final config.

The objective is to create new type of action called on Windows Terminal that Could be Called "Paste Slowly". -> Or any other better name the community define for that.

With that new action "Paste Slowly", Windows Terminal will process the Copy/Paste buffer, and when inserting each character on the console, will respect the delay defined for each specific character defined on the configurations of Windows Terminal.

Proposed technical implementation details (optional)

Deciding when execute "Paster Slowly" instead of "Normal Paste" - Will be defined by: A - Specific Key-Shortcut defined at Configuration->Actions (Ex.: CTRL+V -> Normal Paste, CTRL+Shift+V -> Paste Slowly.) B - Size of the Copy/Paste buffer on a Paste action. -> If bigger than NumBytesToPasteSlowly bytes, will prompt an action choose screen, questioning if "Normal Paste" or "Paste Slowly" should be used (like the warning that appears when the Paste Buffer have multiples lines). With a small checkbox defining "Remember that choice".

On Configurations should exist a Multiple-Choice option that will define the behavior of that "Warning POP" with the following options:

On Configurations should exist an Array of Delay Definition to Paste Slowly The Array will have 2 attributes:

The "Character" attribute, will contain:

The "Time to Delay" attribute will contain:

fischerdouglas commented 2 years ago

@zadjii-msft I saw some progres ( #11473 ) on parsing and treating in paste action on last preview release v1.13.10336.0.

any chance to take advantage of the momentum and take a second look at this paste slowly issue?

zadjii-msft commented 2 years ago

Oh sorry, never followed up here. Team thought it was a cool idea, if albeit a little silly 😄 Like, this is probably not needed like 99% of the time. But when this is needed, there's no other solution.

I think the consensus was the easiest solution was to add a property to PasteTextArgs (or make args for that, since there aren't already). I'm not sure how much more complicated it needs to be than that - the auto detection might be a bit more complicated. But just adding a delayBetweenChars property to PasteTextArgs would be easy. I can help guide if you'd like to take a crack at it 😉

fischerdouglas commented 2 years ago

Thanks for the attention and answer @zadjii-msft

I see you already got the importance of this feature to some of us. But just to give context on this, I'll take the liberty of bringing you some links that talk about how this is handled in other terminal tools.

Cisco users forum - Tera Term - Paste delay time per line https://learningnetwork.cisco.com/s/question/0D53i00000Kt7BS/how-to-slow-down-commands-when-pasting-itno-terminal-prompt

Mobaxterm - Paste delay https://mobaxterm.mobatek.net/documentation.html#4_9_7

SecureCRT - Other Features - Delay options https://www.vandyke.com/products/securecrt/features.html#:~:text=two%20SecureCRT%20windows.-,Delay%20options,-W

Iterm2 - Edit > Paste Slowly https://iterm2.com/documentation/2.1/documentation-menu-items.html#:~:text=spaces%20and%20backslashes.-,Edit%20%3E%20Paste%20Slowly,-%22Paste%20Slowly%22%20pastes Iterm2 - Hidden Settings > Paste Slowly https://iterm2.com/documentation-hidden-settings.html#:~:text=the%20speed%20that-,%22paste%20slowly%22,-pastes%20at%3A

Thanks again!

network-shark commented 6 months ago

@fischerdouglas thanks for collecting all the links. It would be good if terminal can support it .This feature is the only reason I can uninstall securecrt which feels like software from the eighties