Skip to content

Update activecode locked and highlighted region markings on scroll#1190

Open
ascholerChemeketa wants to merge 1 commit intoRunestoneInteractive:mainfrom
ascholerChemeketa:activecode-lock-display-improvement
Open

Update activecode locked and highlighted region markings on scroll#1190
ascholerChemeketa wants to merge 1 commit intoRunestoneInteractive:mainfrom
ascholerChemeketa:activecode-lock-display-improvement

Conversation

@ascholerChemeketa
Copy link
Copy Markdown
Contributor

This pull request improves the handling and rendering of locked and highlighted lines in the ActiveCode interactive editor, especially when scrolling or when only part of the code is visible. The main focus is to ensure that decorations for locked and highlighted lines are applied correctly to only the visible lines, enhancing performance and visual consistency.

Editor rendering and decoration improvements:

  • Added a scroll event listener to the CodeMirror editor to update locked and highlighted regions dynamically as the user scrolls, ensuring offscreen lines are decorated when they come into view.
  • Modified the logic in setHighlightLines to only highlight lines that are currently visible in the editor, using the viewFrom and viewTo properties for accurate line offsets.

Locked line marker placement and decoration:

  • Refactored the locked line marker logic by extracting a placeLock function, and updated its usage to place markers at the correct line numbers.
  • Updated the logic for decorating locked lines at the start and end of the visible regions, ensuring that only lines within the current view are decorated and that locked markers are placed at the midpoint of the locked region. [1] [2]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant