summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/windows/mailwindow.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp
index 4f5f9cac5..da5192aee 100644
--- a/src/gui/windows/mailwindow.cpp
+++ b/src/gui/windows/mailwindow.cpp
@@ -255,6 +255,13 @@ void MailWindow::removeMail(const int64_t id)
if (message != nullptr)
mMailModel->add(getMailHeader(message));
}
+
+ // if player deleted the selected mail, then selection does not change
+ // (selects next one in list). However, if they deleted the last one,
+ // then we go to the previous one in list.
+ const auto lastIndex = mMailModel->getNumberOfElements() - 1;
+ if (mListBox->getSelected() > lastIndex)
+ mListBox->setSelected(lastIndex);
}
void MailWindow::showMessage(MailMessage *const mail,