nvbn / thefuck

Magnificent app which corrects your previous console command.
MIT License
84.92k stars 3.43k forks source link

Change USER_COMMAND_MARK #1447

Closed olavfla closed 4 months ago

olavfla commented 4 months ago

Change USER_COMMAND_MARK to include escape characters so that the non-printing characters are not counted towards prompt length.

olavfla commented 4 months ago

Without this, experimental instant mode has an issue where line breaks occur 10 characters too early, making the terminal a bit wonky. Only tested with one terminal though

olavfla commented 4 months ago

On a slightly related note, in def instant_mode_alias(self, alias_name) in shells/bash.py, is it really necessary with the backspaces in mark = USER_COMMAND_MARK + '\b' * len(USER_COMMAND_MARK)? In my experience, it works just fine without them, and fucks up if anything appends something to the start of PS1 (such as enabling a python venv).