From 1320a80e669c272c80f50e670684b1b689dcf4b2 Mon Sep 17 00:00:00 2001 From: sabetts Date: Fri, 18 Oct 2002 09:03:42 +0000 Subject: * src/actions.c (read_split): a negative number means subtract the pixels from the frame's current size to get the new frame's size. --- ChangeLog | 3 +++ NEWS | 7 +++++++ doc/ratpoison.texi | 22 +++++++++++++++++----- src/actions.c | 9 ++++++--- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index b886448..2ee6b09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2002-10-18 Shawn Betts + * src/actions.c (read_split): a negative number means subtract the + pixels from the frame's current size to get the new frame's size. + * src/split.c (VERTICALLY): new define (VERTICALLY): likewise (split_frame): new argument 'pixels'. The current frame is split diff --git a/NEWS b/NEWS index 84fc2d2..c4476b4 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,12 @@ ratpoison NEWS --- history of user-visible changes. -*- outline -*- +* Changes since 1.1.1 +** split, vsplit, hsplit +These commands now take a single argument. The argument can be a ratio +which divides the frame into two frames sized based on this ratio, or +it can be a number representing the number of pixels the existing +frame will occupy. + * Changes since 1.1.0 ** new commands "nextscreen" and "prevscreen" diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi index c3371eb..3285f64 100644 --- a/doc/ratpoison.texi +++ b/doc/ratpoison.texi @@ -683,11 +683,17 @@ Set the environment variable @var{env} to @var{value} @item source @var{file} Read a text file containing ratpoison commands. -@item split -@item hsplit -Split the current window horizontally in two. The last accessed window +@item split @var{n} +@item hsplit @var{n} +Split the current window horizontally. The last accessed window not occupying a frame will be the second window. +@var{n} is either a ratio of the form @code{x/y} or a number. If it is +a ratio then the two frames are sized according to the ratio. If it is +a pixel, the original frame is resized to that many pixels. If @var{n} +has a minus sign before it, then the new frame will be that many +pixels. + @item startup_message @var{state} Turn on or off the startup_message. This is most useful in your .ratpoisonrc file. @var{state} can be @code{on} or @code{off}. @@ -706,10 +712,16 @@ Clear the value of the environment variable, @var{env}. @item version Print ratpoison version. By default, this is bound to @kbd{C-t v}. -@item vsplit -Split the current window vertically in two. The last accessed window not +@item vsplit @var{n} +Split the current window vertically. The last accessed window not occupying a frame will be the second window. +@var{n} is either a ratio of the form @code{x/y} or a number. If it is +a ratio then the two frames are sized according to the ratio. If it is +a pixel, the original frame is resized to that many pixels. If @var{n} +has a minus sign before it, then the new frame will be that many +pixels. + @item windows @var{fmt} This displays the Program Bar which displays the windows you currently have running. The number before each window name is used to jump to 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); -- cgit v1.2.3