-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
[Tilix] Can't paste multiline commands #544
Comments
Which terminal do you use? This seems like a terminal's quirk that sends the raw pasted data without converting the newlines to RET properly. |
This is Tilix, a popular terminal emulator for GNOME. But you're right, the issue doesn't occur on Konsole, the popular terminal emulator for KDE. |
It seems to call |
It seems to be processed in this function call chain.
However, it seems to copy the current selected terminal content to the clipboard. What is relevant now is The conversion from LF (
However, this conversion was introduced in 22 years ago. It is unlikely that your Tilix uses a 23-year-old version of |
What does this mean then ? |
There are three possibilities currently in my mind.
|
Okay, what's the next step ? |
There is actually a suspicious piece of code: I'm going to check how this function is used. |
@KaKi87 I guess edit: If the configuration setting could be searched by a string, the key would probably be " |
Thanks for the confirmation.
This is a bug of Tilix, which fails to implement the correct terminal protocol for pasting. When the option is enabled, it should convert CRLF and LF to CR for the terminal protocol (instead of converting them into LF as it does now). The behavioral difference between Readline and ble.sh is due to the support for the multiline editing mode in Here, of course, ble.sh behaves differently from Readline. As far as you request exactly the same behavior of the line editor for the multiline editing mode, we cannot support any multiline mode. In particular, it is unreasonable to break or limit the multiline editing mode just to reproduce the Readline behavior for broken data fed by an unusual terminal protocol. |
I'm sorry I don't understand where the difficulty is : if bash can consider all of CR/LF/CRLF as newlines, why couldn't ble.sh ? If I was gonna do this in JS for example, I would just replace Thanks |
In short, ble.sh assigns a different feature to C-j for the multiline editing mode. We cannot assign two functions to a single key. |
But I'm not using this shortcut, I'm just pasting something from my browser. |
Yes, then the necessary conversion should have been made by Tilix. |
But that's where my question is : why couldn't ble.sh accept all of CR/LF/CRLF on paste as bash does ? |
Actually, you can configure ble.sh so that it treats the raw LF (the terminal representation of C-j) the same as CR (the terminal representation of C-m and RET) by the following setting: ble-bind -f 'C-j' 'accept-single-line-or-newline' However, this conflicts with the multiline editing; this overwrites the keybinding to execute a command from the multiline editing mode. You need to bind another key to However, I'm not going to make it the default. |
This seems to be already reported in Tilix at gnunn1/tilix#1959. |
I see, so all programs rely on terminal emulators to send only one type of newline format. |
Yes, or the terminal application needs to use a special terminal mode called the bracketed paste mode. The communication between the terminal and the terminal application is not just plain text, but various types of key combinations, application messages, events, etc. are also transmitted there. Then, everything needs to be encoded properly. There are two ways to send the text containing newlines: one is to convert everything to CR, or the other is to quote the entire text with the bracketed-paste-mode begin/end markers (when the terminal detects the support by the application). However, the Tilix sends the raw plain text directly to the terminal application. It is like putting |
@KaKi87 I'm now trying to debug Tilix. I could build and launch Tilix from the source on my machine after solving several problems. However, I have trouble reproducing the reported behavior. How can I paste a text into the terminal so that the problem reproduces? I've found that the context menu, which pops up when I right-click the terminal display area, has an item "Paste". However, this correctly pastes the text; it quotes the pasted text within the bracketed paste markers, or when the bracketed paste mode is disabled, it correctly converts all the newline characters to CR as far as I observe. This is probably the pasting feature From what I observe in the Tilix source code, I guess Tilix has a special UI for pasting text with a dialog or a pane with a textbox, buttons, etc. However, I so far cannot identify how to call the UI. Do you have an idea? |
OK, I could reproduce the problem. I needed to turn on the option of the advanced pasting dialog in the settings. |
To paste any texts, we should call vte's I submitted a PR at gnunn1/tilix#2248. However, it seems the pull requests in Tilix are not processed at all recently. I anticipate it would take time for Tilix to be finally fixed. @KaKi87 If gnunn1/tilix#2248 is not merged soon (and that's likely), one option is to pull and compile the fixed version of Tilix, In my case, it didn't compile with diff --git a/dub.json b/dub.json
index 45f6e0c6..905d9d6c 100644
--- a/dub.json
+++ b/dub.json
@@ -4,7 +4,7 @@
"copyright": "Copyright 息 2016, Gerald Nunn",
"authors": ["Gerald Nunn"],
"mainSourceFile": "source/app.d",
- "dflags-ldc": ["-disable-linker-strip-dead","-link-defaultlib-shared=false"],
+ "dflags-ldc": ["-disable-linker-strip-dead","-link-defaultlib-shared=true"],
"dependencies": {
"gtk-d:gtkd": {
"version": "3.10.0" |
Oh wow, I didn't expect you to invest so much ! In fact, I was planning to investigate switching to another terminal emulator on Pop OS, like Ptyxis. 😅 |
Hello,
Trying to paste multiline commands results in multiple errors that don't occur when ble.sh is disabled :
Thanks
The text was updated successfully, but these errors were encountered: