obsidian-vimrc-support icon indicating copy to clipboard operation
obsidian-vimrc-support copied to clipboard

Surround Fails After Opening 2nd File

Open Laharah opened this issue 1 year ago • 1 comments

This bug report is also in #104 because I misunderstood the issue. This issue may have the same root cause, but maybe not.

  • [x] I checked that the bug does not happen in the CodeMirror Vim demo. If it does, please report it there and not here.
  • [x] I'm reasonably sure that this bug is indeed about the Vimrc file support and not a general Vim in Obsidian issue. If it's a general Vim issue, report it here.

Describe the bug:

After loading a 2nd file, either a new file or a file previously written, commands with selections no longer work. (eg: surround commands)

To Reproduce:

Steps to reproduce the behavior:

  1. Start Obsidian with plugin enabled and a surround command in your vimrc file
  2. edit a file, check that surround commands work.
  3. open a 2nd file, either new or pre-written.
  4. Attempt a 2nd surround command on either a selected word or within a word.

Environment:

  • OS: Mac OS Version 12.4
  • Vimrc plugin version: 0.7.2

Additional context: With verbose logs this is the error I get:

app.js:1 Error: can't surround on an empty line
    at surroundFunc (plugin:obsidian-vimrc-support:778:27)
    at Object.eval [as surround] (plugin:obsidian-vimrc-support:804:68)
    at ExCommandDispatcher._processCommand (vim.js:4658:34)
    at vim.js:4604:16
    at e.operation (app.js:1:1267455)
    at ExCommandDispatcher.processCommand (vim.js:4602:12)
    at Object.handleEx (vim.js:991:29)
    at Object.eval [as squote] (plugin:obsidian-vimrc-support:654:43)
    at ExCommandDispatcher._processCommand (vim.js:4658:34)
    at vim.js:4604:16

I sometimes also get cannot read property of null anchor errors when attempting the same thing.

Laharah avatar Aug 04 '22 16:08 Laharah

Yes its same problem as #104 selection is stop being updated when new file is open. I send PR with fix for that.

Pomroka avatar Aug 05 '22 00:08 Pomroka

PR is merged, thank you and sorry for the huge delay :(

esm7 avatar Sep 23 '22 12:09 esm7