@@ -129,22 +129,48 @@ touch_resize_main_pane() {
129
129
fi
130
130
}
131
131
132
+ sidebar_left_resize () {
133
+ local sidebar_width=" $1 "
134
+ if directory_in_sidebar_file " $PANE_CURRENT_PATH " ; then
135
+ # use stored sidebar width for the directory
136
+ local saved_width=" $( width_from_sidebar_file " $PANE_CURRENT_PATH " ) "
137
+ tmux resize-pane -x " $(( saved_width - 1 )) "
138
+ elif size_defined && [ $SIZE -lt $sidebar_width ]; then
139
+ tmux resize-pane -x " $(( SIZE - 1 )) "
140
+ fi
141
+ }
142
+
143
+ sidebar_right_resize () {
144
+ local sidebar_width=" $1 "
145
+ local correction
146
+ if directory_in_sidebar_file " $PANE_CURRENT_PATH " ; then
147
+ # use stored sidebar width for the directory
148
+ local saved_width=" $( width_from_sidebar_file " $PANE_CURRENT_PATH " ) "
149
+ correction=" $(( sidebar_width - saved_width)) "
150
+ tmux resize-pane -t " $PANE_ID " -R " $(( correction + 1 )) "
151
+ elif size_defined && [ $SIZE -lt $sidebar_width ]; then
152
+ correction=" $(( SIZE - saved_width)) "
153
+ tmux resize-pane -t " $PANE_ID " -R " $(( correction + 1 )) "
154
+ fi
155
+ }
156
+
157
+ split_sidebar () {
158
+ tmux split-window " $( orientation_option) " -c " $PANE_CURRENT_PATH " -P -F " #{pane_id},#{pane_width}" " $COMMAND "
159
+ }
160
+
132
161
create_sidebar () {
133
- local sidebar_info=$( tmux split-window " $( orientation_option ) " -c " $PANE_CURRENT_PATH " -P -F " #{pane_id},#{pane_width} " " $COMMAND " )
162
+ local sidebar_info=$( split_sidebar )
134
163
local sidebar_id=$( echo " $sidebar_info " | cut -d' ,' -f1)
135
164
local sidebar_width=$( echo " $sidebar_info " | cut -d' ,' -f2) # half a pane
136
165
register_sidebar " $sidebar_id " " $PANE_ID "
137
166
register_sidebar_for_current_pane " $sidebar_id "
138
167
if sidebar_left; then
139
168
tmux swap-pane -U
169
+ sidebar_left_resize " $sidebar_width "
170
+ else # sidebar right
171
+ sidebar_right_resize " $sidebar_width "
140
172
fi
141
- if directory_in_sidebar_file " $PANE_CURRENT_PATH " ; then
142
- # use stored sidebar width for the directory
143
- local saved_width=" $( width_from_sidebar_file " $PANE_CURRENT_PATH " ) "
144
- tmux resize-pane -x " $(( saved_width - 1 )) "
145
- elif size_defined && [ $SIZE -lt $sidebar_width ]; then
146
- tmux resize-pane -x " $(( SIZE - 1 )) "
147
- fi
173
+
148
174
if no_focus; then
149
175
tmux last-pane
150
176
fi
0 commit comments