-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limit right prompt detection logic to the prompt.
Before this change, output containing tabs or otherwise skip characters would trigger the right prompt detection logic, which would then attempt to remove from the yanked text what it sees as part of the prompt. This change restricts right prompt detection to the prompt, the section with bracketed-paste turned on, so that command output is left alone. Fixes #21
- Loading branch information
Showing
2 changed files
with
25 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
144b651
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it legal for a program to enable bracketed paste mode after printing the prompt? Aren't there more explicit prompt-marking control codes?
144b651
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There aren't any official prompt-marking control codes; this is just not a concept in a terminal. Shells and commands do whatever they want in whatever way they want as long as it eventually looks and feels reasonable to users.
This is a heuristic MisTTY uses, one of many. Bracketed past mode on and fullscreen mode off indicates that a specific region of the screen accepts user input - that's what a prompt basically is. This particular heuristic seems to work for at least recent version of bash, zsh and fish (older versions didn't support bracketed paste mode).
There are absolutely no doubts that some shells or command out there violate this heuristic - just like all heuristics MistTTY is built on.