diff options
author | June McEnroe <june@causal.agency> | 2020-09-02 18:51:07 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-09-02 18:51:07 -0400 |
commit | 96386adac3cf4e0ac48c5b8f39b719f194f8d2e6 (patch) | |
tree | 2e5c7bc0137d169dd803d64e5b6f48e44bb8e29d /buffer.c | |
parent | Don't call completeTouch for ignored messages (diff) | |
download | catgirl-96386adac3cf4e0ac48c5b8f39b719f194f8d2e6.tar.gz catgirl-96386adac3cf4e0ac48c5b8f39b719f194f8d2e6.zip |
Hide ignored messages at the soft -> hard buffer layer
This restores normal scrolling behaviour.
Diffstat (limited to '')
-rw-r--r-- | buffer.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/buffer.c b/buffer.c index 711d5fd..7ac5c10 100644 --- a/buffer.c +++ b/buffer.c @@ -174,7 +174,7 @@ static int flow(struct Lines *hard, int cols, const struct Line *soft) { } int bufferPush( - struct Buffer *buffer, int cols, + struct Buffer *buffer, int cols, bool ignore, enum Heat heat, time_t time, const char *str ) { struct Line *soft = linesNext(&buffer->soft); @@ -182,10 +182,11 @@ int bufferPush( soft->time = time; soft->str = strdup(str); if (!soft->str) err(EX_OSERR, "strdup"); + if (heat < Cold && ignore) return 0; return flow(&buffer->hard, cols, soft); } -void bufferReflow(struct Buffer *buffer, int cols) { +void bufferReflow(struct Buffer *buffer, int cols, bool ignore) { buffer->hard.len = 0; for (size_t i = 0; i < BufferCap; ++i) { free(buffer->hard.lines[i].str); @@ -193,6 +194,8 @@ void bufferReflow(struct Buffer *buffer, int cols) { } for (size_t i = 0; i < BufferCap; ++i) { const struct Line *soft = bufferSoft(buffer, i); - if (soft) flow(&buffer->hard, cols, soft); + if (!soft) continue; + if (soft->heat < Cold && ignore) continue; + flow(&buffer->hard, cols, soft); } } |