summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/idle_test
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2020-02-28 18:22:55 (GMT)
committerGitHub <noreply@github.com>2020-02-28 18:22:55 (GMT)
commitc705fd1e89ccb8f6d414ec817b4616546147d877 (patch)
tree8b2161ff8c811747c6c3aa17d281c00dc15fe4d3 /Lib/idlelib/idle_test
parent4f17c5cd9a1ec50fe8de7ef68c39220a01a862cb (diff)
downloadcpython-c705fd1e89ccb8f6d414ec817b4616546147d877.zip
cpython-c705fd1e89ccb8f6d414ec817b4616546147d877.tar.gz
cpython-c705fd1e89ccb8f6d414ec817b4616546147d877.tar.bz2
bpo-39781: Do not jump when select in IDLE codecontext (GH-18683)
Previously, the button-up part of selecting with a mouse was treated as a click that meant 'jump' to this line, which modified the context and undid the selection
Diffstat (limited to 'Lib/idlelib/idle_test')
-rw-r--r--Lib/idlelib/idle_test/test_codecontext.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/idlelib/idle_test/test_codecontext.py b/Lib/idlelib/idle_test/test_codecontext.py
index 3ec49e9..9578cc73 100644
--- a/Lib/idlelib/idle_test/test_codecontext.py
+++ b/Lib/idlelib/idle_test/test_codecontext.py
@@ -332,6 +332,14 @@ class CodeContextTest(unittest.TestCase):
jump()
eq(cc.topvisible, 8)
+ # Context selection stops jump.
+ cc.text.yview('5.0')
+ cc.update_code_context()
+ cc.context.tag_add('sel', '1.0', '2.0')
+ cc.context.mark_set('insert', '1.0')
+ jump() # Without selection, to line 2.
+ eq(cc.topvisible, 5)
+
@mock.patch.object(codecontext.CodeContext, 'update_code_context')
def test_timer_event(self, mock_update):
# Ensure code context is not active.