UI Scroll Position Jumps When Pasting into Long Code Blocks

What’s The Bug?

In larger code snippets that don’t fit on the screen, certain actions cause the note to scroll up unexpectedly. For example, when I’m at the end of the snippet and undo the last action (Ctrl+Z), the page scrolls up for no apparent reason, forcing me to manually scroll back down to continue editing. This becomes quite frustrating when doing it frequently.

How To Reproduce It

  1. Create or open a note and add a code block (snippet) that is large enough to not fit entirely on the screen (e.g., fill it with multiple lines of code until scrolling is required).
  2. Scroll to the bottom of the code snippet so the cursor is at the end.
  3. Perform an action, such as typing some text.
  4. Undo the last action using Ctrl+Z (or the equivalent undo shortcut).
  5. The note/page scrolls up unexpectedly, moving the view away from the cursor position at the bottom.

The Expected Behavior

After undoing an action at the end of a large code snippet, the view should remain at the cursor position without scrolling up. The user should not need to manually adjust the scroll to resume editing.

Device

PC

OS

Windows 11

Anytype Version

v0.50.5

Network Mode

AnySync

Technical Information

OS version: Windows 11 Pro (10.0.26100)
Motherboard: MSI PRO B760M-A WIFI DDR4
CPU: Intel Core i5-12400F
GPU: NVIDIA GeForce GTX 1650
Display resolution: 1920x1080@74hz
RAM: 32 GB DDR4
Anytype version: 0.50.5
Anytype ID: A6sG6gQrxLkNocMuEFYvRhnGvt7AaghVCvijvzJhWx7TFmz9