]> git.lyx.org Git - lyx.git/blobdiff - src/Text.cpp
1.) some white spaces removed
[lyx.git] / src / Text.cpp
index dde070405f0c585cbd511075369ff3279702c88b..91b8a5f02a456ad58c5df78fd1736cfc0c0e8030 100644 (file)
@@ -757,6 +757,25 @@ void Text::selectWord(Cursor & cur, word_location loc)
 }
 
 
+void Text::selectAll(Cursor & cur)
+{
+       LASSERT(this == cur.text(), /**/);
+       if (cur.lastpos() == 0 && cur.lastpit() == 0)
+               return;
+       // If the cursor is at the beginning, make sure the cursor ends there
+       if (cur.pit() == 0 && cur.pos() == 0) {
+               setCursor(cur, cur.lastpit(), getPar(cur.lastpit()).size());
+               cur.resetAnchor();
+               setCursor(cur, 0, 0);           
+       } else {
+               setCursor(cur, 0, 0);
+               cur.resetAnchor();
+               setCursor(cur, cur.lastpit(), getPar(cur.lastpit()).size());
+       }
+       cur.setSelection();
+}
+
+
 // Select the word currently under the cursor when no
 // selection is currently set
 bool Text::selectWordWhenUnderCursor(Cursor & cur, word_location loc)