• Fixed the keybinding merge bug. The helper was restoring missing default commands

by overwriting an occupied default shortcut, which treated user bindings like mod+d=duplicate-line-or-selection as stale
  because that command is not in the default keybinding table. Now it only adds a default when the default shortcut is actually
  free.

  Added a regression test in src/tests/unit_tests/uicodeeditor_tests.cpp:108 covering the reported case: mod+d reassigned, then
  an extra mod+e=show-markdown-preview binding exists. This was reported in SpartanJ/ecode#914.

• Implemented the splitter-level focus state cache, it will remember closed documents cursor state when reopened and it will restore cursor state per-code editor and not per-document (SpartanJ/ecode#893).
This commit is contained in:
Martín Lucas Golini
2026-06-25 11:26:31 -03:00
parent 0693688f73
commit e720b70863
9 changed files with 172 additions and 53 deletions
-48
View File
@@ -58,22 +58,6 @@ void KeybindingsHelper::updateKeybindings(
invertedKeybindings[key.second] = shortcutStr;
ini.setValue( group, shortcutStr, key.second );
added = true;
} else if ( foundCmd == invertedKeybindings.end() ) {
// Override the shortcut if the command that holds that
// shortcut does not exists anymore
auto kb = keybindings.find( shortcutStr );
if ( kb != keybindings.end() ) {
bool found = false;
for ( const auto& val : defKeybindings )
if ( val.second == kb->second )
found = true;
if ( !found ) {
keybindings[shortcutStr] = key.second;
invertedKeybindings[key.second] = shortcutStr;
ini.setValue( group, shortcutStr, key.second );
added = true;
}
}
}
}
}
@@ -147,22 +131,6 @@ void KeybindingsHelper::updateKeybindings(
invertedKeybindings[key.second] = shortcutStr;
ini.setValue( group, shortcutStr, key.second );
added = true;
} else if ( foundCmd == invertedKeybindings.end() ) {
// Override the shortcut if the command that holds that
// shortcut does not exists anymore
auto kb = keybindings.find( shortcutStr );
if ( kb != keybindings.end() ) {
bool found = false;
for ( const auto& val : defKeybindings )
if ( val.second == kb->second )
found = true;
if ( !found ) {
keybindings[shortcutStr] = key.second;
invertedKeybindings[key.second] = shortcutStr;
ini.setValue( group, shortcutStr, key.second );
added = true;
}
}
}
}
}
@@ -235,22 +203,6 @@ void KeybindingsHelper::updateKeybindings(
invertedKeybindings[key.second] = shortcutStr;
ini.setValue( group, shortcutStr, key.second );
added = true;
} else if ( foundCmd == invertedKeybindings.end() ) {
// Override the shortcut if the command that holds that
// shortcut does not exists anymore
auto kb = keybindings.find( shortcutStr );
if ( kb != keybindings.end() ) {
bool found = false;
for ( const auto& val : defKeybindings )
if ( val.second == kb->second )
found = true;
if ( !found ) {
keybindings[shortcutStr] = key.second;
invertedKeybindings[key.second] = shortcutStr;
ini.setValue( group, shortcutStr, key.second );
added = true;
}
}
}
}
}