From 73b9cae2036de6fa461cd753280199d3da431e25 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 15 Oct 2021 20:59:16 -0400 Subject: [PATCH] logbox title isn't infinitely long anymore --- src/ui/React/LogBoxManager.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ui/React/LogBoxManager.tsx b/src/ui/React/LogBoxManager.tsx index 2bbd1b376..78f89265f 100644 --- a/src/ui/React/LogBoxManager.tsx +++ b/src/ui/React/LogBoxManager.tsx @@ -88,7 +88,6 @@ function LogWindow(props: IProps): React.ReactElement { killWorkerScript(props.script, props.script.server, true); props.onClose(); } - //useEffect(() => TerminalEvents.subscribe(_.debounce(async () => rerender(), 25, { maxWait: 50 })), []); function updateLayer(): void { const c = container.current; @@ -98,6 +97,15 @@ function LogWindow(props: IProps): React.ReactElement { rerender(); } + function title(): string { + const maxLength = 30; + const t = `${props.script.filename} ${props.script.args.map((x: any): string => `${x}`).join(" ")}`; + if (t.length <= maxLength) { + return t; + } + return t.slice(0, maxLength - 3) + "..."; + } + return ( - {props.script.filename} {props.script.args.map((x: any): string => `${x}`).join(" ")} + {title()}