Open lebigot opened 1 year ago
PS: It is as if Typewriter Scroll was hesitating between two positions on the screen: a first position where the text is shown for a very short time, and then the final position. Each time I press a key, the first position is used, and then the final position.
I have the same effect, but it appears on any note. When I activated the plugin, at first everything worked almost normally. These jumps also happened, but much less often. But then for some reason they also began to happen from every click. Although I did not change anything.
Reboot did not help.
OS: Windows 10 Obsidian 1.3.5.
Same issue.
This plugin works perfectly: https://github.com/davisriedel/obsidian-typewriter-mode
@fcFn I found the other plugin to be really buggy. Utterly unusable.
This seems to be linked to a previously closed issue https://github.com/deathau/cm-typewriter-scroll-obsidian/issues/6 but I checked my current plugin is up to date and the code changes for the onRefresh
function are corrected according to this fix (Line 136).
I have also found the same problem of 'each character causes the window to go up and down' but my zen mode is deactivated and the document is rather long. This doesn't happen for all lines, but a shaky line remains shaky for the whole line. I think this may be due to how we divide the offsetHeight - how is it rounded?
function onRefresh(cm) {
const halfWindowHeight = Math.ceil(cm.getWrapperElement().offsetHeight / 2);
const linesEl = cm.getScrollerElement().querySelector('.CodeMirror-lines');
linesEl.style.paddingTop = `${halfWindowHeight}px`;
linesEl.style.paddingBottom = `${halfWindowHeight}px`; // Thanks @walulula!
if (cm.getSelection().length === 0) {
cm.execCommand("scrollSelectionToCenter");
}
}
so I did this fix
When a note is not very long (like when it starts empty) and is entered in a "tall" window, each typed character makes the whole not text "shake". This is not very convenient.
In case this matters:
Thanks!