I'm using the Windows Subsystem for Linux; I don't know if this is relevant. Anyway, suppose I'm running cat at a terminal, and I enter 2.718\te
where \t
is an actual tab character. The screen now looks like this: 2.718 e
. Now I realize I made a mistake, and I should give a few more digits of precision. (Whatever, this example is made up. The point is that I make mistakes when typing.) This should be easy: my keyboard has a backspace key :) I hit it once, and the e
disappears. So far so good. I hit it again and ... one space disappears. I hit it one more time, and one more space disappears, even though by now I should have erased the 8. I now press enter, and cat echoes back at me... 2.71
. So, apparently, I did erase the 8, but the contents of my screen got de-synched from the ground truth in the terminal driver.
So, my question is why. More importantly, what to do about it?
\t
character. You can check this by saving the output to a file and runningod -c file
. You should see that there are spaces there and not a\t
. – terdon Oct 17 '16 at 10:45cat > t.txt
, followed bywc
. It is NOT being expanded to spaces. – Mark VY Oct 17 '16 at 18:32readline
implementation on Windows does so then. Could you confirm withcat file | od - c
, just in case though? – terdon Oct 17 '16 at 20:10readline
, and this should probably be filed as a bug on the GitHub bug tracker for WSL. – JdeBP Nov 09 '16 at 21:11