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

Make ncdirect cursor acquisition more reliable #784

Closed
dankamongmen opened this issue Jul 11, 2020 · 4 comments · Fixed by #999
Closed

Make ncdirect cursor acquisition more reliable #784

dankamongmen opened this issue Jul 11, 2020 · 4 comments · Fixed by #999
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@dankamongmen
Copy link
Owner

See #765, where it's revealed that kmscon hands back cursor + row in reverse order from most everything else. We could of course hardwire a bunch of special cases, and hope we get them all, and hope they don't change behavior, like a dumb jabroni. Much better would be to autodetect this. It ought be doable via:

(1) get cursor position
(2) move to the right
(3) move up
(4) get cursor position
(5) if unchanged, either it's broken, or we're in the upper right corner. we can determine the latter by checking against terminal dimensions. in this case, move somewhere else and retry. either way, move back to the original position.
(6) if only one has changed, we were either on the right side, or top line (but not upper right corner)
(7) if both changed, look at the values

we could run this on app startup, or whenever ncdirect_cursor_yx() is first called.

@dankamongmen
Copy link
Owner Author

I need to revert the dumb inversion in order to fix #964, so that's going to break ncneofetch on kmscon (and any other terminal which reports the coordinates in an inverted fashion). It would thus be desirable to get this done sooner rather than later.

@dankamongmen
Copy link
Owner Author

Gonna go ahead and try to knock this out today. Acceptance criteria is that ncneofetch is fixed on kmscon (kmscon returns its coordinates inverted, which this algorithm ought be able to detect).

@dankamongmen
Copy link
Owner Author

I've rewired ncdirect_cursor_yx() to invert if n->inverted_cursor is set. Just need to implement the body of detect_inverted_cursor() using the algorithm described above.

@dankamongmen
Copy link
Owner Author

Initial testing indicates that this is a solid fix. direct and ncneofetch both now work properly in kmscon. =]

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

Successfully merging a pull request may close this issue.

1 participant