Move repo to lower right on list screen and fix helpLine truncation
This commit is contained in:
parent
478c628160
commit
6dc4c46b14
23
src/tui.ts
23
src/tui.ts
|
|
@ -794,11 +794,11 @@ export class TuiEngine {
|
||||||
// Header Bar
|
// Header Bar
|
||||||
const spinnerStr = this.state.loading ? chalk.bold.cyan(SPINNER_FRAMES[spinnerIndex]) + ' ' : '';
|
const spinnerStr = this.state.loading ? chalk.bold.cyan(SPINNER_FRAMES[spinnerIndex]) + ' ' : '';
|
||||||
const instanceName = normalizeUrl(this.state.config.url).replace(/^https?:\/\//, '');
|
const instanceName = normalizeUrl(this.state.config.url).replace(/^https?:\/\//, '');
|
||||||
const rightHeader = `repo: ${chalk.bold.cyan(`${this.state.config.owner}/${this.state.config.repo}`)} `;
|
const rightHeader = '';
|
||||||
const rightLen = stripAnsi(rightHeader).length;
|
const rightLen = 0;
|
||||||
|
|
||||||
// We want the total line length to fit exactly within 'cols', so max left side width is cols - rightLen - 1
|
// We want the total line length to fit exactly within 'cols'
|
||||||
const maxLeftWidth = cols - rightLen - 1;
|
const maxLeftWidth = cols - 1;
|
||||||
|
|
||||||
// Spinner plain length is 2 if loading, 0 otherwise
|
// Spinner plain length is 2 if loading, 0 otherwise
|
||||||
const spinnerPlainLen = this.state.loading ? 2 : 0;
|
const spinnerPlainLen = this.state.loading ? 2 : 0;
|
||||||
|
|
@ -955,8 +955,19 @@ export class TuiEngine {
|
||||||
console.log(chalk.bold.hex('#4A90E2')('└' + '─'.repeat(cols - 2) + '┘'));
|
console.log(chalk.bold.hex('#4A90E2')('└' + '─'.repeat(cols - 2) + '┘'));
|
||||||
|
|
||||||
// Keyboard controls help line
|
// 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');
|
const fullHelpLine = ' [↑/↓] Navigate [Enter] View [/] Search [S] Sort [F] State [T] Type [N/P] Page [R] Reload [O] Settings [Esc] Quit';
|
||||||
process.stdout.write(helpLine);
|
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 search active, position terminal cursor in search box
|
||||||
if (this.activeSearchInput) {
|
if (this.activeSearchInput) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue