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

Over-the-spot implementation for IME preedit #45

Closed yuntan closed 7 years ago

yuntan commented 7 years ago

demo:

https://gyazo.com/94c4eb382c34e83343471b9685df2529

yuntan commented 7 years ago

Fixed incorrect commit message and title.

yuntan commented 7 years ago

Fixed test.

rhysd commented 7 years ago

Could you update screenshot in description? I can't look at the link.

rhysd commented 7 years ago

I could see the screencast in the linked page. Looks great. Let me try this patch before merging it in order to see it works in other environments.

yuntan commented 7 years ago

Reply to https://github.com/rhysd/neovim-component/pull/46#issuecomment-327717556.

I can reproduce the problem neither on Windows 10 nor on Linux. I've changed "font-size" of component but I can't see. I don't have Mac so I can't test it.

rhysd commented 7 years ago

OK, I'll try to fix the issue on Mac.

rhysd commented 7 years ago

Below diff fixed the problem. Could you apply it to this branch?

diff --git a/src/neovim/input.ts b/src/neovim/input.ts
index 182ed4a..f04be79 100644
--- a/src/neovim/input.ts
+++ b/src/neovim/input.ts
@@ -435,9 +435,7 @@ export default class NeovimInput {
     }

     updateFontSize() {
-        const {specified_px} = this.store.font_attr;
-
-        const font_size = specified_px * (window.devicePixelRatio || 1);
+        const {specified_px: font_size} = this.store.font_attr;
         this.element.style.fontSize = font_size + 'px';
         this.fake_element.style.fontSize = font_size + 'px';
     }