commit f9aadae29093d64876963c111a95f1ceeea54f32
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Tue Sep 29 10:15:31 2020 +0200

    Get rid of helper Text::previousWord(), used only once
---
 src/Text.cpp |   19 +++++--------------
 src/Text.h   |    2 --
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index 8f39183..e5969b1 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -2278,19 +2278,6 @@ void Text::setMacrocontextPosition(DocIterator const & 
pos)
 }
 
 
-docstring Text::previousWord(CursorSlice const & sl) const
-{
-       CursorSlice from = sl;
-       CursorSlice to = sl;
-       getWord(from, to, PREVIOUS_WORD);
-       if (sl == from || to == from)
-               return docstring();
-
-       Paragraph const & par = sl.paragraph();
-       return par.asString(from.pos(), to.pos());
-}
-
-
 bool Text::completionSupported(Cursor const & cur) const
 {
        Paragraph const & par = cur.paragraph();
@@ -2321,7 +2308,11 @@ bool Text::insertCompletion(Cursor & cur, docstring 
const & s, bool /*finished*/
 
 docstring Text::completionPrefix(Cursor const & cur) const
 {
-       return previousWord(cur.top());
+       CursorSlice from = cur.top();
+       CursorSlice to = from;
+       getWord(from, to, PREVIOUS_WORD);
+
+       return cur.paragraph().asString(from.pos(), to.pos());
 }
 
 } // namespace lyx
diff --git a/src/Text.h b/src/Text.h
index 99d83f4..b5160a9 100644
--- a/src/Text.h
+++ b/src/Text.h
@@ -173,8 +173,6 @@ public:
        void selectWord(Cursor & cur, word_location loc);
        /// select all text
        void selectAll(Cursor & cur);
-       /// convenience function get the previous word or an empty string
-       docstring previousWord(CursorSlice const & sl) const;
 
        /// what type of change operation to make
        enum ChangeOp {
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to