surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
| @@ -3,7 +3,7 @@ | ||
| 3 | 3 | export * from './keys' |
| 4 | 4 | export * from './pane-id.js' |
| 5 | 5 | export * from './pane-title.js' |
| 6 | -export * from './plugin-name.js' | |
| 6 | +export * from './plugin-names.js' | |
| 7 | 7 | export * from './texts' |
| 8 | 8 | |
| 9 | 9 | export * as default from '.' |
| @@ -1,5 +1,0 @@ | ||
| 1 | -/** | |
| 2 | - * The plugin's own name, as the engine stamps it on the elements its render | |
| 3 | - * hooks draw (`ui.press`, `ui.focus`). | |
| 4 | - */ | |
| 5 | -export const PLUGIN_NAME = 'diff' |
| @@ -1,0 +1,6 @@ | ||
| 1 | +/** | |
| 2 | + * The names the engine may stamp on the elements this plugin's render hooks | |
| 3 | + * draw (`ui.press`, `ui.focus`): its own, and the one a build that carries | |
| 4 | + * it registers it under. | |
| 5 | + */ | |
| 6 | +export const PLUGIN_NAMES = ['diff', 'cc-plugin-diff'] as const |
| @@ -833,7 +833,7 @@ | ||
| 833 | 833 | return result |
| 834 | 834 | }) |
| 835 | 835 | |
| 836 | - on('ui.focus', { plugin: Names.PLUGIN_NAME }, ($, e, next) => { | |
| 836 | + on('ui.focus', { plugin: Names.PLUGIN_NAMES }, ($, e, next) => { | |
| 837 | 837 | const isListed = |
| 838 | 838 | model.placement === 'inline' && model.dialogView === 'list' && host |
| 839 | 839 |
| @@ -7,12 +7,13 @@ | ||
| 7 | 7 | * elements, as the engine raises it before the ring moves. |
| 8 | 8 | * |
| 9 | 9 | * @param key the element's key |
| 10 | + * @param plugin the name the engine stamped on the element | |
| 10 | 11 | * @returns the `ui.focus` input |
| 11 | 12 | */ |
| 12 | -export const ringOnto = (key: string): UiFocusInput => ({ | |
| 13 | +export const ringOnto = (key: string, plugin = 'diff'): UiFocusInput => ({ | |
| 13 | 14 | component: 'Pane', |
| 14 | 15 | requestId: PANE.requestId, |
| 15 | - plugin: 'diff', | |
| 16 | + plugin, | |
| 16 | 17 | element: key, |
| 17 | 18 | origin: { kind: 'person' }, |
| 18 | 19 | }) |
| @@ -200,6 +200,24 @@ | ||
| 200 | 200 | expect(walked).not.toContain('file0.ts') |
| 201 | 201 | }) |
| 202 | 202 | |
| 203 | + test('the walk follows under the name a build registers', async ($, on) => { | |
| 204 | + const world = Fixtures.inRepository(on, Fixtures.MANY_FILES) | |
| 205 | + | |
| 206 | + await $.session.start(Fixtures.SESSION) | |
| 207 | + await $.command.run(Fixtures.DIALOG_DIFF) | |
| 208 | + await world.clock.advance(Fixtures.SETTLE_MS) | |
| 209 | + await $.ui.render(Fixtures.INLINE_PANE) | |
| 210 | + | |
| 211 | + expect( | |
| 212 | + await $.ui.focus(Fixtures.ringOnto('file:file3.ts', 'cc-plugin-diff')), | |
| 213 | + ).toEqual({}) | |
| 214 | + | |
| 215 | + expect( | |
| 216 | + world.focused.map(focus => focus.element), | |
| 217 | + 'its row once centred', | |
| 218 | + ).toEqual(['file:file2.ts']) | |
| 219 | + }) | |
| 220 | + | |
| 203 | 221 | test('off fullscreen, the walk stops at the last file', async ($, on) => { |
| 204 | 222 | const world = Fixtures.inRepository(on, Fixtures.MANY_FILES) |
| 205 | 223 |