| 498 | #define MIN_END_KEEP 4 |
| 499 | |
| 500 | private void |
| 501 | re_update_line(EditLine *el, Char *old, Char *new, int i) |
| 502 | { |
| 503 | Char *o, *n, *p, c; |
| 504 | Char *ofd, *ols, *oe, *nfd, *nls, *ne; |
| 505 | Char *osb, *ose, *nsb, *nse; |
| 506 | int fx, sx; |
| 507 | size_t len; |
| 508 | |
| 509 | /* |
| 510 | * find first diff |
| 511 | */ |
| 512 | for (o = old, n = new; *o && (*o == *n); o++, n++) |
| 513 | continue; |
| 514 | ofd = o; |
| 515 | nfd = n; |
| 516 | |
| 517 | /* |
| 518 | * Find the end of both old and new |
| 519 | */ |
| 520 | while (*o) |
| 521 | o++; |
| 522 | /* |
| 523 | * Remove any trailing blanks off of the end, being careful not to |
| 524 | * back up past the beginning. |
| 525 | */ |
| 526 | while (ofd < o) { |
| 527 | if (o[-1] != ' ') |
| 528 | break; |
| 529 | o--; |
| 530 | } |
| 531 | oe = o; |
| 532 | *oe = '\0'; |
| 533 | |
| 534 | while (*n) |
| 535 | n++; |
| 536 | |
| 537 | /* remove blanks from end of new */ |
| 538 | while (nfd < n) { |
| 539 | if (n[-1] != ' ') |
| 540 | break; |
| 541 | n--; |
| 542 | } |
| 543 | ne = n; |
| 544 | *ne = '\0'; |
| 545 | |
| 546 | /* |
| 547 | * if no diff, continue to next line of redraw |
| 548 | */ |
| 549 | if (*ofd == '\0' && *nfd == '\0') { |
| 550 | ELRE_DEBUG(1, (__F, "no difference.\r\n")); |
| 551 | return; |
| 552 | } |
| 553 | /* |
| 554 | * find last same pointer |
| 555 | */ |
| 556 | while ((o > ofd) && (n > nfd) && (*--o == *--n)) |
| 557 | continue; |
no test coverage detected