Adding a new assertion
Scott Kostyshak
skostysh at lyx.org
Mon Feb 21 02:27:18 UTC 2022
On Sun, Feb 20, 2022 at 07:51:43PM +0100, Jean-Marc Lasgouttes wrote:
>
> 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.
Thanks!
Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20220220/17089a9d/attachment.asc>
More information about the lyx-devel
mailing list