Commit 23b0200c authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(verify_charstarts): New function.

(scroll_frame_lines): When updating charstarts,
treat all columns alike--don't zero out any.
Fix end tests of loops over i.

(adjust_window_charstarts): Fix typo.
parent 84258c5d
......@@ -607,6 +607,7 @@ scroll_frame_lines (frame, from, end, amount, newpos)
register struct frame_glyphs *current_frame
= FRAME_CURRENT_GLYPHS (frame);
int pos_adjust;
int width = FRAME_WIDTH (frame);
if (!line_ins_del_ok)
return 0;
......@@ -631,40 +632,41 @@ scroll_frame_lines (frame, from, end, amount, newpos)
sizeof (int *) * (end + amount - from),
amount * sizeof (int *));
safe_bcopy (current_frame->used + from,
current_frame->used + from + amount,
(end - from) * sizeof current_frame->used[0]);
safe_bcopy (current_frame->highlight + from,
current_frame->highlight + from + amount,
(end - from) * sizeof current_frame->highlight[0]);
safe_bcopy (current_frame->enable + from,
current_frame->enable + from + amount,
(end - from) * sizeof current_frame->enable[0]);
/* Adjust the lines by an amount
that puts the first of them at NEWPOS. */
pos_adjust = newpos - current_frame->charstarts[i][0];
pos_adjust = newpos - current_frame->charstarts[from + amount][0];
/* Offset each char position in the charstarts lines we moved
by pos_adjust. */
for (i = from + amount; i < end; i++)
for (i = from + amount; i < end + amount; i++)
{
int *line = current_frame->charstarts[i];
int col;
for (col = 0; col < current_frame->used[i]; col++)
line[col] += pos_adjust;
for (col = 0; col < width; col++)
if (line[col] > 0)
line[col] += pos_adjust;
}
for (i = from; i <= from + amount; i++)
for (i = from; i < from + amount; i++)
{
int *line = current_frame->charstarts[i];
int col;
line[0] = -1;
for (col = 0; col < current_frame->used[i]; col++)
for (col = 0; col < width; col++)
line[col] = 0;
}
safe_bcopy (current_frame->used + from,
current_frame->used + from + amount,
(end - from) * sizeof current_frame->used[0]);
safe_bcopy (current_frame->highlight + from,
current_frame->highlight + from + amount,
(end - from) * sizeof current_frame->highlight[0]);
safe_bcopy (current_frame->enable + from,
current_frame->enable + from + amount,
(end - from) * sizeof current_frame->enable[0]);
/* Mark the lines made empty by scrolling as enabled, empty and
normal video. */
bzero (current_frame->used + from,
......@@ -726,9 +728,21 @@ scroll_frame_lines (frame, from, end, amount, newpos)
sizeof (int *) * (end - from - amount),
amount * sizeof (int *));
safe_bcopy (current_frame->used + from,
current_frame->used + from + amount,
(end - from) * sizeof current_frame->used[0]);
safe_bcopy (current_frame->highlight + from,
current_frame->highlight + from + amount,
(end - from) * sizeof current_frame->highlight[0]);
safe_bcopy (current_frame->enable + from,
current_frame->enable + from + amount,
(end - from) * sizeof current_frame->enable[0]);
/* Adjust the lines by an amount
that puts the first of them at NEWPOS. */
pos_adjust = newpos - current_frame->charstarts[i][0];
pos_adjust = newpos - current_frame->charstarts[from + amount][0];
/* Offset each char position in the charstarts lines we moved
by pos_adjust. */
......@@ -736,30 +750,19 @@ scroll_frame_lines (frame, from, end, amount, newpos)
{
int *line = current_frame->charstarts[i];
int col;
for (col = 0; col < current_frame->used[i]; col++)
line[col] += pos_adjust;
for (col = 0; col < width; col++)
if (line[col] > 0)
line[col] += pos_adjust;
}
for (i = end + amount; i <= end; i++)
for (i = end + amount; i < end; i++)
{
int *line = current_frame->charstarts[i];
int col;
line[0] = -1;
for (col = 0; col < current_frame->used[i]; col++)
for (col = 0; col < width; col++)
line[col] = 0;
}
safe_bcopy (current_frame->used + from,
current_frame->used + from + amount,
(end - from) * sizeof current_frame->used[0]);
safe_bcopy (current_frame->highlight + from,
current_frame->highlight + from + amount,
(end - from) * sizeof current_frame->highlight[0]);
safe_bcopy (current_frame->enable + from,
current_frame->enable + from + amount,
(end - from) * sizeof current_frame->enable[0]);
/* Mark the lines made empty by scrolling as enabled, empty and
normal video. */
bzero (current_frame->used + end + amount,
......@@ -906,7 +909,7 @@ preserve_my_columns (w)
#endif
/* Adjust by ADJUST the charstart values in window W
before vpos VPOS, which counts relative to the frame
after vpos VPOS, which counts relative to the frame
(not relative to W itself). */
void
......@@ -917,11 +920,11 @@ adjust_window_charstarts (w, vpos, adjust)
{
int left = XFASTINT (w->left);
int top = XFASTINT (w->top);
int right = left + window_internal_height (w);
int height = window_internal_height (w);
int right = left + window_internal_width (w);
int bottom = top + window_internal_height (w);
int i;
for (i = vpos + 1; i < top + height; i++)
for (i = vpos + 1; i < bottom; i++)
{
int *charstart
= FRAME_CURRENT_GLYPHS (XFRAME (WINDOW_FRAME (w)))->charstarts[i];
......@@ -931,6 +934,35 @@ adjust_window_charstarts (w, vpos, adjust)
charstart[j] += adjust;
}
}
verify_charstarts (w)
struct window *w;
{
FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
int i;
int top = XFASTINT (w->top);
int bottom = top + window_internal_height (w);
int left = XFASTINT (w->left);
int right = left + window_internal_width (w);
int next_line;
for (i = top; i < bottom; i++)
{
int j;
int last;
int *charstart
= FRAME_CURRENT_GLYPHS (XFRAME (WINDOW_FRAME (w)))->charstarts[i];
if (i != top)
if (charstart[left] != next_line)
abort ();
for (j = left; j < right; j++)
if (charstart[j] > 0)
last = charstart[j];
next_line = last + (BUF_ZV (XBUFFER (w->buffer)) != last);
}
}
/* On discovering that the redisplay for a window was no good,
cancel the columns of that window, so that when the window is
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment