Skip to content

Commit 5ae171b

Browse files
committed
fix: zero horizontal padding on token-line spans to align cursor (#962)
1 parent 3ff8a37 commit 5ae171b

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

app/page.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ const Editor = styled(LiveEditor)`
222222
textarea {
223223
font-family: ${monospace} !important;
224224
font-size: inherit !important;
225+
font-variant-ligatures: none !important;
225226
line-height: inherit !important;
226227
letter-spacing: inherit !important;
227228
padding: 1.5em !important;
@@ -231,6 +232,11 @@ const Editor = styled(LiveEditor)`
231232
tab-size: 2;
232233
box-sizing: border-box !important;
233234
}
235+
236+
.token-line {
237+
padding-left: 0 !important;
238+
padding-right: 0 !important;
239+
}
234240
`;
235241

236242
const Links = styled.div`

components/LiveEdit.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ const StyledEditor = styled((props: Partial<LiveEditorProps>) => (
120120
textarea {
121121
font-family: ${monospace} !important;
122122
font-size: inherit !important;
123+
font-variant-ligatures: none !important;
123124
line-height: inherit !important;
124125
letter-spacing: inherit !important;
125126
padding: 1.5em !important;
@@ -129,6 +130,11 @@ const StyledEditor = styled((props: Partial<LiveEditorProps>) => (
129130
tab-size: 2;
130131
box-sizing: border-box !important;
131132
}
133+
134+
.token-line {
135+
padding-left: 0 !important;
136+
padding-right: 0 !important;
137+
}
132138
`;
133139

134140
const StyledPreview = styled(LivePreview)`

test/components/__snapshots__/LiveEdit.spec.tsx.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ exports[`LiveEdit renders correctly 1`] = `
3535
.c2 textarea {
3636
font-family: var(--font-mono),ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace!important;
3737
font-size: inherit!important;
38+
font-variant-ligatures: none!important;
3839
line-height: inherit!important;
3940
letter-spacing: inherit!important;
4041
padding: 1.5em!important;
@@ -45,6 +46,11 @@ exports[`LiveEdit renders correctly 1`] = `
4546
box-sizing: border-box!important;
4647
}
4748
49+
.c2 .token-line {
50+
padding-left: 0!important;
51+
padding-right: 0!important;
52+
}
53+
4854
.c3 {
4955
position: relative;
5056
padding: 0.5rem;

0 commit comments

Comments
 (0)