Irritating prompt that asks "keep pipe" in Kakoune #20617

Closed
opened 2026-01-31 07:19:09 +00:00 by claunia · 11 comments
Owner

Originally created by @a12l on GitHub (Oct 3, 2023).

Windows Terminal version

Version: 1.17.11461.0

Windows build number

10.0.19044.3448

Other Software

Kakoune v2023.08.05 (inside WSL)

Steps to reproduce

  1. Start Kakoune and a buffer name as an argument, for example kak foo.

Expected Behavior

Kakoune showing up after pressing fg as-was when putting it into the background.

Actual Behavior

Irritating prompt that asks "keep pipe".

Originally created by @a12l on GitHub (Oct 3, 2023). ### Windows Terminal version Version: 1.17.11461.0 ### Windows build number 10.0.19044.3448 ### Other Software Kakoune v2023.08.05 (inside WSL) ### Steps to reproduce 1. Start Kakoune and a buffer name as an argument, for example `kak foo`. ### Expected Behavior Kakoune showing up after pressing `fg` as-was when putting it into the background. ### Actual Behavior Irritating prompt that asks "keep pipe".
claunia added the Needs-TriageIssue-BugNeeds-AttentionNeeds-Repro labels 2026-01-31 07:19:09 +00:00
Author
Owner

@lhecker commented on GitHub (Oct 3, 2023):

Why do you believe that this is a bug with Windows Terminal instead of Kakoune for instance?

@lhecker commented on GitHub (Oct 3, 2023): Why do you believe that this is a bug with Windows Terminal instead of Kakoune for instance?
Author
Owner

@a12l commented on GitHub (Oct 3, 2023):

Why do you believe that this is a bug with Windows Terminal instead of Kakoune for instance?

Was going to add more information, but something came in between. Sorry!

I believe this is a Windows Terminal problem because Kakoune registers key presses that I don't make.

To see what happens, I do this

  1. Start Kakoune, with a buffer name, and the key debug option enabled. For example, kak -debug keys foo
  2. Observe the problem (see picture 1).

Annotation 2023-10-03 112510

  1. Switch to the *debug* buffer inside Kakoune with the kak command :b *debug*.
    It will now contain
*** This is the debug buffer, where debug info will be written ***
Client 'client0' got key '<a-[>'
Client 'client0' got key '0'
Client 'client0' got key '$'
Client 'client0' got key 'y'
Client 'client0' got key '<esc>'		// Pressed to close `keep pipe:y`, otherwise it captures all keyboard inputs
Client 'client0' got key ':'			// Begin enter the command `:b *debug*`
Client 'client0' got key 'b'
Client 'client0' got key '<space>'
Client 'client0' got key '*'
Client 'client0' got key 'd'
Client 'client0' got key 'e'
Client 'client0' got key 'b'
Client 'client0' got key 'u'
Client 'client0' got key 'g'
Client 'client0' got key '*'
Client 'client0' got key '<ret>'		// Execute the command `:b *debug*`
[...]

The problem does not occur if I run kak inside tmux (installed from Nixpkgs).

