Skip to content

Commit d34970d

Browse files
committed
refactor(config): Enumerate for mutation instead of .index() lookup
1 parent daa03f2 commit d34970d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tmuxp/config.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def trickle(session_config):
385385
if "panes" not in window_config:
386386
window_config["panes"] = [{"shell_command": []}]
387387

388-
for pane_config in window_config["panes"]:
388+
for pane_idx, pane_config in enumerate(window_config["panes"]):
389389
commands_before = []
390390

391391
# Prepend shell_command_before to commands
@@ -399,8 +399,7 @@ def trickle(session_config):
399399
if "shell_command" in pane_config:
400400
commands_before.extend(pane_config["shell_command"])
401401

402-
p_index = window_config["panes"].index(pane_config)
403-
window_config["panes"][p_index]["shell_command"] = commands_before
402+
window_config["panes"][pane_idx]["shell_command"] = commands_before
404403
# pane_config['shell_command'] = commands_before
405404

406405
return session_config

0 commit comments

Comments
 (0)