mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-23 16:52:02 +00:00
Fix bug 2251 (from G Baum)
* src/mathed/math_hullinset.h (displayMargin): new static method. * src/mathed/math_hullinset.C (metrics): use displayMargin(). * src/text2.C (cursorUp, cursorDown): use MathHullInset::displayMargin. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14939 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1822466e57
commit
45808381d0
@ -284,7 +284,7 @@ void MathHullInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
// insert a one pixel gap in front of the formula
|
||||
dim.wid += 1;
|
||||
if (display())
|
||||
dim.des += 12;
|
||||
dim.des += displayMargin();
|
||||
dim_ = dim;
|
||||
return;
|
||||
}
|
||||
@ -296,8 +296,8 @@ void MathHullInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
MathGridInset::metrics(mi, dim);
|
||||
|
||||
if (display()) {
|
||||
dim.asc += 12;
|
||||
dim.des += 12;
|
||||
dim.asc += displayMargin();
|
||||
dim.des += displayMargin();
|
||||
}
|
||||
|
||||
if (numberedType()) {
|
||||
|
@ -116,6 +116,8 @@ public:
|
||||
///
|
||||
void addPreview(lyx::graphics::PreviewLoader &) const;
|
||||
|
||||
///
|
||||
static int displayMargin() { return 12; }
|
||||
|
||||
protected:
|
||||
MathHullInset(MathHullInset const &);
|
||||
|
11
src/text2.C
11
src/text2.C
@ -51,6 +51,8 @@
|
||||
|
||||
#include "insets/insetenv.h"
|
||||
|
||||
#include "mathed/math_hullinset.h"
|
||||
|
||||
#include "support/textutils.h"
|
||||
|
||||
#include <boost/current_function.hpp>
|
||||
@ -1078,7 +1080,10 @@ bool LyXText::cursorUp(LCursor & cur)
|
||||
if (!cur.selection()) {
|
||||
int const y = bv_funcs::getPos(cur, cur.boundary()).y_;
|
||||
LCursor old = cur;
|
||||
editXY(cur, x, y - par.rows()[row].ascent() - 1);
|
||||
// Go to middle of previous row. 16 found to work OK;
|
||||
// 12 = top/bottom margin of display math
|
||||
int const margin = 3 * MathHullInset::displayMargin() / 2;
|
||||
editXY(cur, x, y - par.rows()[row].ascent() - margin);
|
||||
cur.clearSelection();
|
||||
|
||||
// This happens when you move out of an inset.
|
||||
@ -1124,7 +1129,9 @@ bool LyXText::cursorDown(LCursor & cur)
|
||||
if (!cur.selection()) {
|
||||
int const y = bv_funcs::getPos(cur, cur.boundary()).y_;
|
||||
LCursor old = cur;
|
||||
editXY(cur, x, y + par.rows()[row].descent() + 1);
|
||||
// To middle of next row
|
||||
int const margin = 3 * MathHullInset::displayMargin() / 2;
|
||||
editXY(cur, x, y + par.rows()[row].descent() + margin);
|
||||
cur.clearSelection();
|
||||
|
||||
// This happens when you move out of an inset.
|
||||
|
Loading…
x
Reference in New Issue
Block a user