commit ca3e4e1494f028745643cce7b8c354366f3e3487
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Fri Oct 2 15:25:09 2015 +0200

    Small BufferView cleanup
    
    Rename fitCursor() to needsFitCursor() to show that it does not do any
    action. Constify.
    
    Update a few comments.

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 625be3a..0006be4 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -412,7 +412,7 @@ Buffer const & BufferView::buffer() const
 }
 
 
-bool BufferView::fitCursor()
+bool BufferView::needsFitCursor() const
 {
        if (cursorStatus(d->cursor_) == CUR_INSIDE) {
                frontend::FontMetrics const & fm =
@@ -443,6 +443,7 @@ void BufferView::processUpdateFlags(Update::flags flags)
        // Now do the first drawing step if needed. This consists on updating
        // the CoordCache in updateMetrics().
        // The second drawing step is done in WorkArea::redraw() if needed.
+       // FIXME: is this still true now that Buffer::changed() is used all 
over?
 
        // Case when no explicit update is requested.
        if (!flags) {
@@ -460,7 +461,7 @@ void BufferView::processUpdateFlags(Update::flags flags)
        if (flags == Update::FitCursor
                || flags == (Update::Decoration | Update::FitCursor)) {
                // tell the frontend to update the screen if needed.
-               if (fitCursor()) {
+               if (needsFitCursor()) {
                        showCursor();
                        return;
                }
@@ -492,7 +493,7 @@ void BufferView::processUpdateFlags(Update::flags flags)
        // This is done at draw() time. So we need a redraw!
        buffer_.changed(false);
 
-       if (fitCursor()) {
+       if (needsFitCursor()) {
                // The cursor is off screen so ensure it is visible.
                // refresh it:
                showCursor();
@@ -808,7 +809,7 @@ bool BufferView::moveToPosition(pit_type bottom_pit, 
pos_type bottom_pos,
                // paragraph position which is computed at draw() time.
                // So we need a redraw!
                buffer_.changed(false);
-               if (fitCursor())
+               if (needsFitCursor())
                        showCursor();
        }
 
diff --git a/src/BufferView.h b/src/BufferView.h
index 6aa2f06..9116710 100644
--- a/src/BufferView.h
+++ b/src/BufferView.h
@@ -117,9 +117,9 @@ public:
         */
        void processUpdateFlags(Update::flags flags);
 
-       /// move the screen to fit the cursor.
+       /// return true if one shall move the screen to fit the cursor.
        /// Only to be called with good y coordinates (after a bv::metrics)
-       bool fitCursor();
+       bool needsFitCursor() const;
 
        // Returns the amount of horizontal scrolling applied to the
        // top-level row where the cursor lies
@@ -167,11 +167,11 @@ public:
        void recenter();
        /// Ensure that the BufferView cursor is visible.
        /// This method will automatically scroll and update the BufferView
-       /// if needed.
+       /// (metrics+drawing) if needed.
        void showCursor();
        /// Ensure the passed cursor \p dit is visible.
        /// This method will automatically scroll and update the BufferView
-       /// if needed.
+       /// (metrics+drawing) if needed.
        /// \param recenter Whether the cursor should be centered on screen
        void showCursor(DocIterator const & dit, bool recenter,
                bool update);

Reply via email to