New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected line jumping #6
Comments
|
I took a deeper look at the code and found the cause to be Obsidian unexpectedly changing the padding-bottom value of the CodeMirror-lines class. Overwriting padding-bottom through the onRefresh function fixes the problem for me. function onRefresh(cm) {
const halfWindowHeight = cm.getWrapperElement().offsetHeight / 2;
const linesEl = cm.getScrollerElement().querySelector('.CodeMirror-lines');
linesEl.style.paddingTop = `${halfWindowHeight}px`;
linesEl.style.paddingBottom = `${halfWindowHeight}px`; // This line fixes the jumping
if (cm.getSelection().length === 0) {
cm.execCommand("scrollSelectionToCenter");
}
} |
|
Yup. I was having that problem and this fixed it. Thanks. macosxguru |
|
Thanks for the fix! I noticed it wasn't just jumping a line at random. It effectively seemed to be overriding the line-centering, so that as long as you continued typing in the current paragraph (i.e. same line without a return carriage), you would get closer and closer to the bottom, until you reached the bottom, and stayed there. It effectively makes it feel like typewriter mode has been completely disabled until you hit to create a new line. Then it finally snaps back to center. So this bug was most noticeable on very long paragraphs. Anyway the above fix works perfectly. |
Thank you so much for this plugin. It really helps me to focus on my writing.
Sadly I encountered a bug that occurs sometimes when breaking into a new line.
The text was updated successfully, but these errors were encountered: