mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-20 06:49:56 +00:00
Do not forget last word of paragraph in completion
With the old code, the last word of a paragraph would not be added in the completion list. The key difference is to pass `from' instead of `pos' to FontList::fontiterator. Slight cleanup of the code.
This commit is contained in:
parent
fa67a6ae89
commit
3e60f58a92
@ -3861,20 +3861,19 @@ void Paragraph::locateWord(pos_type & from, pos_type & to,
|
|||||||
|
|
||||||
void Paragraph::collectWords()
|
void Paragraph::collectWords()
|
||||||
{
|
{
|
||||||
pos_type n = size();
|
for (pos_type pos = 0; pos < size(); ++pos) {
|
||||||
for (pos_type pos = 0; pos < n; ++pos) {
|
|
||||||
if (isWordSeparator(pos))
|
if (isWordSeparator(pos))
|
||||||
continue;
|
continue;
|
||||||
pos_type from = pos;
|
pos_type from = pos;
|
||||||
locateWord(from, pos, WHOLE_WORD);
|
locateWord(from, pos, WHOLE_WORD);
|
||||||
if ((pos - from) >= (int)lyxrc.completion_minlength) {
|
if (pos < from + lyxrc.completion_minlength)
|
||||||
docstring word = asString(from, pos, AS_STR_NONE);
|
continue;
|
||||||
FontList::const_iterator cit = d->fontlist_.fontIterator(pos);
|
FontList::const_iterator cit = d->fontlist_.fontIterator(from);
|
||||||
if (cit == d->fontlist_.end())
|
if (cit == d->fontlist_.end())
|
||||||
return;
|
return;
|
||||||
Language const * lang = cit->font().language();
|
Language const * lang = cit->font().language();
|
||||||
d->words_[lang->lang()].insert(word);
|
docstring const word = asString(from, pos, AS_STR_NONE);
|
||||||
}
|
d->words_[lang->lang()].insert(word);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,12 +55,14 @@ What's new
|
|||||||
|
|
||||||
* LYX2LYX
|
* LYX2LYX
|
||||||
|
|
||||||
- Fix warning "Missing \use_indices" when converting from 1.6.x format or older
|
- Fix warning "Missing \use_indices" when converting from 1.6.x format
|
||||||
|
or older.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
* USER INTERFACE
|
* USER INTERFACE
|
||||||
|
|
||||||
|
- Do not forget last words of paragraphs in completion possibilities.
|
||||||
|
|
||||||
|
|
||||||
* INTERNALS
|
* INTERNALS
|
||||||
|
Loading…
Reference in New Issue
Block a user