Bram,

Attach patch fixes incorrect movement when using gj with a count and the
initial line is shorter than subsequent wrapped lines.

Thanks,
-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>
# HG changeset patch
# User James Vega <[email protected]>
# Date 1308016431 14400
# Node ID 9181395a34216f28762b545f10a622224c3790f1
# Parent  c6f8f1957c6630a1bf8f6e58c6ddb438c2efabd5
Fix [count]gj movement when count > 1

gj was always using the line length of the initial line it was issued from to
perform calculations.  Therefore, if the initial line had fewer screen lines
than other lines that were being traversed, the motion would move over more
screen lines than intended.

For example, given the following text (leading column represents line
numbers):

  1 some test text
  2 some more test text
    that wraps to multiple
    lines
  3 and a final line

using 2gj from line 1 would place the cursor on line 3 instead of the second
screen line of line 2.

diff --git a/src/normal.c b/src/normal.c
--- a/src/normal.c
+++ b/src/normal.c
@@ -4533,6 +4533,7 @@
 		}
 		curwin->w_cursor.lnum++;
 		curwin->w_curswant %= width2;
+		linelen = linetabsize(ml_get_curline());
 	    }
 	}
       }

Attachment: signature.asc
Description: Digital signature

Raspunde prin e-mail lui