Skip to content

Commit

Permalink
fix: override stdout rows to prevent terminal clearing
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Oct 17, 2024
1 parent 06ac0ac commit 7ad0fec
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,12 @@ export function Skeleton(props: React.PropsWithChildren & {readonly height?: num
* the desired effect in powershell.
*/
class Stream extends WriteStream {
// Override the rows so that ink doesn't clear the entire terminal when
// unmounting the component and the height of the output is greater than
// the height of the terminal
// https://github.com/vadimdemedes/ink/blob/v5.0.1/src/ink.tsx#L174
// This might be a bad idea but it works.
public rows = 10_000
private frames: string[] = []

public lastFrame(): string | undefined {
Expand Down

0 comments on commit 7ad0fec

Please sign in to comment.