]>
Commit | Line | Data |
---|---|---|
d2415672 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.182 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.182 | |
11 | Problem: When using tab pages and an argument list the session file may | |
12 | contain wrong "next" commands. (Alexander Bluem) | |
13 | Solution: Use "argu" commands and only when needed. | |
14 | Files: src/ex_docmd.c | |
15 | ||
16 | ||
17 | *** ../vim-7.1.181/src/ex_docmd.c Sun Dec 9 19:37:37 2007 | |
18 | --- src/ex_docmd.c Mon Dec 31 18:24:16 2007 | |
19 | *************** | |
20 | *** 372,378 **** | |
21 | static char_u *arg_all __ARGS((void)); | |
22 | #ifdef FEAT_SESSION | |
23 | static int makeopens __ARGS((FILE *fd, char_u *dirnow)); | |
24 | ! static int put_view __ARGS((FILE *fd, win_T *wp, int add_edit, unsigned *flagp)); | |
25 | static void ex_loadview __ARGS((exarg_T *eap)); | |
26 | static char_u *get_view_file __ARGS((int c)); | |
27 | static int did_lcd; /* whether ":lcd" was produced for a session */ | |
28 | --- 372,378 ---- | |
29 | static char_u *arg_all __ARGS((void)); | |
30 | #ifdef FEAT_SESSION | |
31 | static int makeopens __ARGS((FILE *fd, char_u *dirnow)); | |
32 | ! static int put_view __ARGS((FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int current_arg_idx)); | |
33 | static void ex_loadview __ARGS((exarg_T *eap)); | |
34 | static char_u *get_view_file __ARGS((int c)); | |
35 | static int did_lcd; /* whether ":lcd" was produced for a session */ | |
36 | *************** | |
37 | *** 8762,8768 **** | |
38 | } | |
39 | else | |
40 | { | |
41 | ! failed |= (put_view(fd, curwin, !using_vdir, flagp) == FAIL); | |
42 | } | |
43 | if (put_line(fd, "let &so = s:so_save | let &siso = s:siso_save") | |
44 | == FAIL) | |
45 | --- 8762,8769 ---- | |
46 | } | |
47 | else | |
48 | { | |
49 | ! failed |= (put_view(fd, curwin, !using_vdir, flagp, | |
50 | ! -1) == FAIL); | |
51 | } | |
52 | if (put_line(fd, "let &so = s:so_save | let &siso = s:siso_save") | |
53 | == FAIL) | |
54 | *************** | |
55 | *** 9761,9766 **** | |
56 | --- 9762,9769 ---- | |
57 | int tabnr; | |
58 | win_T *tab_firstwin; | |
59 | frame_T *tab_topframe; | |
60 | + int cur_arg_idx = 0; | |
61 | + int next_arg_idx; | |
62 | ||
63 | if (ssop_flags & SSOP_BUFFERS) | |
64 | only_save_windows = FALSE; /* Save ALL buffers */ | |
65 | *************** | |
66 | *** 9976,9987 **** | |
67 | { | |
68 | if (!ses_do_win(wp)) | |
69 | continue; | |
70 | ! if (put_view(fd, wp, wp != edited_win, &ssop_flags) == FAIL) | |
71 | return FAIL; | |
72 | if (nr > 1 && put_line(fd, "wincmd w") == FAIL) | |
73 | return FAIL; | |
74 | } | |
75 | ||
76 | /* | |
77 | * Restore cursor to the current window if it's not the first one. | |
78 | */ | |
79 | --- 9979,9997 ---- | |
80 | { | |
81 | if (!ses_do_win(wp)) | |
82 | continue; | |
83 | ! if (put_view(fd, wp, wp != edited_win, &ssop_flags, | |
84 | ! cur_arg_idx) == FAIL) | |
85 | return FAIL; | |
86 | if (nr > 1 && put_line(fd, "wincmd w") == FAIL) | |
87 | return FAIL; | |
88 | + next_arg_idx = wp->w_arg_idx; | |
89 | } | |
90 | ||
91 | + /* The argument index in the first tab page is zero, need to set it in | |
92 | + * each window. For further tab pages it's the window where we do | |
93 | + * "tabedit". */ | |
94 | + cur_arg_idx = next_arg_idx; | |
95 | + | |
96 | /* | |
97 | * Restore cursor to the current window if it's not the first one. | |
98 | */ | |
99 | *************** | |
100 | *** 10190,10200 **** | |
101 | * Caller must make sure 'scrolloff' is zero. | |
102 | */ | |
103 | static int | |
104 | ! put_view(fd, wp, add_edit, flagp) | |
105 | FILE *fd; | |
106 | win_T *wp; | |
107 | int add_edit; /* add ":edit" command to view */ | |
108 | unsigned *flagp; /* vop_flags or ssop_flags */ | |
109 | { | |
110 | win_T *save_curwin; | |
111 | int f; | |
112 | --- 10200,10212 ---- | |
113 | * Caller must make sure 'scrolloff' is zero. | |
114 | */ | |
115 | static int | |
116 | ! put_view(fd, wp, add_edit, flagp, current_arg_idx) | |
117 | FILE *fd; | |
118 | win_T *wp; | |
119 | int add_edit; /* add ":edit" command to view */ | |
120 | unsigned *flagp; /* vop_flags or ssop_flags */ | |
121 | + int current_arg_idx; /* current argument index of the window, use | |
122 | + * -1 if unknown */ | |
123 | { | |
124 | win_T *save_curwin; | |
125 | int f; | |
126 | *************** | |
127 | *** 10224,10233 **** | |
128 | ||
129 | /* Only when part of a session: restore the argument index. Some | |
130 | * arguments may have been deleted, check if the index is valid. */ | |
131 | ! if (wp->w_arg_idx != 0 && wp->w_arg_idx <= WARGCOUNT(wp) | |
132 | && flagp == &ssop_flags) | |
133 | { | |
134 | ! if (fprintf(fd, "%ldnext", (long)wp->w_arg_idx) < 0 | |
135 | || put_eol(fd) == FAIL) | |
136 | return FAIL; | |
137 | did_next = TRUE; | |
138 | --- 10236,10245 ---- | |
139 | ||
140 | /* Only when part of a session: restore the argument index. Some | |
141 | * arguments may have been deleted, check if the index is valid. */ | |
142 | ! if (wp->w_arg_idx != current_arg_idx && wp->w_arg_idx <= WARGCOUNT(wp) | |
143 | && flagp == &ssop_flags) | |
144 | { | |
145 | ! if (fprintf(fd, "%ldargu", (long)wp->w_arg_idx + 1) < 0 | |
146 | || put_eol(fd) == FAIL) | |
147 | return FAIL; | |
148 | did_next = TRUE; | |
149 | *** ../vim-7.1.181/src/version.c Wed Jan 2 13:58:17 2008 | |
150 | --- src/version.c Wed Jan 2 15:10:01 2008 | |
151 | *************** | |
152 | *** 668,669 **** | |
153 | --- 668,671 ---- | |
154 | { /* Add new patch number below this line */ | |
155 | + /**/ | |
156 | + 182, | |
157 | /**/ | |
158 | ||
159 | -- | |
160 | You were lucky. We lived for three months in a brown paper bag in a | |
161 | septic tank. We used to have to get up at six o'clock in the morning, | |
162 | clean the bag, eat a crust of stale bread, go to work down mill for | |
163 | fourteen hours a day week in-week out. When we got home, our Dad | |
164 | would thrash us to sleep with his belt! | |
165 | ||
166 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
167 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
168 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
169 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |