]> git.lyx.org Git - features.git/commit
Enable Update::SinglePar in nested insets too
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 17 Jul 2023 12:43:29 +0000 (14:43 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 5 Apr 2024 11:03:22 +0000 (13:03 +0200)
commit9a96726bcd06d565c3027011fea954656aa46668
treeffd3ed37b34344d522b7a872d7d0ca108f0c5f71
parentf5bbadbad92d55d480ea8b20c1e29f9ffe4ca224
Enable Update::SinglePar in nested insets too

The idea of single par update is to try to re-break only the paragraph
containing the cursor (if this paragraph contains insets etc.,
re-breaking will recursively descend).

The existing single paragraph update mechanism was tailored to work
only at top level. Indeed changing a paragraph nested into an inset may
lead to larger changes.

This commit tries a rather naive approach that seems to work well: we
need a full redraw if either

1/ the height has changed
or
2/ the width has changed and it was equal to the text metrics width;
   the goal is to catch the case of a one-row inset that grows with
   its contents, but optimize the case of typing in a short paragraph
   part of a larger inset.

NOTE: if only the height has changed, then it should be
  possible to update all metrics at minimal cost. However,
  since this is risky, we do not try that right now.

Part of bug #12297.
src/BufferView.cpp