Add support for changing cursor blink rate within the editors. #8712

pull/9076/head
Aditya Toshniwal 2025-08-18 12:34:31 +05:30 committed by GitHub
parent 24b4d35565
commit 9d0ec04667
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 31 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 KiB

After

Width:  |  Height:  |  Size: 215 KiB

View File

@ -292,6 +292,9 @@ Use the fields on the *Options* panel to manage editor preferences.
* When the *Code folding?* switch is set to *False*, the editor will disable
code folding. Disabling will improve editor performance with large files.
* Use the *Cursor blink rate* field to adjust the speed at which the text cursor
blinks within the editors.
* Use the *Font family* field to be used for all SQL editors. The specified
font should already be installed on your system. If the font is not found,
the editor will fall back to the default font, Source Code Pro.

View File

@ -150,6 +150,24 @@ def register_editor_preferences(self, migration_gettext=None):
)
)
self.editor_preference.register(
'options', 'cursor_blink_rate',
gettext("Cursor blink rate"), 'options', 'medium',
category_label=PREF_LABEL_OPTIONS,
options=[{'label': gettext('None'), 'value': 'none'},
{'label': gettext('Slow'), 'value': 'slow'},
{'label': gettext('Medium'), 'value': 'medium'},
{'label': gettext('Fast'), 'value': 'fast'}],
control_props={
'allowClear': False,
'creatable': False,
},
help_str=gettext(
'Adjust the speed at which the text cursor blinks within '
'the editors.'
)
)
self.editor_preference.register(
'options', 'wrap_code',
gettext("Line wrapping?"), 'boolean', False,

View File

@ -120,7 +120,6 @@ function insertTabWithUnit({ state, dispatch }) {
/* React wrapper for CodeMirror */
const defaultExtensions = [
highlightSpecialChars(),
drawSelection(),
rectangularSelection(),
dropCursor(),
crosshairCursor(),
@ -399,6 +398,16 @@ export default function Editor({
}));
}
const CURSOR_BLINK_RATE_MAP = {
'none': 0,
'slow': 1800,
'medium': 1200,
'fast': 600,
};
newConfigExtn.push(drawSelection({
cursorBlinkRate: CURSOR_BLINK_RATE_MAP[editorPref.cursor_blink_rate] ?? 1200
}));
// add fold service conditionally
if(!editorPref.plain_editor_mode && editorPref.code_folding && language == 'pgsql') {
newConfigExtn.push(plpgsqlFoldService);