You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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()
The text was updated successfully, but these errors were encountered:
I don't even have to reproduce this to know it's there ;) Thanks for the very detailed report!
Although the proposed fix resolves the problem it removes the feature that I use daily. You can start writing next statement[s] while the previous one is still being evaluated and is producing output:
>>> import time
>>> for x in range(10):
... time.sleep(1)
... print(x)
...
0
1
2
3
4
5
print("Hello")
6
7
8
9
>>> Hello
>>> print("Hello2")
Hello2
>>>
I think overriding "translate_tabs_to_spaces" in ReplView should fix this w/o introducing the described regression.
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
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
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
The text was updated successfully, but these errors were encountered: