starmath/source/cursor.cxx |   12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

New commits:
commit ddeb13b497e3c118c3bcb0fe55e1a61498b9daa2
Author: Takeshi Abe <t...@fixedpoint.jp>
Date:   Wed Aug 17 17:36:16 2016 +0900

    starmath: Use SmCaretPos::GetPosAfter()
    
    Change-Id: Ie05354f9e359b9dbc10f9d8ee8a9579c67ec5e5f
    Reviewed-on: https://gerrit.libreoffice.org/28185
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index 047e288..35a06b7 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -411,24 +411,18 @@ SmCaretPos SmCursor::PatchLineList(SmNodeList* pLineList, 
SmNodeList::iterator a
             --aIter; //Thus find node before aIter
         if(aIter == pLineList->begin())
             return SmCaretPos();
-        if((*aIter)->GetType() == NTEXT)
-            return SmCaretPos(*aIter, 
static_cast<SmTextNode*>(*aIter)->GetText().getLength());
-        return SmCaretPos(*aIter, 1);
+        return SmCaretPos::GetPosAfter(*aIter);
     }
     if(prev && next && next->GetType() == NPLACE && 
!SmNodeListParser::IsOperator(prev->GetToken())){
         aIter = pLineList->erase(aIter);
         delete next;
-        if(prev->GetType() == NTEXT)
-            return SmCaretPos(prev, 
static_cast<SmTextNode*>(prev)->GetText().getLength());
-        return SmCaretPos(prev, 1);
+        return SmCaretPos::GetPosAfter(prev);
     }
 
     //If we didn't do anything return
     if(!prev) //return an invalid to indicate we're in front of line
         return SmCaretPos();
-    if(prev->GetType() == NTEXT)
-        return SmCaretPos(prev, 
static_cast<SmTextNode*>(prev)->GetText().getLength());
-    return SmCaretPos(prev, 1);
+    return SmCaretPos::GetPosAfter(prev);
 }
 
 SmNodeList::iterator SmCursor::TakeSelectedNodesFromList(SmNodeList *pLineList,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to