Tab being rendered as almost entire line of spaces

Question
Tab being rendered as almost entire line of spaces

Posted Feb 11, 2020, 11:28 AM UTC

413
flaghacker_OP•

Whenever a program tries to display something with tab characters, the output is entirely messed up. After some experimenting the problem seems to be that a tab is rendered as n-1 space characters where n is the width of the terminal buffer. It's reproducible by catting a simple file, see the screenshot (and note the red arrow in the top right). Dragging the mouse on the almost-empty line shows that there are indeed n-1 space characters before the first t. It's not a problem with reading the file, catting to another file gives the correct result.

Curiously the problem fixes itself whenever you run a program that "takes control" of the buffer, I'm not sure what exactly that's called. As an example I'm using git log, that has interactive scrolling. You can see that after the git log the file is printed correctly.

cmd also doesn't have this issue, I'm not sure why that is because they're supposed to share consolehost, right?

Does someone know what could be causing this?

3
Mizerka•

convert to utf8, you probably copy pasted from ansi or some random chinese format.

3
bryan4tw•

It says it is already UTF-8 in the bottom right.

Why would someone COPY a tab character? There's a key for it right on the keyboard.

2
flaghacker_OP•

Yeah the file is just an example, it also happens with other programs. For example the help section often contains tabs and becomes hard to read because of this.

2
Mizerka•

can't replicate on any of my boxes, tried updating to ps5.1?

2
flaghacker_OP•

I think I already have that, my exact version is:

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      18362  145
2
Lee_Dailey[grin]•

howdy flaghacker_,

have you tried starting up the console with your profile disabled?

are you using the standard console OR the new-ish win10 terminal?

take care,
lee

1
flaghacker_OP•

I did Set-ExecutionPolicy Restricted to disable my profile, but I still have the same problem. I'm using the powershell included with Windows itself, although I did have the new one installed at some point in the past.

Also see my other comment for the exact version I have right now.

2
Lee_Dailey[grin]•

howdy flaghacker_,

[1] the execution policy stuff has NOTHING to do with your PoSh profile. [grin]
you run without the profile by ...

  • start up with the -NoProfile parameter
  • find & remove the profile currently being used
  • find & edit the profile so that it does not load anything at all

[2] the version of PoSh you are running has little to do with the version of the console that PoSh is running in. [grin]
that is either the builtin ISE "console", the same console that comes with windows, OR one of the add on console apps. MS has be promoting a new add on terminal for win10 ... and i was wondering if you had installed that.

take care,
lee

2
flaghacker_OP•

[1] hmm really? because it gave some kind of warning about not being able to run the profile when I set it like that. No matter, I commented everything out in my profile (all git-posh related) and I still get the same problem.

[2] Ah I see. I'm just running the stock powershell as is appears in the start menu search: https://i.imgur.com/AecXevq.png

The problem doesn't occur in ISE or when I first run cmd and then in that run powershell. It still happens if I run powershell as administrator.

Is there maybe a way to just reset everything powershell related? I might have messed something up while tinkering with settings in the past, I'm not sure.

2
Lee_Dailey[grin]•

howdy flaghacker_,

there likely is a way to "reset to default" for all PoSh related stuff ... but i have never seen anything about it - nor can i find any such info with a few quick searches.

well, other than doing a system wipe and reinstall ... that seems a tad over-the-top at this point. [grin]


if "run as administrator" triggers the problem ... that means you are seeing some odd permission difference ... and i have no idea what that could be. i would have expected things to glitch the other way around since admin privs usually get around it all.

i am out of ideas. [sigh ...] you may want to re-image your system, after all.

take care,
lee

1