The problem seem to only occur with Kakoune installed from Nixpkgs [https://nixos.org/]. The problem don't seem to occur when I use Kakoune from the Ubuntu repositories. I've not noticed this problem when I'm using kak from Nixpkgs on a non-Nixos system, i.e., this seems to only occur in WSL/Windows terminal. I'm using Ubuntu 22.04 (installed via Windows Store).

The problem occur very often, but not always.

@a12l commented on GitHub (Oct 3, 2023): > Why do you believe that this is a bug with Windows Terminal instead of Kakoune for instance? Was going to add more information, but something came in between. Sorry! I believe this is a Windows Terminal problem because Kakoune registers key presses that I don't make. To see what happens, I do this 1. Start Kakoune, with a buffer name, and the key debug option enabled. For example, `kak -debug keys foo` 2. Observe the problem (see picture 1). ![Annotation 2023-10-03 112510](https://github.com/microsoft/terminal/assets/38804798/0008c238-d462-438a-b313-346e4c8adc90) 3. Switch to the `*debug*` buffer inside Kakoune with the `kak` command `:b *debug*`. It will now contain ``` *** This is the debug buffer, where debug info will be written *** Client 'client0' got key '<a-[>' Client 'client0' got key '0' Client 'client0' got key '$' Client 'client0' got key 'y' Client 'client0' got key '<esc>' // Pressed to close `keep pipe:y`, otherwise it captures all keyboard inputs Client 'client0' got key ':' // Begin enter the command `:b *debug*` Client 'client0' got key 'b' Client 'client0' got key '<space>' Client 'client0' got key '*' Client 'client0' got key 'd' Client 'client0' got key 'e' Client 'client0' got key 'b' Client 'client0' got key 'u' Client 'client0' got key 'g' Client 'client0' got key '*' Client 'client0' got key '<ret>' // Execute the command `:b *debug*` [...] ``` The problem does not occur if I run `kak` inside `tmux` (installed from Nixpkgs). The problem seem to only occur with Kakoune installed from Nixpkgs [https://nixos.org/]. The problem don't seem to occur when I use Kakoune from the Ubuntu repositories. I've not noticed this problem when I'm using `kak` from Nixpkgs on a non-Nixos system, i.e., this seems to only occur in WSL/Windows terminal. I'm using Ubuntu 22.04 (installed via Windows Store). The problem occur very often, but not always.
Author
Owner

@lhecker commented on GitHub (Oct 3, 2023):

I've never used Kakoune so I can't really tell what you mean with "registers key presses that I don't make". What kind of key presses? Are they visible in the above text block?

Kakoune's documentation states that <a-[> is for

select to the inner object start

so I'm assuming you pressed that yourself.

So are these 2 the keys you didn't press?

Client 'client0' got key '0'
Client 'client0' got key '$'
@lhecker commented on GitHub (Oct 3, 2023): I've never used Kakoune so I can't really tell what you mean with "registers key presses that I don't make". What kind of key presses? Are they visible in the above text block? Kakoune's documentation states that `<a-[>` is for > select to the inner object start so I'm assuming you pressed that yourself. So are these 2 the keys you didn't press? ``` Client 'client0' got key '0' Client 'client0' got key '$' ```
Author
Owner

@a12l commented on GitHub (Oct 3, 2023):

I've never used Kakoune so I can't really tell what you mean with "registers key presses that I don't make". What kind of key presses? Are they visible in the above text block?

Sorry for being unclear, unused to describe Kakoune problems to non-Kakoune users. Hope this will make it more clear!

I see now that the -debug flag doesn't seem to be documented anywhere. From what I understand, if you run kak -debug keys Kakoune will write out all "key press events" it gets into its *debug* buffer. For example, if I start Kakoune with kak -debug keys and switch to the *debug* buffer, and every key I press will result in a new line being added to the *debug* buffer.

Kakoune's documentation states that <a-[> is for

select to the inner object start

so I'm assuming you pressed that yourself.

So are these 2 the keys you didn't press?

The first key I press is <esc>, i.e. all key press events above Client 'client0' got key '<esc>' in the above list

Client 'client0' got key '<a-[>'
Client 'client0' got key '0'
Client 'client0' got key '$'
Client 'client0' got key 'y'

are key events that Kakoune register, but I've not pressed any of these keys.

@a12l commented on GitHub (Oct 3, 2023): > I've never used Kakoune so I can't really tell what you mean with "registers key presses that I don't make". What kind of key presses? Are they visible in the above text block? Sorry for being unclear, unused to describe Kakoune problems to non-Kakoune users. Hope this will make it more clear! I see now that the `-debug` flag doesn't seem to be documented anywhere. From what I understand, if you run `kak -debug keys` Kakoune will write out all "key press events" it gets into its `*debug*` buffer. For example, if I start Kakoune with `kak -debug keys` and switch to the `*debug*` buffer, and every key I press will result in a new line being added to the `*debug*` buffer. > Kakoune's documentation states that `<a-[>` is for > > > select to the inner object start > > so I'm assuming you pressed that yourself. > > So are these 2 the keys you didn't press? The first key I press is `<esc>`, i.e. all key press events above `Client 'client0' got key '<esc>'` in the above list ``` Client 'client0' got key '<a-[>' Client 'client0' got key '0' Client 'client0' got key '$' Client 'client0' got key 'y' ``` are key events that Kakoune register, but I've not pressed any of these keys.
Author
Owner

@j4james commented on GitHub (Oct 3, 2023):

FYI, this looks like a DECRPM response.

Client 'client0' got key '<a-[>'
Client 'client0' got key '0'
Client 'client0' got key '$'
Client 'client0' got key 'y'

The CSI introducer \x1b[ is the same as the key sequence for Alt+[, so that's where the <a-[> comes from, and $y is the id of the DECRPM sequence.

And according to this Kakoune commit, it does use a DECRQM query to detect mode ?2026 support, so it's possible this is expected to be seen in the logs. Technically that response should have also had 2026 as one of the sequence parameters, but maybe the log isn't showing everything.

I think the Kakoune devs may be in a better position to determine what's actually happening here, and whether it's a bug or not.

@j4james commented on GitHub (Oct 3, 2023): FYI, this looks like a `DECRPM` response. ``` Client 'client0' got key '<a-[>' Client 'client0' got key '0' Client 'client0' got key '$' Client 'client0' got key 'y' ``` The CSI introducer `\x1b[` is the same as the key sequence for <kbd>Alt</kbd>+<kbd>[</kbd>, so that's where the `<a-[>` comes from, and `$y` is the id of the `DECRPM` sequence. And according to [this Kakoune commit](https://github.com/mawww/kakoune/commit/60165bacf93a6625571c38cc8ab7ea182b5b1dec), it does use a `DECRQM` query to detect mode ?2026 support, so it's possible this is expected to be seen in the logs. Technically that response should have also had 2026 as one of the sequence parameters, but maybe the log isn't showing everything. I think the Kakoune devs may be in a better position to determine what's actually happening here, and whether it's a bug or not.
Author
Owner

@DHowett commented on GitHub (Oct 11, 2023):

I think the Kakoune devs may be in a better position to determine what's actually happening here, and whether it's a bug or not.

I agree with this. Would you mind bringing this issue over to their repo, @a12l? Thank you.

@DHowett commented on GitHub (Oct 11, 2023): > I think the Kakoune devs may be in a better position to determine what's actually happening here, and whether it's a bug or not. I agree with this. Would you mind bringing this issue over to their repo, @a12l? Thank you.
Author
Owner

@mawww commented on GitHub (Oct 12, 2023):

From a quick look here, it sounds like the DECRPM response from the terminal is missing the private mode marker ?. I do not have access to any windows box but I am curious what Windows Terminal responds to printf '\033[?2026$p'.

@mawww commented on GitHub (Oct 12, 2023): From a quick look here, it sounds like the `DECRPM` response from the terminal is missing the private mode marker `?`. I do not have access to any windows box but I am curious what Windows Terminal responds to `printf '\033[?2026$p'`.
Author
Owner

@j4james commented on GitHub (Oct 12, 2023):

I am curious what Windows Terminal responds to printf '\033[?2026$p'.

You need something like a read after that to see the full response, otherwise the start will be eaten by the shell, but it definitely includes the question mark in the DECRPM response when required. See here:

image

@j4james commented on GitHub (Oct 12, 2023): > I am curious what Windows Terminal responds to `printf '\033[?2026$p'`. You need something like a `read` after that to see the full response, otherwise the start will be eaten by the shell, but it definitely includes the question mark in the `DECRPM` response when required. See here: ![image](https://github.com/microsoft/terminal/assets/4181424/104738ed-2679-4513-98c7-cfe72c6057e1)
Author
Owner

@j4james commented on GitHub (Oct 12, 2023):

@mawww My one thought was that OP may have been using an older version of Kakoune that had a bug in the DECRPM handler. I saw there was a commit at some point that was related to the DECRPM parsing (0f688656a4), but I didn't think that was likely to have caused an issue like this.

@j4james commented on GitHub (Oct 12, 2023): @mawww My one thought was that OP may have been using an older version of Kakoune that had a bug in the `DECRPM` handler. I saw there was a commit at some point that was related to the `DECRPM` parsing (https://github.com/mawww/kakoune/commit/0f688656a487fdb2e7d0772de82dd6941418bf67), but I didn't think that was likely to have caused an issue like this.
Author
Owner

@mawww commented on GitHub (Oct 13, 2023):

I get the same response in foot here, so yeah, could be that OP is using an old Kakoune version. Another possibility is that for some reason we do not get the whole CSI content available atomically on Kakoune's side.

@mawww commented on GitHub (Oct 13, 2023): I get the same response in foot here, so yeah, could be that OP is using an old Kakoune version. Another possibility is that for some reason we do not get the whole CSI content available atomically on Kakoune's side.
Author
Owner

@tom-huntington commented on GitHub (Nov 11, 2023):

I'm still getting this after upgrading to Ubuntu 22, and building kakoune from source Only on 21H2 though.

Notably it doesn't happen everytime, only about 50% of the time.

Also, this only became a problem after changes on the windows side. When I first originally build kakoune, this was not happening.

@tom-huntington commented on GitHub (Nov 11, 2023): I'm still getting this after upgrading to Ubuntu 22, and building kakoune from source Only on 21H2 though. Notably it doesn't happen everytime, only about 50% of the time. Also, this only became a problem after changes on the windows side. When I first originally build kakoune, this was not happening.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20617