Changeset 9fd74d5 in mainline for uspace/lib/termui/src/history.c


Ignore:
Timestamp:
2025-11-09T16:20:43Z (3 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
a4301f1
Parents:
e6b4d2d
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-11-09 16:19:21)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-11-09 16:20:43)
Message:

libtermui: Ensure fully consistent history state when evicting old data

Fixes bug #890

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/termui/src/history.c

    re6b4d2d r9fd74d5  
    126126
    127127#define _history_check(history) do { \
    128         assert(history->lines.head < history->lines.buf_len); \
    129         assert(history->lines.tail < history->lines.buf_len); \
     128        assert(history->lines.head < history->lines.buf_len || history->lines.head == 0); \
     129        assert(history->lines.tail < history->lines.buf_len || history->lines.tail == 0); \
    130130        assert(history->cells.tail_top <= history->cells.head_offset); \
    131131        assert(history->cells.head_offset <= history->cells.head_top); \
     
    298298        if (lines->tail >= lines->buf_len)
    299299                lines->tail = 0;
     300
     301        if (viewport_inactive) {
     302            /* Ensure consistent state so asserts don't trigger inside _evict_oldest_line(). */
     303            history->viewport_top = lines->tail;
     304        }
    300305
    301306        if (lines->tail == lines->head)
Note: See TracChangeset for help on using the changeset viewer.