]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Simplify redoParagraph by merging duplicate code
[lyx.git] / src / BufferView.cpp
index 1daee5c720faff049b907e5d452da7106e804aa1..9708a08aebeaf41915b9a9fc5d2c2ddfa03d96de 100644 (file)
@@ -2914,15 +2914,26 @@ int BufferView::horizScrollOffset() const
 }
 
 
-CursorSlice const & BufferView::currentRowSlice() const
-{
-       return d->current_row_slice_;
+int BufferView::horizScrollOffset(Text const * text,
+                                  pit_type pit, pos_type pos) const
+{
+       // Is this a row that is currently scrolled?
+       if (!d->current_row_slice_.empty()
+           && &text->inset() == d->current_row_slice_.inset().asInsetText()
+           && pit ==  d->current_row_slice_.pit()
+           && pos ==  d->current_row_slice_.pos())
+               return d->horiz_scroll_offset_;
+       return 0;
 }
 
 
-CursorSlice const & BufferView::lastRowSlice() const
+bool BufferView::hadHorizScrollOffset(Text const * text,
+                                      pit_type pit, pos_type pos) const
 {
-       return d->last_row_slice_;
+       return !d->last_row_slice_.empty()
+              && &text->inset() == d->last_row_slice_.inset().asInsetText()
+              && pit ==  d->last_row_slice_.pit()
+              && pos ==  d->last_row_slice_.pos();
 }