Closed rygwdn closed 9 years ago
How about the maxWidth
parameter for fillText
, I think it should also be change this way.
@coolwanglu @kopischke I just pushed a new version that lets neovim determine how many columns there are. It should also speed up painting of characters
@rygwdn This looks interesting, why the old version was not working? Maybe some Unicode characters are mis-interpreted by the browser? How about special Unicode characters and double-width characters?
The main issue was in handle_redraw
, which was never actually handling put
specially. It looks like the values inside the event are not actually strings, so e[0] == 'put'
is never true. The next issue was in joining all the characters, since that would require re-calculating the number of columns (since "some string".length
in JS is the number of bytes, not the number of columns). Then I needed to add in the loop to draw the characters individually because the spacing used for the grid apparently doesn't exactly line up with how the canvas draws it.
I determined that put
provides the columns individually by looking at some of the other neovim UI implementations (specifically the python GTK one and the C++ Qt one) where they just handle each put
individually and increase the column by 1
. I'm not sure how it will handle weird cases, but at the moment this should handle them the same way
OK I see. Thanks!
Fixes #10