From 5ff46d5fb8d0816ff0718be2df8a1d407dbb17d8 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Tue, 24 Sep 2024 10:39:56 -0600 Subject: [PATCH] fix: remove dead code --- src/table.tsx | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/src/table.tsx b/src/table.tsx index b87beb8..ee92949 100644 --- a/src/table.tsx +++ b/src/table.tsx @@ -1,7 +1,7 @@ /* eslint-disable react/prop-types */ import cliTruncate from 'cli-truncate' -import {Box, Text, render} from 'ink' +import {Box, Newline, Text, render} from 'ink' import {sha1} from 'object-hash' import React from 'react' import stripAnsi from 'strip-ansi' @@ -68,29 +68,6 @@ function determineWidthOfWrappedText(text: string): number { return lines.reduce((max, line) => Math.max(max, line.length), 0) } -function wrapText(text: string, spaceForText: number, width: number, padding: number): string { - const wrappedText = wrapAnsi(text, spaceForText, {hard: true, trim: true, wordWrap: true}) - if (wrappedText.includes('\n')) { - const widthOfWrappedText = determineWidthOfWrappedText(wrappedText) - const rightPadding = width - widthOfWrappedText - padding * 2 - // return wrappedText.replaceAll('\n', `${' '.repeat(padding)}\n${' '.repeat(rightPadding)}`) - // return wrappedText - const final = wrappedText.replaceAll('\n', `${' '.repeat(rightPadding)}\n${' '.repeat(padding)}`) - console.log({ - final, - padding, - rightPadding, - spaceForText, - width, - widthOrWrappedText: widthOfWrappedText, - wrappedText, - }) - return final - } - - return wrappedText.replaceAll('\n', `${' '.repeat(padding)}\n${' '.repeat(padding)}`) -} - function determineTruncatePosition(overflow: Overflow): 'start' | 'middle' | 'end' { switch (overflow) { case 'truncate-middle': {