mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-07 02:51:50 +00:00
Completion selection on Enter was gated to slash commands only
(value.startsWith('/')), so @file, ./path, and ~/path completions fell
through and submitted the incomplete input instead of inserting the
highlighted row.
Guard on completions.length && compReplace > 0 — useCompletion already
scopes population to slash and path tokens, and the next !== value check
keeps plain-text submits working when the completion is already applied.
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
|
|
const originalPlatform = process.platform
|
|
|
|
async function importPlatform(platform: NodeJS.Platform) {
|
|
vi.resetModules()
|
|
Object.defineProperty(process, 'platform', { value: platform })
|
|
|
|
return import('../lib/platform.js')
|
|
}
|
|
|
|
afterEach(() => {
|
|
Object.defineProperty(process, 'platform', { value: originalPlatform })
|
|
vi.resetModules()
|
|
})
|
|
|
|
describe('platform action modifier', () => {
|
|
it('treats kitty Cmd sequences as the macOS action modifier', async () => {
|
|
const { isActionMod } = await importPlatform('darwin')
|
|
|
|
expect(isActionMod({ ctrl: false, meta: false, super: true })).toBe(true)
|
|
expect(isActionMod({ ctrl: false, meta: true, super: false })).toBe(true)
|
|
expect(isActionMod({ ctrl: true, meta: false, super: false })).toBe(false)
|
|
})
|
|
|
|
it('still uses Ctrl as the action modifier on non-macOS', async () => {
|
|
const { isActionMod } = await importPlatform('linux')
|
|
|
|
expect(isActionMod({ ctrl: true, meta: false, super: false })).toBe(true)
|
|
expect(isActionMod({ ctrl: false, meta: false, super: true })).toBe(false)
|
|
})
|
|
})
|