X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FText.cpp;h=d00d2d5356ee710b7fa26a2e9df288173a89a118;hb=8b7584846c4e1a9c87a004fab479722fee7e3013;hp=8f106b42c6f49e9c91742d1ce09a16d7c33b19fb;hpb=a948d133331ca32052b686bf935f2ef61451220d;p=lyx.git diff --git a/src/Text.cpp b/src/Text.cpp index 8f106b42c6..d00d2d5356 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -53,10 +53,9 @@ #include "insets/InsetText.h" #include "insets/InsetBibitem.h" #include "insets/InsetCaption.h" -#include "insets/InsetLine.h" #include "insets/InsetNewline.h" #include "insets/InsetNewpage.h" -#include "insets/InsetOptArg.h" +#include "insets/InsetArgument.h" #include "insets/InsetSpace.h" #include "insets/InsetSpecialChar.h" #include "insets/InsetTabular.h" @@ -452,11 +451,6 @@ void Text::readParToken(Paragraph & par, Lexer & lex, auto_ptr inset(new InsetTabular(buf)); inset->read(lex); par.insertInset(par.size(), inset.release(), font, change); - } else if (token == "\\lyxline") { - auto_ptr inset; - inset.reset(new InsetLine); - inset->setBuffer(*buf); - par.insertInset(par.size(), inset.release(), font, change); } else if (token == "\\change_unchanged") { change = Change(Change::UNCHANGED); } else if (token == "\\change_inserted" || token == "\\change_deleted") { @@ -525,6 +519,9 @@ void Text::readParagraph(Paragraph & par, Lexer & lex, // Initialize begin_of_body_ on load; redoParagraph maintains par.setBeginOfBody(); + + // mark paragraph for spell checking on load + // par.requestSpellCheck(); } @@ -739,10 +736,9 @@ void Text::breakParagraph(Cursor & cur, bool inverse_logic) break; // the character couldn't be deleted physically due to change tracking } - cur.buffer()->updateBuffer(); - // A singlePar update is not enough in this case. - cur.updateFlags(Update::Force); + cur.screenUpdateFlags(Update::Force); + cur.forceBufferUpdate(); // This check is necessary. Otherwise the new empty paragraph will // be deleted automatically. And it is more friendly for the user! @@ -940,23 +936,17 @@ void Text::insertChar(Cursor & cur, char_type c) // disable the double-space checking if (!freeSpacing && isLineSeparatorChar(c)) { if (cur.pos() == 0) { - static bool sent_space_message = false; - if (!sent_space_message) { - cur.message(_("You cannot insert a space at the " - "beginning of a paragraph. Please read the Tutorial.")); - sent_space_message = true; - } + cur.message(_( + "You cannot insert a space at the " + "beginning of a paragraph. Please read the Tutorial.")); return; } LASSERT(cur.pos() > 0, /**/); if ((par.isLineSeparator(cur.pos() - 1) || par.isNewline(cur.pos() - 1)) - && !par.isDeleted(cur.pos() - 1)) { - static bool sent_space_message = false; - if (!sent_space_message) { - cur.message(_("You cannot type two spaces this way. " - "Please read the Tutorial.")); - sent_space_message = true; - } + && !par.isDeleted(cur.pos() - 1)) { + cur.message(_( + "You cannot type two spaces this way. " + "Please read the Tutorial.")); return; } } @@ -965,7 +955,7 @@ void Text::insertChar(Cursor & cur, char_type c) cur.buffer()->params().trackChanges); cur.checkBufferStructure(); -// cur.updateFlags(Update::Force); +// cur.screenUpdateFlags(Update::Force); bool boundary = cur.boundary() || tm.isRTLBoundary(cur.pit(), cur.pos() + 1); setCursor(cur, cur.pit(), cur.pos() + 1, false, boundary); @@ -1315,8 +1305,8 @@ void Text::acceptOrRejectChanges(Cursor & cur, ChangeOp op) cur.finishUndo(); cur.clearSelection(); setCursorIntern(cur, begPit, begPos); - cur.updateFlags(Update::Force); - cur.buffer()->updateBuffer(); + cur.screenUpdateFlags(Update::Force); + cur.forceBufferUpdate(); } @@ -1467,9 +1457,9 @@ bool Text::handleBibitems(Cursor & cur) cur.recordUndo(ATOMIC_UNDO, prevcur.pit()); mergeParagraph(bufparams, cur.text()->paragraphs(), prevcur.pit()); - cur.buffer()->updateBuffer(); + cur.forceBufferUpdate(); setCursorIntern(cur, prevcur.pit(), prevcur.pos()); - cur.updateFlags(Update::Force); + cur.screenUpdateFlags(Update::Force); return true; } @@ -1495,7 +1485,7 @@ bool Text::erase(Cursor & cur) cur.top().forwardPos(); if (was_inset) - cur.buffer()->updateBuffer(); + cur.forceBufferUpdate(); else cur.checkBufferStructure(); needsUpdate = true; @@ -1571,7 +1561,7 @@ bool Text::backspacePos0(Cursor & cur) } if (needsUpdate) { - cur.buffer()->updateBuffer(); + cur.forceBufferUpdate(); setCursorIntern(cur, prevcur.pit(), prevcur.pos()); } @@ -1611,7 +1601,7 @@ bool Text::backspace(Cursor & cur) bool const was_inset = cur.paragraph().isInset(cur.pos()); cur.paragraph().eraseChar(cur.pos(), cur.buffer()->params().trackChanges); if (was_inset) - cur.buffer()->updateBuffer(); + cur.forceBufferUpdate(); else cur.checkBufferStructure(); } @@ -1622,7 +1612,7 @@ bool Text::backspace(Cursor & cur) needsUpdate |= handleBibitems(cur); // A singlePar update is not enough in this case. -// cur.updateFlags(Update::Force); +// cur.screenUpdateFlags(Update::Force); setCursor(cur.top(), cur.pit(), cur.pos()); return needsUpdate; @@ -1667,9 +1657,7 @@ bool Text::dissolveInset(Cursor & cur) cur.pit() = min(cur.lastpit(), spit); cur.pos() = min(cur.lastpos(), spos); } else - // this is the least that needs to be done (bug 6003) - // in the above case, pasteParagraphList handles this - cur.buffer()->updateBuffer(); + cur.forceBufferUpdate(); // Ensure the current language is set correctly (bug 6292) cur.text()->setCursor(cur, cur.pit(), cur.pos()); @@ -2042,8 +2030,8 @@ bool Text::insertCompletion(Cursor & cur, docstring const & s, bool /*finished*/ LASSERT(cur.bv().cursor() == cur, /**/); cur.insert(s); cur.bv().cursor() = cur; - if (!(cur.result().update() & Update::Force)) - cur.updateFlags(cur.result().update() | Update::SinglePar); + if (!(cur.result().screenUpdate() & Update::Force)) + cur.screenUpdateFlags(cur.result().screenUpdate() | Update::SinglePar); return true; }