Skip to content

Commit 3776daf

Browse files
committed
refusing to have duplicate pane names in context
1 parent 4dccd78 commit 3776daf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

gef.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -10038,13 +10038,13 @@ def add_context_layout_mapping(self, current_pane_name: str, display_pane_functi
1003810038

1003910039
def add_context_pane(self, pane_name: str, display_pane_function: Callable, pane_title_function: Callable, condition: Optional[Callable]) -> None:
1004010040
"""Add a new context pane to ContextCommand."""
10041-
context = self.commands["context"]
10042-
assert isinstance(context, ContextCommand)
10043-
1004410041
# assure users can toggle the new context
1004510042
corrected_settings_name: str = pane_name.replace(" ", "_")
10046-
gef.config["context.layout"] += f" {corrected_settings_name}"
10043+
if corrected_settings_name in gef.config["context.layout"]:
10044+
warn(f"Duplicate name for `{pane_name}` (`{corrected_settings_name}`), skipping")
10045+
return
1004710046

10047+
gef.config["context.layout"] += f" {corrected_settings_name}"
1004810048
self.add_context_layout_mapping(corrected_settings_name, display_pane_function, pane_title_function, condition)
1004910049

1005010050
def load(self) -> None:

0 commit comments

Comments
 (0)