MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / re_update_line

Function re_update_line

extern/editline/src/refresh.c:500–964  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498#define MIN_END_KEEP 4
499
500private void
501re_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;

Callers 1

re_refreshFunction · 0.85

Calls 10

re_printstrFunction · 0.85
terminal_move_to_lineFunction · 0.85
terminal_move_to_charFunction · 0.85
terminal_insertwriteFunction · 0.85
re_insertFunction · 0.85
terminal_overwriteFunction · 0.85
re__strncopyFunction · 0.85
terminal_deletecharsFunction · 0.85
re_deleteFunction · 0.85
re_clear_eolFunction · 0.85

Tested by

no test coverage detected