From b6fcf0f69db8fa2de1926cf39dbb4cee3408c2c0 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Sun, 26 Apr 2015 20:25:08 +0200 Subject: [PATCH] Make sure inserting a new section doesn't change the selected section --- src/menu.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/menu.cpp b/src/menu.cpp index 30c842d..0c72d19 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -472,6 +472,10 @@ int Menu::sectionNamed(const char *sectionName) if (it == sections.end() || *it != sectionName) { sections.emplace(it, sectionName); links.emplace(links.begin() + idx); + // Make sure the selected section doesn't change. + if (idx <= iSection) { + iSection++; + } } return idx; }