use max & min

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8310 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Alfredo Braunstein 2004-01-07 06:48:30 +00:00
parent 839ee41559
commit 4ad759dbc4
4 changed files with 18 additions and 2 deletions

View 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

View 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()));
}

View 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

View 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);
}