diff --git a/src/components/player/TextBuffer.jsx b/src/components/player/TextBuffer.jsx index ca52f32..46541c2 100644 --- a/src/components/player/TextBuffer.jsx +++ b/src/components/player/TextBuffer.jsx @@ -25,23 +25,18 @@ const parseInbox = (inbox, currentWindow) => { const { clear, text: inboxMessagesRaw } = currentInbox - const incoming = trimImputPrompt( + const eol = { style: 'endOfLine' } + + const incoming = inboxMessagesRaw /* Normalize. */ .map(({ content }) => - content || [{ style: 'emptyLine' }]) + content + ? [...trimImputPrompt(content), eol] + : [eol]) /* Flatten. */ .reduce((acc, x) => acc.concat(x), []) - /* Collapse empty lines. */ - .reduce((acc, x, i, xs) => { - if (x.style !== 'emptyLine') return [...acc, x] - - const prev = xs[i - 1] || {} - return prev.style === 'emptyLine' - ? acc - : [...acc, x] - }, [])) return { clear, incoming } } diff --git a/src/components/player/TextMessage.jsx b/src/components/player/TextMessage.jsx index ef93625..569700a 100644 --- a/src/components/player/TextMessage.jsx +++ b/src/components/player/TextMessage.jsx @@ -1,16 +1,14 @@ import { h } from 'preact' export default function ({ style, text }) { - const defaultContent = ({text}) + const defaultContent = ( + + {text} + ) - const content = ({ - emptyLine: (
), - subheader: ({text}) + return ({ + input: (> {text}), + subheader: ({text}), + endOfLine: (
) })[style] || defaultContent - - return ( -
- {content} -
- ) }