Replies: 16 comments 9 replies
-
I should have noted that any intervening output fixes things. For example, this batch file works as desired.
|
Beta Was this translation helpful? Give feedback.
-
Just a note ... in this one
which does not work correctly, the terminal is doing exactly what it was asked to do. According to the debug tap, the "do" command produces
which is what we see. Where did the "9" come from? It takes you to column 11 which does not correspond to an old (or new) tab stop. Before the experiment, the tab stops were at 1, 9, 17, et c. And the debug tap does not show the tab_clear and tab_set sequences (though I doubt that seeing them would have been much help). |
Beta Was this translation helpful? Give feedback.
-
My biggest concern is that some process is mucking with the console output mode between when I know that tools that use the Cygwin (or MSYS2 -- it's Cygwin-derived) runtime do do some console mode shenanigans. If you use a tool that isn't |
Beta Was this translation helpful? Give feedback.
-
I doubt anyone is messing with the tab settings and recall you making a change a few years ago so that the tab settings would be remembered when the console goes out_of/back_into VT mode. |
Beta Was this translation helpful? Give feedback.
-
My guess is this is just something writing In the example where you perform the additional |
Beta Was this translation helpful? Give feedback.
-
@j4james , I reckon you're right about that. I can get rid of the problem by, after the grep, clearing the whole buffer or by writing a line of spaces and returning the cursor to column 1; I'll find other ways. Have you any idea what grep (Gnu 32-bit or Cygwin, 64-bit, also Gnu) might be doing? |
Beta Was this translation helpful? Give feedback.
-
I just noticed an And, for my purposes, this works to fix whatever grep does: |
Beta Was this translation helpful? Give feedback.
-
Thanks! I still go here (below). Is there a better place? https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences With regard to whatever grep is doing, clearing one line helps. Are the tabs remembered in the buffer itself? My experience suggests that they're being altered. |
Beta Was this translation helpful? Give feedback.
-
Yeah, but where is it remembered where the tab stops are? Is that somewhere that grep could have corrupted? |
Beta Was this translation helpful? Give feedback.
-
It does not misbehave when I use CUF. And using CUF first fixes it if tabs are later used. But (see post 3) ... when I was using So a tab stop was corrupted, at least temporarily. |
Beta Was this translation helpful? Give feedback.
-
I can't reproduce ANY erros in a console (Windows 10 ConHost or OpenConsole). It has nothing to do with grep or anything Gnu; a variety of apps used in the pipe will cause the same error (e.g., findstr.exe). I can change the behavior with command grouping. For example, there is no error if I use So it has something to do with how TCC implements piping and redirection. I'm pretty sure that the console goes out of VT mode and back into it when TCC does piping. Is it true that the tab settings are remembered when that happens? Are you aware of any mechanisms that would thwart that? I doubt TCC is messing with the tabs directly. |
Beta Was this translation helpful? Give feedback.
-
If the tab settings weren't remembered, then you'd expect them to be reset to every 8 columns, or perhaps no tabs at all. What you're getting - visually at least - is all the tab positions are 5 columns to the left. So it's far more likely that the tabs are fine, but conpty is not able to reproduce the buffer content correctly. That's why you don't see the same problem in conhost or openconsole. |
Beta Was this translation helpful? Give feedback.
-
Does that account for the bogus ESC[9C in the debug tap? Is there some fault here ... and whose is it? |
Beta Was this translation helpful? Give feedback.
-
Yeah, there does seem to be a disconnect when it comes to where the cursor is. After the pipe/redirection, a mere ^e[1G (CHA) gets rid of the later error. I doubt we'll ever know what TCC is doing. |
Beta Was this translation helpful? Give feedback.
-
Hmmm! That difference of 6 seems to be somehow built-in to TCC. At least I have something to ask about in TCC's forum. Below, _COLUMN in built-in to TCC and, no doubt, uses GetConsoleScreenBufferInfo[Ex] to get the current cursor position.
That's a bit odd in that, if the cursor were really at 6, I'd expect the "6" to be echoed at column 6! :-) |
Beta Was this translation helpful? Give feedback.
-
I posted in TCC's forum and almost immediately retracted my post because it's WT-specific, In a console, I see this.
Regardless of the middle command, it's always 6 in WT and 0 in a console. I'm not sure what to make of it! |
Beta Was this translation helpful? Give feedback.
-
I have a plugin command, TABS, for the TCC shell.
It first ensures VT mode is enabled, clears all tabs (ESC 3 g) and in the evenly-spaced case, successively moves the cursor to column 1, 1+width, 1+2*width, ... and sets a tab (ESC H).
This batch file works as desired.
This batch file doesn't work as desired,
See how all the tabs after column 1 are in the wrong place (and rather inexplicably so)!
After a few hours of debugging, I'm at a complete loss. Regardless of what the pipe and redirection may do to the console, I figure we're starting all over again with the TABS command.
Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions