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

fold DECCPR inversion check into rendered mode #1886

Open
dankamongmen opened this issue Jul 5, 2021 · 3 comments
Open

fold DECCPR inversion check into rendered mode #1886

dankamongmen opened this issue Jul 5, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@dankamongmen
Copy link
Owner

Since we're now during a cursor location report in rendered mode (when NCOPTION_PRESERVE_CURSOR is used, anyway), we ought fold cursor inversion support into the process. This should only be done when NCOPTION_PRESERVE_CURSOR is supplied, or when we're in direct mode and perform our first actual cursor lookup, since it involves several round trips and would otherwise unduly retard startup.

As a good test for this, run notcurses-info in kmscon (known to invert its report). Currently, it always prints at the top of the screen due to report inversion. If it prints at the correct place, things are probably working.

@dankamongmen dankamongmen added the enhancement New feature or request label Jul 5, 2021
@dankamongmen dankamongmen added this to the 3.0.0 milestone Jul 5, 2021
@dankamongmen dankamongmen self-assigned this Jul 5, 2021
@dankamongmen dankamongmen changed the title fold DECCPR into rendered mode fold DECCPR inversion check into rendered mode Jul 5, 2021
@dankamongmen
Copy link
Owner Author

i really don't want to introduce the mandatory latency that my inversion detection algorithm would require to startup. =[ inversion is a rare thing, and is paired with 0-indexing (see #2044); maybe we ought just make that a heuristic? except kmscon doesn't advertise itself via anything other than the rather dubious COLORTERM=kmscon, which is both dicey and won't work for ssh =[.

@dankamongmen
Copy link
Owner Author

maybe we could instead key off a trivial detection of 0-indexing? we would send u7 first, then a cup to 0,0, then another u7. we already do a move following these queries, so that introduces nothing. all we're adding is the cup and the second u7.

hell, so long as we're not a 1x1 geometry, we could detect inversion directly off a cup to 0,1 or 1,0, since cup doesn't get inverted itself. but i think the 0-indexing detection suffices.

the only downside is that this will be kinda complicated; the cursor report stuff is already a bit of a mess, and complexly interwoven with general input code. but i think this is the right thing to do, so long as 0-indexing is always correlated with cursor report inversion. which, to the best of my knowledge, it is.

@dankamongmen
Copy link
Owner Author

so yeah in the initial query reply handler, we'll want to recognize cursor reports, and also keep a bit of state as to whether we've seen the initial cursor report. if we've seen the initial one, and we get a second, that's the reply to our 0-indexing detection. perform detection, and in the face of inversion, update the tinfo (which will need a new boolean to indicate inversion), and also invert/1-bias the existing report in the initial_state (written when we lexed the previous cursor report).

@dankamongmen dankamongmen removed this from the 3.0.0 milestone Oct 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant