8000 Fix borders for code structure highlighting. (#210) · pdg137/python-editor-next@b787ec3 · GitHub
[go: up one dir, main page]

Skip to content

Commit b787ec3

Browse files
Fix borders for code structure highlighting. (microbit-foundation#210)
Avoid rounding where it's problematic. If we want it we need to draw another box or switch to SVG. Fix a failure to account for bodyPullBack in the body element's width. No visible change for the alpha/staging deployment as new options aren't available yet. See microbit-foundation#207
1 parent e84b83e commit b787ec3

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/editor/codemirror/structure-highlighting/theme.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ export const baseTheme = EditorView.baseTheme({
1818
".cm-cs--block": {
1919
borderRadius: "var(--chakra-radii-lg)",
2020
},
21+
// Disable border radius when it looks bad.
22+
".cm-cs--lshapes .cm-cs--block": {
23+
borderRadius: "unset",
24+
},
25+
".cm-cs--borders-left-edge-only .cm-cs--block": {
26+
borderRadius: "unset",
27+
},
28+
2129
".cm-cs--background-block .cm-cs--block": {
2230
backgroundColor: "var(--chakra-colors-code-block)",
2331
},
@@ -52,7 +60,7 @@ export const baseTheme = EditorView.baseTheme({
5260
},
5361

5462
// boxes full border
55-
".cm-cs--boxes.cm-cs--borders-border .cm-cs--block": {
63+
".cm-cs--boxes.cm-cs--borders-borders .cm-cs--block": {
5664
border: "2px solid var(--chakra-colors-code-border)",
5765
},
5866
});

src/editor/codemirror/structure-highlighting/visual-block.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class VisualBlock {
7373
body.style.left = this.body.left - bodyPullBack + "px";
7474
body.style.top = this.body.top + "px";
7575
body.style.height = this.body.height + "px";
76-
body.style.width = `calc(100% - ${this.body.left}px)`;
76+
body.style.width = `calc(100% - ${this.body.left - bodyPullBack}px)`;
7777
}
7878

7979
if (this.parent && parent && this.body && body && indent) {

0 commit comments

Comments
 (0)
0