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.
This commit is contained in:
Cheryl Sabella 2018-06-01 19:23:00 -04:00 committed by Terry Jan Reedy
parent 6854e803b7
commit 29996a1c4e
6 changed files with 40 additions and 29 deletions

View file

@ -1843,7 +1843,7 @@ class GenPage(Frame):
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 @@ class GenPage(Frame):
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 @@ class GenPage(Frame):
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 @@ ParenMatch: Style indicates what is highlighted when closer is entered:
'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.
'''
}