Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scripts/editor.checks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ describe('editor option wiring', () => {
/** A settled settings store, so each test names only the field it is about. */
const SETTINGS = {
minimap: false,
stickyScroll: true,
wordWrap: 'on',
editorMaxWidth: 80,
lineNumbers: 'on',
Expand Down Expand Up @@ -303,6 +304,7 @@ describe('editor option wiring', () => {
'renderWhitespace',
'selectionHighlight',
'smoothScrolling',
'stickyScroll',
'wordWrap',
'wordWrapColumn',
'wrappingStrategy',
Expand Down
8 changes: 8 additions & 0 deletions scripts/editor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ describe('editor options', () => {
/** A settled settings store, so each test names only the field it is about. */
const SETTINGS = {
minimap: false,
stickyScroll: true,
wordWrap: 'on',
editorMaxWidth: 80,
lineNumbers: 'on',
Expand All @@ -138,6 +139,13 @@ describe('editor options', () => {
typewriterMode: false,
};

test('Sticky Headings reaches the editor that is already open', () => {
// It was set in the creation literal only, so turning the setting on or off
// changed nothing until the next editor was created.
assert.deepEqual(editorOptionsFromSettings(SETTINGS, 100).stickyScroll, { enabled: true });
assert.deepEqual(editorOptionsFromSettings({ ...SETTINGS, stickyScroll: false }, 100).stickyScroll, { enabled: false });
});

test('the caret glide is a setting and not a hard-coded on', () => {
// It was `cursorSmoothCaretAnimation: 'on'` in the creation literal (#710),
// which is why the assertion below is about `editorOptionsFromSettings` and
Expand Down
1 change: 0 additions & 1 deletion src/lib/components/Editor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@
...editorOptionsFromSettings(settings, zoomLevel),
readOnly,
scrollBeyondLastLine: true,
stickyScroll: { enabled: settings.stickyScroll },
wordBasedSuggestions: "off",
quickSuggestions: false,
// Monaco's Unicode highlighter is built for source code, where a
Expand Down
2 changes: 2 additions & 0 deletions src/lib/utils/editorOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ export function editorOptionsFromSettings(
// cursor line. 'all' applies it to clicks too, not only to keyboard moves.
cursorSurroundingLines: settings.typewriterMode ? TYPEWRITER_SURROUNDING_LINES : 0,
cursorSurroundingLinesStyle: settings.typewriterMode ? "all" : "default",
stickyScroll: { enabled: settings.stickyScroll },
};
}

/** The slice of the settings store the options above are derived from. */
export type EditorOptionSettings = {
minimap: boolean;
stickyScroll: boolean;
wordWrap: string;
editorMaxWidth: number;
lineNumbers: string;
Expand Down
Loading