Skip to content

fix: avoid toggling empty links, fix bug where some functions don't get called in template#192

Merged
lervag merged 2 commits intolervag:masterfrom
jeffmm:jmm/small_fixes
Oct 3, 2021
Merged

fix: avoid toggling empty links, fix bug where some functions don't get called in template#192
lervag merged 2 commits intolervag:masterfrom
jeffmm:jmm/small_fixes

Conversation

@jeffmm
Copy link
Copy Markdown
Contributor

@jeffmm jeffmm commented Oct 3, 2021

Context

Hi @lervag, I really like your plugin so far! I made a few small changes locally and thought I'd share them:

  • I noticed an annoying error if I accidentally hit Return in normal mode when my cursor was on a blank line.
  • I had a problem with consecutive user-defined functions not being called in my wiki template

Changes

  • If there is no text under the cursor, exit early from wiki#link#follow(don't attempt to toggle an empty link)
  • make the search for user-defined template functions less aggressive, since after the insertion of the result of the function call the length of the variable l:lines changes, and l:c2 can extend beyond the beginning of the next curly-braces defining another custom function.

@lervag
Copy link
Copy Markdown
Owner

lervag commented Oct 3, 2021

Hi @lervag, I really like your plugin so far!

Thanks, glad you like it!

I made a few small changes locally and thought I'd share them:

I'm quite impressed that you managed to fix the errors; well done! Especially the second one is quite intricate, and I would not be surprised if I would have spent some time pinpointing and fixing it myself.

@lervag lervag merged commit 2874332 into lervag:master Oct 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants