]>
Commit | Line | Data |
---|---|---|
a6d1e5bc ER |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.084 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.084 | |
11 | Problem: When splitting the window, the new one scrolls with the cursor at | |
12 | the top. | |
13 | Solution: Compute w_fraction before setting the new height. | |
14 | Files: src/window.c | |
15 | ||
16 | ||
17 | *** ../vim-7.3.083/src/window.c 2010-09-21 16:56:29.000000000 +0200 | |
18 | --- src/window.c 2010-12-17 17:09:51.000000000 +0100 | |
19 | *************** | |
20 | *** 70,76 **** | |
21 | #endif /* FEAT_WINDOWS */ | |
22 | ||
23 | static win_T *win_alloc __ARGS((win_T *after, int hidden)); | |
24 | ! static void win_new_height __ARGS((win_T *, int)); | |
25 | ||
26 | #define URL_SLASH 1 /* path_is_url() has found "://" */ | |
27 | #define URL_BACKSLASH 2 /* path_is_url() has found ":\\" */ | |
28 | --- 70,77 ---- | |
29 | #endif /* FEAT_WINDOWS */ | |
30 | ||
31 | static win_T *win_alloc __ARGS((win_T *after, int hidden)); | |
32 | ! static void set_fraction __ARGS((win_T *wp)); | |
33 | ! static void win_new_height __ARGS((win_T *wp, int height)); | |
34 | ||
35 | #define URL_SLASH 1 /* path_is_url() has found "://" */ | |
36 | #define URL_BACKSLASH 2 /* path_is_url() has found ":\\" */ | |
37 | *************** | |
38 | *** 983,992 **** | |
39 | --- 984,999 ---- | |
40 | else | |
41 | frame_append(curfrp, frp); | |
42 | ||
43 | + /* Set w_fraction now so that the cursor keeps the same relative | |
44 | + * vertical position. */ | |
45 | + set_fraction(oldwin); | |
46 | + wp->w_fraction = oldwin->w_fraction; | |
47 | + | |
48 | #ifdef FEAT_VERTSPLIT | |
49 | if (flags & WSP_VERT) | |
50 | { | |
51 | wp->w_p_scr = curwin->w_p_scr; | |
52 | + | |
53 | if (need_status) | |
54 | { | |
55 | win_new_height(oldwin, oldwin->w_height - 1); | |
56 | *************** | |
57 | *** 5453,5458 **** | |
58 | --- 5460,5478 ---- | |
59 | ||
60 | #endif /* FEAT_WINDOWS */ | |
61 | ||
62 | + #define FRACTION_MULT 16384L | |
63 | + | |
64 | + /* | |
65 | + * Set wp->w_fraction for the current w_wrow and w_height. | |
66 | + */ | |
67 | + static void | |
68 | + set_fraction(wp) | |
69 | + win_T *wp; | |
70 | + { | |
71 | + wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT | |
72 | + + FRACTION_MULT / 2) / (long)wp->w_height; | |
73 | + } | |
74 | + | |
75 | /* | |
76 | * Set the height of a window. | |
77 | * This takes care of the things inside the window, not what happens to the | |
78 | *************** | |
79 | *** 5465,5471 **** | |
80 | { | |
81 | linenr_T lnum; | |
82 | int sline, line_size; | |
83 | - #define FRACTION_MULT 16384L | |
84 | ||
85 | /* Don't want a negative height. Happens when splitting a tiny window. | |
86 | * Will equalize heights soon to fix it. */ | |
87 | --- 5485,5490 ---- | |
88 | *************** | |
89 | *** 5475,5482 **** | |
90 | return; /* nothing to do */ | |
91 | ||
92 | if (wp->w_wrow != wp->w_prev_fraction_row && wp->w_height > 0) | |
93 | ! wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT | |
94 | ! + FRACTION_MULT / 2) / (long)wp->w_height; | |
95 | ||
96 | wp->w_height = height; | |
97 | wp->w_skipcol = 0; | |
98 | --- 5494,5500 ---- | |
99 | return; /* nothing to do */ | |
100 | ||
101 | if (wp->w_wrow != wp->w_prev_fraction_row && wp->w_height > 0) | |
102 | ! set_fraction(wp); | |
103 | ||
104 | wp->w_height = height; | |
105 | wp->w_skipcol = 0; | |
106 | *** ../vim-7.3.083/src/version.c 2010-12-17 16:27:10.000000000 +0100 | |
107 | --- src/version.c 2010-12-17 17:14:19.000000000 +0100 | |
108 | *************** | |
109 | *** 716,717 **** | |
110 | --- 716,719 ---- | |
111 | { /* Add new patch number below this line */ | |
112 | + /**/ | |
113 | + 84, | |
114 | /**/ | |
115 | ||
116 | -- | |
117 | How To Keep A Healthy Level Of Insanity: | |
118 | 12. Sing along at the opera. | |
119 | ||
120 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
121 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
122 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
123 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |