]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Fix isSpace for docstring
[lyx.git] / src / BufferView.cpp
index 75d8a4e4348fd2fa34bb205bbee0e724cf24e2af..fbfe41c6dbeb465a7135216a6284b4ae5f0fa4be 100644 (file)
@@ -18,7 +18,6 @@
 
 #include "BranchList.h"
 #include "Buffer.h"
-#include "buffer_funcs.h"
 #include "BufferList.h"
 #include "BufferParams.h"
 #include "CoordCache.h"
 #include "CutAndPaste.h"
 #include "DispatchResult.h"
 #include "ErrorList.h"
-#include "factory.h"
-#include "FloatList.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
 #include "Intl.h"
-#include "InsetIterator.h"
 #include "Language.h"
-#include "LaTeXFeatures.h"
 #include "LayoutFile.h"
 #include "Lexer.h"
 #include "LyX.h"
 #include "LyXAction.h"
 #include "lyxfind.h"
-#include "Layout.h"
 #include "LyXRC.h"
 #include "MetricsInfo.h"
 #include "Paragraph.h"
-#include "ParagraphParameters.h"
-#include "ParIterator.h"
-#include "RowPainter.h"
 #include "Session.h"
 #include "Text.h"
-#include "TextClass.h"
 #include "TextMetrics.h"
 #include "TexRow.h"
 #include "TocBackend.h"
-#include "WordLangTuple.h"
 
 #include "insets/InsetBibtex.h"
 #include "insets/InsetCitation.h"
 #include "insets/InsetCommand.h" // ChangeRefs
-#include "insets/InsetExternal.h"
 #include "insets/InsetGraphics.h"
-#include "insets/InsetNote.h"
 #include "insets/InsetRef.h"
 #include "insets/InsetText.h"
 
 #include "mathed/MathData.h"
-#include "mathed/InsetMathNest.h"
 
 #include "frontends/alert.h"
-#include "frontends/Application.h"
 #include "frontends/Delegates.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/NullPainter.h"
 
 #include "support/convert.h"
 #include "support/debug.h"
-#include "support/ExceptionMessage.h"
+#include "support/docstring.h"
 #include "support/filetools.h"
 #include "support/gettext.h"
 #include "support/lassert.h"
 #include "support/Length.h"
 #include "support/lstrings.h"
 #include "support/lyxlib.h"
-#include "support/Package.h"
 #include "support/types.h"
 
+#include <algorithm>
 #include <cerrno>
+#include <cstring>
 #include <fstream>
 #include <functional>
 #include <iterator>
@@ -947,7 +933,7 @@ bool BufferView::scrollToCursor(DocIterator const & dit, bool const recenter)
        TextMetrics & tm = d->text_metrics_[bot.text()];
 
        pos_type const max_pit = pos_type(bot.text()->paragraphs().size() - 1);
-       int bot_pit = bot.pit();
+       pos_type bot_pit = bot.pit();
        if (bot_pit > max_pit) {
                // FIXME: Why does this happen?
                LYXERR0("bottom pit is greater that max pit: "
@@ -3062,23 +3048,24 @@ bool BufferView::paragraphVisible(DocIterator const & dit) const
 }
 
 
-void BufferView::caretPosAndHeight(Point & p, int & h) const
+void BufferView::caretPosAndDim(Point & p, Dimension & dim) const
 {
-       int asc, des;
        Cursor const & cur = cursor();
        if (cur.inMathed()) {
                MathRow const & mrow = mathRow(&cur.cell());
-               asc = mrow.caret_ascent;
-               des = mrow.caret_descent;
+               dim = mrow.caret_dim;
        } else {
                Font const font = cur.real_current_font;
                frontend::FontMetrics const & fm = theFontMetrics(font);
-               asc = fm.maxAscent();
-               des = fm.maxDescent();
+               dim.wid = fm.lineWidth();
+               dim.asc = fm.maxAscent();
+               dim.des = fm.maxDescent();
        }
-       h = asc + des;
+       if (lyxrc.cursor_width > 0)
+               dim.wid = lyxrc.cursor_width;
+
        p = getPos(cur);
-       p.y_ -= asc;
+       p.y_ -= dim.asc;
 }
 
 
@@ -3087,11 +3074,11 @@ bool BufferView::caretInView() const
        if (!paragraphVisible(cursor()))
                return false;
        Point p;
-       int h;
-       caretPosAndHeight(p, h);
+       Dimension dim;
+       caretPosAndDim(p, dim);
 
        // does the cursor touch the screen ?
-       if (p.y_ + h < 0 || p.y_ >= workHeight())
+       if (p.y_ + dim.height() < 0 || p.y_ >= workHeight())
                return false;
        return true;
 }
@@ -3409,7 +3396,7 @@ docstring const & BufferView::inlineCompletion() const
 }
 
 
-size_t const & BufferView::inlineCompletionUniqueChars() const
+size_t BufferView::inlineCompletionUniqueChars() const
 {
        return d->inlineCompletionUniqueChars_;
 }