summaryrefslogtreecommitdiff
path: root/Lib/idlelib/autocomplete_w.py
diff options
context:
space:
mode:
authorTal Einat <532281+taleinat@users.noreply.github.com>2021-05-03 05:27:38 +0300
committerGitHub <noreply@github.com>2021-05-02 22:27:38 -0400
commitb43cc31a270d0dacbc69e35d6c6fbdb5edd7e711 (patch)
treef656c691cf80d2b927037808ea51d4f75ae20a16 /Lib/idlelib/autocomplete_w.py
parent90d523910a61290597b4599f17363b532f0a4411 (diff)
downloadcpython-git-b43cc31a270d0dacbc69e35d6c6fbdb5edd7e711.tar.gz
bpo-37903: IDLE: add shell sidebar mouse interactions (GH-25708)
Left click and drag to select lines. With selection, right click for context menu with copy and copy-with-prompts. Also add copy-with-prompts to the text-box context menu. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Lib/idlelib/autocomplete_w.py')
-rw-r--r--Lib/idlelib/autocomplete_w.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/idlelib/autocomplete_w.py b/Lib/idlelib/autocomplete_w.py
index fe7a6be83d..d3d1e6982b 100644
--- a/Lib/idlelib/autocomplete_w.py
+++ b/Lib/idlelib/autocomplete_w.py
@@ -26,9 +26,11 @@ DOUBLECLICK_SEQUENCE = "<B1-Double-ButtonRelease>"
class AutoCompleteWindow:
- def __init__(self, widget):
+ def __init__(self, widget, tags):
# The widget (Text) on which we place the AutoCompleteWindow
self.widget = widget
+ # Tags to mark inserted text with
+ self.tags = tags
# The widgets we create
self.autocompletewindow = self.listbox = self.scrollbar = None
# The default foreground and background of a selection. Saved because
@@ -69,7 +71,8 @@ class AutoCompleteWindow:
"%s+%dc" % (self.startindex, len(self.start)))
if i < len(newstart):
self.widget.insert("%s+%dc" % (self.startindex, i),
- newstart[i:])
+ newstart[i:],
+ self.tags)
self.start = newstart
def _binary_search(self, s):