From d95ee172bb8919d3a7cbeb158ab58354ac4822be Mon Sep 17 00:00:00 2001 From: He4eT Date: Mon, 19 Jul 2021 17:50:40 +0500 Subject: [PATCH] TextBuffer: treat short buffers as a status --- src/components/Player/TextBuffer.jsx | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/components/Player/TextBuffer.jsx b/src/components/Player/TextBuffer.jsx index 7d445fa..4997075 100644 --- a/src/components/Player/TextBuffer.jsx +++ b/src/components/Player/TextBuffer.jsx @@ -3,6 +3,9 @@ import { useEffect, useRef, useState } from 'preact/hooks' import TextMessage from './TextMessage' +const isFakeStatus = w => + w.height < 5 + const trimInputPrompt = messages => messages.length < 1 ? messages @@ -22,7 +25,7 @@ const parseInbox = (inbox, currentWindow) => { } } - const { clear, text: inboxMessagesRaw } = + const { text: inboxMessagesRaw } = currentInbox const eol = { style: 'endOfLine' } @@ -38,7 +41,12 @@ const parseInbox = (inbox, currentWindow) => { .reduce((acc, x) => acc.concat(x), []) - return { clear, incoming } + return { + incoming, + clear: isFakeStatus(currentWindow) + ? true + : currentInbox.clear + } } export default function ({ inbox, currentWindow }) { @@ -66,11 +74,17 @@ export default function ({ inbox, currentWindow }) { }, 0) }, [inbox]) + const classes = [ + isFakeStatus(currentWindow) + ? 'gridBuffer' + : 'textBuffer', + 'buffer'].join(' ') + return (
- {messages.map(TextMessage)} + className={classes}> + {messages.map(TextMessage)}
) }