summaryrefslogtreecommitdiff
path: root/src/actions.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions.c')
-rw-r--r--src/actions.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/actions.c b/src/actions.c
index 87ad310..579d2ad 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1273,12 +1273,14 @@ read_split (const char *str, int max)
p = (int)(max * (float)(a) / (float)(b));
}
else if (sscanf(str, "%d", &p) == 1)
- {
+ {
+ if (p < 0)
+ p = max + p;
}
else
{
/* Failed to read input. */
- p = -1;
+ return -1;
}
/* Input out of range. */
@@ -1296,9 +1298,10 @@ cmd_h_split (int interactive, void *data)
/* Default to dividing the frame in half. */
if (data == NULL)
pixels = current_screen()->rp_current_frame->height / 2;
- else
+ else
pixels = read_split (data, current_screen()->rp_current_frame->height);
+
if (pixels > 0)
h_split_frame (current_screen()->rp_current_frame, pixels);