7f1c71ef5141

Fix in-between line movement.
[view raw] [browse files]
author Steve Losh <steve@dwaiter.com>
date Tue, 12 Oct 2010 18:48:47 -0400
parents 8637cdbbba8a
children 920859982e84
branches/tags (none)
files plugin/gundo.vim

Changes

--- a/plugin/gundo.vim	Tue Oct 12 18:44:51 2010 -0400
+++ b/plugin/gundo.vim	Tue Oct 12 18:48:47 2010 -0400
@@ -23,12 +23,15 @@
 
 "{{{ Movement Mappings
 function! s:GundoMoveUp()
+    let start_line = getline('.')
     if line('.') - 2 <= 4
-        return
+        call cursor(5, 0)
+    elseif stridx(start_line, '[') == -1
+        call cursor(line('.') - 1, 0)
+    else
+        call cursor(line('.') - 2, 0)
     endif
 
-    call cursor(line('.') - 2, 0)
-
     let line = getline('.')
     let idx1 = stridx(line, '@')
     let idx2 = stridx(line, 'o')
@@ -44,12 +47,15 @@
 endfunction
 
 function! s:GundoMoveDown()
+    let start_line = getline('.')
     if line('.') + 2 >= line('$')
-        return
+        call cursor(line('$') - 1, 0)
+    elseif stridx(start_line, '[') == -1
+        call cursor(line('.') + 1, 0)
+    else
+        call cursor(line('.') + 2, 0)
     endif
 
-    call cursor(line('.') + 2, 0)
-
     let line = getline('.')
     let idx1 = stridx(line, '@')
     let idx2 = stridx(line, 'o')