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

PositionCursor broke with recent ConsoleDriver changes #3881

Open
tig opened this issue Dec 5, 2024 · 6 comments
Open

PositionCursor broke with recent ConsoleDriver changes #3881

tig opened this issue Dec 5, 2024 · 6 comments
Labels

Comments

@tig
Copy link
Collaborator

tig commented Dec 5, 2024

I can't tell exactly what changed, but in the recent IConsoleDriver work PositionCursor is not working correctly.

The cursor is appearing all over the place when it shouldn't

4d1Fu6Z 1

@tznind
Copy link
Collaborator

tznind commented Jan 1, 2025

This is a brute force way to fix this problem in #3837

Each iteration after draw we ask the most focused view where it would like cursor to be. Thoughts?

internal void IterationImpl ()
{
    InputProcessor.ProcessQueue ();

    if (Application.Top != null)
    {
        bool needsDrawOrLayout = AnySubviewsNeedDrawn (Application.Top);

        bool sizeChanged = WindowSizeMonitor.Poll ();

        if (needsDrawOrLayout || sizeChanged)
        {
            // TODO: Test only
            Application.LayoutAndDraw (true);

            Out.Write (OutputBuffer);


+        Application.Top.MostFocused?.PositionCursor ();
+        Out.SetCursorPosition (OutputBuffer.Col,OutputBuffer.Row);
+        Out.SetCursorVisibility (CursorVisibility.Default);
        }
    }



    var swCallbacks = Stopwatch.StartNew ();

    TimedEvents.LockAndRunTimers ();

    TimedEvents.LockAndRunIdles ();

    Logging.IterationInvokesAndTimeouts.Record (swCallbacks.Elapsed.Milliseconds);
}

tznind added a commit to tznind/gui.cs that referenced this issue Jan 1, 2025
@tznind
Copy link
Collaborator

tznind commented Jan 11, 2025

@BDisp are you able to look into what broke the current PositionCursor?

I have some ideas about how we can improve it but having v2 fixed would be a good baseline place to start.

I suspect it could be down to focus events changing and/or the keyboard/mouse handling code changes altering the order of execution of events?

@tznind
Copy link
Collaborator

tznind commented Jan 11, 2025

Seems it was working at 903a886

@tznind
Copy link
Collaborator

tznind commented Jan 11, 2025

Hmn actually I am having difficulty reproducing this. I get invisible cursor sometimes on some consoles but that is seperate issue I think

@BDisp
Copy link
Collaborator

BDisp commented Jan 11, 2025

But its broken using Win or Net?

@tznind
Copy link
Collaborator

tznind commented Jan 11, 2025

UICatalog in @tig gif above is showing WindowsDriver but I cannot repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

3 participants