diff --git a/README.md b/README.md index 662cbff..6fe079e 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ This installs two equivalent commands, `dev-workspace` and the shorter `dws`. Ru Escape goes back one screen: from a project to the project list, from the workspace list or path prompt to the project list, and from the project list it exits. While you are searching, it only clears the search. The help line under each menu shows what it does (`esc back` or `esc exit`). -Every menu opens with a small box that shows where you are: the name of the workspace folder, followed by the project you are in (`◆ dev › web-app`), the workspace folder, and in a project, its package manager on the right. The box also holds the buttons of the screen, on the right of the workspace line: **⚙ Workspace** and **✕ Exit** in the project list, **← Back** and **… Run with args** in a project. The buttons sit just above the list: press ↑ on the first entry to reach the first button, ↑ again for the next one, and ↓ to come back (Tab and Shift+Tab work too, and ← and → move between buttons). The focused button is shown in reverse, or between brackets without colours, and Enter presses it. Each script's command is shown next to its name, in a column of its own, and tags such as `last run` sit at the right edge. When a list is longer than the window, `▲ 3 more` and `▼ 12 more` show how many entries are hidden above and below. The layout stays within 100 columns on wide terminals. Long workspace paths are shortened in the middle (`C:Users…projectsweb`), keeping the folders that tell them apart, and script commands are cut with `…` to fit, and emoji or CJK characters in folder names never break the layout. +Every menu opens with a small box that shows where you are: the name of the workspace folder, followed by the project you are in (`◆ dev › web-app`), the workspace folder, and in a project, its package manager on the right. The box also holds the buttons of the screen, on the right of the workspace line: **⚙ Workspace** and **✕ Exit** in the project list, **← Back** and **… Run with args** in a project. The buttons sit just above the list: press ↑ on the first entry to reach the first button, ↑ again for the next one, and ↓ to come back (Tab and Shift+Tab work too, and ← and → move between buttons). The focused button is shown in reverse, or between brackets without colours, and Enter presses it. Each script's command is shown next to its name, in a column of its own, and tags such as `last run` sit at the right edge. When a list is longer than the window, `▲ 3 more` and `▼ 12 more` show how many entries are hidden above and below. The layout fills a new cmd or Windows Terminal window (120 columns) and stays within that width on wider ones; in a smaller window, such as the 80 columns macOS and Linux terminals open at, it uses the window's width. Long workspace paths are shortened in the middle (`C:Users…projectsweb`), keeping the folders that tell them apart, and script commands are cut with `…` to fit, and emoji or CJK characters in folder names never break the layout. The menus are drawn on the terminal's alternate screen, as `less` and `vim` do, so resizing the window redraws the whole screen cleanly and the menus never fill your scrollback. A script's output appears on the normal screen and stays there after you return to the menus. diff --git a/lib/list.js b/lib/list.js index 08c5529..9632595 100644 --- a/lib/list.js +++ b/lib/list.js @@ -26,9 +26,11 @@ const SIGNALS = ['SIGINT', 'SIGTERM', 'SIGHUP'] const OPEN_DELAY = 300 const REPLY_TIMEOUT = 100 -// The widest a line gets, so the columns stay together on wide terminals, -// and the widest the label column gets before details move further right. -export const MAX_WIDTH = 100 +// The widest a line gets, so the columns stay together on wide terminals: +// the 120 columns cmd and Windows Terminal open at (the list leaves the last +// one free). And the widest the label column gets before details move +// further right. +export const MAX_WIDTH = 120 const MAX_LABEL_WIDTH = 32 export class ExitPromptError extends Error { diff --git a/test/list.test.js b/test/list.test.js index 6228d18..e25e641 100644 --- a/test/list.test.js +++ b/test/list.test.js @@ -1508,7 +1508,10 @@ test('drawLines draws lines once, at the width a list uses', () => { drawLines(build, { columns: 300, useColors: true })[0], ' \x1b[32mdone\x1b[39m', ) - assert.deepEqual(widths, [39, 100]) + // A new cmd or Windows Terminal window is 120 columns wide: the list + // leaves the last one free, and gets no wider on larger windows. + drawLines(build, { columns: 120, useColors: false }) + assert.deepEqual(widths, [39, 120, 119]) }) test('an item style colours its label until it is selected', async () => {