- Timestamp:
- Jul 11, 2009, 1:14:33 PM (14 years ago)
- Branches:
- master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- b5ef65c
- Parents:
- a0fbdee
- git-author:
- Karl Ramm <kcr@1ts.org> (06/08/09 19:00:40)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (07/11/09 13:14:33)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
editwin.c
ra0fbdee rcedc95c 344 344 } 345 345 index = p - e->buff; 346 347 /* note the position of the dot */ 348 if (x != NULL && index == e->index) 349 *x = width; 346 350 } 347 351 return index; … … 349 353 350 354 static void oe_reframe(owl_editwin *e) { 351 e->topindex = 0; /*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/ 355 oe_excursion x; 356 int goal = e->winlines / 2; 357 int index; 358 int count = 0; 359 int point; 360 int n, i; 361 int last; 362 363 oe_save_excursion(e, &x); 364 /* step back line-by-line through the buffer until we have >= goal lines of 365 display text */ 366 e->lock = 0; /* we can (must) tread on the locktext */ 367 368 point = e->index; 369 last = -1; 370 while (count < goal) { 371 index = e->index; 372 owl_editwin_move_to_beginning_of_line(e); 373 if (last == e->index) 374 break; 375 last = e->index; 376 for (n = 0, i = e->index; i < index; n++) 377 i = oe_find_display_line(e, NULL, i); 378 count += n == 0 ? 1 : n; 379 if (count < goal) 380 owl_editwin_point_move(e, -1); 381 } 382 /* if we overshot, backtrack */ 383 for (n = 0; n < (count - goal); n++) 384 e->index = oe_find_display_line(e, NULL, e->index); 385 386 e->topindex = e->index; 387 388 oe_restore_excursion(e, &x); 352 389 } 353 390 … … 359 396 int line, index, lineindex; 360 397 361 werase(e->curswin);362 363 398 do { 399 werase(e->curswin); 400 364 401 if (e->topindex == -1 || e->index < e->topindex) 365 402 oe_reframe(e);
Note: See TracChangeset
for help on using the changeset viewer.