Unexpected behaviour when setting tab stops #140
Labels
Product-Conhost
For issues in the Console codebase
Work-Item
It's being tracked by an actual work item internally. (to be removed soon)
Milestone
Microsoft Windows [Version 10.0.16299.309]
I've been experimenting with the various escape sequences for setting tab stops and noticed a number of areas in which the behaviour is different from what I would have expected. This seems largely due to the fact that the default tab stops are treated differently from the manually specified tabs.
If you start with just the default tab stops (every 8 columns), and try to use the single-column tab clear command (TBC) to clear one of those tabs, it appears to have no effect in the Windows console. Example test case:
In a Linux console, the TBC clears the tab stop at column 8 (zero-based), so the x appears in column 16 as expected:
In the Windows 10 console, though, the TBC command has no effect, so the x appears in column 8:
The horizontal tab set (HTS) command is similarly out of sync with the default tab stops. So if you start with the defaults, and try to set an addition tab with HTS, that one tab stop appears to wipe out all the defaults. Example test case:
In a Linux console this adds a tab stop in column 4, leaving the default 8 column tabs unchanged, so you get one x in column 4 and one in column 8:
In the Windows 10 console, the defaults are erased, so while the first x appears in column 4, the second x appears in the rightmost column of the display:
Then there's the all-column TBC, which is supposed to clear all tab stops, but just resets to the defaults in the Windows console. Example test case:
On Linux this works as expected - all tabs are cleared, so the x appears in the rightmost column of the display:
On Windows the tabs are reset to the default positions, so the x appears in column 8:
Now if I really did want to reset the tabs to their defaults, I would have expected the
ESC c
(reset) command to have that effect, but in the Windows console that leaves the most recently set tab stops unchanged. Example test case:This sequence sets a tab in column 4, resets the terminal with
ESC c
, then attempts to output an x in the first tab position. On Linux the tabs are reset to the 8 column defaults, so the x appears in column 8:On Windows the tab stop in column 4 is retained, even after the reset, so the x appears in column 4:
Note that in all of these test cases I'm starting with a combination of
CSI 3g
andESC c
as a cross platform way to reset the tabs before getting to the actual test. If you wanted to be certain of the behaviour, though, it would be preferable to test each sequence from a fresh console.I should also note there are a few other areas where the tab functionality differs from what I would expect, but I thought it best to check first whether the current behaviour is intentionally the way it is, in which case my other complaints would likely be non-issues too.
I'd expect the default tab stops and manual specified tab stops to work in exactly the same way, exhibiting behaviour more in line with what I see in a Linux console. I'd also expect the reset command to reset the tab stops to their default values.
The text was updated successfully, but these errors were encountered: