From 33794de82b5c3d9e7cdd078bcc5bc7494ee842a5 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 7 Nov 2018 11:53:00 -1000 Subject: [PATCH] Fixup 097da3a9: fix horizontal navigatiion in InsetMathRoot Exchanging cells 0 and 1 requires to implement idxBackWard/Forward. --- src/mathed/InsetMathRoot.cpp | 24 ++++++++++++++++++++++++ src/mathed/InsetMathRoot.h | 4 ++++ 2 files changed, 28 insertions(+) diff --git a/src/mathed/InsetMathRoot.cpp b/src/mathed/InsetMathRoot.cpp index b3723faca8..565951114e 100644 --- a/src/mathed/InsetMathRoot.cpp +++ b/src/mathed/InsetMathRoot.cpp @@ -156,6 +156,30 @@ bool InsetMathRoot::idxUpDown(Cursor & cur, bool up) const } +bool InsetMathRoot::idxForward(Cursor & cur) const +{ + // nucleus is 0 and is on the right + if (cur.idx() == 0) + return false; + else + cur.idx() = 0; + + return true; +} + + +bool InsetMathRoot::idxBackward(Cursor & cur) const +{ + // nucleus is 0 and is on the right + if (cur.idx() == 1) + return false; + else + cur.idx() = 1; + + return true; +} + + void InsetMathRoot::maple(MapleStream & os) const { os << '(' << cell(0) << ")^(1/(" << cell(1) <<"))"; diff --git a/src/mathed/InsetMathRoot.h b/src/mathed/InsetMathRoot.h index 63c35b6425..d9e92c07be 100644 --- a/src/mathed/InsetMathRoot.h +++ b/src/mathed/InsetMathRoot.h @@ -26,6 +26,10 @@ public: InsetMathRoot(Buffer * buf); /// bool idxUpDown(Cursor & cur, bool up) const; + /// + bool idxForward(Cursor & cur) const; + /// + bool idxBackward(Cursor & cur) const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; -- 2.39.5