mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 14:15:32 +00:00
503c7c1688
The original use case for this bug is entering an overset inset when there is a selection. The expected result was to have the selection pasted in main text, but the result was to have it in the cell. Insets already have idxFirst() that is able to set cursor to the "entry" cell of an inset. This patch introduces firstIdx(), which is the index of this cell and uses it in idxFirst() (idem for lastIdx/idxLast). As a consequence, several instances of idxFirst/idxLast can be removed. Now for the real fix: the two places where the cell in which selection is inserted seem to be: * Cursor::macroModeClose * Cursor::handleNest These two methods are changed to insert material in the entry cell instead of cell 0. idxFirst/Last methods are added to InsetMathRoot and InsetMathStackrel so that the natural entry point is the nucleus of those insets. Finallly, a typo is fixed in InsetMathNest::edit() where enter_front computation was incorrect.
57 lines
1.1 KiB
C++
57 lines
1.1 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file InsetMathUnderset.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author André Pönitz
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#ifndef MATH_UNDERSETINSET_H
|
|
#define MATH_UNDERSETINSET_H
|
|
|
|
|
|
#include "InsetMathFrac.h"
|
|
|
|
|
|
namespace lyx {
|
|
|
|
/// Inset for underset
|
|
class InsetMathUnderset : public InsetMathFracBase {
|
|
public:
|
|
///
|
|
InsetMathUnderset(Buffer * buf) : InsetMathFracBase(buf) {}
|
|
///
|
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
|
///
|
|
void draw(PainterInfo & pi, int x, int y) const;
|
|
///
|
|
idx_type firstIdx() const { return 1; }
|
|
///
|
|
idx_type lastIdx() const { return 1; }
|
|
///
|
|
bool idxUpDown(Cursor & cur, bool up) const;
|
|
///
|
|
void write(WriteStream & ws) const;
|
|
///
|
|
void normalize(NormalStream & ns) const;
|
|
///
|
|
void mathmlize(MathStream &) const;
|
|
///
|
|
void htmlize(HtmlStream &) const;
|
|
///
|
|
void validate(LaTeXFeatures & features) const;
|
|
///
|
|
InsetCode lyxCode() const { return MATH_UNDERSET_CODE; }
|
|
|
|
private:
|
|
virtual Inset * clone() const;
|
|
};
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
#endif
|