Skip to content

Commit d259244

Browse files
release: beta 4.11.7-beta.1
Fix cursor/scroll lag in source mode (#698): skip page-view remount when layout-change fires but mode and sticky setting are unchanged.
1 parent 03e0d23 commit d259244

6 files changed

Lines changed: 31 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. See [standa
44

55
## 4.X
66

7+
### [4.11.7-beta.1](https://github.com/SkepticMystic/breadcrumbs/compare/4.11.6...4.11.7-beta.1) (2026-05-23)
8+
9+
### Bug Fixes
10+
11+
* **Cursor/scroll lag in source mode**`layout-change` fires on every CM6 cursor movement and scroll tick, causing a full Svelte unmount+remount of the Trail/Prev-Next page view on each tick even when nothing had changed. The DOM thrash inside `.cm-scroller` made CM6 re-measure and skip cursor positions (visible as paragraph jumps in vim mode). Page views are now only remounted when the editor mode (source vs. preview) or the sticky setting actually changes; repeat `layout-change` firings with an already-correct mount are ignored ([#698](https://github.com/SkepticMystic/breadcrumbs/issues/698)).
12+
713
### [4.11.6](https://github.com/SkepticMystic/breadcrumbs/compare/4.11.5...4.11.6) (2026-05-22)
814

915
### Bug Fixes

manifest-beta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "breadcrumbs",
33
"name": "Breadcrumbs",
4-
"version": "4.11.5",
4+
"version": "4.11.7-beta.1",
55
"minAppVersion": "1.12.0",
66
"description": "Add structured hierarchies to your notes.",
77
"author": "SkepticMystic",

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"fundingUrl": "https://github.com/SkepticMystic/breadcrumbs#donations",
99
"helpUrl": "https://breadcrumbs-docs.michaelpporter.com",
1010
"isDesktopOnly": false,
11-
"version": "4.11.6"
11+
"version": "4.11.7-beta.1"
1212
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "breadcrumbs",
3-
"version": "4.11.6",
3+
"version": "4.11.7-beta.1",
44
"description": "Add typed-links to your Obsidian notes",
55
"main": "main.js",
66
"scripts": {

src/views/page.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ import type BreadcrumbsPlugin from "src/main";
55
import { mount, unmount } from "svelte";
66

77
type MountedPageView = ReturnType<typeof mount>;
8+
type PageViewMountState = {
9+
view: MountedPageView;
10+
mode: string;
11+
sticky: boolean;
12+
};
813

9-
const mounted_page_views = new WeakMap<MarkdownView, MountedPageView>();
14+
const mounted_page_views = new WeakMap<MarkdownView, PageViewMountState>();
1015

1116
export function cleanup_page_views(plugin: BreadcrumbsPlugin) {
1217
const markdown_views = plugin.app.workspace.getLeavesOfType("markdown");
@@ -15,7 +20,7 @@ export function cleanup_page_views(plugin: BreadcrumbsPlugin) {
1520
const existing = mounted_page_views.get(leaf.view);
1621
if (existing) {
1722
mounted_page_views.delete(leaf.view);
18-
void unmount(existing);
23+
void unmount(existing.view);
1924
}
2025
});
2126
}
@@ -32,11 +37,22 @@ export function redraw_page_views(plugin: BreadcrumbsPlugin) {
3237

3338
const markdown_view = leaf.view;
3439
const mode = markdown_view.getMode();
40+
const sticky = plugin.settings.views.page.all.sticky;
3541

3642
const existing = mounted_page_views.get(markdown_view);
43+
44+
// Skip remount if mode and sticky haven't changed and the element is still in the DOM.
45+
// layout-change fires on every CM6 cursor/scroll update; remounting on each one
46+
// causes DOM thrash inside .cm-scroller which makes CM6 re-measure and skip cursor positions.
47+
if (existing && existing.mode === mode && existing.sticky === sticky) {
48+
const page_views_el =
49+
markdown_view.containerEl.querySelector<HTMLElement>(".BC-page-views");
50+
if (page_views_el?.isConnected) return;
51+
}
52+
3753
if (existing) {
3854
mounted_page_views.delete(markdown_view);
39-
void unmount(existing);
55+
void unmount(existing.view);
4056
}
4157

4258
// Ensure the container exists _on the current page_, leaving other pages' containers alone
@@ -155,6 +171,6 @@ export function redraw_page_views(plugin: BreadcrumbsPlugin) {
155171
target: mount_target,
156172
props: { plugin, file_path: markdown_view.file?.path ?? "" },
157173
});
158-
mounted_page_views.set(markdown_view, mounted);
174+
mounted_page_views.set(markdown_view, { view: mounted, mode, sticky });
159175
});
160176
}

versions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,5 +292,6 @@
292292
"4.11.1": "1.12.0",
293293
"4.11.2": "1.12.0",
294294
"4.11.3": "1.12.0",
295-
"4.11.4": "1.12.0"
295+
"4.11.4": "1.12.0",
296+
"4.11.7-beta.1": "1.12.0"
296297
}

0 commit comments

Comments
 (0)