--- /dev/null
+To: vim-dev@vim.org
+Subject: Patch 6.2.308
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 6.2.308
+Problem: Not all systems have "whoami", resulting in an empty user name.
+Solution: Use "logname" when possible, "whoami" otherwise. (David Boyce)
+Files: src/Makefile
+
+
+*** ../vim-6.2.307/src/Makefile Mon Mar 1 21:49:48 2004
+--- src/Makefile Mon Mar 1 20:03:04 2004
+***************
+*** 2083,2089 ****
+ -@echo 'char_u *compiled_user = (char_u *)"' | tr -d $(NL) >> $@
+ -@if test -n "$(COMPILEDBY)"; then \
+ echo "$(COMPILEDBY)" | tr -d $(NL) >> $@; \
+! else whoami | tr -d $(NL) >> $@; fi
+ -@echo '";' >> $@
+ -@echo 'char_u *compiled_sys = (char_u *)"' | tr -d $(NL) >> $@
+ -@if test -z "$(COMPILEDBY)"; then hostname | tr -d $(NL) >> $@; fi
+--- 2093,2099 ----
+ -@echo 'char_u *compiled_user = (char_u *)"' | tr -d $(NL) >> $@
+ -@if test -n "$(COMPILEDBY)"; then \
+ echo "$(COMPILEDBY)" | tr -d $(NL) >> $@; \
+! else ((logname) 2>/dev/null || whoami) | tr -d $(NL) >> $@; fi
+ -@echo '";' >> $@
+ -@echo 'char_u *compiled_sys = (char_u *)"' | tr -d $(NL) >> $@
+ -@if test -z "$(COMPILEDBY)"; then hostname | tr -d $(NL) >> $@; fi
+*** ../vim-6.2.307/src/version.c Mon Mar 1 21:49:48 2004
+--- src/version.c Tue Mar 2 14:14:12 2004
+***************
+*** 639,640 ****
+--- 639,642 ----
+ { /* Add new patch number below this line */
++ /**/
++ 308,
+ /**/
+
+--
+"It's so simple to be wise. Just think of something stupid to say
+and then don't say it." -- Sam Levenson
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
+/// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
+ \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
--- /dev/null
+To: vim-dev@vim.org
+Subject: Patch 6.2.309
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 6.2.309
+Problem: "3grx" waits for two ESC to be typed. (Jens Paulus)
+Solution: Append the ESC to the stuff buffer when redoing the "gr" insert.
+Files: src/edit.c
+
+
+*** ../vim-6.2.308/src/edit.c Mon Mar 1 16:54:50 2004
+--- src/edit.c Tue Mar 2 14:50:56 2004
+***************
+*** 6061,6067 ****
+ if (!arrow_used)
+ {
+ /*
+! * Don't append the ESC for "r<CR>".
+ */
+ if (cmdchar != 'r' && cmdchar != 'v')
+ AppendToRedobuff(ESC_STR);
+--- 6060,6066 ----
+ if (!arrow_used)
+ {
+ /*
+! * Don't append the ESC for "r<CR>" and "grx".
+ */
+ if (cmdchar != 'r' && cmdchar != 'v')
+ AppendToRedobuff(ESC_STR);
+***************
+*** 6070,6076 ****
+ * Repeating insert may take a long time. Check for
+ * interrupt now and then.
+ */
+! if (*count)
+ {
+ line_breakcheck();
+ if (got_int)
+--- 6069,6075 ----
+ * Repeating insert may take a long time. Check for
+ * interrupt now and then.
+ */
+! if (*count > 0)
+ {
+ line_breakcheck();
+ if (got_int)
+***************
+*** 6080,6085 ****
+--- 6079,6086 ----
+ if (--*count > 0) /* repeat what was typed */
+ {
+ (void)start_redo_ins();
++ if (cmdchar == 'r' || cmdchar == 'v')
++ stuffReadbuff(ESC_STR); /* no ESC in redo buffer */
+ ++RedrawingDisabled;
+ disabled_redraw = TRUE;
+ return FALSE; /* repeat the insert */
+*** ../vim-6.2.308/src/version.c Tue Mar 2 14:15:55 2004
+--- src/version.c Tue Mar 2 14:53:09 2004
+***************
+*** 639,640 ****
+--- 639,642 ----
+ { /* Add new patch number below this line */
++ /**/
++ 309,
+ /**/
+
+--
+-rwxr-xr-x 1 root 24 Oct 29 1929 /bin/ed
+-rwxr-xr-t 4 root 131720 Jan 1 1970 /usr/ucb/vi
+-rwxr-xr-x 1 root 5.89824e37 Oct 22 1990 /usr/bin/emacs
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
+/// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
+ \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
--- /dev/null
+To: vim-dev@vim.org
+Subject: Patch 6.2.310
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 6.2.310
+Problem: When setting 'undolevels' to -1, making a change and setting
+ 'undolevels' to a positive value an "undo list corrupt" error
+ occurs. (Madoka Machitani)
+Solution: Sync undo before changing 'undolevels'.
+Files: src/option.c
+
+
+*** ../vim-6.2.309/src/option.c Sun Feb 29 21:06:13 2004
+--- src/option.c Tue Mar 2 13:05:48 2004
+***************
+*** 6699,6704 ****
+--- 6699,6713 ----
+ }
+ if (p_uc && !old_value)
+ ml_open_files();
++ }
++
++ /* sync undo before 'undolevels' changes */
++ else if (pp == &p_ul)
++ {
++ /* use the old value, otherwise u_sync() may not work properly */
++ p_ul = old_value;
++ u_sync();
++ p_ul = value;
+ }
+
+ /*
+*** ../vim-6.2.309/src/version.c Tue Mar 2 14:59:39 2004
+--- src/version.c Tue Mar 2 15:09:43 2004
+***************
+*** 639,640 ****
+--- 639,642 ----
+ { /* Add new patch number below this line */
++ /**/
++ 310,
+ /**/
+
+--
+FATHER: You killed eight wedding guests in all!
+LAUNCELOT: Er, Well ... the thing is ... I thought your son was a lady.
+FATHER: I can understand that.
+ "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
+/// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
+ \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
--- /dev/null
+To: vim-dev@vim.org
+Subject: Patch 6.2.311
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 6.2.311 (after 6.2.298)
+Problem: When making several changes in one line the changelist grows
+ quickly. There is no error message for reaching the end of the
+ changelist. Reading changelist marks from viminfo doesn't work
+ properly.
+Solution: Only make a new entry in the changelist when making a change in
+ another line or 'textwidth' columns away. Add E662, E663 and E664
+ error messages. Put a changelist mark from viminfo one position
+ before the end.
+Files: runtime/doc/motion.txt, src/mark.c, src/misc1.c, src/normal.c
+
+
+*** ../vim-6.2.310/runtime/doc/motion.txt Sun Feb 29 20:46:43 2004
+--- runtime/doc/motion.txt Tue Mar 2 15:29:59 2004
+***************
+*** 1,4 ****
+! *motion.txt* For Vim version 6.2. Last change: 2004 Feb 29
+
+
+ VIM REFERENCE MANUAL by Bram Moolenaar
+--- 1,4 ----
+! *motion.txt* For Vim version 6.2. Last change: 2004 Mar 02
+
+
+ VIM REFERENCE MANUAL by Bram Moolenaar
+***************
+*** 960,995 ****
+ stored in the viminfo file and restored when starting Vim.
+
+
+! CHANGE LIST JUMPS *changelist* *change-list-jumps*
+!
+! For changes the cursor position is remembered. One position is remembered for
+! every change that can be undone. Two commands can be used to jump to
+! positions of changes, also those that have been undone.
+
+! *g;*
+! g; Go to [count] older cursor position in change list
+! (not a motion command).
+ {not in Vi}
+ {not available without the +jumplist feature}
+
+! *g,*
+! g, Go to [count] newer cursor position in change list
+! (not a motion command).
+ {not in Vi}
+ {not available without the +jumplist feature}
+
+! When you already are at the end or start of the change list you will get an
+! error message. When using a count you jump as far back or forward as
+! possible. Thus you can use "999g;" to go to the first change for which the
+! position is still remembered. The number of entries in the change list is
+! fixed and is the same as for the |jumplist|.
+
+ Note that when text has been inserted or deleted the cursor position might be
+! a bit different from the position of the change.
+
+ When the |:keepjumps| command modifier is used the position of a change is not
+ remembered.
+
+ ==============================================================================
+ 9. Various motions *various-motions*
+
+--- 968,1040 ----
+ stored in the viminfo file and restored when starting Vim.
+
+
+! CHANGE LIST JUMPS *changelist* *change-list-jumps* *E664*
+
+! When making a change the cursor position is remembered. One position is
+! remembered for every change that can be undone, unless it is close to a
+! previous change. Two commands can be used to jump to positions of changes,
+! also those that have been undone:
+!
+! *g;* *E662*
+! g; Go to [count] older position in change list.
+! If [count] is larger than the number of older change
+! positions go to the oldest change.
+! If there is no older change an error message is given.
+! (not a motion command)
+ {not in Vi}
+ {not available without the +jumplist feature}
+
+! *g,* *E663*
+! g, Go to [count] newer cursor position in change list.
+! Just like "g;| but in the opposite direction.
+! (not a motion command)
+ {not in Vi}
+ {not available without the +jumplist feature}
+
+! When using a count you jump as far back or forward as possible. Thus you can
+! use "999g;" to go to the first change for which the position is still
+! remembered. The number of entries in the change list is fixed and is the same
+! as for the |jumplist|.
+!
+! When two undo-able changes are in the same line and at a column position less
+! than 'textwidth' apart only the last one is remembered. This avoids that a
+! sequence of small changes in a line, for example "xxxxx", adds many positions
+! to the change list. When 'textwidth' is zero 'wrapmargin' is used. When that
+! also isn't set a fixed number of 79 is used. Detail: For the computations
+! bytes are used, not characters, to avoid a speed penalty (this only matters
+! for multi-byte encodings).
+
+ Note that when text has been inserted or deleted the cursor position might be
+! a bit different from the position of the change. Especially when lines have
+! been deleted.
+
+ When the |:keepjumps| command modifier is used the position of a change is not
+ remembered.
+
++ *:changes*
++ :changes Print the change list. A ">" character indicates the
++ current position. Just after a change it is below the
++ newest entry, indicating that "g;" takes you to the
++ newest entry position. The first column indicates the
++ count needed to take you to this position. Example:
++
++ change line col text ~
++ 3 9 8 bla bla bla
++ 2 11 57 foo is a bar
++ 1 14 54 the latest changed line
++ >
++
++ The "3g;" command takes you to line 9. Then the
++ output of ":changes is:
++
++ change line col text ~
++ > 0 9 8 bla bla bla
++ 1 11 57 foo is a bar
++ 2 14 54 the latest changed line
++
++ Now you can use "g," to go to line 11 and "2g," to go
++ to line 14.
++
+ ==============================================================================
+ 9. Various motions *various-motions*
+
+*** ../vim-6.2.310/src/mark.c Sun Feb 29 20:46:43 2004
+--- src/mark.c Mon Mar 1 22:42:35 2004
+***************
+*** 898,904 ****
+ #ifdef FEAT_JUMPLIST
+ /* list of change positions */
+ for (i = 0; i < curbuf->b_changelistlen; ++i)
+! one_adjust(&(curbuf->b_changelist[i].lnum));
+ #endif
+
+ #ifdef FEAT_VISUAL
+--- 898,904 ----
+ #ifdef FEAT_JUMPLIST
+ /* list of change positions */
+ for (i = 0; i < curbuf->b_changelistlen; ++i)
+! one_adjust_nodel(&(curbuf->b_changelist[i].lnum));
+ #endif
+
+ #ifdef FEAT_VISUAL
+***************
+*** 1470,1476 ****
+ else
+ ++curbuf->b_changelistlen;
+ curbuf->b_changelist[
+! curbuf->b_changelistlen] = pos;
+ #endif
+ break;
+ default: if ((i = line[1] - 'a') >= 0 && i < NMARKS)
+--- 1470,1476 ----
+ else
+ ++curbuf->b_changelistlen;
+ curbuf->b_changelist[
+! curbuf->b_changelistlen - 1] = pos;
+ #endif
+ break;
+ default: if ((i = line[1] - 'a') >= 0 && i < NMARKS)
+*** ../vim-6.2.310/src/misc1.c Sun Feb 29 20:46:43 2004
+--- src/misc1.c Tue Mar 2 10:48:59 2004
+***************
+*** 2494,2499 ****
+--- 2501,2511 ----
+ {
+ win_T *wp;
+ int i;
++ #ifdef FEAT_JUMPLIST
++ int cols;
++ pos_T *p;
++ int add;
++ #endif
+
+ /* mark the buffer as modified */
+ changed();
+***************
+*** 2505,2539 ****
+ curbuf->b_last_change.col = col;
+
+ #ifdef FEAT_JUMPLIST
+! if (curbuf->b_new_change)
+ {
+! /* This is the first of a new sequence of undo-able changes.
+! * Use a new position in the changelist. */
+! curbuf->b_new_change = FALSE;
+!
+! if (curbuf->b_changelistlen == JUMPLISTSIZE)
+ {
+! /* changelist is full: remove oldest entry */
+! curbuf->b_changelistlen = JUMPLISTSIZE - 1;
+! mch_memmove(curbuf->b_changelist, curbuf->b_changelist + 1,
+! sizeof(pos_T) * (JUMPLISTSIZE - 1));
+! FOR_ALL_WINDOWS(wp)
+ {
+! /* Correct position in changelist for other windows on
+! * this buffer. */
+! if (wp->w_buffer == curbuf && wp->w_changelistidx > 0)
+! --wp->w_changelistidx;
+ }
+ }
+! FOR_ALL_WINDOWS(wp)
+ {
+! /* For other windows, if the position in the changelist is at
+! * the end it stays at the end. */
+! if (wp->w_buffer == curbuf
+ && wp->w_changelistidx == curbuf->b_changelistlen)
+! ++wp->w_changelistidx;
+ }
+- ++curbuf->b_changelistlen;
+ }
+ curbuf->b_changelist[curbuf->b_changelistlen - 1] =
+ curbuf->b_last_change;
+--- 2517,2575 ----
+ curbuf->b_last_change.col = col;
+
+ #ifdef FEAT_JUMPLIST
+! /* Create a new entry if a new undo-able change was started or we
+! * don't have an entry yet. */
+! if (curbuf->b_new_change || curbuf->b_changelistlen == 0)
+ {
+! if (curbuf->b_changelistlen == 0)
+! add = TRUE;
+! else
+ {
+! /* Don't create a new entry when the line number is the same
+! * as the last one and the column is not too far away. Avoids
+! * creating many entries for typing "xxxxx". */
+! p = &curbuf->b_changelist[curbuf->b_changelistlen - 1];
+! if (p->lnum != lnum)
+! add = TRUE;
+! else
+ {
+! cols = comp_textwidth(FALSE);
+! if (cols == 0)
+! cols = 79;
+! add = (p->col + cols < col || col + cols < p->col);
+ }
+ }
+! if (add)
+ {
+! /* This is the first of a new sequence of undo-able changes
+! * and it's at some distance of the last change. Use a new
+! * position in the changelist. */
+! curbuf->b_new_change = FALSE;
+!
+! if (curbuf->b_changelistlen == JUMPLISTSIZE)
+! {
+! /* changelist is full: remove oldest entry */
+! curbuf->b_changelistlen = JUMPLISTSIZE - 1;
+! mch_memmove(curbuf->b_changelist, curbuf->b_changelist + 1,
+! sizeof(pos_T) * (JUMPLISTSIZE - 1));
+! FOR_ALL_WINDOWS(wp)
+! {
+! /* Correct position in changelist for other windows on
+! * this buffer. */
+! if (wp->w_buffer == curbuf && wp->w_changelistidx > 0)
+! --wp->w_changelistidx;
+! }
+! }
+! FOR_ALL_WINDOWS(wp)
+! {
+! /* For other windows, if the position in the changelist is
+! * at the end it stays at the end. */
+! if (wp->w_buffer == curbuf
+ && wp->w_changelistidx == curbuf->b_changelistlen)
+! ++wp->w_changelistidx;
+! }
+! ++curbuf->b_changelistlen;
+ }
+ }
+ curbuf->b_changelist[curbuf->b_changelistlen - 1] =
+ curbuf->b_last_change;
+*** ../vim-6.2.310/src/normal.c Mon Mar 1 16:54:50 2004
+--- src/normal.c Mon Mar 1 22:30:36 2004
+***************
+*** 6549,6555 ****
+ }
+
+ /*
+! * Handle CTRL-O and CTRL-I commands.
+ */
+ static void
+ nv_pcmark(cap)
+--- 6549,6555 ----
+ }
+
+ /*
+! * Handle CTRL-O, CTRL-I, "g;" and "g," commands.
+ */
+ static void
+ nv_pcmark(cap)
+***************
+*** 6575,6580 ****
+--- 6575,6589 ----
+ }
+ else if (pos != NULL) /* can jump */
+ nv_cursormark(cap, FALSE, pos);
++ else if (cap->cmdchar == 'g')
++ {
++ if (curbuf->b_changelistlen == 0)
++ EMSG(_("E664: changelist is empty"));
++ else if (cap->count1 < 0)
++ EMSG(_("E662: At start of changelist"));
++ else
++ EMSG(_("E663: At end of changelist"));
++ }
+ else
+ clearopbeep(cap->oap);
+ # ifdef FEAT_FOLDING
+*** ../vim-6.2.310/src/version.c Tue Mar 2 15:10:20 2004
+--- src/version.c Tue Mar 2 15:30:56 2004
+***************
+*** 639,640 ****
+--- 639,642 ----
+ { /* Add new patch number below this line */
++ /**/
++ 311,
+ /**/
+
+--
+The early bird gets the worm. If you want something else for
+breakfast, get up later.
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
+/// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
+ \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
--- /dev/null
+To: vim-dev@vim.org
+Subject: Patch 6.2.312
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 6.2.312 (after 6.2.299)
+Problem: "make install" clears the screen when installing the docs.
+Solution: Execute ":helptags" in silent mode.
+Files: runtime/doc/Makefile
+
+
+*** ../vim-6.2.311/runtime/doc/Makefile Sun Jan 25 19:28:46 2004
+--- runtime/doc/Makefile Wed Mar 3 19:23:05 2004
+***************
+*** 6,11 ****
+--- 6,14 ----
+
+ AWK = awk
+
++ # Set to $(VIMTARGET) when executed from src/Makefile.
++ VIMEXE = vim
++
+ # include the config.mk from the source directory. It's only needed to set
+ # AWK, used for "make html". Comment this out if the include gives problems.
+ include ../../src/auto/config.mk
+***************
+*** 251,260 ****
+ all: tags vim.man vimdiff.man vimtutor.man xxd.man
+
+ # Use Vim to generate the tags file. Can only be used when Vim has been
+! # compiled and installed.
+ vimtags: $(DOCS)
+! vim -c "helptags ." -c quit
+
+ tags: doctags $(DOCS)
+ ./doctags $(DOCS) | LANG=C LC_ALL=C sort >tags
+ uniq -d -2 tags
+--- 254,264 ----
+ all: tags vim.man vimdiff.man vimtutor.man xxd.man
+
+ # Use Vim to generate the tags file. Can only be used when Vim has been
+! # compiled and installed. Supports multiple languages.
+ vimtags: $(DOCS)
+! $(VIMEXE) -e -s -c "helptags ." -c quit
+
++ # Use "doctags" to generate the tags file. Only works for English!
+ tags: doctags $(DOCS)
+ ./doctags $(DOCS) | LANG=C LC_ALL=C sort >tags
+ uniq -d -2 tags
+*** ../vim-6.2.311/src/version.c Tue Mar 2 16:04:09 2004
+--- src/version.c Wed Mar 3 19:21:48 2004
+***************
+*** 639,640 ****
+--- 639,642 ----
+ { /* Add new patch number below this line */
++ /**/
++ 312,
+ /**/
+
+--
+TIM: Too late.
+ARTHUR: What?
+TIM: There he is!
+ [They all turn,, and see a large white RABBIT lollop a few yards out of the
+ cave. Accompanied by terrifying chord and jarring metallic monster noise.]
+ "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
+/// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
+ \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
--- /dev/null
+To: vim-dev@vim.org
+Subject: Patch 6.2.313
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 6.2.313
+Problem: When opening folds in a diff window, other diff windows no longer
+ show the same text.
+Solution: Sync the folds in diff windows.
+Files: src/diff.c, src/fold.c, src/move.c, src/proto/diff.pro,
+ src/proto/move.pro
+
+
+*** ../vim-6.2.312/src/diff.c Fri Feb 20 21:36:20 2004
+--- src/diff.c Tue Mar 2 16:32:40 2004
+***************
+*** 2102,2105 ****
+--- 2102,2146 ----
+
+ return OK;
+ }
++
++ #if defined(FEAT_FOLDING) || defined(PROTO)
++ /*
++ * For line "lnum" in the current window find the equivalent lnum in window
++ * "wp", compensating for inserted/deleted lines.
++ */
++ linenr_T
++ diff_lnum_win(lnum, wp)
++ linenr_T lnum;
++ win_T *wp;
++ {
++ diff_T *dp;
++ int idx;
++ int i;
++
++ idx = diff_buf_idx(curbuf);
++ if (idx == DB_COUNT) /* safety check */
++ return (linenr_T)0;
++
++ if (diff_invalid)
++ ex_diffupdate(NULL); /* update after a big change */
++
++ /* search for a change that includes "lnum" in the list of diffblocks. */
++ for (dp = first_diff; dp != NULL; dp = dp->df_next)
++ if (lnum <= dp->df_lnum[idx] + dp->df_count[idx])
++ break;
++
++ /* When after the last change, compute relative to the last line number. */
++ if (dp == NULL)
++ return wp->w_buffer->b_ml.ml_line_count
++ - (curbuf->b_ml.ml_line_count - lnum);
++
++ /* Find index for "wp". */
++ i = diff_buf_idx(wp->w_buffer);
++ if (i == DB_COUNT) /* safety check */
++ return (linenr_T)0;
++
++ return lnum + (dp->df_lnum[i] - dp->df_lnum[idx]);
++ }
++ #endif
++
+ #endif /* FEAT_DIFF */
+*** ../vim-6.2.312/src/fold.c Fri Feb 20 21:36:20 2004
+--- src/fold.c Tue Mar 2 17:02:36 2004
+***************
+*** 43,54 ****
+--- 43,56 ----
+ #define MAX_LEVEL 20 /* maximum fold depth */
+
+ /* static functions {{{2 */
++ static void newFoldLevelWin __ARGS((win_T *wp));
+ static int checkCloseRec __ARGS((garray_T *gap, linenr_T lnum, int level));
+ static int foldFind __ARGS((garray_T *gap, linenr_T lnum, fold_T **fpp));
+ static int foldLevelWin __ARGS((win_T *wp, linenr_T lnum));
+ static void checkupdate __ARGS((win_T *wp));
+ static void setFoldRepeat __ARGS((linenr_T lnum, long count, int open));
+ static linenr_T setManualFold __ARGS((linenr_T lnum, int opening, int recurse, int *donep));
++ static linenr_T setManualFoldWin __ARGS((win_T *wp, linenr_T lnum, int opening, int recurse, int *donep));
+ static void foldOpenNested __ARGS((fold_T *fpr));
+ static void deleteFoldEntry __ARGS((garray_T *gap, int idx, int recursive));
+ static void foldMarkAdjustRecurse __ARGS((garray_T *gap, linenr_T line1, linenr_T line2, long amount, long amount_after));
+***************
+*** 486,506 ****
+ void
+ newFoldLevel()
+ {
+ fold_T *fp;
+ int i;
+
+! checkupdate(curwin);
+! if (curwin->w_fold_manual)
+ {
+ /* Set all flags for the first level of folds to FD_LEVEL. Following
+ * manual open/close will then change the flags to FD_OPEN or
+ * FD_CLOSED for those folds that don't use 'foldlevel'. */
+! fp = (fold_T *)curwin->w_folds.ga_data;
+! for (i = 0; i < curwin->w_folds.ga_len; ++i)
+ fp[i].fd_flags = FD_LEVEL;
+! curwin->w_fold_manual = FALSE;
+ }
+! changed_window_setting();
+ }
+
+ /* foldCheckClose() {{{2 */
+--- 488,534 ----
+ void
+ newFoldLevel()
+ {
++ newFoldLevelWin(curwin);
++
++ #ifdef FEAT_DIFF
++ if (foldmethodIsDiff(curwin) && curwin->w_p_scb)
++ {
++ win_T *wp;
++
++ /*
++ * Set the same foldlevel in other windows in diff mode.
++ */
++ FOR_ALL_WINDOWS(wp)
++ {
++ if (wp != curwin && foldmethodIsDiff(wp) && wp->w_p_scb)
++ {
++ wp->w_p_fdl = curwin->w_p_fdl;
++ newFoldLevelWin(wp);
++ }
++ }
++ }
++ #endif
++ }
++
++ static void
++ newFoldLevelWin(wp)
++ win_T *wp;
++ {
+ fold_T *fp;
+ int i;
+
+! checkupdate(wp);
+! if (wp->w_fold_manual)
+ {
+ /* Set all flags for the first level of folds to FD_LEVEL. Following
+ * manual open/close will then change the flags to FD_OPEN or
+ * FD_CLOSED for those folds that don't use 'foldlevel'. */
+! fp = (fold_T *)wp->w_folds.ga_data;
+! for (i = 0; i < wp->w_folds.ga_len; ++i)
+ fp[i].fd_flags = FD_LEVEL;
+! wp->w_fold_manual = FALSE;
+ }
+! changed_window_setting_win(wp);
+ }
+
+ /* foldCheckClose() {{{2 */
+***************
+*** 1232,1246 ****
+ /* setManualFold() {{{2 */
+ /*
+ * Open or close the fold in the current window which contains "lnum".
+ * "donep", when not NULL, points to flag that is set to DONE_FOLD when some
+ * fold was found and to DONE_ACTION when some fold was opened or closed.
+ * When "donep" is NULL give an error message when no fold was found for
+! * "lnum".
+ * Return the line number of the next line that could be closed.
+ * It's only valid when "opening" is TRUE!
+ */
+ static linenr_T
+! setManualFold(lnum, opening, recurse, donep)
+ linenr_T lnum;
+ int opening; /* TRUE when opening, FALSE when closing */
+ int recurse; /* TRUE when closing/opening recursive */
+--- 1260,1312 ----
+ /* setManualFold() {{{2 */
+ /*
+ * Open or close the fold in the current window which contains "lnum".
++ * Also does this for other windows in diff mode when needed.
++ */
++ static linenr_T
++ setManualFold(lnum, opening, recurse, donep)
++ linenr_T lnum;
++ int opening; /* TRUE when opening, FALSE when closing */
++ int recurse; /* TRUE when closing/opening recursive */
++ int *donep;
++ {
++ #ifdef FEAT_DIFF
++ if (foldmethodIsDiff(curwin) && curwin->w_p_scb)
++ {
++ win_T *wp;
++ linenr_T lnum;
++
++ /*
++ * Do the same operation in other windows in diff mode. Calculate the
++ * line number from the diffs.
++ */
++ FOR_ALL_WINDOWS(wp)
++ {
++ if (wp != curwin && foldmethodIsDiff(wp) && wp->w_p_scb)
++ {
++ lnum = diff_lnum_win(curwin->w_cursor.lnum, wp);
++ if (lnum != 0)
++ (void)setManualFoldWin(wp, lnum, opening, recurse, NULL);
++ }
++ }
++ }
++ #endif
++
++ return setManualFoldWin(curwin, lnum, opening, recurse, donep);
++ }
++
++ /* setManualFoldWin() {{{2 */
++ /*
++ * Open or close the fold in window "wp" which contains "lnum".
+ * "donep", when not NULL, points to flag that is set to DONE_FOLD when some
+ * fold was found and to DONE_ACTION when some fold was opened or closed.
+ * When "donep" is NULL give an error message when no fold was found for
+! * "lnum", but only if "wp" is "curwin".
+ * Return the line number of the next line that could be closed.
+ * It's only valid when "opening" is TRUE!
+ */
+ static linenr_T
+! setManualFoldWin(wp, lnum, opening, recurse, donep)
+! win_T *wp;
+ linenr_T lnum;
+ int opening; /* TRUE when opening, FALSE when closing */
+ int recurse; /* TRUE when closing/opening recursive */
+***************
+*** 1258,1269 ****
+ linenr_T off = 0;
+ int done = 0;
+
+! checkupdate(curwin);
+
+ /*
+ * Find the fold, open or close it.
+ */
+! gap = &curwin->w_folds;
+ for (;;)
+ {
+ if (!foldFind(gap, lnum, &fp))
+--- 1324,1335 ----
+ linenr_T off = 0;
+ int done = 0;
+
+! checkupdate(wp);
+
+ /*
+ * Find the fold, open or close it.
+ */
+! gap = &wp->w_folds;
+ for (;;)
+ {
+ if (!foldFind(gap, lnum, &fp))
+***************
+*** 1285,1291 ****
+ if (use_level || fp->fd_flags == FD_LEVEL)
+ {
+ use_level = TRUE;
+! if (level >= curwin->w_p_fdl)
+ fp->fd_flags = FD_CLOSED;
+ else
+ fp->fd_flags = FD_OPEN;
+--- 1351,1357 ----
+ if (use_level || fp->fd_flags == FD_LEVEL)
+ {
+ use_level = TRUE;
+! if (level >= wp->w_p_fdl)
+ fp->fd_flags = FD_CLOSED;
+ else
+ fp->fd_flags = FD_OPEN;
+***************
+*** 1331,1342 ****
+ found->fd_flags = FD_CLOSED;
+ done |= DONE_ACTION;
+ }
+! curwin->w_fold_manual = TRUE;
+ if (done & DONE_ACTION)
+! changed_window_setting();
+ done |= DONE_FOLD;
+ }
+! else if (donep == NULL)
+ EMSG(_(e_nofold));
+
+ if (donep != NULL)
+--- 1397,1408 ----
+ found->fd_flags = FD_CLOSED;
+ done |= DONE_ACTION;
+ }
+! wp->w_fold_manual = TRUE;
+ if (done & DONE_ACTION)
+! changed_window_setting_win(wp);
+ done |= DONE_FOLD;
+ }
+! else if (donep == NULL && wp == curwin)
+ EMSG(_(e_nofold));
+
+ if (donep != NULL)
+*** ../vim-6.2.312/src/move.c Fri Feb 20 21:36:20 2004
+--- src/move.c Tue Mar 2 16:41:52 2004
+***************
+*** 467,476 ****
+ void
+ changed_window_setting()
+ {
+! curwin->w_lines_valid = 0;
+! changed_line_abv_curs();
+! curwin->w_valid &= ~(VALID_BOTLINE|VALID_BOTLINE_AP|VALID_TOPLINE);
+! redraw_later(NOT_VALID);
+ }
+
+ /*
+--- 467,483 ----
+ void
+ changed_window_setting()
+ {
+! changed_window_setting_win(curwin);
+! }
+!
+! void
+! changed_window_setting_win(wp)
+! win_T *wp;
+! {
+! wp->w_lines_valid = 0;
+! changed_line_abv_curs_win(wp);
+! wp->w_valid &= ~(VALID_BOTLINE|VALID_BOTLINE_AP|VALID_TOPLINE);
+! redraw_win_later(wp, NOT_VALID);
+ }
+
+ /*
+*** ../vim-6.2.312/src/proto/diff.pro Sun Jun 1 12:26:06 2003
+--- src/proto/diff.pro Tue Mar 2 16:54:08 2004
+***************
+*** 19,22 ****
+--- 19,23 ----
+ void ex_diffgetput __ARGS((exarg_T *eap));
+ int diff_mode_buf __ARGS((buf_T *buf));
+ int diff_move_to __ARGS((int dir, long count));
++ linenr_T diff_lnum_win __ARGS((linenr_T lnum, win_T *wp));
+ /* vim: set ft=c : */
+*** ../vim-6.2.312/src/proto/move.pro Sun Jun 1 12:26:16 2003
+--- src/proto/move.pro Tue Mar 2 16:54:12 2004
+***************
+*** 4,9 ****
+--- 4,10 ----
+ void update_curswant __ARGS((void));
+ void check_cursor_moved __ARGS((win_T *wp));
+ void changed_window_setting __ARGS((void));
++ void changed_window_setting_win __ARGS((win_T *wp));
+ void set_topline __ARGS((win_T *wp, linenr_T lnum));
+ void changed_cline_bef_curs __ARGS((void));
+ void changed_cline_bef_curs_win __ARGS((win_T *wp));
+*** ../vim-6.2.312/src/version.c Wed Mar 3 19:23:14 2004
+--- src/version.c Wed Mar 3 21:03:54 2004
+***************
+*** 639,640 ****
+--- 639,642 ----
+ { /* Add new patch number below this line */
++ /**/
++ 313,
+ /**/
+
+--
+The Law of VIM:
+For each member b of the possible behaviour space B of program P, there exists
+a finite time t before which at least one user u in the total user space U of
+program P will request b becomes a member of the allowed behaviour space B'
+(B' <= B).
+In other words: Sooner or later everyone wants everything as an option.
+ -- Vince Negri
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
+/// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
+ \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///