On 12/6/20 3:35 PM, Jean-Marc Lasgouttes wrote: > Le 06/12/2020 à 19:40, Richard Kimberly Heck a écrit : >>> For example, suppose I do: >>> >>> 1. write "abc" outside an inset (just to have something to undo *to*). >>> 2. edit an inset externally. >>> 3. without ending the external edit, do "undo". >>> 4. now go to the text editor that opened after (2) and make changes and >>> save and exit. >>> >>> The current result, I think, is that the external edits will be lost. >>> I think the current behavior is reasonable, since I don't know what I >>> would expect. But I'm still curious what others think. >>> >>> Perhaps a warning would be appropriate? >>> >>> Similarly, if I edit an inset externally, and close the buffer, >>> should we give an error like "please end your external edits before >>> closing" or something like that? >> >> I'm pretty clueless about undo. JMarc, can you tell me what to do here? > > I'm pretty clueless about external edits. To me, the change is done at > point 4. Is that right?
The actual change is made only when the user clicks "End edit externally", which calls LFUN_INSET_END_EDIT. > In this case, the abc undo element will be acted on at 3 and the > External edit thing will have its undo recoded at 4; > > Note however that I have no idea of how undo is handled in external > edit. Where should have look to find such code? It looks to me like the problem is this. Create a new file. Enter "this is [ERT]some ERT[/ERT]." Right click the ERT and choose "Edit externally". Now type "abc" after the inset, then undo. This undoes "abc" and also undoes the editing of the inset. The lock symbol disappears, and it's impossible to choose "End edit externally" to load the changes. So it's now impossible for changes made externally to be included back into LyX. And, weirdly, to me, re-doing the undo does not re-activate the external edit. I think probably the call to LFUN_INSET_EDIT, which began the external editing, should not be recorded as an Undo step at all. This is not really the kind of thing one needs to undo. It does not, by itself, change the document (even as far as opening or closing insets). Riki -- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel