collin/browser-terminal-extension · 528182f6
Score the showing tab like any other tab
Collin Richards · 2026-08-19 06:49 UTC · 528182f632b06d50052bfddfa0cc2920face6ecf · parent 2f84c606 · browse files
modifiedextension/sidebar.js+18 −17
| ⋯ 3503 unchanged lines | |||
| 3504 | 3504 | * What a host row's score is pushed up by, so that anything that already exists | |
| 3505 | 3505 | * outranks somewhere you could connect to. | |
| 3506 | 3506 | * | |
| 3507 | - | * The bottom of the ladder — panes at +50, tabs at +60, the showing tab at | |
| 3508 | - | * +160, hosts here — because that is the one row in the list that is not a | |
| 3509 | - | * place. Everything above it is somewhere already running that you are asking | |
| 3510 | - | * to be taken to; a host is a connection that does not exist until the row is | |
| 3511 | - | * pressed, and it stays plausible for far longer while a name is being typed, | |
| 3512 | - | * since `bui` is a legal hostname all the way to `build`. Under a page you have | |
| 3513 | - | * open, then, rather than over it. | |
| 3507 | + | * The bottom of the ladder — panes at +50, tabs at +60, hosts here — because | |
| 3508 | + | * that is the one row in the list that is not a place. Everything above it is | |
| 3509 | + | * somewhere already open or running that you are asking to be taken to, where a | |
| 3510 | + | * host is a connection that does not exist until the row is pressed. It also | |
| 3511 | + | * stays plausible for far longer while a name is being typed, since `bui` is a | |
| 3512 | + | * legal hostname all the way to `build`, so left alone it would sit over a page | |
| 3513 | + | * you actually have open for most of the typing. | |
| 3514 | 3514 | * | |
| 3515 | 3515 | * The row for a host that is not in the list at all is a separate offer made | |
| 3516 | 3516 | * further down, at `Infinity`, and is unaffected by this. | |
| ⋯ 120 unchanged lines | |||
| 3637 | 3637 | * would leave the terminal behind in this one, which is a strange thing for the | |
| 3638 | 3638 | * terminal's own box to offer. | |
| 3639 | 3639 | * | |
| 3640 | - | * Every tab in the window, the showing one included — see the score. Titles and | |
| 3641 | - | * URLs are page-controlled, which is the same footing tmux names are on: both | |
| 3642 | - | * reach the DOM through textContent and nothing else. | |
| 3640 | + | * Every tab in the window, the showing one on the same footing as the rest. | |
| 3641 | + | * Titles and URLs are page-controlled, which is the footing tmux names are on: | |
| 3642 | + | * both reach the DOM through textContent and nothing else. | |
| 3643 | 3643 | * | |
| 3644 | 3644 | * @param {string} q already lowercased and trimmed | |
| 3645 | 3645 | * @returns {TbOmniItem[]} | |
| ⋯ 11 unchanged lines | |||
| 3657 | 3657 | kind: "tab", | |
| 3658 | 3658 | label: tab.title || where, | |
| 3659 | 3659 | meta: where, | |
| 3660 | - | // The showing tab is a worse answer than any other equally good match — | |
| 3661 | - | // it is the one place you can already see — but it is still an answer, | |
| 3662 | - | // and the same +100 the current window takes rather than the omission the | |
| 3663 | - | // current session takes. A session you are on cannot be typed at by | |
| 3664 | - | // accident; the address of the page in front of you very much can, and | |
| 3665 | - | // being told there is no such tab is the box looking broken. | |
| 3666 | - | score: score + OMNI_TAB_PENALTY + (tab.active ? 100 : 0), | |
| 3660 | + | // The showing tab is scored like every other one. The current session is | |
| 3661 | + | // left out of the list and the current window is pushed down it, and | |
| 3662 | + | // neither rule carries across: both of those are named in the box in | |
| 3663 | + | // front of you, where the tab you are looking at is a page whose address | |
| 3664 | + | // you would type without once thinking of it as where you already are. | |
| 3665 | + | // A row that answers is worth more than a row that is spent on being | |
| 3666 | + | // right about which page is in front. | |
| 3667 | + | score: score + OMNI_TAB_PENALTY, | |
| 3667 | 3668 | // Showing the tab is the whole of it. The keyboard stays where `runOmni` | |
| 3668 | 3669 | // puts it — a panel cannot hand focus to the page — and if the tab is | |
| 3669 | 3670 | // pinned, showing it moves the terminal too: the same forward pin that a | |
| ⋯ 2456 unchanged lines | |||