-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
[konsole] Doesn't work with semantic integration (mouse click to position cursor) in KDE's Konsole #391
Comments
Thank you for the report. I tried to see the problem, but so far I couldn't have managed to make it work even without ble.sh. Testing with plain Bash (without ble.sh)I tried it with Konsole 23.08.4 on Fedora 39 Server. The mentioned script was inserted into the prompt when I press Ctrl-Alt-]. After running the script by hitting Enter, I start to see some red and blue bars on the left edge of the terminal display. The red bar seems to indicate the prompt and output of the failed command. The blue bar seems to show the recently added terminal lines. However, clicking on the command line doesn't seem to move the cursor position. Also, Ctrl-Shift-PageUp and Ctrl-Shift-PageDown mentioned in the link you provided doesn't seem to work properly; it somehow scrolls the terminal buffer, but the destination of the scroll seems to be random and doesn't seem to move between the prompts. I also tried DomTerm's Ah, OK. It turned out that I needed to enable the mouse click feature in [Settings]-[Profiles]-[General]-[Semantic Integration]. |
With this setting in Konsole, I don't see any problem both with and without ble.sh. It seems to work in every 3x2 case of (
It doesn't seem to reproduce in my environment. When I put those lines (suggested by Konsole's Ctrl-Alt-]) in Since the reported behavior without ble.sh seems already strange, I suspect some of the custom settings in your
|
@akinomyoga It's a bit odd, but if I have only the semantic integration code (no ble.sh) in my .bashrc, mouse click to position cursor doesn't work. If I add an echo then it works eg.
Do you need any echo or other lines before the semantic integration code in your .bashrc (without ble.sh)? I'm running Kubuntu 23.10. |
OK, interesting. I can reproduce this behavior. Indeed, the mouse click doesn't work for the first command unless we specify |
I think this is a bug of Konsole. When I click somewhere in the terminal display, a Qt signal for the mouse click is emitted on
The problem is that, when somewhere on the first line is clicked, Then, I noticed that the other lines calling the mouse signal add 1 to its arguments [4], but only the mouse signal for the semantic mouse click lacks the addition of 1. Therefore, I think we should add 1 to the second and third arguments on line 1231 [1]. The code was introduced in Konsole by commit ccd56f20 (MR !702) [5,6].
I quickly checked if there are any existing reports or patches [7-9] but couldn't find any if I didn't miss it. It's a bit surprising that no one has ever noticed it until now. The report [10] is possibly caused by the same issue of shifted |
I've created a fix at Ref. [1]: I'm going to test this. Probably we would need adjustments in the cursor movement calculations at the receiver side. |
I submitted MR !951 to the upstream Konsole. The next release cycle of KDE is 2024-02, so hopefully it will be fixed in the release next month. If it's too late, I think it would be delayed until the 2024-08 release, unfortunately. |
Thank you for looking into that and even more for making the effort to submit a fix to Konsole. In the meantime, I managed to get semantic integration, Bash-It and ble.sh working by adding the following after the stuff Bash-It automatically added to my .bashrc (and not using the Bash-it ble.sh plugin):
I was not able to get semantic integration to work using the recommended approach (with ble-attach etc.). I have no idea why. |
Could you give me an example of a case where the semantic integration does not work? I tried many patterns, but I couldn't find a case. In all the cases I tried, the semantic integration works (except on the first line where Konsole has a bug). Basically, the recommended ordering is sourcing ble.sh at the beginning of bashrc and perform # bashrc
source /path/to/ble.sh/out/ble.sh --norc --attach=none
source /path/to/rcaloras/bash-preexec/bash-preexec.sh
source /path/to/PerBothner/DomTerm/tools/shell-integration.bash
ble-attach I also tried the following with Bash-it, but the semantic integration still works. # bashrc
# Settings for Bash-it
BASH_IT=/path/to/Bash-it/bash-it
export BASH_IT_THEME='bobby'
export GIT_HOSTING='[email protected]'
unset MAILCHECK
export IRC_CLIENT='irssi'
export TODO="t"
export SCM_CHECK=true
source /path/to/ble.sh/out/ble.sh --norc --attach=none
source /path/to/Bash-it/bash-it/bash_it.sh
source /path/to/rcaloras/bash-preexec/bash-preexec.sh
source /path/to/PerBothner/DomTerm/tools/shell-integration.bash
ble-attach The version of bash-preexec bundled with DomTerm seems to be old, so I also tried the bash-preexec bundled with DomTerm as follows, but the result is unchanged. The semantic integration is still working. # bashrc
source /path/to/ble.sh/out/ble.sh --norc --attach=none
source /path/to/PerBothner/DomTerm/tools/bash-preexec.sh
source /path/to/PerBothner/DomTerm/tools/shell-integration.bash
ble-attach I also tried the blesh plugin of Bash-it, but the semantic integration still works: # bashrc
# Settings for Bash-it
BASH_IT=/path/to/Bash-it/bash-it
export BASH_IT_THEME='bobby'
export GIT_HOSTING='[email protected]'
unset MAILCHECK
export IRC_CLIENT='irssi'
export TODO="t"
export SCM_CHECK=true
# Note: blesh plugin is enabled by "bash-it enable plugin blesh"
source /path/to/Bash-it/bash-it/bash_it.sh
source /path/to/rcaloras/bash-preexec/bash-preexec.sh
source /path/to/PerBothner/DomTerm/tools/shell-integration.bash
ble-attach I checked other ordering where ble.sh is not sourced at the beginning with and without Bash-it, but both cases work for the semantic integration. # bashrc
source /path/to/rcaloras/bash-preexec/bash-preexec.sh
source /path/to/PerBothner/DomTerm/tools/shell-integration.bash
source /path/to/ble.sh/out/ble.sh --norc --attach=none
ble-attach # bashrc
# Settings for Bash-it
BASH_IT=/path/to/Bash-it/bash-it
export BASH_IT_THEME='bobby'
export GIT_HOSTING='[email protected]'
unset MAILCHECK
export IRC_CLIENT='irssi'
export TODO="t"
export SCM_CHECK=true
source /path/to/Bash-it/bash-it/bash_it.sh
source /path/to/ble.sh/out/ble.sh --norc --attach=none
source /path/to/rcaloras/bash-preexec/bash-preexec.sh
source /path/to/PerBothner/DomTerm/tools/shell-integration.bash
ble-attach On the other hand, |
I have tested more. I've removed all the stuff Kubuntu put in my .bashrc and simplified as a starting point.
That works perfectly.
No bash it. Only works after I press Enter ie. not working on first line.
No bash it or blesh. Only works after I press Enter ie. not working on first line.
Like 1, but launching ble.sh the proper way. Works on first line, but not on subsequent lines after pressing Enter.
Like 2 (no bash it), but launching ble.sh the proper way. Only works after I press Enter ie. not working on first line. |
Thank you. OK, I can reproduce the problem in case 4. I haven't checked the behavior in the second or later prompt. I'll take a look. For the other cases, case 1 is just fine. The behaviors in cases 2, 3, and 5 should be fixed by MR !951 that I submitted to Konsole. |
I fixed it in commit 50af4d9. Could you update ble.sh by running Note that the issue that the sematic click doesn't work on the first line is not solved at the ble.sh's side. If you want to use the sematic click on the first line, you may pick a patch at MR !951 and build Konsole by yourself. Here's the summary of the issue: Actually, ble.sh has an integration with bash-preexec, which was originally written two years before, but that integration was broken after the two years. There were mainly two causes: one was a change in the upstream bash-preexec, which is ironically submitted by me. The other was the change of the treatment of |
I can confirm that option 4 works perfectly now like option 1. It works on the first line and on subsequent lines. Thanks so much for looking into this! |
Thanks for the confirmation! I'm closing the issue now. Thank you again for raising the issue. |
ble version: 29cd8f1
Bash version: 5.2.15(1)-release (x86_64-pc-linux-gnu)
Thanks for a great project!
KDE's Konsole supports semantic integration. This allows clicking the left mouse button to position the cursor in Bash. I am not able to get this to work with ble.sh unfortunately.
It is activated by adding this to .bashrc:
In the Konsole, you press Ctrl+Alt+I then search for "semantic integration" and put what appears there (the lines above) in your .bashrc to make it permanent.
I found that although those lines executed manually in bash in Konsole worked fine temporarily, they would not work in .bashrc, but I got it working by adding these lines at the end of my .bashrc instead:
bash-preexec.sh and shell-integration.bash are copied from another terminal called DomTerm (the first I'm aware of to offer click to position cursor) into ~/.local/share/DomTerm. Those files can be found here. cc @PerBothner: I think you may be interested in this topic.
I have click to position cursor working with Konsole and bash-it. I'd love to get it working with ble.sh as well. An increasing number of terminal emulators offer click to position cursor in bash (Konsole, Domterm, Kitty are the ones I've come across).
The text was updated successfully, but these errors were encountered: