rhysd / neovim-component

<neovim-editor> WebComponent to embed Neovim to your app with great ease
https://github.com/rhysd/NyaoVim
MIT License
193 stars 18 forks source link

Will it ever be possible to set line-height? #13

Closed metalelf0 closed 8 years ago

metalelf0 commented 8 years ago

Hi, first of all - thanks for your work, it's really great to see what you're building! Keep up the great work :)

My question is about line-height. I was comparing the output from a neovim-component with atom editor, and the obvious difference is that default line height in atom is 1.5. This gives a better readability to code IMHO (and it's a setting I always tweak in terminals like iTerm).

I've tried hacking something inside neovim-component but the HTML canvas specifications explicitly ignore any line-height setting (see http://www.w3.org/TR/2dcontext/, Chapter 4).

What do you think about this? Do you think there's any workaround for the drawText canvas function to allow using a different lineHeight or does this require a completely different approach (like adding text directly to the DOM, à-la Atom)? If so, is this something you considered?

Thanks again!

Andrea Schiavini

rhysd commented 8 years ago

Hi, thank you for your report.

Currently <neovim-editor> doesn't see line-height as you said. It calculates each line's height from line number and character height. I didn't think there is a requirement of line-height because gVim doesn't have the feature. But I agree that it's reasonable.

Do you think there's any workaround for the drawText canvas function to allow using a different lineHeight

I couldn't find drawText canvas function. Could you please show me a pointer?

or does this require a completely different approach

I think it's hard because of performance. Atom had the same problem with rendering using DOM and added many optimizations for DOM manipulation.

metalelf0 commented 8 years ago

Sorry, I meant fillText, not drawText. The specifications are here, at chapter 10. I found this example using canvas and lineHeight, but I'm not sure if it could be of any use. Thanks again!

rhysd commented 8 years ago

Thank you for the pointers. It looks not so hard to implement line-height. (Currently I'm working to improve key handling.)

rhysd commented 8 years ago

I implemented it in 0.3.4 and NyaoVim 0.0.11 already includes it. Please try it :)

https://github.com/rhysd/NyaoVim#configure-gui-options

metalelf0 commented 8 years ago

This is wonderful :) Thanks! Great work!

rhysd commented 8 years ago

:smile: