Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Herdr previews each plugin and its build and runtime commands before confirming

![Herdr tabs labelled Dashboard 1, Editor 2, and Tests 3](docs/images/tab-numbers.png)

The `sync` action re-indexes all named tabs. Creation, rename, move, and close events keep the numbers contiguous afterwards. See the [Tab Numbers documentation](plugins/tab-numbers) for behaviour and cleanup details.
The `sync` action re-indexes all named tabs. Creation, rename, move, close, and pane-exit events keep the numbers contiguous afterwards. See the [Tab Numbers documentation](plugins/tab-numbers) for behaviour and cleanup details.

### Tmux Keybindings

Expand Down
2 changes: 1 addition & 1 deletion plugins/tab-numbers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ herdr plugin action invoke oullin.tab-numbers.sync
| ------ | ---------------------------------------------------- | --------------------------------------------------------- |
| Sync | `herdr plugin action invoke oullin.tab-numbers.sync` | Re-index every named tab using its current display order. |

The `tab.created`, `tab.renamed`, `tab.closed`, and `tab.moved` hooks keep the sequence contiguous after the initial synchronisation.
The `tab.created`, `tab.renamed`, `tab.closed`, `tab.moved`, `pane.closed`, and `pane.exited` hooks keep the sequence contiguous after the initial synchronisation. The pane hooks cover tabs that close because their last shell exits, which Herdr reports without a `tab.closed` event.

## Behaviour

Expand Down
10 changes: 9 additions & 1 deletion plugins/tab-numbers/herdr-plugin.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id = "oullin.tab-numbers"
name = "Tab Numbers"
version = "0.1.7"
version = "0.1.8"
min_herdr_version = "0.7.0"
description = "Show contiguous position numbers in named Herdr tab labels"
platforms = ["linux", "macos", "windows"]
Expand Down Expand Up @@ -39,3 +39,11 @@ command = ["node", "index.ts"]
[[events]]
on = "tab.moved"
command = ["node", "index.ts"]

[[events]]
on = "pane.closed"
command = ["node", "index.ts"]

[[events]]
on = "pane.exited"
command = ["node", "index.ts"]
2 changes: 1 addition & 1 deletion plugins/tab-numbers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oullin/herdr-tab-numbers",
"version": "0.1.7",
"version": "0.1.8",
"description": "Show contiguous position numbers in named Herdr tab labels.",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/tab-numbers/src/application/tab-numbers-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type { Environment } from '@oullin/herdr-plugin-core';

export class TabNumbersPlugin {
private static readonly singleTabEvents: ReadonlySet<string> = new Set(['tab.created', 'tab.renamed']);
private static readonly workspaceTabEvents: ReadonlySet<string> = new Set(['tab.closed', 'tab.moved']);
private static readonly workspaceTabEvents: ReadonlySet<string> = new Set(['tab.closed', 'tab.moved', 'pane.closed', 'pane.exited']);

private readonly synchroniser: TabNumberSynchroniser;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('TabNumbersPlugin', () => {
expect(client.renameCalls).toEqual([['w1:t7', 'new label · 3']]);
});

it.each(['tab.closed', 'tab.moved'])('reindexes the affected workspace for %s', (event) => {
it.each(['tab.closed', 'tab.moved', 'pane.closed'])('reindexes the affected workspace for %s', (event) => {
const client = new FakeHerdrClient({
tabsByWorkspace: new Map([
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('module aliases', () => {
'utf8',
);

expect(packageJson.version).toBe('0.1.7');
expect(packageJson.version).toBe('0.1.8');
expect(manifest).toContain(`version = "${packageJson.version}"`);
});
});
Loading