Python Python Basics Types and Branching String Methods

How to go back and re-write words on the console without substituting what have already been written beforehand.

How to go back and re-write words on the console without substituting what have already been written beforehand. I write a bunch of commands on my console and then I want to go back and fix something, but every time I go back I can not write new commands in the same line, all it does is substitute the words written beforehand by erasing them and putting in what I wrote in their place . I need to erase the whole prior command to make a new one because I can't edit. Please how can I fix this issue?

I need help because I do not want to keep erasing the string and the rest all the time when I want to edit something.

Thank You

Chris Freeman
Chris Freeman
Treehouse Moderator 56,648 Points

Feedback set to developers: Workspace bash command line editing has an text overwrite bug in emacs mode (the default), but works in set -o vi mode.

To recreate, Use ctrl-b to back over multiple words, then type text to insert. Insertion is done, but the display is overwritten. Need to hit up-arrow, down-arrow to see actual inserted text and original text.

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 56,648 Points

By default the command line editing has been set to emacs style editing. As you've noted, this is not working correctly, in that, the insert appears to overwrite characters but does not actually do so. This actual text can be seen with an up-arrow, down-arrow to reset the current line buffer to what is actually there. (yes, a bad workaround)

Vi style editing can be set with the command set -o vi. This mode appears to correctly if that is your preference. Cheatsheet available here

Thanks