commit 90e7cb1bb509fa74cdd14c664b3920205a86f737
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Mon Oct 20 18:04:09 2025 +0200
Do not update buffer when inserting quote inset
There is not need to run the complete updateBuffer machinery to update
the context variables of the quotes inset. Separate the relevant code
in its own method and call it before inserting.
When when outline is open, this also avoids flickering of the TOC.
---
src/Text.cpp | 6 ++++--
src/insets/InsetQuotes.cpp | 16 ++++++++++++----
src/insets/InsetQuotes.h | 2 ++
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/Text.cpp b/src/Text.cpp
index f6223f39fb..7da4f3fa32 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -5234,8 +5234,10 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
}
QuoteLevel const quote_level = inner
? QuoteLevel::Secondary : QuoteLevel::Primary;
- cur.insert(new InsetQuotes(cur.buffer(), c, quote_level,
cmd.getArg(1), cmd.getArg(2)));
- cur.buffer()->updateBuffer();
+ InsetQuotes * quote = new InsetQuotes(cur.buffer(), c,
quote_level,
+ cmd.getArg(1),
cmd.getArg(2));
+ quote->update(cur);
+ cur.insert(quote);
cur.posForward();
break;
}
diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp
index 795d16db4d..a60a75df69 100644
--- a/src/insets/InsetQuotes.cpp
+++ b/src/insets/InsetQuotes.cpp
@@ -747,7 +747,9 @@ void InsetQuotes::doDispatch(Cursor & cur, FuncRequest &
cmd)
}
cur.recordUndoInset(this);
parseString(cmd.getArg(1), true);
- cur.forceBufferUpdate();
+ // The context values (set inInsetQuotes::updateBuffer) have
+ // no reason to have changed change after this lfun
+ //cur.forceBufferUpdate();
break;
}
default:
@@ -942,11 +944,11 @@ void InsetQuotes::forOutliner(docstring & os, size_t
const, bool const) const
}
-void InsetQuotes::updateBuffer(ParIterator const & it, UpdateType /* utype*/,
bool const /*deleted*/)
+void InsetQuotes::update(DocIterator const & dit)
{
BufferParams const & bp = buffer().masterBuffer()->params();
- Font const & font = it.paragraph().getFontSettings(bp, it.pos());
- pass_thru_ = it.paragraph().isPassThru();
+ Font const & font = dit.paragraph().getFontSettings(bp, dit.pos());
+ pass_thru_ = dit.paragraph().isPassThru();
context_lang_ = font.language()->code();
internal_fontenc_ = font.language()->internalFontEncoding();
global_style_ = bp.quotes_style;
@@ -955,6 +957,12 @@ void InsetQuotes::updateBuffer(ParIterator const & it,
UpdateType /* utype*/, bo
}
+void InsetQuotes::updateBuffer(ParIterator const & it, UpdateType /* utype*/,
bool const /*deleted*/)
+{
+ update(it);
+}
+
+
void InsetQuotes::validate(LaTeXFeatures & features) const
{
QuoteStyle style =
diff --git a/src/insets/InsetQuotes.h b/src/insets/InsetQuotes.h
index fdf69c1b13..27b38d35df 100644
--- a/src/insets/InsetQuotes.h
+++ b/src/insets/InsetQuotes.h
@@ -164,6 +164,8 @@ public:
void forOutliner(docstring &, size_t const maxlen, bool const) const
override;
/// Update the contextual information of this inset
+ void update(DocIterator const & dit);
+ ///
void updateBuffer(ParIterator const &, UpdateType, bool const deleted =
false) override;
///
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs