Comments (10)
MRE: VtRendererBug.zip
STR: compile, run, follow instructions
P.S. I think the provided example reproduces the same issue.
Just in case if not, STR for the original one:
- Get Far - https://github.com/FarGroup/FarManager/releases/
- Run it.
- In F9 - Options - Interface settings
uncheck:
[ ] Use Virtual Terminal for rendering
[ ] Fullwidth-aware rendering
check:
[x] ClearType-friendly redraw (can be slow)
- Edit any file (F4)
- In F11 - FarColorer - Configure - Main settings
check:
[x] Cross
setCross style
toboth
- Press
CtrlHome
to move the cursor to the upper left corner and thenRight
a few times.
from terminal.
I've just confirmed that reverting commit 72b4488 on the main branch is enough to fix the issue for me (i.e. moving the WaitUntilCanRender
call back down to the bottom of the loop, before PaintFrame
). And I've also now tested the cursor movement in Far itself, and the same fix works there too.
Again I'm not sure that's a real solution to the problem, but it might be worth considering as a quick fix, assuming it works for everyone else and not just me.
from terminal.
As for what's going wrong, this is what I've been able to establish:
-
When you write a line of text that extends to the last column, we set the
_wrapForced
flag, even though the line hasn't actually wrapped (this is partially tracked in #15602, although that's referencing theAdaptDispatch
class, while this particular case is in one of the console APIs). -
When the VtEngine outputs that line, and it sees that flag is set, it records the apparent wrapped state in the
_wrappedRow
field, again despite the fact that it hasn't actually wrapped. -
At this point in time, the cursor is meant to be at the start of line 2, because that's where it was manually positioned, and the
WriteConsoleOutput
API doesn't change that. So at the end of the frame, the VtEngine tries to move the cursor there. However, because of_wrappedRow
being set to the line above, it thinks there is nothing to do (thepreviousLineWrapped
test here). -
Even though the
_MoveCursor
method didn't do anything in the previous step, it still updates the_lastText
field to where it mistakenly thought the cursor was (it thinks it's at the start of line 2, when it's actually at the end of line 1). This is why the subsequent output ends up the wrong location.
Ignoring bug number 1 for the moment, it seems to me that point 3 is also a bug, because the _wrappedRow
field being set does not actually indicate that the cursor is on the next line, only that it doesn't need to be moved there if you're about to write a character. If you're just painting the cursor at that point, it needs to be moved explicitly.
So another possible way to fix this issue would be to set _wrappedRow = std::nullopt
in the VtEngine::PaintCursor
method before calling _MoveCursor
.
That said, the conpty code is complicated, and I really don't know it very well, so there may be more to it than that. I'm just throwing this out there as potential solution.
from terminal.
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Closed similar issues:
- Issues with cursor invalidation in GDI (#17150), similarity score: 0.75
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
from terminal.
We've talked internally about reverting #15500 for the 1.21 release. It's the source for all these issues. While the fix you found may fix this particular issue, it's not unlikely that there will be more.
On the current main branch, which targets version 1.22, we're thinking of potentially removing VtEngine in its entirety. This would then also fix the cursor invalidation issue introduced in #15500. Unfortunately, this means that this issue would intentionally exist on main for up to a couple months.
from terminal.
FYI, I did a git bisect with the VtRendererBug test case, and for me the issue first showed up in commit 72b4488. However, I suspect it may be one of those things that's timing dependent, and that commit just exposed a bug that has always existed.
from terminal.
Thanks James, reverting 72b4488 fixed it for me as well.
from terminal.
Another simple test case that can be run from a WSL bash shell:
printf '\033[2J\033[1;999H*'; sleep 1; printf '\033[2H\033[65;1;1;1;999$x'; sleep 1; printf '\033[3HThis should be line 3\n'
The text "This should be line 3", should be on line 3 😄, but it usually ends up on line 2.
This one is not fixed by reverting 72b4488, but it is fixed by the _wrappedRow
patch suggested above.
from terminal.
Whichever the fix ends up being, I'm going to defer it until the next servicing wave for 1.21 - thanks for all the great investigations, everyone 😄
from terminal.
I've just realised that issue #17013 is another variant of this bug. And that scenario is also fixed by PR #17290.
from terminal.
Related Issues (20)
- Better Warnings for Custom Pixel Shader Compilation Failures
- Windows key doesn't work when assigning key actions HOT 5
- Escape sequence leaking to terminal on starting/attaching `tmux` (over `ssh`) HOT 2
- BUG: Error in TypeData "Microsoft.PowerShell.DeserializingTypeConverter": Cannot create an instance of the type converter for type Microsoft.PowerShell.DeserializingTypeConverter due to exception: The type initializer for 'Microsoft.PowerShell.DeserializingTypeConverter' threw an exception.. , and 3 another errors HOT 5
- Pasting multiline text not working (in shell, vi and hangs kakoune) HOT 3
- distribute conhost fixes with Windows 10 HOT 1
- `settings.json` gets regenerated after it is deleted while Windows Terminal is running HOT 1
- allow tabs on any side and allow users to change the sharpness HOT 5
- Duplicate Titlebar when System Theme Changes HOT 1
- Multiple font style support HOT 3
- wt new-tab --no-focus, to keep the focus in the current tab rather than the new tab HOT 1
- Window title is not updated HOT 1
- wt: The term 'wt' is not recognized as a name of a cmdlet HOT 6
- Use tab colors in the Ctrl-Tab switcher menu entry visuals HOT 1
- The task bar of the activity can be switched and selected from a dropdown menu HOT 1
- All powershell versions dont work HOT 1
- Clicking on link in JSON object adds trailing double-quote HOT 5
- profiles.schema.json: NewTerminalArgs section is outdated
- Cursor disappears when AtlasEngine and Software Rendering are used together HOT 4
- TerminalPaneContent.cpp - TerminalPaneContent::TerminalPaneContent never knows the profile settings updated with the wt.exe cmdline arguments HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terminal.