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
| @@ -730,8 +730,10 @@ | ||
| 730 | 730 | |
| 731 | 731 | /** |
| 732 | 732 | * A seat that changed since the last drawing lists other rows, whose |
| 733 | - * bodies are read once: the model takes the new seat in this same pass, | |
| 734 | - * so the drawing that read asks for finds the seat unchanged. | |
| 733 | + * bodies are read once. | |
| 734 | + * | |
| 735 | + * The model takes the new seat in this same pass, so the drawing that | |
| 736 | + * read asks for finds the seat unchanged. | |
| 735 | 737 | */ |
| 736 | 738 | const isReseated = e.props.placement !== model.placement |
| 737 | 739 |
| @@ -1,17 +1,23 @@ | ||
| 1 | 1 | import type { On } from 'claude-code' |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * Answers `$.fs` over /work holding MOVED_IN's two files, both last | |
| 5 | - * written at time 0, before any session began. | |
| 4 | + * Answers `$.fs` over /work holding the named files, MOVED_IN's two when | |
| 5 | + * none is given, each last written at time 0, before any session began. | |
| 6 | 6 | * |
| 7 | 7 | * @param on the test's `on` |
| 8 | + * @param names the files /work holds | |
| 8 | 9 | */ |
| 9 | -export function oldFiles(on: On) { | |
| 10 | +export function oldFiles( | |
| 11 | + on: On, | |
| 12 | + names: readonly string[] = ['old.ts', 'moved.ts'], | |
| 13 | +) { | |
| 10 | 14 | on('fs.list', () => ({ |
| 11 | - value: [ | |
| 12 | - { name: 'old.ts', kind: 'file', size: 2, isLink: false }, | |
| 13 | - { name: 'moved.ts', kind: 'file', size: 2, isLink: false }, | |
| 14 | - ], | |
| 15 | + value: names.map(name => ({ | |
| 16 | + name, | |
| 17 | + kind: 'file' as const, | |
| 18 | + size: 2, | |
| 19 | + isLink: false, | |
| 20 | + })), | |
| 15 | 21 | })) |
| 16 | 22 | |
| 17 | 23 | on('fs.stat', () => ({ |
| @@ -147,6 +147,42 @@ | ||
| 147 | 147 | expect(drawn).toContain('+"left": "1.0.1"') |
| 148 | 148 | }) |
| 149 | 149 | |
| 150 | + test('inline, a window that moves reads only its new rows', async ($, on) => { | |
| 151 | + const world = Fixtures.inRepository(on, Fixtures.MANY_FILES) | |
| 152 | + | |
| 153 | + on('session.usage', () => ({ value: Fixtures.usageAt(Fixtures.SETTLE_MS) })) | |
| 154 | + | |
| 155 | + Fixtures.oldFiles( | |
| 156 | + on, | |
| 157 | + Array.from( | |
| 158 | + { length: Fixtures.MANY_FILE_COUNT }, | |
| 159 | + (_, at) => `file${at}.ts`, | |
| 160 | + ), | |
| 161 | + ) | |
| 162 | + | |
| 163 | + await $.session.start(Fixtures.SESSION) | |
| 164 | + await $.command.run(Fixtures.DIALOG_DIFF) | |
| 165 | + await world.clock.advance(Fixtures.SETTLE_MS) | |
| 166 | + await $.ui.render(Fixtures.INLINE_PANE) | |
| 167 | + await world.clock.advance(Fixtures.SETTLE_MS) | |
| 168 | + await $.ui.focus(Fixtures.ringOnto('file:file3.ts')) | |
| 169 | + await world.clock.advance(Fixtures.SETTLE_MS) | |
| 170 | + await $.ui.render(Fixtures.INLINE_PANE) | |
| 171 | + await $.ui.press({ plugin: 'diff', key: 'file:file5.ts' }) | |
| 172 | + await world.clock.advance(Fixtures.SETTLE_MS) | |
| 173 | + | |
| 174 | + expect( | |
| 175 | + world.runs | |
| 176 | + .filter(run => run.argv.includes('--raw')) | |
| 177 | + .map(run => run.argv.slice(run.argv.indexOf('--') + 1).join(' ')), | |
| 178 | + 'the first five, the one the walk brought in, the two the press did', | |
| 179 | + ).toEqual([ | |
| 180 | + 'file0.ts file1.ts file2.ts file3.ts file4.ts', | |
| 181 | + 'file5.ts', | |
| 182 | + 'file6.ts file7.ts', | |
| 183 | + ]) | |
| 184 | + }) | |
| 185 | + | |
| 150 | 186 | test('docked, a wheel tick moves the body, not the list', async ($, on) => { |
| 151 | 187 | const world = Fixtures.inRepository(on, Fixtures.MANY_FILES) |
| 152 | 188 |