Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab as last character on terminal not displayed #1020

Closed
faramir opened this issue Jul 10, 2020 · 5 comments
Closed

Tab as last character on terminal not displayed #1020

faramir opened this issue Jul 10, 2020 · 5 comments
Labels

Comments

@faramir
Copy link

faramir commented Jul 10, 2020

There is buf (I think it is regression from 3.1.4) on mintty 3.2.0 (x86_64-pc-cygwin) [Windows 19041].

In cygwin/bash (terminal size 80x25) type command:
for i in `seq 10 50`; do echo -ne "$i$i.$i\t"; done
The output is:

1010.10 1111.11 1212.12 1313.13 1414.14 1515.15 1616.16 1717.17 1818.18 1919.192
020.20  2121.21 2222.22 2323.23 2424.24 2525.25 2626.26 2727.27 2828.28 2929.293
030.30  3131.31 3232.32 3333.33 3434.34 3535.35 3636.36 3737.37 3838.38 3939.394
040.40  4141.41 4242.42 4343.43 4444.44 4545.45 4646.46 4747.47 4848.48 4949.495
050.50

but should be:

1010.10 1111.11 1212.12 1313.13 1414.14 1515.15 1616.16 1717.17 1818.18 1919.19 
2020.20 2121.21 2222.22 2323.23 2424.24 2525.25 2626.26 2727.27 2828.28 2929.29 
3030.30 3131.31 3232.32 3333.33 3434.34 3535.35 3636.36 3737.37 3838.38 3939.39 
4040.40 4141.41 4242.42 4343.43 4444.44 4545.45 4646.46 4747.47 4848.48 4949.49 
5050.50

The problem is with the last tab (when the 1 char left) on line.
Changing command to (\t changed to ):
for i in `seq 10 50`; do echo -ne "$i$i.$i "; done
produces proper output:

1010.10 1111.11 1212.12 1313.13 1414.14 1515.15 1616.16 1717.17 1818.18 1919.19 
2020.20 2121.21 2222.22 2323.23 2424.24 2525.25 2626.26 2727.27 2828.28 2929.29 
3030.30 3131.31 3232.32 3333.33 3434.34 3535.35 3636.36 3737.37 3838.38 3939.39 
4040.40 4141.41 4242.42 4343.43 4444.44 4545.45 4646.46 4747.47 4848.48 4949.49 
5050.50

Changing terminal size to 81x25 also produces right output.

@mintty
Copy link
Owner

mintty commented Jul 10, 2020

It's not a regression, it has always been like this and behaviour is consistent with xterm.
It's related to the "pending wrap position" behaviour of DEC terminals (which is admittedly a bit weird).

@faramir
Copy link
Author

faramir commented Jul 11, 2020

OK, so are there any workarounds to have that behaviour changed, that tab is at least one char long or start at the position mod 8 == 0?

@mintty
Copy link
Owner

mintty commented Jul 11, 2020

It's related to the "pending wrap position" behaviour of DEC terminals

Actually, it's due to the fact that TAB does not set the "pending wrap" state. It could be checked with VT100 whether that's really the original behaviour (or checked in xterm documentation whether there is a comment on this already).

@avih
Copy link
Contributor

avih commented Jul 11, 2020

The output is:

1010.10 1111.11 1212.12 1313.13 1414.14 1515.15 1616.16 1717.17 1818.18 1919.192
020.20  2121.21 2222.22 2323.23 2424.24 2525.25 2626.26 2727.27 2828.28 2929.293
030.30  3131.31 3232.32 3333.33 3434.34 3535.35 3636.36 3737.37 3838.38 3939.394
040.40  4141.41 4242.42 4343.43 4444.44 4545.45 4646.46 4747.47 4848.48 4949.495
050.50

That's exactly how a real VT102 behaves:

--- LED [ BEEP SCAN LOCAL LOCKED CTS DSR INSERT L1 ] CLK 5668864
 0 ││
 1 ││
 2 │$ bash -c 'for i in `seq 10 50`; do echo -ne "$i$i.$i\t"; done'                 │
 3 │1010.10 1111.11 1212.12 1313.13 1414.14 1515.15 1616.16 1717.17 1818.18 1919.192│
 4 │020.20  2121.21 2222.22 2323.23 2424.24 2525.25 2626.26 2727.27 2828.28 2929.293│
 5 │030.30  3131.31 3232.32 3333.33 3434.34 3535.35 3636.36 3737.37 3838.38 3939.394│
 6 │040.40  4141.41 4242.42 4343.43 4444.44 4545.45 4646.46 4747.47 4848.48 4949.495│
 7 │050.50  $                                                                       │
 8 │                                                                                │
 9 │                                                                                │
10 │                                                                                │
11 │                                                                                │
12 │                                                                                │
13 │                                                                                │
14 │                                                                                │
15 │                                                                                │
16 │                                                                                │
17 │                                                                                │
18 │                                                                                │
19 │                                                                                │
20 │                                                                                │
21 │                                                                                │
22 │                                                                                │
23 │                                                                                │
24 │                                                                                │
25 │                                                                                │

bash -c because echo -ne is non standard, but bash does support it.
Tested using http://blog.schmorp.de/2015-11-10-emulating-vt102-hardware-in-perl-1.html

@mintty
Copy link
Owner

mintty commented Jul 11, 2020

I was pondering whether to consider an option to make TAB consistent with other characters with respect to auto-wrap behaviour, but on the other hand, TAB is not a printable character so not really comparable. Its common description as horizontal tabulation suggests it advances the cursor only horizontally, thus not having any wrap behaviour associated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants