Code block changes height and cursor position on selection

Hi team,

I am using Bear extensively to save my code snippets and so I need to work with the code blocks frequently.

The problem is that when you are trying to select a code line (not the entire block of code) the cursor position automatically changes position as the height of the block increases when the ``` code formatter becomes visible.

This creates a visual confusion as the cursor moves up and we have to again move the cursor to the original line which we had to copy.

Bear 2.2.0 has introduced the copy code block feature which is really awesome but it could be really great if this cursor moving issue could be fixed as well.

Here’s a screen capture video showing how the code block changes height and the cursor moves position (move on the line above) on selection :point_down:

Screen Recording 2024-06-10 at 9 (1)

Just as a side note, this phenomenon is technically called “Cumulative Content Shift (CLS)” and it is considered as bad user experience. Here’s a reference from Google’s documentation: Cumulative Layout Shift (CLS)  |  Articles  |  web.dev

Thank you.

Maybe turning off Hide Markdown toggle in General Settings would work for you?

Hi @roar
Thanks for the suggestion. Turning off the “Hide Markdown” toggle does help to kind of fix the issue but it then creates markdown everywhere else in the note. For eg: all bold words will show the ** around them and so on which I don’t want as it created clutter in the notes.

There should be a better way to implement this without having to compromise on other features like hiding the markdown.

1 Like