You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default with 'emacs-mcx.strictEmacsMove': false:
When scrolling down 1 page (ScrollUpCommand, or page down), the cursor is moved to the bottom of the visible range.
When scrolling up 1 page (ScrollDownCommand, or page up), the cursor is moved to the top of the visible range.
When strictEmacsMove is set the behavior is supposed to be flipped.
When scrolling down a page, the cursor is at the top of the screen, and vice versa.
Problem:
I notice that when strictEmacsMove is set, movePrimaryCursorIntoVisibleRange seems to think the visibleRange is always 1 page behind. So if I begin with lines 0 to 50 visible, and then I scroll down 1 page so that lines 51-100 are visible, I have debug statements inside movePrimaryCursorIntoVisibleRange that show visibleRange contains values that claim lines 0-50 are visible. If I move down another page so that lines 101-150 are visible, then visibleRange claims lines 51-100 are visible.
This results in the cursor being put in the wrong place after each scroll up / down command.
Theory:
microsoft/vscode#157194 suggests that TextEditor.visibleRanges is not atomically updated. I tested this theory by adding a delay, so ScollUpCommand looks something like this, and it worked as expected. This seems to support the theory that there's some sort of race condition when reading visibleRanges
The text was updated successfully, but these errors were encountered:
zpencer
changed the title
strictEmacsMove is 1 screen behind when running ScrollUpCommand / ScrollDownCommand
movePrimaryCursorIntoVisibleRange lags behind 1 screen, possible race condition?
Aug 1, 2024
FWIW I discovered that the vscode command editorScroll now has a recealCursor argument that makes the cursor behave in a way that is the same as emacs. However, this alone is not enough to replace movePrimaryCursorIntoVisibleRange, because that function also has some special handling for mark mode.
I'm not sure what's the right way to fix this issue, assuming it's not just something strange about my vscode instance in particular.
Context:
By default with
'emacs-mcx.strictEmacsMove': false
:When strictEmacsMove is set the behavior is supposed to be flipped.
When scrolling down a page, the cursor is at the top of the screen, and vice versa.
Problem:
I notice that when strictEmacsMove is set,
movePrimaryCursorIntoVisibleRange
seems to think thevisibleRange
is always 1 page behind. So if I begin with lines 0 to 50 visible, and then I scroll down 1 page so that lines 51-100 are visible, I have debug statements insidemovePrimaryCursorIntoVisibleRange
that showvisibleRange
contains values that claim lines 0-50 are visible. If I move down another page so that lines 101-150 are visible, thenvisibleRange
claims lines 51-100 are visible.This results in the cursor being put in the wrong place after each scroll up / down command.
Theory:
microsoft/vscode#157194 suggests that
TextEditor.visibleRanges
is not atomically updated. I tested this theory by adding a delay, so ScollUpCommand looks something like this, and it worked as expected. This seems to support the theory that there's some sort of race condition when readingvisibleRanges
The text was updated successfully, but these errors were encountered: