- Timestamp:
- Jul 11, 2009, 1:14:35 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 77f605d
- Parents:
- fc2677b
- git-author:
- Karl Ramm <kcr@1ts.org> (06/15/09 04:33:20)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (07/11/09 13:14:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
editwin.c
rfc2677b r3e36085 486 486 } 487 487 488 static void oe_addnec(owl_editwin *e, int count) 489 { 490 int i; 491 492 for (i = 0; i < count; i++) 493 waddch(e->curswin, e->echochar); 494 } 495 496 static void oe_mvaddnec(owl_editwin *e, int y, int x, int count) 497 { 498 wmove(e->curswin, y, x); 499 oe_addnec(e, count); 500 } 501 488 502 /* regenerate the text on the curses window */ 489 503 /* if update == 1 then do a doupdate(), otherwise do not */ … … 507 521 if (x == -1 && t != -1) 508 522 x = t, y = line; 509 if (index - lineindex) 510 mvwaddnstr(e->curswin, line, 0, 511 e->buff + lineindex, 512 index - lineindex); 523 if (index - lineindex) { 524 if (!e->echochar) 525 mvwaddnstr(e->curswin, line, 0, 526 e->buff + lineindex, 527 index - lineindex); 528 else { 529 if(lineindex < e->lock) { 530 mvwaddnstr(e->curswin, line, 0, 531 e->buff + lineindex, 532 MIN(index - lineindex, 533 e->lock - lineindex)); 534 if (e->lock < index) 535 oe_addnec(e, 536 oe_region_width(e, e->lock, index, 537 oe_region_width(e, lineindex, e->lock, 0))); 538 } else 539 oe_mvaddnec(e, line, 0, oe_region_width(e, line, index, 0)); 540 } 541 } 513 542 line++; 514 543 } … … 576 605 577 606 /* fix up the mark */ 578 if (e->mark != -1)579 oe_fixup(&e->mark, start, end, change);607 oe_fixup(&e->mark, start, end, change); 608 oe_fixup(&e->topindex, start, end, change); 580 609 /* fix up any saved points after the replaced area */ 581 610 for (x = e->excursions; x != NULL; x = x->next) { 582 611 oe_fixup(&x->index, start, end, change); 583 if (x->mark != -1) 584 oe_fixup(&x->mark, start, end, change); 612 oe_fixup(&x->mark, start, end, change); 585 613 } 586 614 … … 1145 1173 } 1146 1174 1147 static int oe_region_width(owl_editwin *e, int start, int end, int width)1175 static int oe_region_width(owl_editwin *e, int start, int end, int offset) 1148 1176 { 1149 1177 char *p; 1178 int width = offset; 1179 1150 1180 for(p = e->buff + start; 1151 1181 p < e->buff + end; … … 1153 1183 width += oe_char_width(g_utf8_get_char(p), width); 1154 1184 1155 return width ;1185 return width - offset; 1156 1186 } 1157 1187
Note: See TracChangeset
for help on using the changeset viewer.