Option+click cannot move the cursor to a previous line of a wrapped command in fish shell #4793
Unanswered
pfgithub
asked this question in
Ideas and Issue Triage
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Option click (cursor-click-to-move) tries to use the up arrow and left and right arrows to navigate the cursor to the target position. With a command that is very long and wraps in fish shell, the up arrow can't be used and it will just flash the prompt white (or even switch to the previous command). The default macos terminal moves the cursor successfully in this case.
Reproduction:
Use fish shell. Make the window small and type a long command that wraps:
Option+click part of the command on the first line. The command flashes but the cursor doesn't move to that line.
Try the same thing on the built in macos terminal and the cursor moves succesfully
Cause:
I believe this is because the macos terminal will only use the left/right arrow to move the cursor within a line if the line was wrapped automatically by the terminal:
In this case, option clicking on the first line in macos terminal will first send an up arrow (
\x1b[A
and then left/right to move to the target)In this case, option clicking on the first line will send lots of left arrows to get to the first line (
\x1b[D\x1b[D\x1b[D\x1b[D\x1b[D...
) and not send any up/down arrowsTest script
node option-click-tester.js
press any key to show the prompt, make the terminal window small so the line wraps, and then option+click on the top part of the line. it sends left/right arrows only to move the cursor.
try the same thing but with
\n
in the process.stdout.write. it uses\x1b[A
instead.Beta Was this translation helpful? Give feedback.
All reactions