Improve code quality for external editor settings

This commit is contained in:
Lawrence Lee
2023-04-09 13:52:09 -07:00
parent 19f12f3182
commit 186995acf4
3 changed files with 29 additions and 15 deletions

View File

@@ -1753,7 +1753,7 @@ void Preferences::storePreferences()
for (unsigned i = 0; i < editors.size(); i++) {
moptions.externalEditors[i] = (ExternalEditor(
editors[i].name, editors[i].command, editors[i].native_command, editors[i].icon_serialized));
if (editors[i].other_data) {
if (editors[i].other_data.selected) {
// The current editor was marked before the list was edited. We
// found the mark, so this is the editor that was active.
moptions.externalEditorIndex = i;
@@ -2038,7 +2038,7 @@ void Preferences::fillPreferences()
}
if (moptions.externalEditorIndex >= 0) {
// Mark the current editor so we can track it.
editorInfos[moptions.externalEditorIndex].other_data = (void *)1;
editorInfos[moptions.externalEditorIndex].other_data.selected = true;
}
externalEditors->setEditors(editorInfos);