When setting a cursor to the far left side and press down button, the cursor will not stay on the left side, but jumps around between left and right. This makes it very difficult to navigate in obsidian.
Here I show where the cursor will be placed in paragraph, each time a down arrow is pressed.
What I would expect is that if the cursor is placed to the left side, then it will stay at the left as I press up/down arrows on the keyboard.
I hope this bug could be fixed.
I noticed that it comes from this code that I have in snippets.
If this is not a bug, I wonder how we are meant to change the line-height where this bug will not occur?
I found something more…
If I set the line-height to 2.5, the bug doesn’t happen.
.cm-contentContainer {
line-height: 2.5;
}
But if I set the line height to 2.0, the bug is present. So it seems that the amount of line height that is being set, somehow affects the cursor to be misplaced.
I believe that what you’re experiencing is an attempt to preserve the horizontal position as to up and down. So say you place the cursor on the 10th character on a line it’ll try to select that position when you go up and down.
The same will occur if you place the cursor on the 50th character of the one, but when you then go up and down, especially between paragraphs it’ll look like the cursor is doing random jumps.
If that’s the case, I wonder why changing the line-height, will change the behaviour of the cursor?
It seems like the line-height affects the cursor position calculation when the text is continued on the following lines.
I wonder where the code for this calculation is? Maybe looking at the code would suggest why this x-1 happens.
This bug seems to specifically happen when the text is too long to fit on one line and the string has to be split to several lines. Then somewhere the code will need to calculate what is the cursor position for this string that doesn’t fit.
The surprising thing is that the up arrow works correctly. It’s only the down arrow that doesn’t work.
This indicates that the bug is real. There’s something wrong with the calculation of cursor when pressing down arrow for a paragraph that has more than one line.