Adding a new assertion
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Sun Feb 20 18:51:43 UTC 2022
Le 18/02/2022 à 17:18, Scott Kostyshak a écrit :
> In whatever part of LyX's code that marks a buffer as dirty, should we
> assert that the document is not read-only?
>
> If I open the User Guide from the Help menu, editing is disabled. But if I run:
>
> command-sequence inset-forall Caption char-delete-forward; statistics; undo
>
> The buffer is marked as dirty. I'm not sure if something actually
> changed, but I wonder if a general way to catch these types of issues is
> to add an assertion. But perhaps there are some cases where it is hard
> to know if the buffer is dirty (maybe with Undo?) so we mark it as dirty
> just in case?
Actually, the buffer is marked dirty when a recordUndo happens.
Several things come to mind:
1/ in LFUN_BUFFER_FORALL, we do a recordUndo before dispatching each
command. There is no reason for that IMO (it was my doing, but there are
no explanations).
2/ all undo operations should be no-ops when buffer is read-only (unless
I am missing something important).
1/ is done at 48ee2fd0,
2/ is done at bfe98181.
Hope I did not overlook something.
JMarc
More information about the lyx-devel
mailing list