_From @tylerl0706 on July 21, 2018 3:13_
node-pty terminals jump to the bottom when a .NET Core console app requests for a cursor position. In other terminals (iterm, terminal.app), it does not.
This only happens on unix/linux OS's - Windows works as expected.
This is easily reproducible in PowerShell since it's built on .NET Core.
while ($true) { $null = [Console]::CursorTop; Start-Sleep 1 }
Note the use of
[Console]::CursorTopwhich is the cursor query. In .NET Core, this emits the report cursor position ansi escape sequence on unix-like platforms
The console window jumps down to the prompt
The console window does not move
_Copied from original issue: Microsoft/node-pty#211_
p.s. @Tyriar is awesome 馃憤
In case it helps, here's the function that gets called when you call CursorTop in corefx.
_From @jerch on July 23, 2018 16:14_
@tylerl0706 Imho this can't be fixed in the pty binding, the binding simply routes the byte streams to and from the OS into JS space. This seems more emulator related (if you use xterm.js as emulator - thats the place to address this imho).
Ah my bad - that's my lack of knowledge of the stack. I can move this over there if you'd like
_From @Tyriar on July 23, 2018 17:45_
This is happening because the text is sent via Terminal.send:
I'm not totally sure what the right behavior is (I would check other terminals), but it definitely belongs in xterm.js 馃憤
We should check what the behavior of other popular linux/mac terminals is when you're in the scrollback and cursor position is requested, if we're doing standard behavior I'm not sure how best to fix this for PS atm.
@Tyriar not sure if you over looked it - but in the description I mentioned that this behavior is different from within iTerm2 and Terminal.app (2 non-xtermjs terminals) on macOS. It doesn't scroll back.
@tylerl0706 oh ok, I thought this was a PS extension within VS Code thing.
@Tyriar sorry for the delay! I was heads down on OneWeek 馃憤
I can confirm that branch fixes the problem 馃帀
@tylerl0706 I pulled the fix into VS Code, you can test it there on Monday
Most helpful comment
@tylerl0706 can you clone my fork, checkout
1579_emit_pos_directlyand test if this fixes it by running the demo?