Skip to content

Commit c94386d

Browse files
bpo-37692: Improve highlight config sample (GH-14983)
Use an example shell interaction in the sample and better labels for shell elements. (cherry picked from commit b222955) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
1 parent 69372ee commit c94386d

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

Lib/idlelib/configdialog.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ def create_page_highlight(self):
808808
(*)theme_message: Label
809809
"""
810810
self.theme_elements = {
811-
'Normal Text': ('normal', '00'),
811+
'Normal Code or Text': ('normal', '00'),
812812
'Code Context': ('context', '01'),
813813
'Python Keywords': ('keyword', '02'),
814814
'Python Definitions': ('definition', '03'),
@@ -819,10 +819,10 @@ def create_page_highlight(self):
819819
'Found Text': ('hit', '08'),
820820
'Cursor': ('cursor', '09'),
821821
'Editor Breakpoint': ('break', '10'),
822-
'Shell Normal Text': ('console', '11'),
823-
'Shell Error Text': ('error', '12'),
824-
'Shell Stdout Text': ('stdout', '13'),
825-
'Shell Stderr Text': ('stderr', '14'),
822+
'Shell Prompt': ('console', '11'),
823+
'Error Text': ('error', '12'),
824+
'Shell User Output': ('stdout', '13'),
825+
'Shell User Exception': ('stderr', '14'),
826826
'Line Number': ('linenumber', '16'),
827827
}
828828
self.builtin_name = tracers.add(
@@ -852,27 +852,26 @@ def create_page_highlight(self):
852852
takefocus=FALSE, highlightthickness=0, wrap=NONE)
853853
text.bind('<Double-Button-1>', lambda e: 'break')
854854
text.bind('<B1-Motion>', lambda e: 'break')
855-
text_and_tags=(
856-
('\n', 'normal'),
857-
('#you can click here', 'comment'), ('\n', 'normal'),
858-
('#to choose items', 'comment'), ('\n', 'normal'),
859-
('code context section', 'context'), ('\n\n', 'normal'),
855+
string_tags=(
856+
('# Click selects item.', 'comment'), ('\n', 'normal'),
857+
('code context section', 'context'), ('\n', 'normal'),
858+
('| cursor', 'cursor'), ('\n', 'normal'),
860859
('def', 'keyword'), (' ', 'normal'),
861860
('func', 'definition'), ('(param):\n ', 'normal'),
862-
('"""string"""', 'string'), ('\n var0 = ', 'normal'),
861+
('"Return None."', 'string'), ('\n var0 = ', 'normal'),
863862
("'string'", 'string'), ('\n var1 = ', 'normal'),
864863
("'selected'", 'hilite'), ('\n var2 = ', 'normal'),
865864
("'found'", 'hit'), ('\n var3 = ', 'normal'),
866865
('list', 'builtin'), ('(', 'normal'),
867866
('None', 'keyword'), (')\n', 'normal'),
868867
(' breakpoint("line")', 'break'), ('\n\n', 'normal'),
869-
(' error ', 'error'), (' ', 'normal'),
870-
('cursor |', 'cursor'), ('\n ', 'normal'),
871-
('shell', 'console'), (' ', 'normal'),
872-
('stdout', 'stdout'), (' ', 'normal'),
873-
('stderr', 'stderr'), ('\n\n', 'normal'))
874-
for texttag in text_and_tags:
875-
text.insert(END, texttag[0], texttag[1])
868+
('>>>', 'console'), (' 3.14**2\n', 'normal'),
869+
('9.8596', 'stdout'), ('\n', 'normal'),
870+
('>>>', 'console'), (' pri ', 'normal'),
871+
('n', 'error'), ('t(\n', 'normal'),
872+
('SyntaxError', 'stderr'), ('\n', 'normal'))
873+
for string, tag in string_tags:
874+
text.insert(END, string, tag)
876875
n_lines = len(text.get('1.0', END).splitlines())
877876
for lineno in range(1, n_lines):
878877
text.insert(f'{lineno}.0',
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Improve highlight config sample with example shell interaction and better
2+
labels for shell elements.

0 commit comments

Comments
 (0)