Skip to content

Commit

Permalink
[8.x] [ES|QL] Fix editor cursor jumpiness (#202389) (#202850)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [[ES|QL] Fix editor cursor jumpiness
(#202389)](#202389)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Davis
McPhee","email":"davis.mcphee@elastic.co"},"sourceCommit":{"committedDate":"2024-12-04T00:12:04Z","message":"[ES|QL]
Fix editor cursor jumpiness (#202389)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/191216\r\n\r\nThis PR fixes my
least favourite editor bug - the cursor jumpiness! It\r\nturns out this
was just due to Monaco editor being picky about styles. I\r\nremoved the
margin from the editor since that's what was causing the\r\ncursor to be
off, and then added an equivalent number of pixels
to\r\n`lineDecorationsWidth` so it's visually the same.\r\n\r\nI tracked
the issue back to this PR in 8.15: #186345. It may not make it\r\nin the
last planned 8.15 patch release, but we can backport there
anyway\r\njust in
case.\r\n\r\nBefore:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/924bbdb4-0ba6-446c-a4ad-63332f43f158\r\n\r\nAfter:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/864bedd0-c711-4910-b7a7-6a54e27e9148\r\n\r\nFixes
#191216.\r\n\r\n### Checklist\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"22141cbbfa1c7c00800fe340032f84ee87ba0222","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","Feature:ES|QL","Team:ESQL","backport:version","v8.18.0"],"title":"[ES|QL]
Fix editor cursor
jumpiness","number":202389,"url":"https://github.com/elastic/kibana/pull/202389","mergeCommit":{"message":"[ES|QL]
Fix editor cursor jumpiness (#202389)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/191216\r\n\r\nThis PR fixes my
least favourite editor bug - the cursor jumpiness! It\r\nturns out this
was just due to Monaco editor being picky about styles. I\r\nremoved the
margin from the editor since that's what was causing the\r\ncursor to be
off, and then added an equivalent number of pixels
to\r\n`lineDecorationsWidth` so it's visually the same.\r\n\r\nI tracked
the issue back to this PR in 8.15: #186345. It may not make it\r\nin the
last planned 8.15 patch release, but we can backport there
anyway\r\njust in
case.\r\n\r\nBefore:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/924bbdb4-0ba6-446c-a4ad-63332f43f158\r\n\r\nAfter:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/864bedd0-c711-4910-b7a7-6a54e27e9148\r\n\r\nFixes
#191216.\r\n\r\n### Checklist\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"22141cbbfa1c7c00800fe340032f84ee87ba0222"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/202389","number":202389,"mergeCommit":{"message":"[ES|QL]
Fix editor cursor jumpiness (#202389)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/191216\r\n\r\nThis PR fixes my
least favourite editor bug - the cursor jumpiness! It\r\nturns out this
was just due to Monaco editor being picky about styles. I\r\nremoved the
margin from the editor since that's what was causing the\r\ncursor to be
off, and then added an equivalent number of pixels
to\r\n`lineDecorationsWidth` so it's visually the same.\r\n\r\nI tracked
the issue back to this PR in 8.15: #186345. It may not make it\r\nin the
last planned 8.15 patch release, but we can backport there
anyway\r\njust in
case.\r\n\r\nBefore:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/924bbdb4-0ba6-446c-a4ad-63332f43f158\r\n\r\nAfter:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/864bedd0-c711-4910-b7a7-6a54e27e9148\r\n\r\nFixes
#191216.\r\n\r\n### Checklist\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"22141cbbfa1c7c00800fe340032f84ee87ba0222"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
  • Loading branch information
kibanamachine and davismcphee authored Dec 4, 2024
1 parent 7014c7e commit 632d2e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 3 additions & 1 deletion packages/kbn-esql-editor/src/esql_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ export const ESQLEditor = memo(function ESQLEditor({
lightbulb: {
enabled: false,
},
lineDecorationsWidth: 12,
lineDecorationsWidth: 20,
lineNumbers: 'on',
lineNumbersMinChars: 3,
minimap: { enabled: false },
Expand All @@ -601,7 +601,9 @@ export const ESQLEditor = memo(function ESQLEditor({
renderLineHighlightOnlyWhenFocus: true,
scrollbar: {
horizontal: 'hidden',
horizontalScrollbarSize: 6,
vertical: 'auto',
verticalScrollbarSize: 6,
},
scrollBeyondLastLine: false,
theme: darkMode ? ESQL_DARK_THEME_ID : ESQL_LIGHT_THEME_ID,
Expand Down
14 changes: 5 additions & 9 deletions packages/kbn-esql-editor/src/overwrite.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@
@include euiTextBreakWord;
}

// All scrollable containers (e.g. main container and suggest menu)
.ESQLEditor .monaco-editor .monaco-scrollable-element {
margin-left: $euiSizeS;
// Space between the autocomplete menu and expanded suggestion details
.ESQLEditor .monaco-editor .suggest-details {
padding-left: $euiSizeS;
}

.ESQLEditor .monaco-editor .monaco-list .monaco-scrollable-element {
margin-left: 0;

.monaco-list-row.focused {
border-radius: $euiBorderRadius;
}
.ESQLEditor .monaco-editor .monaco-list .monaco-scrollable-element .monaco-list-row.focused {
border-radius: $euiBorderRadius;
}

0 comments on commit 632d2e8

Please sign in to comment.