3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
14 #include "textcursor.h"
17 LyXCursor const & TextCursor::selStart() const
21 return std::min(selection.cursor, cursor);
25 LyXCursor const & TextCursor::selEnd() const
29 return std::max(selection.cursor, cursor);
33 LyXCursor & TextCursor::selStart()
35 TextCursor const & t = *this;
36 return const_cast<LyXCursor &>(t.selStart());
40 LyXCursor & TextCursor::selEnd()
42 TextCursor const & t = *this;
43 return const_cast<LyXCursor &>(t.selEnd());
47 void TextCursor::setSelection()
50 // a selection with no contents is not a selection
51 if (cursor.par() == selection.cursor.par() &&
52 cursor.pos() == selection.cursor.pos())
59 void TextCursor::clearSelection()
62 selection.mark(false);
63 selection.cursor = cursor;