Skip to content

Commit 01650ea

Browse files
Alan Morganrvaiya
authored andcommitted
grid: Add up/down/right/left bisection (#246)
1 parent 8a7e6f2 commit 01650ea

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

src/config.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ static struct {
7676
{ "grid_left", "a", "Move the grid left.", OPT_KEY },
7777
{ "grid_down", "s", "Move the grid down.", OPT_KEY },
7878
{ "grid_right", "d", "Move the grid right.", OPT_KEY },
79+
{ "grid_cut_up", "W", "Cut the grid up.", OPT_KEY },
80+
{ "grid_cut_left", "A", "Cut the grid left.", OPT_KEY },
81+
{ "grid_cut_down", "S", "Cut the grid down.", OPT_KEY },
82+
{ "grid_cut_right", "D", "Cut the grid right.", OPT_KEY },
7983
{ "grid_keys", "u i j k", "A sequence of comma delimited keybindings which are ordered bookwise with respect to grid position.", OPT_KEY },
8084
{ "grid_exit", "c", "Exit grid mode and return to normal mode.", OPT_KEY },
8185

src/grid.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ struct input_event *grid_mode()
103103
"grid_down",
104104
"grid_right",
105105
"grid_left",
106+
"grid_cut_up",
107+
"grid_cut_down",
108+
"grid_cut_right",
109+
"grid_cut_left",
106110
"grid_keys",
107111

108112
"buttons",
@@ -145,6 +149,38 @@ struct input_event *grid_mode()
145149
redraw(mx, my, 0);
146150
}
147151

152+
if (config_input_match(ev, "grid_cut_up")) {
153+
my -= grid_height/4;
154+
grid_height /= 2;
155+
156+
platform->mouse_move(scr, mx, my);
157+
redraw(mx, my, 0);
158+
}
159+
160+
if (config_input_match(ev, "grid_cut_down")) {
161+
my += grid_height/4;
162+
grid_height /= 2;
163+
164+
platform->mouse_move(scr, mx, my);
165+
redraw(mx, my, 0);
166+
}
167+
168+
if (config_input_match(ev, "grid_cut_left")) {
169+
mx -= grid_width/4;
170+
grid_width /= 2;
171+
172+
platform->mouse_move(scr, mx, my);
173+
redraw(mx, my, 0);
174+
}
175+
176+
if (config_input_match(ev, "grid_cut_right")) {
177+
mx += grid_width/4;
178+
grid_width /= 2;
179+
180+
platform->mouse_move(scr, mx, my);
181+
redraw(mx, my, 0);
182+
}
183+
148184
if (config_input_match(ev, "buttons") ||
149185
config_input_match(ev, "oneshot_buttons")) {
150186
goto exit;

0 commit comments

Comments
 (0)