joshuadanpeterson / typewriter.nvim

A Neovim plugin that emulates a typewriter, keeping the cursor centered on the screen for a focused writing experience.
MIT License
23 stars 0 forks source link

In normal mode with plugin installed using command $ - end of line not reached. #1

Closed richardj-bsquare closed 2 months ago

richardj-bsquare commented 2 months ago

Using neovim v0.10.0, and installing the plugin using lazyvim with the following configuration:

return {
  {
    "joshuadanpeterson/typewriter",
    dependencies = "nvim-treesitter/nvim-treesitter",
    tag = "v0.1.5",
    opts = {},
    init = function()
      require("typewriter").enable()
    end,
  },
}

In later versions (0.2.0+) in normal mode, $ only moves the cursor to one less character than the end of the line. In version v0.1.5 the behaviour is correct.

v0.1.5:

abcd
   ^

v0.2.0+:

abcd
  ^

This for example $A results in insert mode before end of line. meaning the result in v0.2.0+ would be abc<inserted characters here>d instead of abcd<inserted characters here>.

Correct behaviour is restored either by using v0.1.5 or uninstalling the plugin.

joshuadanpeterson commented 2 months ago

@richardj-bsquare Thank you for pointing this out, and thank you for the detail in pointing out which version worked vs which version broke. That made it easy for me to isolate the error. The center_cursor function was altered in later versions, causing the glitch. I've reverted the function back to the v.0.1.5 version and fixed the issue.