Menu

#244 bash incremental search adds escape characters when using arrow keys

1.0
open
nobody
bash (1)
2016-02-20
2016-02-18
No

Hi,

When using an inline-search in bash (by press ctrl + r) normal behaviour that I've encountered when using the arrow keys after typing a search query is to end the search and perform the movement command.

In Msys2 this does not happen all of the time when running bash in a Windows terminal (such as by just executing bash.exe). There seems to be an intermittent problem that causes bash to insert the character escape key (i.e. [A [B [C or [D) instead of moving the cursor and then ending the search. I can't seem to find any consistency into why this happens but it seems to be about 25-30% of the time for me. Other movement commands such as ctrl+a or ctrl+e seem to work fine, although maybe it's just sample size.

This does not happen in mintty.exe that ships with Msys2 that I can see, so I've tried importing as many bindings and environment variables from the mintty shell into the Windows shell but without any luck.

Discussion

  • Yoshi Spendiff

    Yoshi Spendiff - 2016-02-18

    This issue was created as a result of the discussion here: https://github.com/git-for-windows/git/issues/353

     
  • David Macek

    David Macek - 2016-02-20

    Testing on Windows 10.

    I played with this a bit and it seems that the code is printed only if the arrow key is pressed for too long, so it may be some timing issue. When I try to hit the key very quickly, the code doesn't appear, but when I keep the key pressed for even a bit longer (still well within the standard key hit time though), the code appears. Can you confirm?

    About the issue in general, I have no idea. I'm not even sure these things are expected to work at all in the Windows console.

    Noting that the behavior seems to be the same on Cygwin...

     
  • Yoshi Spendiff

    Yoshi Spendiff - 2016-02-20

    I can confirm that the key press duration happens for me as well. So short press won't print a character and long press will.
    If I hold down the arrow then the character will print, there's a short delay and then the cursor starts moving.

     
MongoDB Logo MongoDB