Skip to content

Commit

Permalink
fix: remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Sep 24, 2024
1 parent 6bea971 commit 5ff46d5
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions src/table.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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': {
Expand Down

0 comments on commit 5ff46d5

Please sign in to comment.