Patch 7.4.2279
Problem: Starting diff mode with the cursor in the last line might end up
only showing one closed fold. (John Beckett)
Solution: Scroll the window to show the same relative cursor position.
Files: src/diff.c, src/window.c, src/proto/window.pro
*** ../vim-7.4.2278/src/diff.c 2016-08-27 22:40:38.523752257 +0200
--- src/diff.c 2016-08-28 15:39:07.157711589 +0200
***************
*** 1075,1080 ****
--- 1075,1084 ----
#ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif
+ /* Need to compute w_fraction when no redraw happened yet. */
+ validate_cursor();
+ set_fraction(curwin);
+
/* don't use a new tab page, each tab page has its own diffs */
cmdmod.tab = 0;
***************
*** 1101,1106 ****
--- 1105,1113 ----
curbuf,
curwin->w_cursor.lnum);
}
+ /* Now that lines are folded scroll to show the cursor at the same
+ * relative position. */
+ scroll_to_fraction(curwin, curwin->w_height);
}
}
}
*** ../vim-7.4.2278/src/window.c 2016-08-24 22:11:52.337277956 +0200
--- src/window.c 2016-08-28 15:00:43.513204338 +0200
***************
*** 5674,5681 ****
void
win_new_height(win_T *wp, int height)
{
- linenr_T lnum;
- int sline, line_size;
int prev_height = wp->w_height;
/* Don't want a negative height. Happens when splitting a tiny window.
--- 5674,5679 ----
***************
*** 5701,5706 ****
--- 5699,5714 ----
wp->w_height = height;
wp->w_skipcol = 0;
+ scroll_to_fraction(wp, prev_height);
+ }
+
+ void
+ scroll_to_fraction(win_T *wp, int prev_height)
+ {
+ linenr_T lnum;
+ int sline, line_size;
+ int height = wp->w_height;
+
/* Don't change w_topline when height is zero. Don't set w_topline when
* 'scrollbind' is set and this isn't the current window. */
if (height > 0
*** ../vim-7.4.2278/src/proto/window.pro 2016-08-14 19:08:41.834022311
+0200
--- src/proto/window.pro 2016-08-28 15:00:41.941217890 +0200
***************
*** 56,61 ****
--- 56,62 ----
void win_drag_vsep_line(win_T *dragwin, int offset);
void set_fraction(win_T *wp);
void win_new_height(win_T *wp, int height);
+ void scroll_to_fraction(win_T *wp, int prev_height);
void win_new_width(win_T *wp, int width);
void win_comp_scroll(win_T *wp);
void command_height(void);
*** ../vim-7.4.2278/src/version.c 2016-08-28 14:39:40.752099018 +0200
--- src/version.c 2016-08-28 15:38:18.958118126 +0200
***************
*** 765,766 ****
--- 765,768 ----
{ /* Add new patch number below this line */
+ /**/
+ 2279,
/**/
--
I AM THANKFUL...
...for the taxes that I pay because it means that I am employed.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.