comparison src/scroll.c @ 6647:e6611521fb67

(do_scrolling): Handle charstarts like glyphs.
author Richard M. Stallman <rms@gnu.org>
date Sun, 03 Apr 1994 08:08:33 +0000
parents 1fc792473491
children ed16e189b9a5
comparison
equal deleted inserted replaced
6646:d3e3efcd8461 6647:e6611521fb67
215 p->deletecost = min (cost, cost1); 215 p->deletecost = min (cost, cost1);
216 p->deletecount = (cost < cost1) ? 1 : p1->deletecount + 1; 216 p->deletecount = (cost < cost1) ? 1 : p1->deletecount + 1;
217 } 217 }
218 } 218 }
219 219
220 /* Perform insert-lines and delete-lines operations 220 /* Perform insert-lines and delete-lines operations on FRAME
221 according to the costs in the matrix. 221 according to the costs in MATRIX.
222 Updates the contents of the frame to record what was done. */ 222 Update the frame's current_glyphs info to record what was done.
223
224 WINDOW_SIZE is the number of lines being considered for scrolling
225 and UNCHANGED_AT_TOP is the vpos of the first line being considered.
226 These two arguments can specify any contiguous range of lines.
227
228 We also shuffle the charstarts vectors for the lines
229 along with the glyphs; but the results are not quite right,
230 since we cannot offset them for changes in amount of text
231 in this line or that line. Luckily it doesn't matter,
232 since update_frame and update_line will copy in the proper
233 new charstarts vectors from the frame's desired_glyphs. */
223 234
224 static void 235 static void
225 do_scrolling (frame, matrix, window_size, unchanged_at_top) 236 do_scrolling (frame, matrix, window_size, unchanged_at_top)
226 FRAME_PTR frame; 237 FRAME_PTR frame;
227 struct matrix_elt *matrix; 238 struct matrix_elt *matrix;
245 256
246 current_frame = FRAME_CURRENT_GLYPHS (frame); 257 current_frame = FRAME_CURRENT_GLYPHS (frame);
247 temp_frame = FRAME_TEMP_GLYPHS (frame); 258 temp_frame = FRAME_TEMP_GLYPHS (frame);
248 259
249 bcopy (current_frame->glyphs, temp_frame->glyphs, 260 bcopy (current_frame->glyphs, temp_frame->glyphs,
261 current_frame->height * sizeof (GLYPH *));
262 bcopy (current_frame->charstarts, temp_frame->charstarts,
250 current_frame->height * sizeof (GLYPH *)); 263 current_frame->height * sizeof (GLYPH *));
251 bcopy (current_frame->used, temp_frame->used, 264 bcopy (current_frame->used, temp_frame->used,
252 current_frame->height * sizeof (int)); 265 current_frame->height * sizeof (int));
253 bcopy (current_frame->highlight, temp_frame->highlight, 266 bcopy (current_frame->highlight, temp_frame->highlight,
254 current_frame->height * sizeof (char)); 267 current_frame->height * sizeof (char));
301 { 314 {
302 /* Best thing done here is no insert or delete */ 315 /* Best thing done here is no insert or delete */
303 /* Old line at vpos j-1 ends up at vpos i-1 */ 316 /* Old line at vpos j-1 ends up at vpos i-1 */
304 current_frame->glyphs[i + offset - 1] 317 current_frame->glyphs[i + offset - 1]
305 = temp_frame->glyphs[j + offset - 1]; 318 = temp_frame->glyphs[j + offset - 1];
319 current_frame->charstarts[i + offset - 1]
320 = temp_frame->charstarts[j + offset - 1];
306 current_frame->used[i + offset - 1] 321 current_frame->used[i + offset - 1]
307 = temp_frame->used[j + offset - 1]; 322 = temp_frame->used[j + offset - 1];
308 current_frame->highlight[i + offset - 1] 323 current_frame->highlight[i + offset - 1]
309 = temp_frame->highlight[j + offset - 1]; 324 = temp_frame->highlight[j + offset - 1];
310 325
335 for (j = tem + queue[i].count - 1; j >= tem; j--) 350 for (j = tem + queue[i].count - 1; j >= tem; j--)
336 { 351 {
337 current_frame->enable[j] = 0; 352 current_frame->enable[j] = 0;
338 while (temp_frame->enable[next]) 353 while (temp_frame->enable[next])
339 next++; 354 next++;
340 current_frame->glyphs[j] = temp_frame->glyphs[next++]; 355 current_frame->glyphs[j] = temp_frame->glyphs[next];
356 current_frame->charstarts[j] = temp_frame->charstarts[next++];
341 } 357 }
342 } 358 }
343 359
344 if (window) 360 if (window)
345 set_terminal_window (0); 361 set_terminal_window (0);