X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FText.cpp;h=c3c21084727b7eb6f83165ff1832f638d0394ecf;hb=cd4ae51f7787046e8852abc4b339b5191c6adc16;hp=301cd5f2e3fa75978b0989e07471d2b9d92e4dce;hpb=ea9fe523361a1a52fc9e5c6f635c4f2888187fc5;p=lyx.git diff --git a/src/Text.cpp b/src/Text.cpp index 301cd5f2e3..c3c2108472 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -445,6 +445,9 @@ void Text::readParToken(Paragraph & par, Lexer & lex, } else if (token == "\\numeric") { lex.next(); font.fontInfo().setNumber(setLyXMisc(lex.getString())); + } else if (token == "\\nospellcheck") { + lex.next(); + font.fontInfo().setNoSpellcheck(setLyXMisc(lex.getString())); } else if (token == "\\emph") { lex.next(); font.fontInfo().setEmph(setLyXMisc(lex.getString())); @@ -922,8 +925,8 @@ bool canInsertChar(Cursor const & cur, char_type c) "beginning of a paragraph. Please read the Tutorial.")); return false; } - // LASSERT: Is it safe to continue here? - LASSERT(cur.pos() > 0, /**/); + // If something is wrong, ignore this character. + LASSERT(cur.pos() > 0, return false); if ((par.isLineSeparator(cur.pos() - 1) || par.isNewline(cur.pos() - 1)) && !par.isDeleted(cur.pos() - 1)) { cur.message(_( @@ -968,14 +971,19 @@ void Text::insertChar(Cursor & cur, char_type c) if (lyxrc.auto_number) { static docstring const number_operators = from_ascii("+-/*"); static docstring const number_unary_operators = from_ascii("+-"); - static docstring const number_separators = from_ascii(".,:"); + // European Number Separators: comma, dot etc. + // European Number Terminators: percent, permille, degree, euro etc. if (cur.current_font.fontInfo().number() == FONT_ON) { if (!isDigitASCII(c) && !contains(number_operators, c) && - !(contains(number_separators, c) && + !(isEuropeanNumberSeparator(c) && cur.pos() != 0 && cur.pos() != cur.lastpos() && tm.displayFont(pit, cur.pos()).fontInfo().number() == FONT_ON && + tm.displayFont(pit, cur.pos() - 1).fontInfo().number() == FONT_ON) && + !(isEuropeanNumberTerminator(c) && + cur.pos() != 0 && + tm.displayFont(pit, cur.pos()).fontInfo().number() == FONT_ON && tm.displayFont(pit, cur.pos() - 1).fontInfo().number() == FONT_ON) ) number(cur); // Set current_font.number to OFF @@ -993,7 +1001,7 @@ void Text::insertChar(Cursor & cur, char_type c) ) { setCharFont(pit, cur.pos() - 1, cur.current_font, tm.font_); - } else if (contains(number_separators, ch) + } else if (isEuropeanNumberSeparator(ch) && cur.pos() >= 2 && tm.displayFont(pit, cur.pos() - 2).fontInfo().number() == FONT_ON) { setCharFont(pit, cur.pos() - 1, cur.current_font, @@ -1476,7 +1484,7 @@ void Text::deleteWordForward(Cursor & cur, bool const force) cursorForwardOneWord(cur); cur.setSelection(); if (force || !cur.confirmDeletion()) { - cutSelection(cur, true, false); + cutSelection(cur, false); cur.checkBufferStructure(); } } @@ -1494,7 +1502,7 @@ void Text::deleteWordBackward(Cursor & cur, bool const force) cursorBackwardOneWord(cur); cur.setSelection(); if (force || !cur.confirmDeletion()) { - cutSelection(cur, true, false); + cutSelection(cur, false); cur.checkBufferStructure(); } } @@ -2039,7 +2047,7 @@ docstring Text::getPossibleLabel(DocIterator const & cur) const // We need a unique label docstring label = text; int i = 1; - while (cur.buffer()->insetLabel(label)) { + while (cur.buffer()->activeLabel(label)) { label = text + '-' + convert(i); ++i; } @@ -2191,7 +2199,8 @@ docstring Text::previousWord(CursorSlice const & sl) const bool Text::completionSupported(Cursor const & cur) const { Paragraph const & par = cur.paragraph(); - return cur.pos() > 0 + return !cur.selection() + && cur.pos() > 0 && (cur.pos() >= par.size() || par.isWordSeparator(cur.pos())) && !par.isWordSeparator(cur.pos() - 1); }