bpo-33642: IDLE: Use variable number of lines in CodeContext. (GH-7106)
Instead of displaying a fixed number of lines, some blank, Code Context
now displays the variable number of actual context lines. When there
are no context lines, it shows a single blank line to indicate that the
feature is turned on.
The Code Context configuration option is changed from 'numlines'
(default 3) to 'maxlines' (default 15) to avoid possible interference
between user settings for the old and new versions of Code Context.
(cherry picked from commit 29996a1c4e8bd6dde6adce2b44d11a0982a47a3a)
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py
index 36ac4a2..28ad458 100644
--- a/Lib/idlelib/configdialog.py
+++ b/Lib/idlelib/configdialog.py
@@ -1843,7 +1843,7 @@
self.format_width = tracers.add(
StringVar(self), ('extensions', 'FormatParagraph', 'max-width'))
self.context_lines = tracers.add(
- StringVar(self), ('extensions', 'CodeContext', 'numlines'))
+ StringVar(self), ('extensions', 'CodeContext', 'maxlines'))
# Create widgets:
# Section frames.
@@ -1910,7 +1910,7 @@
frame_format, textvariable=self.format_width, width=4)
frame_context = Frame(frame_editor, borderwidth=0)
- context_title = Label(frame_context, text='Context Lines :')
+ context_title = Label(frame_context, text='Max Context Lines :')
self.context_int = Entry(
frame_context, textvariable=self.context_lines, width=3)
@@ -2012,7 +2012,7 @@
self.format_width.set(idleConf.GetOption(
'extensions', 'FormatParagraph', 'max-width', type='int'))
self.context_lines.set(idleConf.GetOption(
- 'extensions', 'CodeContext', 'numlines', type='int'))
+ 'extensions', 'CodeContext', 'maxlines', type='int'))
# Set additional help sources.
self.user_helplist = idleConf.GetAllExtraHelpSourcesList()
@@ -2204,6 +2204,9 @@
'opener' - opener '({[' corresponding to closer; 'parens' - both chars;
'expression' (default) - also everything in between. Flash-delay is how
long to highlight if cursor is not moved (0 means forever).
+
+CodeContext: Maxlines is the maximum number of code context lines to
+display when Code Context is turned on for an editor window.
'''
}