]> git.lyx.org Git - features.git/commitdiff
use max & min
authorAlfredo Braunstein <abraunst@lyx.org>
Wed, 7 Jan 2004 06:48:30 +0000 (06:48 +0000)
committerAlfredo Braunstein <abraunst@lyx.org>
Wed, 7 Jan 2004 06:48:30 +0000 (06:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8310 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/lyxcursor.C
src/lyxcursor.h
src/textcursor.C

index 4f7aa40a40d9483f55ff88832f6ab89b9d6ef914..dda43c6bb805e1a2c9d27713930cc45cf752cf21 100644 (file)
@@ -1,3 +1,9 @@
+
+2004-01-07  Alfredo Braunstein  <abraunst@lyx.org>
+
+       * lyxcursor.[Ch] (operator>): add
+       * textcursor.C (selStart, selEnd): use std::min and std::max
+
 2004-01-06  Lars Gullik Bjonnes  <larsbj@gullik.net>
 
        * Chktex.C: include boost/format.hpp
index 137ea2bccd74e153c62ff97803cd2badc90ff6bd..66b063da2a1ceff6fdc70578f258a65e4b0b0a4f 100644 (file)
@@ -76,3 +76,10 @@ bool operator<(LyXCursor const & a, LyXCursor const & b)
        return (a.par() < b.par() ||
                (a.par() == b.par()  && a.pos() < b.pos()));
 }
+
+
+bool operator>(LyXCursor const & a, LyXCursor const & b)
+{
+       return (a.par() > b.par() ||
+               (a.par() == b.par()  && a.pos() > b.pos()));
+}
index 6ae0f4e97c53df087b7c92ba8a31747ae183eaaa..f27c0db105e76a98dc78fbeccf6edaa71ee59fd1 100644 (file)
@@ -71,5 +71,7 @@ bool operator==(LyXCursor const & a, LyXCursor const & b);
 bool operator!=(LyXCursor const & a, LyXCursor const & b);
 ///
 bool operator<(LyXCursor const & a, LyXCursor const & b);
+///
+bool operator>(LyXCursor const & a, LyXCursor const & b);
 
 #endif // LYXCURSOR_H
index 275441471f652ae6d97d07e8e40e588ea67823c2..a372f3fd50cae7f25dda4e5a6f107111257188cf 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <config.h>
+#include <algorithm>
 
 #include "textcursor.h"
 
@@ -17,7 +18,7 @@ LyXCursor const & TextCursor::selStart() const
 {
        if (!selection.set())
                return cursor;
-       return selection.cursor < cursor ? selection.cursor : cursor;
+       return std::min(selection.cursor, cursor);
 }
 
 
@@ -25,7 +26,7 @@ LyXCursor const & TextCursor::selEnd() const
 {
        if (!selection.set())
                return cursor;
-       return selection.cursor < cursor ? cursor : selection.cursor;
+       return std::max(selection.cursor, cursor);
 }