[LyX/master] Run updateBuffer when adding/merging changes

Richard Kimberly Heck rikiheck at lyx.org
Thu Jan 28 14:54:24 UTC 2021


On 1/28/21 5:28 AM, Jean-Marc Lasgouttes wrote:
> commit f3a0e8ff9a9b914d40eb520bb31674d1ad4eb0d0
> Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
> Date:   Thu Jan 28 10:10:18 2021 +0100
>
>      Run updateBuffer when adding/merging changes
>      
>      Following 4a4ded22, the enabling of some change-related functions is
>      handled in updateBuffer. However, this method is not ran at every
>      document change for performance reasons.
>      
>      This patch adds code to every place that modifies
>      Paragraph::Private::changes_ that checks whether the `changedness' of
>      the paragraph, err... changes.
>      
>      To this end, a new helper struct is introduced that remembers
>      paragraph state at contruction time, and compares it to new state in
>      the destructor.
>      
>      New forceUpdate/needUpdate methods are added to Buffer class, since
>      the cursor is in general not available in the places where these
>      changes are made.
>      
>      Fixes bug #12074.
> ---
>   src/Buffer.cpp     |   17 ++++++++++++-
>   src/Buffer.h       |    6 ++++-
>   src/BufferView.cpp |    2 +-
>   src/Paragraph.cpp  |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>   4 files changed, 91 insertions(+), 3 deletions(-)
>
> diff --git a/src/Buffer.cpp b/src/Buffer.cpp
> index 6454ba3..f2a3702 100644
> --- a/src/Buffer.cpp
> +++ b/src/Buffer.cpp
> diff --git a/src/BufferView.cpp b/src/BufferView.cpp
> index ec89084..8094c64 100644
> --- a/src/BufferView.cpp
> +++ b/src/BufferView.cpp
> @@ -2417,7 +2417,7 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
>   	// Do we have a selection?
>   	theSelection().haveSelection(cursor().selection());
>   
> -	if (cur.needBufferUpdate()) {
> +	if (cur.needBufferUpdate() || buffer().needUpdate()) {
>   		cur.clearBufferUpdate();

Shouldn't the Buffer::updateBuffer_ member also be reset here?

Riki




More information about the lyx-devel mailing list