Skip to content

Commit 65b50da

Browse files
authored
input_code_editor(): fix caret drift caused by prism theme font-family override (#1304)
* fix: override prism theme font-family on .prism-code-editor to fix caret drift Prism themes hardcode `font-family` directly on `.prism-code-editor`, which wins over bslib's monospace font override and causes the caret to visually drift from the actual insertion point. Closes #1303 * Resave distributed files (GitHub Action) * news: add entry for input_code_editor() caret drift fix Closes #1304
1 parent d9b20fe commit 65b50da

5 files changed

Lines changed: 5 additions & 1 deletion

File tree

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Improvements and bug fixes
44

5+
* Fixed a caret drift issue in `input_code_editor()` where the cursor would appear to the right of the actual text insertion point when certain themes or on some operating systems. (#1304)
6+
57
* `input_code_editor()` now supports `language = "ggsql"` for syntax highlighting of ggsql queries. (#1291)
68

79
* Improved the sidebar resize handle to avoid conflicts with the sidebar's native scrollbar and to better support touch devices. (#1299)

R/sysdata.rda

-234 Bytes
Binary file not shown.

inst/components/dist/code-editor.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ bslib-code-editor .code-editor textarea {
5555

5656
/* Ensure proper font rendering */
5757
bslib-code-editor .code-editor,
58+
bslib-code-editor .code-editor .prism-code-editor,
5859
bslib-code-editor .code-editor textarea,
5960
bslib-code-editor .code-editor pre,
6061
bslib-code-editor .code-editor code {

inst/lib/prism-code-editor/prism/languages/ggsql.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ggsql["ggsql-keyword"] = {
2525

2626
// Geom types
2727
ggsql["ggsql-geom"] = {
28-
pattern: /\b(?:point|line|path|bar|col|area|tile|polygon|ribbon|histogram|density|smooth|boxplot|violin|text|label|segment|arrow|rule|errorbar|rect)\b/,
28+
pattern: /\b(?:point|line|path|bar|col|area|tile|polygon|ribbon|histogram|density|smooth|boxplot|violin|text|label|segment|arrow|rule|range)\b/,
2929
alias: "builtin",
3030
};
3131

srcts/src/components/codeEditor.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ bslib-code-editor .code-editor textarea {
5555

5656
/* Ensure proper font rendering */
5757
bslib-code-editor .code-editor,
58+
bslib-code-editor .code-editor .prism-code-editor,
5859
bslib-code-editor .code-editor textarea,
5960
bslib-code-editor .code-editor pre,
6061
bslib-code-editor .code-editor code {

0 commit comments

Comments
 (0)