()
| 178 | * `mouse` option is off; null otherwise. |
| 179 | */ |
| 180 | export async function maybeGetTmuxMouseHint(): Promise<string | null> { |
| 181 | if (!process.env.TMUX) return null |
| 182 | // tmux -CC auto-disables fullscreen above, but belt-and-suspenders. |
| 183 | if (!isFullscreenActive() || isTmuxControlMode()) return null |
| 184 | if (checkedTmuxMouseHint) return null |
| 185 | checkedTmuxMouseHint = true |
| 186 | // -A includes inherited values: `show -v mouse` returns empty when the |
| 187 | // option is set globally (`set -g mouse on` in .tmux.conf) but not at |
| 188 | // session level — which is the common case. -A gives the effective value. |
| 189 | const { stdout, code } = await execFileNoThrow( |
| 190 | 'tmux', |
| 191 | ['show', '-Av', 'mouse'], |
| 192 | { useCwd: false, timeout: 2000 }, |
| 193 | ) |
| 194 | if (code !== 0 || stdout.trim() === 'on') return null |
| 195 | return "tmux detected · scroll with PgUp/PgDn · or add 'set -g mouse on' to ~/.tmux.conf for wheel scroll" |
| 196 | } |
| 197 | |
| 198 | /** Test-only: reset module-level once-per-session flags. */ |
| 199 | export function _resetForTesting(): void { |
no test coverage detected