}
+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)
ErrorList & errorList, InsetText * insetPtr)
{
depth_type depth = 0;
+ bool res = true;
while (lex.isOK()) {
lex.nextToken();
continue;
if (token == "\\end_document") {
- // avoid a crash on weird documents (bug 4859)
- if (pars_.empty()) {
- Paragraph par;
- par.setInsetOwner(insetPtr);
- par.params().depth(depth);
- par.setFont(0, Font(inherit_font,
- buf.params().language));
- pars_.push_back(par);
- }
- return false;
+ res = false;
+ break;
}
if (token == "\\begin_layout") {
LYXERR0("Handling unknown body token: `" << token << '\'');
}
}
- return true;
+
+ // avoid a crash on weird documents (bug 4859)
+ if (pars_.empty()) {
+ Paragraph par;
+ par.setInsetOwner(insetPtr);
+ par.params().depth(depth);
+ par.setFont(0, Font(inherit_font,
+ buf.params().language));
+ par.setPlainOrDefaultLayout(buf.params().documentClass());
+ pars_.push_back(par);
+ }
+
+ return res;
}
// Returns the current font and depth as a message.