Mercurial > vim
comparison src/window.c @ 16690:4e3c4e8e465c v8.1.1347
patch 8.1.1347: fractional scroll position not restored after closing window
commit https://github.com/vim/vim/commit/bd2d68c2f42c7689f681aeaf82606d17f8a0312f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 18 15:36:11 2019 +0200
patch 8.1.1347: fractional scroll position not restored after closing window
Problem: Fractional scroll position not restored after closing window.
Solution: Do restore fraction if topline is not one.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 18 May 2019 15:45:05 +0200 |
parents | 06fd0eaada01 |
children | 695d9ef00b03 |
comparison
equal
deleted
inserted
replaced
16689:7f784d132212 | 16690:4e3c4e8e465c |
---|---|
5828 int height = wp->w_height; | 5828 int height = wp->w_height; |
5829 | 5829 |
5830 // Don't change w_topline in any of these cases: | 5830 // Don't change w_topline in any of these cases: |
5831 // - window height is 0 | 5831 // - window height is 0 |
5832 // - 'scrollbind' is set and this isn't the current window | 5832 // - 'scrollbind' is set and this isn't the current window |
5833 // - window height is sufficient to display the whole buffer | 5833 // - window height is sufficient to display the whole buffer and first line |
5834 // is visible. | |
5834 if (height > 0 | 5835 if (height > 0 |
5835 && (!wp->w_p_scb || wp == curwin) | 5836 && (!wp->w_p_scb || wp == curwin) |
5836 && (height < wp->w_buffer->b_ml.ml_line_count)) | 5837 && (height < wp->w_buffer->b_ml.ml_line_count || wp->w_topline > 1)) |
5837 { | 5838 { |
5838 /* | 5839 /* |
5839 * Find a value for w_topline that shows the cursor at the same | 5840 * Find a value for w_topline that shows the cursor at the same |
5840 * relative position in the window as before (more or less). | 5841 * relative position in the window as before (more or less). |
5841 */ | 5842 */ |