[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/window.c [emacs-unicode-2]
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/src/window.c [emacs-unicode-2] |
Date: |
Fri, 19 Nov 2004 02:16:29 -0500 |
Index: emacs/src/window.c
diff -c emacs/src/window.c:1.445.2.13 emacs/src/window.c:1.445.2.14
*** emacs/src/window.c:1.445.2.13 Fri Nov 12 02:52:55 2004
--- emacs/src/window.c Fri Nov 19 06:54:57 2004
***************
*** 241,247 ****
register struct window *p;
p = allocate_window ();
! XSETFASTINT (p->sequence_number, ++sequence_number);
XSETFASTINT (p->left_col, 0);
XSETFASTINT (p->top_line, 0);
XSETFASTINT (p->total_lines, 0);
--- 241,248 ----
register struct window *p;
p = allocate_window ();
! ++sequence_number;
! XSETFASTINT (p->sequence_number, sequence_number);
XSETFASTINT (p->left_col, 0);
XSETFASTINT (p->top_line, 0);
XSETFASTINT (p->total_lines, 0);
***************
*** 2657,2662 ****
--- 2658,2666 ----
--shrinkable;
total_removed += smallest;
+ /* We don't know what the smallest is now. */
+ smallest = total;
+
/* Out of for, just remove one window at the time and
check again if we have enough space. */
break;
***************
*** 2681,2686 ****
--- 2685,2700 ----
that are left and still can be shrunk. */
while (total_shrink > total_removed)
{
+ int nonzero_sizes = 0;
+ int nonzero_idx = -1;
+
+ for (i = 0; i < nchildren; ++i)
+ if (new_sizes[i] > 0)
+ {
+ ++nonzero_sizes;
+ nonzero_idx = i;
+ }
+
for (i = 0; i < nchildren; ++i)
if (new_sizes[i] > min_size)
{
***************
*** 2691,2696 ****
--- 2705,2729 ----
check again if we have enough space. */
break;
}
+
+
+ /* Special case, only one window left. */
+ if (nonzero_sizes == 1)
+ break;
+ }
+
+ /* Any surplus due to rounding, we add to windows that are left. */
+ while (total_shrink < total_removed)
+ {
+ for (i = 0; i < nchildren; ++i)
+ {
+ if (new_sizes[i] != 0 && total_shrink < total_removed)
+ {
+ ++new_sizes[i];
+ --total_removed;
+ break;
+ }
+ }
}
return new_sizes;
***************
*** 3117,3123 ****
w = XWINDOW (window);
w->frozen_window_start_p = 0;
! XSETFASTINT (w->use_time, ++window_select_count);
if (EQ (window, selected_window))
return window;
--- 3150,3157 ----
w = XWINDOW (window);
w->frozen_window_start_p = 0;
! ++window_select_count;
! XSETFASTINT (w->use_time, window_select_count);
if (EQ (window, selected_window))
return window;
***************
*** 3608,3614 ****
= ((struct Lisp_Vector *)o)->contents[i];
XSETWINDOW (new, p);
! XSETFASTINT (p->sequence_number, ++sequence_number);
/* Put new into window structure in place of window */
replace_window (window, new);
--- 3642,3649 ----
= ((struct Lisp_Vector *)o)->contents[i];
XSETWINDOW (new, p);
! ++sequence_number;
! XSETFASTINT (p->sequence_number, sequence_number);
/* Put new into window structure in place of window */
replace_window (window, new);
***************
*** 4506,4512 ****
results for variable height lines. */
init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
it.current_y = it.last_visible_y;
! move_it_vertically (&it, - window_box_height (w) / 2);
/* The function move_iterator_vertically may move over more than
the specified y-distance. If it->w is small, e.g. a
--- 4541,4547 ----
results for variable height lines. */
init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
it.current_y = it.last_visible_y;
! move_it_vertically_backward (&it, window_box_height (w) / 2);
/* The function move_iterator_vertically may move over more than
the specified y-distance. If it->w is small, e.g. a
***************
*** 4516,4522 ****
if (it.current_y <= 0)
{
init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
! move_it_vertically (&it, 0);
it.current_y = 0;
}
--- 4551,4557 ----
if (it.current_y <= 0)
{
init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
! move_it_vertically_backward (&it, 0);
it.current_y = 0;
}
***************
*** 5185,5191 ****
SET_TEXT_POS (pt, PT, PT_BYTE);
start_display (&it, w, pt);
! move_it_vertically (&it, - window_box_height (w) / 2);
charpos = IT_CHARPOS (it);
bytepos = IT_BYTEPOS (it);
}
--- 5220,5226 ----
SET_TEXT_POS (pt, PT, PT_BYTE);
start_display (&it, w, pt);
! move_it_vertically_backward (&it, window_box_height (w) / 2);
charpos = IT_CHARPOS (it);
bytepos = IT_BYTEPOS (it);
}
***************
*** 5193,5221 ****
{
struct it it;
struct text_pos pt;
! int y0, y1, h, nlines;
SET_TEXT_POS (pt, PT, PT_BYTE);
start_display (&it, w, pt);
! y0 = it.current_y;
/* The amount of pixels we have to move back is the window
height minus what's displayed in the line containing PT,
and the lines below. */
! nlines = - XINT (arg) - 1;
move_it_by_lines (&it, nlines, 1);
! y1 = line_bottom_y (&it);
/* If we can't move down NLINES lines because we hit
the end of the buffer, count in some empty lines. */
if (it.vpos < nlines)
! y1 += (nlines - it.vpos) * FRAME_LINE_HEIGHT (it.f);
!
! h = window_box_height (w) - (y1 - y0);
start_display (&it, w, pt);
! move_it_vertically (&it, - h);
charpos = IT_CHARPOS (it);
bytepos = IT_BYTEPOS (it);
}
--- 5228,5289 ----
{
struct it it;
struct text_pos pt;
! int nlines = - XINT (arg);
! int extra_line_spacing;
! int h = window_box_height (w);
SET_TEXT_POS (pt, PT, PT_BYTE);
start_display (&it, w, pt);
!
! /* Be sure we have the exact height of the full line containing PT.
*/
! move_it_by_lines (&it, 0, 1);
/* The amount of pixels we have to move back is the window
height minus what's displayed in the line containing PT,
and the lines below. */
! it.current_y = 0;
! it.vpos = 0;
move_it_by_lines (&it, nlines, 1);
! if (it.vpos == nlines)
! h -= it.current_y;
! else
! {
! /* Last line has no newline */
! h -= line_bottom_y (&it);
! it.vpos++;
! }
!
! /* Don't reserve space for extra line spacing of last line. */
! extra_line_spacing = it.max_extra_line_spacing;
/* If we can't move down NLINES lines because we hit
the end of the buffer, count in some empty lines. */
if (it.vpos < nlines)
! {
! nlines -= it.vpos;
! extra_line_spacing = it.extra_line_spacing;
! h -= nlines * (FRAME_LINE_HEIGHT (it.f) + extra_line_spacing);
! }
! if (h <= 0)
! return Qnil;
+ /* Now find the new top line (starting position) of the window. */
start_display (&it, w, pt);
! it.current_y = 0;
! move_it_vertically_backward (&it, h);
!
! /* If extra line spacing is present, we may move too far
! back. This causes the last line to be only partially
! visible (which triggers redisplay to recenter that line
! in the middle), so move forward.
! But ignore extra line spacing on last line, as it is not
! considered to be part of the visible height of the line.
! */
! h += extra_line_spacing;
! while (-it.current_y > h)
! move_it_by_lines (&it, 1, 1);
!
charpos = IT_CHARPOS (it);
bytepos = IT_BYTEPOS (it);
}
***************
*** 5817,5823 ****
p = SAVED_WINDOW_N (vector, i);
w = XWINDOW (window);
! XSETFASTINT (w->temslot, i++);
p->window = window;
p->buffer = w->buffer;
p->left_col = w->left_col;
--- 5885,5891 ----
p = SAVED_WINDOW_N (vector, i);
w = XWINDOW (window);
! XSETFASTINT (w->temslot, i); i++;
p->window = window;
p->buffer = w->buffer;
p->left_col = w->left_col;