Skip to content

Commit d6f54a2

Browse files
authored
Simplify file reload by removing cursor restoration
Removed cursor position restoration logic during file reload.
1 parent 884758b commit d6f54a2

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

Lib/idlelib/iomenu.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -262,22 +262,8 @@ def reload(self, event):
262262
self.text.focus_set()
263263
return "break"
264264

265-
# Save cursor position
266-
insert_pos = self.text.index("insert")
267-
yview_pos = self.text.yview()
268-
269265
# Reload the file
270-
if self.loadfile(self.filename):
271-
# Try to restore cursor position if the file still has that line
272-
try:
273-
self.text.mark_set("insert", insert_pos)
274-
self.text.see("insert")
275-
# Restore vertical scroll position
276-
self.text.yview_moveto(yview_pos[0])
277-
except Exception:
278-
# If position doesn't exist anymore, go to top
279-
self.text.mark_set("insert", "1.0")
280-
self.text.see("insert")
266+
self.loadfile(self.filename)
281267

282268
self.text.focus_set()
283269
return "break"

0 commit comments

Comments
 (0)