#include "Author.h"
#include "Buffer.h"
-#include "buffer_funcs.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "Changes.h"
#include "CompletionList.h"
#include "Cursor.h"
+#include "CursorSlice.h"
#include "CutAndPaste.h"
#include "DispatchResult.h"
#include "Encoding.h"
#include "ErrorList.h"
-#include "FuncRequest.h"
#include "factory.h"
-#include "InsetList.h"
+#include "Font.h"
#include "Language.h"
#include "Layout.h"
#include "Lexer.h"
#include "LyXRC.h"
#include "Paragraph.h"
#include "ParagraphParameters.h"
-#include "ParIterator.h"
#include "TextClass.h"
#include "TextMetrics.h"
-#include "WordLangTuple.h"
+#include "Undo.h"
#include "WordList.h"
+#include "insets/Inset.h"
#include "insets/InsetText.h"
-#include "insets/InsetBibitem.h"
#include "insets/InsetCaption.h"
-#include "insets/InsetNewline.h"
-#include "insets/InsetNewpage.h"
-#include "insets/InsetArgument.h"
#include "insets/InsetIPAMacro.h"
-#include "insets/InsetSpace.h"
#include "insets/InsetSpecialChar.h"
#include "insets/InsetTabular.h"
#include "support/convert.h"
#include "support/debug.h"
#include "support/docstream.h"
+#include "support/docstring.h"
#include "support/gettext.h"
#include "support/lassert.h"
-#include "support/Length.h"
#include "support/lstrings.h"
-#include "support/lyxalgo.h"
#include "support/lyxtime.h"
#include "support/textutils.h"
#include "support/unique_ptr.h"
virtual ~TextCompletionList() {}
///
- virtual bool sorted() const { return true; }
+ bool sorted() const override { return true; }
///
- virtual size_t size() const
+ size_t size() const override
{
return list_.size();
}
///
- virtual docstring const & data(size_t idx) const
+ docstring const & data(size_t idx) const override
{
return list_.word(idx);
}
&& par.isWordSeparator(cur.pos() - 1)) {
// get the word in front of cursor
LBUFERR(this == cur.text());
- cur.paragraph().updateWords();
+ par.updateWords();
}
}
Cursor prev_cur = cur;
--prev_cur.pit();
- if (cur.paragraph().size() > 0
+ if (!cur.paragraph().empty()
&& !prev_cur.paragraph().isMergedOnEndOfParDeletion(cur.buffer()->params().track_changes)) {
cur.recordUndo(prev_cur.pit(), prev_cur.pit());
prev_cur.paragraph().setChange(prev_cur.lastpos(), Change(Change::DELETED));
}
-// Returns the current font and depth as a message.
+// Returns the current state (font, depth etc.) as a message for status bar.
docstring Text::currentState(CursorData const & cur, bool devel_mode) const
{
LBUFERR(this == cur.text());
os << bformat(_("Font: %1$s"), font.stateText(&buf.params()));
// The paragraph depth
- int depth = cur.paragraph().getDepth();
+ int depth = par.getDepth();
if (depth > 0)
os << bformat(_(", Depth: %1$d"), depth);
}
}
+ // Custom text style
+ InsetLayout const & layout = cur.inset().getLayout();
+ if (layout.lyxtype() == InsetLayout::CHARSTYLE)
+ os << _(", Style: ") << translateIfPossible(layout.labelstring());
+
if (devel_mode) {
os << _(", Inset: ") << &cur.inset();
if (cur.lastidx() > 0)
}
-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();
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