… | |
… | |
542 | e->last_size = stats.st_size; |
542 | e->last_size = stats.st_size; |
543 | } |
543 | } |
544 | } |
544 | } |
545 | } |
545 | } |
546 | |
546 | |
|
|
547 | /* |
|
|
548 | * insert a single physical line (that must be short enough to fit) |
|
|
549 | * at position "idx" by pushing up lines above it. the caller |
|
|
550 | * MUST then fill in lines[idx] with valid data. |
|
|
551 | */ |
547 | static void |
552 | static void |
548 | insert_line (int idx) |
553 | insert_line (int idx) |
549 | { |
554 | { |
550 | int cur_line; |
555 | int cur_line; |
551 | struct logfile_entry *current; |
556 | struct logfile_entry *current; |
… | |
… | |
558 | for (current = loglist; current; current = current->next) |
563 | for (current = loglist; current; current = current->next) |
559 | if (current->partial && current->index && current->index <= idx) |
564 | if (current->partial && current->index && current->index <= idx) |
560 | current->index--; |
565 | current->index--; |
561 | } |
566 | } |
562 | |
567 | |
|
|
568 | /* |
|
|
569 | * remove a single physical line at position "idx" by moving the lines above it |
|
|
570 | * down and inserting a "~" line at the top. |
|
|
571 | */ |
563 | static void |
572 | static void |
564 | delete_line (int idx) |
573 | delete_line (int idx) |
565 | { |
574 | { |
566 | int cur_line; |
575 | int cur_line; |
567 | struct logfile_entry *current; |
576 | struct logfile_entry *current; |
… | |
… | |
574 | for (current = loglist; current; current = current->next) |
583 | for (current = loglist; current; current = current->next) |
575 | if (current->partial && current->index && current->index <= idx) |
584 | if (current->partial && current->index && current->index <= idx) |
576 | current->index++; |
585 | current->index++; |
577 | } |
586 | } |
578 | |
587 | |
|
|
588 | /* |
|
|
589 | * takes a logical log file line and split it into multiple physical |
|
|
590 | * screen lines by splitting it whenever a part becomes too long. |
|
|
591 | * lal lines will be inserted at position "idx". |
|
|
592 | */ |
579 | static void |
593 | static void |
580 | split_line (int idx, const char *str, unsigned long color) |
594 | split_line (int idx, const char *str, unsigned long color) |
581 | { |
595 | { |
582 | int l = strlen (str); |
596 | int l = strlen (str); |
583 | const char *p = str; |
597 | const char *p = str; |
… | |
… | |
613 | } |
627 | } |
614 | } |
628 | } |
615 | while (l); |
629 | while (l); |
616 | } |
630 | } |
617 | |
631 | |
|
|
632 | /* |
|
|
633 | * append something to an existing physical line. this is done |
|
|
634 | * by deleting the file on-screen, concatenating the new data to it |
|
|
635 | * and splitting it again. |
|
|
636 | */ |
618 | static void |
637 | static void |
619 | append_line (int idx, const char *str) |
638 | append_line (int idx, const char *str) |
620 | { |
639 | { |
621 | unsigned long color = lines[idx].color; |
640 | unsigned long color = lines[idx].color; |
622 | char *old = lines[idx].line; |
641 | char *old = lines[idx].line; |