X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FText.cpp;h=5803c2d4ad07e1fca7be0574d645a9090801e26c;hb=27d580b5c057d565b9b4b50c811f6e1fab7f1246;hp=d8436b2ddc7eed3cfa789a052477a5ef8401ac01;hpb=82c7e15e6444a8566a9b7b8053b830d03058383e;p=lyx.git diff --git a/src/Text.cpp b/src/Text.cpp index d8436b2ddc..5803c2d4ad 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -485,8 +485,8 @@ class TextCompletionList : public CompletionList { public: /// - TextCompletionList(Cursor const & cur) - : buffer_(cur.buffer()), pos_(0) + TextCompletionList(Cursor const & cur, WordList const * list) + : buffer_(cur.buffer()), pos_(0), list_(list) {} /// virtual ~TextCompletionList() {} @@ -496,12 +496,12 @@ public: /// virtual size_t size() const { - return theWordList().size(); + return list_->size(); } /// virtual docstring const & data(size_t idx) const { - return theWordList().word(idx); + return list_->word(idx); } private: @@ -509,6 +509,8 @@ private: Buffer const * buffer_; /// size_t pos_; + /// + WordList const * list_; }; @@ -1123,9 +1125,11 @@ void Text::selectWord(Cursor & cur, word_location loc) setCursor(cur, from.pit(), from.pos()); if (to == from) return; - cur.resetAnchor(); + if (!cur.selection()) + cur.resetAnchor(); setCursor(cur, to.pit(), to.pos()); cur.setSelection(); + cur.setWordSelection(true); } @@ -1986,7 +1990,8 @@ bool Text::completionSupported(Cursor const & cur) const CompletionList const * Text::createCompletionList(Cursor const & cur) const { - return new TextCompletionList(cur); + WordList const * list = theWordList(*cur.getFont().language()); + return new TextCompletionList(cur, list); }