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.
13 #include "textcursor.h"
14 #include "paragraph.h"
15 #include "ParagraphList_fwd.h"
23 void TextCursor::setSelection()
27 if (selection.cursor.par() == cursor.par())
28 if (selection.cursor.pos() < cursor.pos()) {
29 selection.end = cursor;
30 selection.start = selection.cursor;
32 selection.end = selection.cursor;
33 selection.start = cursor;
35 else if (selection.cursor.par() < cursor.par() ||
36 (selection.cursor.par() == cursor.par()
37 && selection.cursor.pos() < cursor.pos())) {
38 selection.end = cursor;
39 selection.start = selection.cursor;
41 selection.end = selection.cursor;
42 selection.start = cursor;
45 // a selection with no contents is not a selection
46 if (selection.start.par() == selection.end.par() &&
47 selection.start.pos() == selection.end.pos())
54 void TextCursor::clearSelection()
57 selection.mark(false);
58 selection.end = cursor;
59 selection.start = cursor;
60 selection.cursor = cursor;