mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 22:06:15 +00:00
restore the correct behavior of suppression of misspelled marker for word at cursor position - the change r37340 broke it
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37363 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4a8751f8dd
commit
5eed97b56b
@ -3763,9 +3763,12 @@ void Paragraph::spellCheck() const
|
||||
}
|
||||
|
||||
|
||||
bool Paragraph::isMisspelled(pos_type pos) const
|
||||
bool Paragraph::isMisspelled(pos_type pos, bool check_boundary) const
|
||||
{
|
||||
return SpellChecker::misspelled(d->speller_state_.getState(pos));
|
||||
bool result = SpellChecker::misspelled(d->speller_state_.getState(pos));
|
||||
if (!result && check_boundary && pos > 0 && isWordSeparator(pos))
|
||||
result = SpellChecker::misspelled(d->speller_state_.getState(pos - 1));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -456,8 +456,10 @@ public:
|
||||
bool check_learned = false) const;
|
||||
|
||||
/// Spell checker status at position \p pos.
|
||||
/// \return true if pointed position is misspelled.
|
||||
bool isMisspelled(pos_type pos) const;
|
||||
/// If \p check_boundary is true the status of position immediately
|
||||
/// before \p pos is tested too if it is at word boundary.
|
||||
/// \return true if one of the tested positions is misspelled.
|
||||
bool isMisspelled(pos_type pos, bool check_boundary = false) const;
|
||||
|
||||
/// \return true if both positions are inside the same
|
||||
/// spell range - i.e. the same word.
|
||||
|
@ -467,9 +467,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
cur.noScreenUpdate();
|
||||
|
||||
LASSERT(cur.text() == this, /**/);
|
||||
CursorSlice oldTopSlice = cur.top();
|
||||
bool oldBoundary = cur.boundary();
|
||||
bool sel = cur.selection();
|
||||
CursorSlice const oldTopSlice = cur.top();
|
||||
bool const oldBoundary = cur.boundary();
|
||||
bool const oldSelection = cur.selection();
|
||||
// Signals that, even if needsUpdate == false, an update of the
|
||||
// cursor paragraph is required
|
||||
bool singleParUpdate = lyxaction.funcHasFlag(cmd.action(),
|
||||
@ -477,9 +477,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
// Signals that a full-screen update is required
|
||||
bool needsUpdate = !(lyxaction.funcHasFlag(cmd.action(),
|
||||
LyXAction::NoUpdate) || singleParUpdate);
|
||||
int const last_pid = cur.paragraph().id();
|
||||
pos_type const last_pos = cur.pos();
|
||||
bool const last_misspelled = lyxrc.spellcheck_continuously && cur.paragraph().isMisspelled(cur.pos());
|
||||
bool const last_misspelled = lyxrc.spellcheck_continuously
|
||||
&& cur.paragraph().isMisspelled(cur.pos(), true);
|
||||
|
||||
FuncCode const act = cmd.action();
|
||||
switch (act) {
|
||||
@ -2184,9 +2183,10 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
if (!cur.inTexted()) {
|
||||
// move from regular text to math
|
||||
needsUpdate = last_misspelled;
|
||||
} else if (cur.paragraph().id() != last_pid || cur.pos() != last_pos) {
|
||||
} else if (oldTopSlice != cur.top() || oldBoundary != cur.boundary()) {
|
||||
// move inside regular text
|
||||
needsUpdate = last_misspelled || cur.paragraph().isMisspelled(cur.pos());
|
||||
needsUpdate = last_misspelled
|
||||
|| cur.paragraph().isMisspelled(cur.pos(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2212,7 +2212,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
if (!needsUpdate
|
||||
&& &oldTopSlice.inset() == &cur.inset()
|
||||
&& oldTopSlice.idx() == cur.idx()
|
||||
&& !sel // sel is a backup of cur.selection() at the beginning of the function.
|
||||
&& !oldSelection // oldSelection is a backup of cur.selection() at the beginning of the function.
|
||||
&& !cur.selection())
|
||||
// FIXME: it would be better if we could just do this
|
||||
//
|
||||
|
@ -421,6 +421,8 @@ void RowPainter::paintFromPos(pos_type & vpos, bool changed)
|
||||
pos_type cpos = cur.pos();
|
||||
if (cpos > 0 && cpos == par_.size() && !par_.isWordSeparator(cpos-1))
|
||||
--cpos;
|
||||
else if (cpos > 0 && par_.isWordSeparator(cpos))
|
||||
--cpos;
|
||||
current_word = par_.isSameSpellRange(pos, cpos) ;
|
||||
}
|
||||
if (!current_word)
|
||||
|
Loading…
Reference in New Issue
Block a user