This commit is contained in:
2026-01-23 01:19:36 -08:00
parent 072edb4399
commit 5626bde557
2 changed files with 46 additions and 15 deletions

View File

@@ -615,9 +615,23 @@ class ConfigModal(ModalScreen):
self.notify("Clipboard not supported in this terminal", severity="warning")
def on_store_type_selected(self, stype: str) -> None:
if not stype: return
new_name = f"new_{stype}"
if not stype:
return
existing_names: set[str] = set()
store_block = self.config_data.get("store")
if isinstance(store_block, dict):
st_entries = store_block.get(stype)
if isinstance(st_entries, dict):
existing_names = {str(name) for name in st_entries.keys() if name}
base_name = f"new_{stype}"
new_name = base_name
suffix = 1
while new_name in existing_names:
suffix += 1
new_name = f"{base_name}_{suffix}"
if "store" not in self.config_data:
self.config_data["store"] = {}
if stype not in self.config_data["store"]:
@@ -644,7 +658,7 @@ class ConfigModal(ModalScreen):
for rk in required:
if rk.upper() != "NAME":
new_config[rk] = ""
self.config_data["store"][stype][new_name] = new_config
self.editing_item_type = f"store-{stype}"
self.editing_item_name = new_name