Skip to content

Commit 3a9833b

Browse files
committed
Move Commands and Help bindings to left side of footer
Child states now inherit parent left bindings instead of parent right, placing global actions (Commands, Help) at the end of the left side after context-specific bindings.
1 parent a71aafe commit 3a9833b

File tree

10 files changed

+40
-49
lines changed

10 files changed

+40
-49
lines changed

sqlit/domains/explorer/state/tree_multi_select.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,14 @@ def get_display_bindings(self, app: InputContext) -> tuple[list[DisplayBinding],
5757
)
5858
seen.add("delete_connection")
5959

60-
right: list[DisplayBinding] = []
6160
if self.parent:
62-
_, parent_right = self.parent.get_display_bindings(app)
63-
for binding in parent_right:
61+
parent_left, _ = self.parent.get_display_bindings(app)
62+
for binding in parent_left:
6463
if binding.action not in seen:
65-
right.append(binding)
64+
left.append(binding)
6665
seen.add(binding.action)
6766

68-
return left, right
67+
return left, []
6968

7069
def is_active(self, app: InputContext) -> bool:
7170
return app.focus == "explorer" and app.tree_multi_select_active

sqlit/domains/explorer/state/tree_on_connection.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,14 @@ def get_display_bindings(self, app: InputContext) -> tuple[list[DisplayBinding],
118118
)
119119
seen.add("refresh_tree")
120120

121-
right: list[DisplayBinding] = []
122121
if self.parent:
123-
_, parent_right = self.parent.get_display_bindings(app)
124-
for binding in parent_right:
122+
parent_left, _ = self.parent.get_display_bindings(app)
123+
for binding in parent_left:
125124
if binding.action not in seen:
126-
right.append(binding)
125+
left.append(binding)
127126
seen.add(binding.action)
128127

129-
return left, right
128+
return left, []
130129

131130
def is_active(self, app: InputContext) -> bool:
132131
return app.focus == "explorer" and app.tree_node_kind == "connection"

sqlit/domains/explorer/state/tree_on_database.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@ def get_display_bindings(self, app: InputContext) -> tuple[list[DisplayBinding],
2929
)
3030
seen.add("refresh_tree")
3131

32-
right: list[DisplayBinding] = []
3332
if self.parent:
34-
_, parent_right = self.parent.get_display_bindings(app)
35-
for binding in parent_right:
33+
parent_left, _ = self.parent.get_display_bindings(app)
34+
for binding in parent_left:
3635
if binding.action not in seen:
37-
right.append(binding)
36+
left.append(binding)
3837
seen.add(binding.action)
3938

40-
return left, right
39+
return left, []
4140

4241
def is_active(self, app: InputContext) -> bool:
4342
return app.focus == "explorer" and app.tree_node_kind == "database"

sqlit/domains/explorer/state/tree_on_folder.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,14 @@ def get_display_bindings(self, app: InputContext) -> tuple[list[DisplayBinding],
5959
)
6060
seen.add("delete_connection_folder")
6161

62-
right: list[DisplayBinding] = []
6362
if self.parent:
64-
_, parent_right = self.parent.get_display_bindings(app)
65-
for binding in parent_right:
63+
parent_left, _ = self.parent.get_display_bindings(app)
64+
for binding in parent_left:
6665
if binding.action not in seen:
67-
right.append(binding)
66+
left.append(binding)
6867
seen.add(binding.action)
6968

70-
return left, right
69+
return left, []
7170

7271
def is_active(self, app: InputContext) -> bool:
7372
return app.focus == "explorer" and app.tree_node_kind in ("folder", "schema", "connection_folder")

sqlit/domains/explorer/state/tree_on_object.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,14 @@ def get_display_bindings(self, app: InputContext) -> tuple[list[DisplayBinding],
3535
)
3636
seen.add("refresh_tree")
3737

38-
right: list[DisplayBinding] = []
3938
if self.parent:
40-
_, parent_right = self.parent.get_display_bindings(app)
41-
for binding in parent_right:
39+
parent_left, _ = self.parent.get_display_bindings(app)
40+
for binding in parent_left:
4241
if binding.action not in seen:
43-
right.append(binding)
42+
left.append(binding)
4443
seen.add(binding.action)
4544

46-
return left, right
45+
return left, []
4746

4847
def is_active(self, app: InputContext) -> bool:
4948
return app.focus == "explorer" and app.tree_node_kind in ("index", "trigger", "sequence")

