diff --git a/src/tui.ts b/src/tui.ts index 66f3c96..0e271d1 100644 --- a/src/tui.ts +++ b/src/tui.ts @@ -794,11 +794,11 @@ export class TuiEngine { // Header Bar const spinnerStr = this.state.loading ? chalk.bold.cyan(SPINNER_FRAMES[spinnerIndex]) + ' ' : ''; const instanceName = normalizeUrl(this.state.config.url).replace(/^https?:\/\//, ''); - const rightHeader = `repo: ${chalk.bold.cyan(`${this.state.config.owner}/${this.state.config.repo}`)} `; - const rightLen = stripAnsi(rightHeader).length; + const rightHeader = ''; + const rightLen = 0; - // We want the total line length to fit exactly within 'cols', so max left side width is cols - rightLen - 1 - const maxLeftWidth = cols - rightLen - 1; + // We want the total line length to fit exactly within 'cols' + const maxLeftWidth = cols - 1; // Spinner plain length is 2 if loading, 0 otherwise const spinnerPlainLen = this.state.loading ? 2 : 0; @@ -955,8 +955,19 @@ export class TuiEngine { console.log(chalk.bold.hex('#4A90E2')('└' + '─'.repeat(cols - 2) + '┘')); // Keyboard controls help line - const helpLine = chalk.gray(' [↑/↓] Navigate [Enter] View [/] Search [S] Sort [F] State [T] Type [N/P] Page [R] Reload [O] Settings [Esc] Quit'); - process.stdout.write(helpLine); + const fullHelpLine = ' [↑/↓] Navigate [Enter] View [/] Search [S] Sort [F] State [T] Type [N/P] Page [R] Reload [O] Settings [Esc] Quit'; + const repoStr = chalk.bold.cyan(` repo: ${this.state.config.owner}/${this.state.config.repo} `); + const repoLen = stripAnsi(repoStr).length; + + // We want total length to be cols - 1 to prevent any wrapping + const maxHelpLen = cols - repoLen - 1; + let helpLinePlain = fullHelpLine; + if (helpLinePlain.length > maxHelpLen) { + helpLinePlain = helpLinePlain.substring(0, maxHelpLen - 3) + '...'; + } + + const spaces = cols - helpLinePlain.length - repoLen - 1; + process.stdout.write(chalk.gray(helpLinePlain) + ' '.repeat(Math.max(0, spaces)) + repoStr); // If search active, position terminal cursor in search box if (this.activeSearchInput) {