-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Summary: Tokenization errors don't work nicely with shell integration, at least as implemented on DomTerm. A possibly fix to for Fish to emit a fish_postexec event in this situation.
To reproduce, type a lone right-parenthesis and then Enter. Fish prints the error fish: Unexpected ')' for unopened parenthesis and then re-displays the prompt and incorrect input, ready for editing. Fish calls fish_prompt function, but does not emit any events that I can see.
This causes a problem for shell integration, because it looks like a regular re-display during input editing. In such a situation, DomTerm moves the cursor to the start of the "current" editing area - i.e. what Fish thinks is the previous input area. The reason for this is that it is impossible for Fish to correctly move to the start of the input area if the window resizes, so when "start prompt" is received, DomTerm ignores wherever Fish has moved the cursor to, and overrides the cursor to move it to the start of the input area. (The reason Fish cannot correctly move the cursor is that it cannot know the line width of the terminal when its re-display escape sequences are received by the terminal - the width may have changed again.)
There are various ways to fix or work-around this problem. The simplest (though untested) may be for fish to emit fish_postexec after the error message. This seems consistent with the documentation: "This event will be emitted even if the command is invalid."
Fish version: 3.1.0-439-g69afb1b56
OS: Fedora Linux 31
Terminal: DomTerm (git trunk)