[Bug] vim-mode gj movement command break with live preview, bullets, and transclusion

Using

  • vim mode
  • live preview
  • a transcluded (embedded) wiki link
  • inside a bullet point

vim movement command gj can not move past the transcluded link.

gj is identical to j except it accounts for line wraps. Some of us noremap j gj for this reason.

gj is effectively equivalent to using the arrow keys to navigate.

Steps to reproduce

  1. enable vim mode
  2. use Live Preview
  3. create the following document
![[#foo]]

- ![[#foo]]

# foo

NOTE: for some reason, copy and pasting this snippet from Discourse into Obsidian elides the line breaks. Go into source mode to ensure the document is structured properly

  1. starting at the top line, attempt to navigate down one line at a time using gj. Type gj repeatedly. Same with the down arrow.

Expected result

gj should be able to move past the transcluded wikilink in the bullet point just as it does on the transcluded wikilink that isn’t in a bullet.

Actual result

gj can not move past the bullet point with the transcluded wikilink. j of course still works.

The same result happens with the down arrow.

Environment

SYSTEM INFO:
	Obsidian version: v0.13.22
	Installer version: v0.13.19
	Operating system: Darwin Kernel Version 20.6.0: Wed Nov 10 22:23:07 PST 2021; root:xnu-7195.141.14~1/RELEASE_X86_64 20.6.0
	Login status: logged in
	Catalyst license: vip
	Insider build toggle: on
	Live preview: on
	Legacy editor: off
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Safe mode: on

RECOMMENDATIONS:
	none

1 Like

does it happen in source mode?

It does not happen in source mode, just LP.
It also happens in LP when in vim mode and using the down arrow key to navigate.

It doesn’t happen in LP when out of vim mode and using the down arrow key to navigate lines.

(Deleted my previous reply; I was confused on which bug this was. Sorry.)

Since updating to 13.30 I have a similar problem with ‘gj’ in vim mode, only it does not move past level one headings. This is with either live preview or source view toggled. Transcluded links and bullets, other level headings, work fine. ‘gj’ works in legacy mode.

Debug Info

SYSTEM INFO:
	Obsidian version: v0.13.30
	Installer version: v0.12.19
	Operating system: #1 SMP Mon Feb 7 14:40:20 UTC 2022 (77d9d02) 5.3.18-150300.59.49-default
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Legacy editor: off
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Safe mode: off
	Plugins installed: 0
	Plugins enabled: 0

RECOMMENDATIONS:
	none

I had the same issue with H1 and was able to fix by reducing the size of my headings. It seems like there is a bug computing logical lines, likely upstream cc @WhiteNoise

:root {
  --h1: 1.25em;
  --h2: 1.20em;
  --h3: 1.15em;
  --h4: 1.10em;
  --h5: 1.05em;
  --h6: 1.00em;
}
1 Like

Thanks for that!

For what it is worth the magic number for me was 1.87em. Any greater and ‘gj’ can’t scroll past h1.

Related

This issue appears to be fixed in the latest insider build (v0.15.1).

This issue appears to be fixed in the latest insider build (v0.15.1).

I just tried again, and it is not fixed in 0.15.1 and 0.15.2. gj and the down arrow get stuck on transclusions in bullets and the repro steps I listed in the original post (above) are still valid. Did you mean to reply to this ticket or did you try the repro steps yourself?

For me it was the gj getting stuck on a large h1/h2 header where the cursor would simply go to the end of the line and then not move. This is what is fixed for me in v0.15.x. Sorry for not being clear.

Regarding bullets… for me gj works ok for top level multi-line bullets but it does not work for any sub-bullets.

I also just noticed that typing in gj has a different (better more consistent) behavior vs just j with nmap j gj defined in my .obisidian.vimrc.

For me gj worked as expected for a while, even with transclusions in bullets (or maybe I just didn’t put any transclusions in bullets over the past few months???) so I thought this got fixed.

Now I am noticing it again and thought it was a regression, reported i: Vim mode gj does not scroll past transclusion link which is part of a list - #2 by WhiteNoise

Since this happens in source mode, can you make this bug happen in here https://codemirror-vim--util.repl.co when you increase the font size?

It does not happen in source mode, only in live preview. As such, I don’t think the upstream-bug label is accurate?

thanks