Pasting long enough block causes cursor position and text buffer to get confused

Steps to reproduce

  1. create a New note
  2. Paste a long enough string of text such that the cursor position would be beyond the bottom of the visible view.

Expected result

Cursor should be resting at the edge of the last character of the pasted text.

Actual result

Cursor is positioned several chars/lines “back” from the edge, and moving left/right results in strange “jumps”. There is a portion of text that cannot be selected. This persists until you switch to another note and then back.

Environment

  • Operating system: macOS 11.2.3->12.0.1
  • Obsidian version: 0.13.0

Video

Possibly related:

can you post a screen recording with no css and no plugins? Thanks

Sure, here’s a recording of the bug, fresh vault, no plugins or CSS…

Steps to reproduce

Turn on “Readable line length”.

  1. Start a blank document and create a list. The list can either be ordered (1.) or unordered (-). The scrollbar for the note should not be present yet.
  2. To make this easier to reproduce, copy about one line’s worth of text into your clipboard and hold down Ctrl+V. Stop as soon right when the scroll bar appears. If you keep pasting or type after the scroll bar appears, the bug corrects itself.

Expected result

Following the above procedure, the text cursor should always be at the end of the most recently pasted text.

Actual result

The cursor is no longer at the end of the current text. Trying to use the arrow keys, pressing End, or pressing Ctrl+End does not place the cursor at the end of the line. However, typing additional text places it at the correct location.

Environment

  • Operating system: Windows 10 version 2004
  • Obsidian version: 0.8.12, turned off custom CSS for testing

I am not sure I can repro this.
Can you post a gif?

Here is a GIF.

The software I used didn’t capture key presses, but I was just pasting text. When I stop pasting, notice where the text cursor is. At the very end, I typed “test” without hitting any other keys (arrow keys, end key, etc.)

This is probably due to the internal optimizations we use. I managed to repro.

do you still have this issue?

Yes, it’s still present in 0.10.13. I’m on installer version 0.8.12 if that matters.

Please, update the installer and try again.
If you still have it post a screen recording without thirdparty plugins and default css.

Have it sometimes too.
Upload files for free - 2021_03_08 16-13-57.mp4 - ufile.io (Yeah didn’t know where to upload so first site from google)

let me know if this is this better in 0.11.7

Will do, as soon as it shows up :slight_smile:

Nope, still broken… I think it’s somewhat improved, but still bugged.

this is an upstream problem I can repro on codemirror website

Gotcha. I set up a test instance of CM6 and couldn’t repro, FWIW. So when that gets swapped in hopefully this will be solved.

@WhiteNoise Sorry I’ve been a bit out of the loop on development lately. This bug still persists- Just checking on the move to CM6, are you guys getting close?

This is a bit stale so I wanted to post a couple of fresh videos along with some easy text you can copy & paste into a new note to repro this. All done using 0.12.19.

Here’s a gist with some raw text that when pasted into a note, should trigger this bug:
copy the text from this gist

Here’s a video showing how it looks in my vault (with a monospace font) – easiest to see the effect:

and here’s a video of the same text, from the Help vault (no plugins, etc.) showing the same thing:

It’s easiest to repro when the left side panel (file explorer/navigation) is visible.

Just a note that this bug is unchanged in 0.13.0