From 55e9c57721c41b5ab7aeb92eb5242f6bcb9c2085 Mon Sep 17 00:00:00 2001 From: abose Date: Tue, 8 Apr 2025 16:37:08 +0530 Subject: [PATCH 1/2] fix: choppy cursor selection performance issue --- src/editor/EditorManager.js | 2 +- src/extensions/default/Git/src/GutterManager.js | 5 +++++ src/extensionsIntegrated/CSSColorPreview/main.js | 5 +++++ src/extensionsIntegrated/HtmlTagSyncEdit/main.js | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/editor/EditorManager.js b/src/editor/EditorManager.js index d72277d8ec..40f9d30092 100644 --- a/src/editor/EditorManager.js +++ b/src/editor/EditorManager.js @@ -775,7 +775,7 @@ define(function (require, exports, module) { // Set up event dispatching EventDispatcher.makeEventDispatcher(exports); - EventDispatcher.setLeakThresholdForEvent(EVENT_ACTIVE_EDITOR_CHANGED, 25); + EventDispatcher.setLeakThresholdForEvent(EVENT_ACTIVE_EDITOR_CHANGED, 30); // File-based preferences handling exports.on(EVENT_ACTIVE_EDITOR_CHANGED, function (e, current) { diff --git a/src/extensions/default/Git/src/GutterManager.js b/src/extensions/default/Git/src/GutterManager.js index 7c6db24df1..e5f5281b7a 100644 --- a/src/extensions/default/Git/src/GutterManager.js +++ b/src/extensions/default/Git/src/GutterManager.js @@ -49,6 +49,11 @@ define(function (require, exports) { function _cursorActivity(_evt, editor){ // this is to prevent a gutter gap in the active line if there is no color on this line. + if (editor.hasSelection()){ + // we dont show the gutter gap color when there is a selection. also adding dummy gutter is expensive + // and make test selection with cursor choppy + return; + } _addDummyGutterMarkerIfNotExist(editor._codeMirror, editor.getCursorPos().line); } diff --git a/src/extensionsIntegrated/CSSColorPreview/main.js b/src/extensionsIntegrated/CSSColorPreview/main.js index e5b03b5c5e..04a4ad9dbc 100644 --- a/src/extensionsIntegrated/CSSColorPreview/main.js +++ b/src/extensionsIntegrated/CSSColorPreview/main.js @@ -213,6 +213,11 @@ define(function (require, exports, module) { function _cursorActivity(_evt, editor){ // this is to prevent a gutter gap in the active line if there is no color on this line. + if(editor.hasSelection()){ + // we dont show the gutter gap color when there is a selection. also adding dummy gutter is expensive + // and make test selection with cursor choppy + return; + } _addDummyGutterMarkerIfNotExist(editor, editor.getCursorPos().line); if(editor._currentlyColorMarkedLine){ editor.clearAllMarks(COLOR_MARK_NAME); diff --git a/src/extensionsIntegrated/HtmlTagSyncEdit/main.js b/src/extensionsIntegrated/HtmlTagSyncEdit/main.js index 463db703ff..9351c7d493 100644 --- a/src/extensionsIntegrated/HtmlTagSyncEdit/main.js +++ b/src/extensionsIntegrated/HtmlTagSyncEdit/main.js @@ -237,7 +237,7 @@ define(function (require, exports, module) { function cursorActivity() { const cursor = activeEditor.getCursorPos(); - if(activeEditor.hasMultipleCursors()){ + if(activeEditor.hasMultipleCursors() || activeEditor.hasSelection()){ clearRenameMarkers(); return; } From e92f5a8f2c83dbf0884373be9e0e30d1188b6145 Mon Sep 17 00:00:00 2001 From: abose Date: Tue, 8 Apr 2025 17:13:25 +0530 Subject: [PATCH 2/2] fix: integ test failures after cursoractivity fix --- src/extensionsIntegrated/HtmlTagSyncEdit/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/extensionsIntegrated/HtmlTagSyncEdit/main.js b/src/extensionsIntegrated/HtmlTagSyncEdit/main.js index 9351c7d493..d279e27200 100644 --- a/src/extensionsIntegrated/HtmlTagSyncEdit/main.js +++ b/src/extensionsIntegrated/HtmlTagSyncEdit/main.js @@ -237,7 +237,9 @@ define(function (require, exports, module) { function cursorActivity() { const cursor = activeEditor.getCursorPos(); - if(activeEditor.hasMultipleCursors() || activeEditor.hasSelection()){ + const sel = activeEditor.getSelection(); + const multiLineSelection = sel.start.line !== sel.end.line; + if(activeEditor.hasMultipleCursors() || multiLineSelection){ clearRenameMarkers(); return; }