Repository navigation
Commit 76a3b92
committed
fix(web/shell): #107 review — a command no longer replaces a file with unsaved changes in the editor
shellCommit.js refuses a change to a file with unsaved changes in the editor — but only when its io has an isDirty,
and agent.js's commit hook never passed one; only the unit test injected it. So a command's change to a dirty file
went to the review, which replaces the whole document (reviewSession.applyEdit) and saves it, and whose Undo restores
the file as it was on disk: what the user had typed was lost.
The commit hook now passes isDirty: hasUnsavedChanges finds the document by URI, as the review finds the file
(host.uriFor), with the path's letter case and Unicode form folded — on a disk that ignores case (the usual folder
from the computer: htmlFileSystemProvider has no PathCaseSensitive off Linux, so openTextDocument canonicalises the
URI) the editor keeps one document for README.md and readme.md, and the review would replace it whichever spelling the
command used. A modify and a delete are refused; a file the command created has no buffer to lose, as before.
Test (test/shellSeam.test.js, through the real runAgent -> run_command -> the commit hook agent.js hands the shell):
"a file with unsaved changes in the editor is not replaced by a command" — a dirty document refuses a modify (and the
other file of the set), a delete, and the dirty buffer of another spelling; an open, saved document does not. It fails
on 187fd21 (the dirty file reached the review) and passes here; removing the wiring, the fold, the isDirty test or the
URI lookup each fails it.1 parent 82e6cea commit 76a3b92
2 files changed
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
| 328 | + | |
328 | 329 | | |
329 | 330 | | |
330 | 331 | | |
331 | 332 | | |
332 | 333 | | |
333 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
334 | 349 | | |
335 | 350 | | |
336 | 351 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
227 | 265 | | |
228 | 266 | | |
229 | 267 | | |
| |||
0 commit comments