To: vim-dev@vim.org Subject: Patch 6.1.206 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.206 Problem: The script generated with ":mksession" doesn't work properly when some commands are mapped. Solution: Use ":normal!" instead of ":normal". And use ":wincmd" where possible. (Muraoka Taro) Files: src/ex_docmd.c, src/fold.c *** ../vim61.205/src/ex_docmd.c Tue Sep 17 21:36:54 2002 --- src/ex_docmd.c Tue Oct 1 20:18:37 2002 *************** *** 8031,8037 **** } /* Go to the first window. */ ! if (put_line(fd, IF_EB("normal \027t", "normal " CTRL_W_STR "t")) == FAIL) return FAIL; /* --- 8033,8039 ---- } /* Go to the first window. */ ! if (put_line(fd, "wincmd t") == FAIL) return FAIL; /* *************** *** 8064,8071 **** (long)wp->w_width, Columns / 2, Columns) < 0 || put_eol(fd) == FAIL)) return FAIL; ! if (put_line(fd, IF_EB("normal \027w", ! " normal " CTRL_W_STR "w")) == FAIL) return FAIL; } --- 8066,8072 ---- (long)wp->w_width, Columns / 2, Columns) < 0 || put_eol(fd) == FAIL)) return FAIL; ! if (put_line(fd, "wincmd w") == FAIL) return FAIL; } *************** *** 8073,8080 **** else { /* Just equalise window sizes */ ! if (put_line(fd, IF_EB("normal \027=", "normal " CTRL_W_STR "=")) ! == FAIL) return FAIL; } } --- 8074,8080 ---- else { /* Just equalise window sizes */ ! if (put_line(fd, "wincmd =") == FAIL) return FAIL; } } *************** *** 8088,8103 **** continue; if (put_view(fd, wp, TRUE, &ssop_flags) == FAIL) return FAIL; ! if (nr > 1 && put_line(fd, IF_EB("normal \027w", ! "normal " CTRL_W_STR "w")) == FAIL) return FAIL; } /* * Restore cursor to the current window if it's not the first one. */ ! if (cnr > 1 && (fprintf(fd, IF_EB("normal %d\027w", ! "normal %d" CTRL_W_STR "w"), cnr) < 0 || put_eol(fd) == FAIL)) return FAIL; --- 8088,8101 ---- continue; if (put_view(fd, wp, TRUE, &ssop_flags) == FAIL) return FAIL; ! if (nr > 1 && put_line(fd, "wincmd w") == FAIL) return FAIL; } /* * Restore cursor to the current window if it's not the first one. */ ! if (cnr > 1 && (fprintf(fd, "%dwincmd w", cnr) < 0 || put_eol(fd) == FAIL)) return FAIL; *************** *** 8142,8149 **** { /* Make window as big as possible so that we have lots of room * to split. */ ! if (put_line(fd, IF_EB("normal \027_\027|", ! "normal " CTRL_W_STR "_" CTRL_W_STR "|")) == FAIL || put_line(fd, fr->fr_layout == FR_COL ? "split" : "vsplit") == FAIL) return FAIL; --- 8140,8146 ---- { /* Make window as big as possible so that we have lots of room * to split. */ ! if (put_line(fd, "wincmd _ | wincmd |") == FAIL || put_line(fd, fr->fr_layout == FR_COL ? "split" : "vsplit") == FAIL) return FAIL; *************** *** 8152,8160 **** /* Go back to the first window. */ if (count > 0 && (fprintf(fd, fr->fr_layout == FR_COL ! ? IF_EB("normal %d\027k", "normal %d" CTRL_W_STR "k") ! : IF_EB("normal %d\027h", "normal %d" CTRL_W_STR "h"), ! count) < 0 || put_eol(fd) == FAIL)) return FAIL; --- 8149,8155 ---- /* Go back to the first window. */ if (count > 0 && (fprintf(fd, fr->fr_layout == FR_COL ! ? "%dwincmd k" : "%dwincmd h", count) < 0 || put_eol(fd) == FAIL)) return FAIL; *************** *** 8166,8173 **** ses_win_rec(fd, frc); frc = ses_skipframe(frc->fr_next); /* Go to next window. */ ! if (frc != NULL && put_line(fd, IF_EB("normal \027w", ! "normal " CTRL_W_STR "w")) == FAIL) return FAIL; } } --- 8161,8167 ---- ses_win_rec(fd, frc); frc = ses_skipframe(frc->fr_next); /* Go to next window. */ ! if (frc != NULL && put_line(fd, "wincmd w") == FAIL) return FAIL; } } *************** *** 8365,8378 **** || put_eol(fd) == FAIL || put_line(fd, "if s:l < 1 | let s:l = 1 | endif") == FAIL || put_line(fd, "exe s:l") == FAIL ! || put_line(fd, "normal zt") == FAIL || fprintf(fd, "%ld", (long)wp->w_cursor.lnum) < 0 || put_eol(fd) == FAIL) return FAIL; /* Restore the cursor column and left offset when not wrapping. */ if (wp->w_cursor.col == 0) { ! if (put_line(fd, "normal 0") == FAIL) return FAIL; } else --- 8359,8372 ---- || put_eol(fd) == FAIL || put_line(fd, "if s:l < 1 | let s:l = 1 | endif") == FAIL || put_line(fd, "exe s:l") == FAIL ! || put_line(fd, "normal! zt") == FAIL || fprintf(fd, "%ld", (long)wp->w_cursor.lnum) < 0 || put_eol(fd) == FAIL) return FAIL; /* Restore the cursor column and left offset when not wrapping. */ if (wp->w_cursor.col == 0) { ! if (put_line(fd, "normal! 0") == FAIL) return FAIL; } else *************** *** 8387,8404 **** || put_eol(fd) == FAIL || put_line(fd, "if s:c > 0") == FAIL || fprintf(fd, ! " exe 'normal 0' . s:c . 'lzs' . (%ld - s:c) . 'l'", (long)wp->w_cursor.col) < 0 || put_eol(fd) == FAIL || put_line(fd, "else") == FAIL ! || fprintf(fd, " normal 0%dl", wp->w_cursor.col) < 0 || put_eol(fd) == FAIL || put_line(fd, "endif") == FAIL) return FAIL; } else { ! if (fprintf(fd, "normal 0%dl", wp->w_cursor.col) < 0 || put_eol(fd) == FAIL) return FAIL; } --- 8381,8398 ---- || put_eol(fd) == FAIL || put_line(fd, "if s:c > 0") == FAIL || fprintf(fd, ! " exe 'normal! 0' . s:c . 'lzs' . (%ld - s:c) . 'l'", (long)wp->w_cursor.col) < 0 || put_eol(fd) == FAIL || put_line(fd, "else") == FAIL ! || fprintf(fd, " normal! 0%dl", wp->w_cursor.col) < 0 || put_eol(fd) == FAIL || put_line(fd, "endif") == FAIL) return FAIL; } else { ! if (fprintf(fd, "normal! 0%dl", wp->w_cursor.col) < 0 || put_eol(fd) == FAIL) return FAIL; } *** ../vim61.205/src/fold.c Sun May 19 21:29:28 2002 --- src/fold.c Tue Oct 1 20:11:57 2002 *************** *** 3049,3055 **** { if (foldmethodIsManual(wp)) { ! if (put_line(fd, "silent! normal zE") == FAIL || put_folds_recurse(fd, &wp->w_folds, (linenr_T)0) == FAIL) return FAIL; } --- 3049,3055 ---- { if (foldmethodIsManual(wp)) { ! if (put_line(fd, "silent! normal! zE") == FAIL || put_folds_recurse(fd, &wp->w_folds, (linenr_T)0) == FAIL) return FAIL; } *** ../vim61.205/src/version.c Tue Oct 1 19:34:38 2002 --- src/version.c Tue Oct 1 20:15:01 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 206, /**/ -- I AM THANKFUL... ...for the clothes that fit a little too snug because it means I have more than enough to eat. /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///