Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to specially deal with paste in Windows #342

Open
hyee opened this issue Dec 29, 2018 · 1 comment
Open

Option to specially deal with paste in Windows #342

hyee opened this issue Dec 29, 2018 · 1 comment

Comments

@hyee
Copy link
Contributor

hyee commented Dec 29, 2018

It would be nice if specially deal with the paste behaviour in Windows, I raised a similar ticket (#142) before but it only works in non-Windows system. As far as I know that the ConEmu console supports bracketing paste however it doesn't meet my needs.

Below are what I'm experiencing without the paste option:

  • The terminal cannot identify the purpose of the tab char. For manual input, it's to complete; however for paste mode, it's a normal char.
  • LineReaderImpl has to spend much time on hightlighting and parsing when pasting very long SQL statement(i.e.,32k), and sometimes crash due to OutOfMemoryException. It works well for short input.

There is a workaround but I'm not sure if it's fine, that is to enter/exit paste mode by checking if Terminal.reader.available()>n, because manual input speed should not be so fast. Attached the revised JansiWinSysTerminal.txt for your reference, the change doesn't look graceful.

@gnodet
Copy link
Member

gnodet commented Jan 9, 2019

The behavior you're describing is exactly the purpose for the bracketed paste option. If ConEmu supports it, you should not experience any problems. Maybe it has to be enabled somehow.

Anyway, on the usual windows console, I think the idea of checking if there is already some input pending is a good idea, but maybe we could use a configurable threshold. Also, I don't think translating tabs into spaces is a good idea. However, if we detect a burst in the input stream, we could force the bracketing paste behavior (i.e. insert BRACKETED_PASTE_BEGIN, process all input, then write BRACKETED_PASTE_END). This should also be controlled by the JansiWinSysTerminal detecting and processing the BRACKETED_PASTE_ON / BRACKETED_PASTE_OFF sequences. Reusing the bracketed paste sequences will allow the LineReader to behave properly without tampering with the actual input data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants