fix(editor): preserve active cell border on row highlight

This commit is contained in:
zipg authored and GitHub committed 2026-08-22 12:57:23 +08:00
1 parent e8c759e314
commit edffa6706d
2 files changed
+15 -2

No files matched your search

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import { Text } from "@codemirror/state";
import { currentStatementFrameRect, FRAME_INSET_PX } from "@/lib/editor/codemirrorCurrentStatementFrameLayer";
import { currentStatementFrameLayer, currentStatementFrameRect, FRAME_INSET_PX } from "@/lib/editor/codemirrorCurrentStatementFrameLayer";
interface CoordRect {
left: number;
@@ -253,3 +253,14 @@ describe("currentStatementFrameRect", () => {
expect(rect!.height).toBe(expectedHeight);
});
});
describe("currentStatementFrameLayer", () => {
it("renders above line decorations so active-line backgrounds cannot cover the frame", () => {
const layer = vi.fn((config) => config);
const RectangleMarker = vi.fn();
currentStatementFrameLayer({ layer, RectangleMarker } as never, () => ({ from: 0, to: 1 }));
expect(layer).toHaveBeenCalledWith(expect.objectContaining({ above: true, class: "cm-db-currentStatementFrameLayer" }));
});
});
@@ -140,7 +140,9 @@ interface CurrentStatementFrameModule {
*/
export function currentStatementFrameLayer(viewModule: CurrentStatementFrameModule, resolve: StatementFrameResolver): Extension {
return viewModule.layer({
above: false,
// Keep the outline above line decorations so opaque active-line colors
// from editor themes cannot cover the frame border.
above: true,
class: "cm-db-currentStatementFrameLayer",
markers(view) {
const request = resolve(view);