ClickHouse / ClickHouse

ClickHouse® is a real-time analytics DBMS
https://clickhouse.com
Apache License 2.0
37.64k stars 6.91k forks source link

replxx: if I press Ctrl+V instead of Ctrl+Shift+V, and then correct myself and press Ctrl+Shift+V, strange escape sequences are pasted #58977

Open alexey-milovidov opened 10 months ago

alexey-milovidov commented 10 months ago

Use case

:) ^[[200~Hello, world^[[201~
azat commented 10 months ago

What terminal do you use? I don't have such problems in kitty

Algunenano commented 10 months ago

Doesn't this happen also outside of clickhouse's term? At least it does in my case:

In both cases I press Ctrl+V and then Ctrl+Shift+V:

/mnt/ch/ClickHouse $ ^[[200~combineFilters~
bash: $'\E[200~combineFilters~': command not found
/mnt/ch/ClickHouse $ clickhouse local
ClickHouse local version 24.1.1.1.

Mordor :) ^[[200~combineFilters^[[201~

Syntax error: failed at position 1 ('

[200~combineFilters

Unrecognized token: '

Mordor :)
azat commented 10 months ago

Yes, it does, it is bracketed-paste-begin:

It can be disabled - bind 'set enable-bracketed-paste off', but not in clickhouse-client, since it is explicitly enabled - https://github.com/ClickHouse/ClickHouse/blob/facbd89d4867b246762d8cb82cde2691b2f90200/src/Client/ClientBase.cpp#L2470-L2475

Refs: https://github.com/AmokHuginnsson/replxx/pull/67 (cc @amosbird )

P.S. by some reason when I tested this previously I did not get bracketed paste symbols, while now I do.

alexey-milovidov commented 9 months ago

@azat Can we prevent rendering these symbols in the input line?

azat commented 9 months ago

Can we prevent rendering these symbols in the input line?

You mean strip them? I thought about this, but it is tricky, since you cannot do this if you are pasting into an open string.