Skip to content

Commit

Permalink
add gutter background color to prevent text collision on overflow bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ukorvl committed Nov 25, 2024
1 parent 84267d5 commit da4f43e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/components/codefield/codeMirrorTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const defaultSettings = {
selectionMatch: COLORS.gray600,
fontFamily: "Roboto Mono, monospace",
caret: COLORS.gray100,
gutterBackground: "transparent",
gutterForeground: COLORS.gray300,
} satisfies CreateThemeOptions["settings"];

Expand Down
5 changes: 5 additions & 0 deletions src/components/codefield/defaultStylesOverridesExtension.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { EditorView } from "@codemirror/view";
import { COLORS } from "../../shared";
import { expandProperty } from "inline-style-expand-shorthand";

export const createDefaultStylesOverridesExtension = (showLineNumbers: boolean) =>
EditorView.theme({
Expand Down Expand Up @@ -27,4 +28,8 @@ export const createDefaultStylesOverridesExtension = (showLineNumbers: boolean)
".cm-activeLineGutter": {
color: COLORS.gray200,
},
".cm-gutters": {
backgroundColor: COLORS.gray900,
...expandProperty("transition", "background 0.15s"),
},
});
3 changes: 3 additions & 0 deletions src/components/codefield/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const getContainerStyles = (size: CODE_FIELD_SIZE, highlightOnHover: boolean): S
...expandProperty("transition", "background 0.15s"),
":hover": {
background: COLORS.gray800,
":first-child .cm-gutters": {
backgroundColor: COLORS.gray800,
},
},
}),
fontSize: size === CODE_FIELD_SIZE.small ? "14px" : "16px",
Expand Down

0 comments on commit da4f43e

Please sign in to comment.