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

Fix spacing issues on ligatures as seen on #36. #122

Merged
merged 4 commits into from
Nov 13, 2015

Conversation

HealsCodes
Copy link
Contributor

This PR is a response to the new issues reported in #36, currently WIP - see checklist below.

The idea is to do a proper analysis of the ligatures (if any) and try to avoid double character draws / moving spaces etc.

code changes:

  • compare string with- and without ligatures
  • skip positions as needed
  • add compatibility with emoji
  • add a note to the preference to indicate the cursorline / relativenumber requirement.

testing:

  • instruments: no leaks?
  • local test with and without listchars
  • local test with and without cursorline (to force / relax draws)
  • collect feedback from affected users (see Support for font ligatures #36)

Do a proper analysis of the ligatures (if any) and try to avoid double
character draws / moving spaces etc.
@splhack
Copy link
Contributor

splhack commented Nov 8, 2015

Unfortunately, ligature support breaks Emoji (for example, '🐱') rendering. Surrogate pairs, perhaps?

ligature_disable

ligature_enable

@HealsCodes
Copy link
Contributor Author

That feature got in after my first PR - I'll have a look at it..

Am 08.11.2015 um 04:59 schrieb Kazuki Sakamoto notifications@github.com:

Unfortunately, ligature support breaks Emoji rendering. Surrogate pairs, perhaps?


Reply to this email directly or view it on GitHub.

@HealsCodes
Copy link
Contributor Author

@splhack - I think I have something working for both of us:

emoji and ligature sample

@splhack
Copy link
Contributor

splhack commented Nov 8, 2015

@Shirk 👍

@jordwalke
Copy link
Contributor

The result of this diff is that MacVim has a reasonable user experience for ligature fonts if you have cursorline enabled. There are still remaining issues being tracked, but I can confirm that this fixes bugs that were currently already merged into master.

@jordwalke
Copy link
Contributor

Any update on this?

@HealsCodes
Copy link
Contributor Author

@jordwalke - I'm undecided..

I could remove the [WIP] for this part and convince @douglasdrumond to merge but it would still only work for people with either cursorline or relativenumber enabled.

So I'm debating with myself whether to add a notice to the option dialog ("currently cursorline or relativenumber setting is required for this feature") or go looking for a way to get vim to always redraw the active window when it has ligatures enabled.

I've been looking around the MacVim-gui design and there seems to be no easy way for the GUI process to communicate to the back-end process that the active (VIM)window needs redraw.

@jordwalke
Copy link
Contributor

My justification for suggesting this be merged is that it fixes bugs that are in master and seems to not make anything else worse. Of course, I'd love for everything to be redrawn at the right time perfectly with or without cursorline. But there are many people who would do anything for ligatures. For those people, with this implementation, it's pretty easy to add a little tweak to their vimrc:

set cursorline
highlight CursorLine guibg=NONE

Not to downplay how awesome it would be for this to not be necessary.

@chdiza
Copy link
Contributor

chdiza commented Nov 13, 2015

What will happen if someone does not want ligatures rendered, does not have a font with ligatures, but has cursorline or relativenumber enabled? Is their experience going to be bogged down with constant redraws? If so, then this should either not be merged, or there needs to be a checkbox in the prefs, OFF by default, to enable this ligature stuff.

@jordwalke
Copy link
Contributor

screen shot 2015-11-13 at 11 30 11 am

There is certainly an option (already in master, in fact) - @Shirk will have to confirm that it actually has no impact when toggled off - but I can't even detect a perf impact when toggled on (on my very weak macbook).

@HealsCodes
Copy link
Contributor Author

@chdiza - ligatures have been merged already in a previous (see #36) and have no impact at all since they are in no way related to cursorline or relativenumber. The only relation between them is that if you happen to have enabled cursorline or relativenumber ligatures will be displayed properly since in those cases VIM will always redraw the whole current line if the cursor moves up / down (which is not new but the default behavior for both options).

[EDIT] rephrased to prevent this comment from sounding harsh which it wasn't supposed to be (it was a long day..)

Make it clear that currently ligatures will only draw properly with
`cursorline` or `relativenumber` enabled.
@HealsCodes HealsCodes changed the title [WIP] Fix spacing issues on ligatures as seen on #36. Fix spacing issues on ligatures as seen on #36. Nov 13, 2015
@HealsCodes
Copy link
Contributor Author

@jordwalke for now I'm going with the "add a note the preferences" way so this PR has a chance of getting merged quickly.

@douglasdrumond - if you wouldn't mind to have a look.

splhack added a commit that referenced this pull request Nov 13, 2015
Fix spacing issues on ligatures as seen on #36.
@splhack splhack merged commit 2696990 into macvim-dev:master Nov 13, 2015
@HealsCodes HealsCodes deleted the ligature_fixes branch November 13, 2015 20:13
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

Successfully merging this pull request may close these issues.

4 participants