aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorKarl Heuer1995-12-13 03:29:28 +0000
committerKarl Heuer1995-12-13 03:29:28 +0000
commitc08076084e695962627fee84814873b7e52de15f (patch)
tree26a7ca0a7a6f6704c6ea168c24b517f3b20cc3d7 /src/window.c
parent9121ca4020057e02487e37ce5c8355d9ba3e781e (diff)
downloademacs-c08076084e695962627fee84814873b7e52de15f.tar.gz
emacs-c08076084e695962627fee84814873b7e52de15f.zip
(Fsplit_window): Account for scroll bar width.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/window.c b/src/window.c
index 035b6a78c23..915297b46f5 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2253,7 +2253,10 @@ and put SIZE columns in the first of the pair.")
2253{ 2253{
2254 register Lisp_Object new; 2254 register Lisp_Object new;
2255 register struct window *o, *p; 2255 register struct window *o, *p;
2256 FRAME_PTR fo;
2256 register int size; 2257 register int size;
2258 int internal_width;
2259 int separator_width = 1;
2257 2260
2258 if (NILP (window)) 2261 if (NILP (window))
2259 window = selected_window; 2262 window = selected_window;
@@ -2261,13 +2264,17 @@ and put SIZE columns in the first of the pair.")
2261 CHECK_LIVE_WINDOW (window, 0); 2264 CHECK_LIVE_WINDOW (window, 0);
2262 2265
2263 o = XWINDOW (window); 2266 o = XWINDOW (window);
2267 fo = XFRAME (WINDOW_FRAME (o));
2268 if (FRAME_HAS_VERTICAL_SCROLL_BARS (fo))
2269 separator_width = FRAME_SCROLL_BAR_COLS (fo);
2270 internal_width = window_internal_width (o);
2264 2271
2265 if (NILP (chsize)) 2272 if (NILP (chsize))
2266 { 2273 {
2267 if (!NILP (horflag)) 2274 if (!NILP (horflag))
2268 /* Round odd size up, since this is for the left-hand window, 2275 /* Calculate the size of the left-hand window, by dividing
2269 and it will lose a column for the separators. */ 2276 the usable space in columns by two. */
2270 size = ((XFASTINT (o->width) + 1) & -2) >> 1; 2277 size = (internal_width - separator_width) >> 1;
2271 else 2278 else
2272 size = XFASTINT (o->height) >> 1; 2279 size = XFASTINT (o->height) >> 1;
2273 } 2280 }
@@ -2279,7 +2286,7 @@ and put SIZE columns in the first of the pair.")
2279 2286
2280 if (MINI_WINDOW_P (o)) 2287 if (MINI_WINDOW_P (o))
2281 error ("Attempt to split minibuffer window"); 2288 error ("Attempt to split minibuffer window");
2282 else if (FRAME_NO_SPLIT_P (XFRAME (WINDOW_FRAME (o)))) 2289 else if (FRAME_NO_SPLIT_P (fo))
2283 error ("Attempt to split unsplittable frame"); 2290 error ("Attempt to split unsplittable frame");
2284 2291
2285 check_min_window_sizes (); 2292 check_min_window_sizes ();
@@ -2303,9 +2310,9 @@ and put SIZE columns in the first of the pair.")
2303 { 2310 {
2304 if (size < window_min_width) 2311 if (size < window_min_width)
2305 error ("Window width %d too small (after splitting)", size); 2312 error ("Window width %d too small (after splitting)", size);
2306 if (size + window_min_width > XFASTINT (o->width)) 2313 if (internal_width - size - separator_width < window_min_width)
2307 error ("Window width %d too small (after splitting)", 2314 error ("Window width %d too small (after splitting)",
2308 XFASTINT (o->width) - size); 2315 internal_width - size - separator_width);
2309 if (NILP (o->parent) 2316 if (NILP (o->parent)
2310 || NILP (XWINDOW (o->parent)->hchild)) 2317 || NILP (XWINDOW (o->parent)->hchild))
2311 { 2318 {
@@ -2320,7 +2327,7 @@ and put SIZE columns in the first of the pair.")
2320 if we are making side-by-side windows */ 2327 if we are making side-by-side windows */
2321 2328
2322 windows_or_buffers_changed++; 2329 windows_or_buffers_changed++;
2323 FRAME_WINDOW_SIZES_CHANGED (XFRAME (WINDOW_FRAME (o))) = 1; 2330 FRAME_WINDOW_SIZES_CHANGED (fo) = 1;
2324 new = make_window (); 2331 new = make_window ();
2325 p = XWINDOW (new); 2332 p = XWINDOW (new);
2326 2333
@@ -2341,7 +2348,8 @@ and put SIZE columns in the first of the pair.")
2341 { 2348 {
2342 p->height = o->height; 2349 p->height = o->height;
2343 p->top = o->top; 2350 p->top = o->top;
2344 XSETFASTINT (p->width, XFASTINT (o->width) - size); 2351 size += separator_width;
2352 XSETFASTINT (p->width, internal_width - size);
2345 XSETFASTINT (o->width, size); 2353 XSETFASTINT (o->width, size);
2346 XSETFASTINT (p->left, XFASTINT (o->left) + size); 2354 XSETFASTINT (p->left, XFASTINT (o->left) + size);
2347 } 2355 }