sqlit/domains/explorer/state/tree_on_table.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@ def get_display_bindings(self, app: InputContext) -> tuple[list[DisplayBinding],
3737
)
3838
seen.add("refresh_tree")
3939

40-
right: list[DisplayBinding] = []
4140
if self.parent:
42-
_, parent_right = self.parent.get_display_bindings(app)
43-
for binding in parent_right:
41+
parent_left, _ = self.parent.get_display_bindings(app)
42+
for binding in parent_left:
4443
if binding.action not in seen:
45-
right.append(binding)
44+
left.append(binding)
4645
seen.add(binding.action)
4746

48-
return left, right
47+
return left, []
4948

5049
def is_active(self, app: InputContext) -> bool:
5150
return app.focus == "explorer" and app.tree_node_kind in ("table", "view")

sqlit/domains/explorer/state/tree_visual_mode.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,14 @@ def get_display_bindings(self, app: InputContext) -> tuple[list[DisplayBinding],
6969
)
7070
seen.add("delete_connection")
7171

72-
right: list[DisplayBinding] = []
7372
if self.parent:
74-
_, parent_right = self.parent.get_display_bindings(app)
75-
for binding in parent_right:
73+
parent_left, _ = self.parent.get_display_bindings(app)
74+
for binding in parent_left:
7675
if binding.action not in seen:
77-
right.append(binding)
76+
left.append(binding)
7877
seen.add(binding.action)
7978

80-
return left, right
79+
return left, []
8180

8281
def is_active(self, app: InputContext) -> bool:
8382
return app.focus == "explorer" and app.tree_visual_mode_active

sqlit/domains/query/state/query_normal.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,14 @@ def get_display_bindings(self, app: InputContext) -> tuple[list[DisplayBinding],
127127
)
128128
seen.add("new_query")
129129

130-
right: list[DisplayBinding] = []
131130
if self.parent:
132-
_, parent_right = self.parent.get_display_bindings(app)
133-
for binding in parent_right:
131+
parent_left, _ = self.parent.get_display_bindings(app)
132+
for binding in parent_left:
134133
if binding.action not in seen:
135-
right.append(binding)
134+
left.append(binding)
136135
seen.add(binding.action)
137136

138-
return left, right
137+
return left, []
139138

140139
def is_active(self, app: InputContext) -> bool:
141140
return app.focus == "query" and app.vim_mode == VimMode.NORMAL

sqlit/domains/results/state/results_focused.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ def has_results(app: InputContext) -> bool:
3232
def get_display_bindings(self, app: InputContext) -> tuple[list[DisplayBinding], list[DisplayBinding]]:
3333
# No bindings when there are no results
3434
if not app.has_results:
35-
right: list[DisplayBinding] = []
35+
left: list[DisplayBinding] = []
3636
if self.parent:
37-
_, right = self.parent.get_display_bindings(app)
38-
return [], right
37+
left, _ = self.parent.get_display_bindings(app)
38+
return left, []
3939

4040
left: list[DisplayBinding] = []
4141
seen: set[str] = set()
@@ -136,15 +136,14 @@ def get_display_bindings(self, app: InputContext) -> tuple[list[DisplayBinding],
136136
]
137137
)
138138

139-
right_bindings: list[DisplayBinding] = []
140139
if self.parent:
141-
_, parent_right = self.parent.get_display_bindings(app)
142-
for binding in parent_right:
140+
parent_left, _ = self.parent.get_display_bindings(app)
141+
for binding in parent_left:
143142
if binding.action not in seen:
144-
right_bindings.append(binding)
143+
left.append(binding)
145144
seen.add(binding.action)
146145

147-
return left, right_bindings
146+
return left, []
148147

149148
def is_active(self, app: InputContext) -> bool:
150149
return app.focus == "results"

sqlit/domains/shell/state/main_screen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ def _setup_actions(self) -> None:
1818
self.allows("show_connection_picker")
1919
self.allows("disconnect", guard=lambda app: app.has_connection)
2020
self.allows("toggle_fullscreen", help="Toggle fullscreen")
21-
self.allows("show_help", key="?", label="Help", right=True)
2221
self.allows("change_theme")
2322
self.allows("toggle_process_worker", help="Toggle process worker")
2423
self.allows("leader_key", key="<space>", label="Commands")
24+
self.allows("show_help", key="?", label="Help")
2525

2626
def is_active(self, app: InputContext) -> bool:
2727
if app.modal_open:

0 commit comments

Comments
 (0)