Get rid of helper Text::previousWord(), used only once

This commit is contained in:
Jean-Marc Lasgouttes 2020-09-29 10:15:31 +02:00
parent a41bcb3701
commit f9aadae290
2 changed files with 5 additions and 16 deletions

View File

@ -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

View File

@ -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 {