rhysd/neovim-component

Remove default size (height/width) and make screen fit to <canvas> size

Closed this issue · 1 comments

rhysd commented

Currently inner canvas element has fixed size and user must manage width and height of <neovim-editor> component. This is because we must know lines and cols before starting nvim (otherwise it is needed to send vim_try_resize after nvim starting).

  1. <neovim-editor> (includes inner <canvas>) is created
  2. nvim process starts
  3. <neovim-editor> is attached to DOM

Now the size must be specified because we can't know the element size before attaching it to DOM.
The sequence might be:

  1. <neovim-editor> (includes inner <canvas>) is created
  2. <neovim-editor> is attached to DOM
  3. Get the size of inner <canvas> and calculate lines and cols
  4. nvim process starts with the lines and cols

Starting process will be delayed until DOM is attached. I must check the start up time change to ensure this change has small impact to it.

rhysd commented

Default size is not removal because <canvas> doesn't have 'resize' event... We might make a compromize with resize on <body> resized.