From 61ebf4e34abc8ba5c0df25e09be3c963fcd8dafc Mon Sep 17 00:00:00 2001
From: Terry Jan Reedy
Date: Fri, 6 Mar 2020 01:57:35 -0500
Subject: [PATCH 1/4] bpo-39852: IDLE 'Go to line' deletes selection, updates
status
Clearing any selection prevents accidental deletion.
The update is for Ln and Col on the status bar.
---
Lib/idlelib/editor.py | 7 ++++++-
.../next/IDLE/2020-03-06-01-55-14.bpo-39852.QjA1qF.rst | 2 ++
2 files changed, 8 insertions(+), 1 deletion(-)
create mode 100644 Misc/NEWS.d/next/IDLE/2020-03-06-01-55-14.bpo-39852.QjA1qF.rst
diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py
index 04c786dc5234c2..f2fa96a68e3920 100644
--- a/Lib/idlelib/editor.py
+++ b/Lib/idlelib/editor.py
@@ -678,8 +678,13 @@ def goto_line_event(self, event):
if lineno <= 0:
text.bell()
return "break"
- text.mark_set("insert", "%d.0" % lineno)
+ newindex = f'{lineno}.0'
+ text.mark_set("insert", newindex )
text.see("insert")
+ text.update_idletasks()
+ x0, y0, w, h = text.bbox(newindex)
+ text.event_generate('', x=x0, y=y0)
+ text.event_generate('', x=x0, y=y0)
return "break"
def open_module(self):
diff --git a/Misc/NEWS.d/next/IDLE/2020-03-06-01-55-14.bpo-39852.QjA1qF.rst b/Misc/NEWS.d/next/IDLE/2020-03-06-01-55-14.bpo-39852.QjA1qF.rst
new file mode 100644
index 00000000000000..7d7d941418074b
--- /dev/null
+++ b/Misc/NEWS.d/next/IDLE/2020-03-06-01-55-14.bpo-39852.QjA1qF.rst
@@ -0,0 +1,2 @@
+Edit "Go to line" now clears any selection, preventing accidental deletion.
+It also updates Ln and Col on the status bar.
From 763f2c13bf0bc76532a9794e219c5beed2294dfb Mon Sep 17 00:00:00 2001
From: Terry Jan Reedy
Date: Sat, 7 Mar 2020 00:47:41 -0500
Subject: [PATCH 2/4] News and doc.
---
Doc/library/idle.rst | 4 +++-
Lib/idlelib/NEWS.txt | 3 +++
Lib/idlelib/help.html | 33 +++++++++++++++++++--------------
3 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst
index fd6e309567de39..b1192e7bb46552 100644
--- a/Doc/library/idle.rst
+++ b/Doc/library/idle.rst
@@ -142,7 +142,9 @@ Replace...
Open a search-and-replace dialog.
Go to Line
- Move cursor to the line number requested and make that line visible.
+ Move the cursor to the beginning of the line requested and make that
+ line visible. A request past the end of the file goes to the end.
+ Clear any selection and update the line and column status.
Show Completions
Open a scrollable list allowing selection of keywords and attributes. See
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index 0651b3d68dc8b1..1e6cd4580ea7bc 100644
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -3,6 +3,9 @@ Released on 2020-10-05?
======================================
+bpo-39852: Edit "Go to line" now clears any selection, preventing
+accidental deletion. It also updates Ln and Col on the status bar.
+
bpo-39781: Selecting code context lines no longer causes a jump.
bpo-39663: Add tests for pyparse find_good_parse_start().
diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html
index 0b2bdd2e174ccf..424c6b50f339e1 100644
--- a/Lib/idlelib/help.html
+++ b/Lib/idlelib/help.html
@@ -4,7 +4,7 @@
- IDLE — Python 3.9.0a1 documentation
+ IDLE — Python 3.9.0a4 documentation
@@ -17,7 +17,7 @@
@@ -71,7 +71,7 @@