mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-13 03:52:00 +00:00
fix(tui): copilot review on #16707 — naming, label consistency, esc priority
- Rename `removeAt` → `removeAtInPlace` and document the mutation contract; the old name read like a non-mutating helper. - Hotkey table + queue header: use `Ctrl+X` / `Esc` to match the rest of the UI (was `⌃X` / `esc`). - Render the queued header as a single template literal so JSX text-node whitespace can't sneak into the rendered line. - Make `Esc` while editing beat the `terminal.hasSelection` clear: the header promises 'Esc cancel', so an active selection shouldn't silently consume the keystroke.
This commit is contained in:
parent
32b068560d
commit
718088c382
5 changed files with 21 additions and 15 deletions
|
|
@ -1,26 +1,26 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { removeAt } from '../hooks/useQueue.js'
|
||||
import { removeAtInPlace } from '../hooks/useQueue.js'
|
||||
|
||||
describe('removeAt', () => {
|
||||
describe('removeAtInPlace', () => {
|
||||
it('removes the item at the given index in place', () => {
|
||||
const arr = ['a', 'b', 'c']
|
||||
|
||||
removeAt(arr, 1)
|
||||
removeAtInPlace(arr, 1)
|
||||
expect(arr).toEqual(['a', 'c'])
|
||||
})
|
||||
|
||||
it('is a no-op when the index is out of bounds', () => {
|
||||
const arr = ['a', 'b']
|
||||
|
||||
removeAt(arr, -1)
|
||||
removeAt(arr, 5)
|
||||
removeAtInPlace(arr, -1)
|
||||
removeAtInPlace(arr, 5)
|
||||
expect(arr).toEqual(['a', 'b'])
|
||||
})
|
||||
|
||||
it('returns the same reference (mutates in place)', () => {
|
||||
const arr = ['x']
|
||||
const same = removeAt(arr, 0)
|
||||
const same = removeAtInPlace(arr, 0)
|
||||
|
||||
expect(same).toBe(arr)
|
||||
expect(arr).toEqual([])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue