wuub/SublimeREPL — Issue #22: Output that contains tabs causes problems when replaced by spaces
Author: inkytonik
Created: 2012-03-05 09:06:25+00:00
State: open

It appears that shell command output containing tab characters causes the output end position to be messed up when those tabs are replaced by spaces by Sublime Text 2. I.e., when the

"translate_tabs_to_spaces": true

setting is present for text files (or default).

I can reproduce it on my Mac by running the SublimeREPL | Shell command to get a bash REPL, then running "ls -C /etc". This command uses tabs to separate the columns of output. The output is fine, but then when I do (say) a "w" command next, it thinks that the command starts in the middle of the "ls -C" output rather than at the last prompt.

I think the problem is caused by

self._output_end += len(unistr)

in ReplView.write() in sublimerepl.py since that statement assumes that the number of characters in the command output is equal to the position adjustment in the buffer, which is not true if tabs have been replaced by spaces when the output is inserted into the buffer.

It seems to be fixed by replacing that line with

self._output_end = self._view.size()