// inside it.
doInsertInset(cur, this, cmd, true, true);
cur.posForward();
+ if (act == LFUN_SCRIPT_INSERT) {
+ /* Script insets change the font style in metrics(), and
+ * this is used to compute the height of the caret
+ * (because the font is stored in TextMetrics::font_).
+ * When we insert, we have to make sure that metrics are
+ * computed so that the caret height is wrong. Arguably,
+ * this is hackish.*/
+ bv->processUpdateFlags(Update::SinglePar);
+ }
+ cur.setCurrentFont();
// Some insets are numbered, others are shown in the outline pane so
// let's update the labels and the toc backend.
cur.forceBufferUpdate();
void InsetScript::metrics(MetricsInfo & mi, Dimension & dim) const
{
int const shift = params_.shift(mi.base.font);
+ // Remember the value of the outser font, so that it can be used in cursorPos.
+ outer_font_ = mi.base.font;
Changer dummy = mi.base.changeScript();
InsetText::metrics(mi, dim);
dim.asc -= shift;
void InsetScript::cursorPos(BufferView const & bv,
CursorSlice const & sl, bool boundary, int & x, int & y) const
{
- Font const font = bv.textMetrics(&text()).displayFont(sl.pit(), sl.pos());
- int const shift = params_.shift(font.fontInfo());
+ int const shift = params_.shift(outer_font_);
InsetText::cursorPos(bv, sl, boundary, x, y);
y += shift;
}
///
bool neverIndent() const { return true; }
///
- bool inheritFont() const { return false; }
+ bool inheritFont() const { return true; }
///
int plaintext(odocstringstream & ods, OutputParams const & op,
size_t max_length = INT_MAX) const;
friend class InsetScriptParams;
///
InsetScriptParams params_;
+ /// The font of containing inset; this is necessary to compute shift
+ mutable FontInfo outer_font_;
};