Add sf-tui shared utility functions.
Provides rightAlign helper for text alignment in terminal UI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
acab81de11
commit
e501ffeefd
1 changed files with 8 additions and 0 deletions
8
src/resources/extensions/sf-tui/shared.ts
Normal file
8
src/resources/extensions/sf-tui/shared.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import { visibleWidth } from "@sf-run/pi-tui";
|
||||
|
||||
export function rightAlign(left: string, right: string, width: number): string {
|
||||
const leftVis = visibleWidth(left);
|
||||
const rightVis = visibleWidth(right);
|
||||
const gap = Math.max(1, width - leftVis - rightVis);
|
||||
return left + " ".repeat(gap) + right;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue