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

insertion point flicker on paragraph movement #14

Closed
cmyr opened this issue Apr 15, 2017 · 4 comments
Closed

insertion point flicker on paragraph movement #14

cmyr opened this issue Apr 15, 2017 · 4 comments

Comments

@cmyr
Copy link
Member

cmyr commented Apr 15, 2017

The paragraph movement commands (⌥↑ & ⌥↓) cause the insertion point to flicker to the start or end of the line before being drawn at the end or the start of the line, respectively. In other words: wherever they're supposed to be drawn, they're first drawn for a frame in the wrong place.

Stepping through in the debugger, it looks like this action sends two RPCs; in the case of ⌥↓, it's move_forward followed by move_to_end_of_paragraph. This doesn't immediately strike me as expected behaviour? Anyway I'm not sure exactly what's going on.

@raphlinus
Copy link
Member

This is an odd OSX thing; http://osxnotes.net/keybindings.html describes two actions in a row for these keybindings ("~\Uf700" and "~\Uf701"). I think it's done this way so repeatedly pressing the key makes progress through the document.

How to deal with it? One possibility is to place a very short timeout on updates, aggregating them if they fall within the timer. I wouldn't do it for just this issue, but it's also very much an issue for color flickering when the plugin is doing syntax highlighting. I think if that can get its answer back in a ms or so, it's worth taking the small latency hit to avoid flickering.

That can be done either in the front-end or the core, but I lean toward the latter for two reasons. First, the need is common to all front-ends (as long as we're talking about syntax color and not just this specific issue 😃). Second, the core probably has more context to apply heuristics to minimize the tradeoff.

If it were just this issue, it's probably possible to override the keybinding to send a single command with the combined effect. But that might have negative consequences for users customizing their keybindings, and I'm inclined to try to solve the more general problem.

Good catch!

@cmyr
Copy link
Member Author

cmyr commented Apr 16, 2017

Interesting.

I've been thinking a lot about keybindings in the last day or two, and I've come to assume that at some point we would stop relying on the interpreted NSResponder events and start sending raw events to the core. (At least, this is the only good way I can imagine implementing modal editing, and I think it also has some merit for certain a certain category of particularly ambitious plugin; again this is far future; but basically I've been imagining a modular system that sits between the client and the main dispatcher, receiving raw key events and outputting edit/other commands, maybe implemented as an FSM; this module could either be part of xi-core or a plugin communicating via json-rpc, which would let people experiment with novel modal (or not) editing paradigms).

Obviously we would want to do this in a way that didn't compromise IME support. There will probably have to be platform-specific accommodations of some kind? You'll have a much better sense of this then most of us.

My first thought about this discreet problem is that we can probably intercept the raw key event in keyDown(with:) and manually send the appropriate movement event; I'll take a look and see if it's a quick fix.

cmyr added a commit to cmyr/xi-mac that referenced this issue Apr 16, 2017
@jansol
Copy link
Contributor

jansol commented Aug 20, 2018

Status bump?

@cmyr
Copy link
Member Author

cmyr commented Aug 21, 2018

Although I don't believe we added a concrete fix, it does look like at least the flickering has been resolved, probably because of the delayed rendering stuff in xi-editor/xi-editor#626. Since this was really a UI issue, I think that fix is acceptable.

@cmyr cmyr closed this as completed Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants