Skip to content

Commit dcbae01

Browse files
Backport PR #23955 on branch 6.x (PR: Update focused file for Run plugin after a Save as operation (Editor)) (#23956)
1 parent bd99bd7 commit dcbae01

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

spyder/app/tests/test_mainwindow.py

+4
Original file line numberDiff line numberDiff line change
@@ -4812,6 +4812,10 @@ def test_tour_message(main_window, qtbot):
48124812
sys.version_info[:2] < (3, 10),
48134813
reason="Too flaky in old Python versions"
48144814
)
4815+
@pytest.mark.skipif(
4816+
not running_in_ci_with_conda(),
4817+
reason="Too flaky with pip packages"
4818+
)
48154819
@pytest.mark.known_leak
48164820
def test_update_outline(main_window, qtbot, tmpdir):
48174821
"""

spyder/plugins/editor/widgets/main_widget.py

+6
Original file line numberDiff line numberDiff line change
@@ -2479,6 +2479,12 @@ def save_as(self):
24792479
fname = editorstack.get_current_filename()
24802480
self.__add_recent_file(fname)
24812481

2482+
# We need to call this directly because at least on Windows
2483+
# editorstack.editor_focus_changed is not emitted after saving the
2484+
# file (and it's not harmful to do it for other OSes).
2485+
# Fixes spyder-ide/spyder#23716
2486+
self.update_run_focus_file()
2487+
24822488
@Slot()
24832489
def save_copy_as(self):
24842490
"""Save *copy as* the currently edited file"""

0 commit comments

Comments
 (0)