From 55ee0a6920e10fe17bd3369d3a5a0bec95b2c8e8 Mon Sep 17 00:00:00 2001 From: saberoueslati Date: Sat, 2 May 2026 01:01:55 +0100 Subject: [PATCH] Fix file rename: pre-fill dialog and actually delete old file --- src/ScintillaNext.cpp | 2 +- src/dialogs/MainWindow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ScintillaNext.cpp b/src/ScintillaNext.cpp index 2e59ddb9d..3a77bdaf9 100644 --- a/src/ScintillaNext.cpp +++ b/src/ScintillaNext.cpp @@ -456,7 +456,7 @@ bool ScintillaNext::rename(const QString &newFilePath) emit aboutToSave(); // Write out the buffer to the new path - if (saveCopyAs(newFilePath)) { + if (saveCopyAs(newFilePath) == QFileDevice::NoError) { // Remove the old file const QString oldPath = fileInfo.canonicalFilePath(); QFile::remove(oldPath); diff --git a/src/dialogs/MainWindow.cpp b/src/dialogs/MainWindow.cpp index 008c8e095..daf1d5b45 100644 --- a/src/dialogs/MainWindow.cpp +++ b/src/dialogs/MainWindow.cpp @@ -1479,7 +1479,7 @@ void MainWindow::renameFile() if (editor->isFile()) { const QString filter = app->getFileDialogFilter(); QString selectedFilter = app->getFileDialogFilterForLanguage(editor->languageName); - QString fileName = FileDialogHelpers::getSaveFileName(this, tr("Rename"), defaultDirectoryManager->getDefaultDirectory(), filter, &selectedFilter); + QString fileName = FileDialogHelpers::getSaveFileName(this, tr("Rename"), editor->getFilePath(), filter, &selectedFilter); if (fileName.isEmpty()) { return;