diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-11-13 00:13:33 -0700 |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2019-11-13 02:13:33 -0500 |
commit | 9c2844927d15b2d3e21b28d62249dead02b5b597 (patch) | |
tree | 92b3e7027c11cc29aecaa95b3c98d43dec1671cf /Lib/idlelib/editor.py | |
parent | 2d56af7a94fe7ec0bdf3011652558ae1b889b4a8 (diff) | |
download | cpython-git-9c2844927d15b2d3e21b28d62249dead02b5b597.tar.gz |
bpo-4630: Add cursor no-blink option for IDLE (GH-16960)
This immediately toggles shell, editor, and output windows, but does not affect other input widgets.
Diffstat (limited to 'Lib/idlelib/editor.py')
-rw-r--r-- | Lib/idlelib/editor.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py index adeed74059..dff104ff0f 100644 --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -241,6 +241,12 @@ class EditorWindow(object): self.indentwidth = self.tabwidth self.set_notabs_indentwidth() + # Store the current value of the insertofftime now so we can restore + # it if needed. + if not hasattr(idleConf, 'blink_off_time'): + idleConf.blink_off_time = self.text['insertofftime'] + self.update_cursor_blink() + # When searching backwards for a reliable place to begin parsing, # first start num_context_lines[0] lines back, then # num_context_lines[1] lines back if that didn't work, and so on. @@ -803,6 +809,16 @@ class EditorWindow(object): text.mark_set("insert", pos + "+1c") text.see(pos) + def update_cursor_blink(self): + "Update the cursor blink configuration." + cursorblink = idleConf.GetOption( + 'main', 'EditorWindow', 'cursor-blink', type='bool') + if not cursorblink: + self.text['insertofftime'] = 0 + else: + # Restore the original value + self.text['insertofftime'] = idleConf.blink_off_time + def ResetFont(self): "Update the text widgets' font if it is changed" # Called from configdialog.py |