-
-
Notifications
You must be signed in to change notification settings - Fork 973
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable partial preprompt updates when possible
This commit adds a third mode to the preprompt update: number of lines between previous and current preprompt are equal. We then compare the preprompts, part-by-part, to find the first part that differs. From this we can calculate the offset of the update. Since "%~" is the only prompt substitution we use in the preprompt, we now expand it in-place so that we get comparable preprompts from the get-go. The preprompt was also turned into an array (preprompt_parts) to allow comparing the different parts in the prompt. NOTE: We previously used `ESC[${COLUMNS}G` to make sure the cursor is at the beginning of the line. Turns out this does not work as expected with prompts that occupy multiple lines due to small terminal size or long paths. The thought was that it would stop moving the cursor when the first column of the line was reached, however, it seems it can continue on to the following line. For the above reason, we no use `ESC[1G` to move the cursor into the first column. This is not part of ANSI.SYS, however, and might not be supported by all terminal emulators. Works in Terminal, iTerm, Hyper. Does not work in Emacs ansi-term. One way to fix this is to fetch the current cursor position from ZLE using a ZLE widget. If we know the starting position, we can calculate the rest.
- Loading branch information
Showing
1 changed file
with
86 additions
and
33 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