Commit 6531739
authored
feat: Make undo work when importing pattern (#2160)
A user complained that they imported a file by accident when they meant
to export it and as a result had trouble recovering the changes they
were trying to save. Auto-save saved the day but there is no reason for
not being able to undo changes after importing a pattern.
In fact, the previous implementation treated importing a pattern as a
reset on the editor instance which actually erased all previous undo
entries. Importing now is treated as a normal editing operation where
the entire file is replaced with the imported pattern.
Since all imports use AddText it was easy to add an undo entry to that
function while removing the part where the previous undo records were
being deleted.
Care is taken to add the preprocessed version of the imported file to
the undo buffer so that unwanted chars don't sneak in. A bug was found
in the handling of a tab char as well but hopefully it wont need to be
used anymore.1 parent 7d09cc6 commit 6531739
File tree
1 file changed
+13
-10
lines changed- lib/third_party/imgui/ColorTextEditor/source
1 file changed
+13
-10
lines changedLines changed: 13 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
267 | 266 | | |
268 | 267 | | |
269 | 268 | | |
| |||
1288 | 1287 | | |
1289 | 1288 | | |
1290 | 1289 | | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
1291 | 1295 | | |
1292 | 1296 | | |
1293 | 1297 | | |
1294 | 1298 | | |
1295 | | - | |
1296 | | - | |
1297 | | - | |
| 1299 | + | |
1298 | 1300 | | |
1299 | | - | |
| 1301 | + | |
1300 | 1302 | | |
1301 | | - | |
1302 | 1303 | | |
1303 | | - | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
1304 | 1307 | | |
1305 | 1308 | | |
1306 | | - | |
1307 | | - | |
1308 | | - | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
1309 | 1312 | | |
1310 | 1313 | | |
1311 | 1314 | | |
| |||
0 commit comments