Procházet zdrojové kódy

Add a test for specifying MRU window height/width

Yegappan Lakshmanan před 4 roky
rodič
revize
ff1a4c68d9
2 změnil soubory, kde provedl 61 přidání a 6 odebrání
  1. 10 6
      doc/mru.txt
  2. 51 0
      test/unit_tests.vim

+ 10 - 6
doc/mru.txt

@@ -132,18 +132,22 @@ window from the MRU list.
 You can close the MRU window by pressing the 'q' key or the <Esc> key or
 using one of the Vim window commands.
 
-By default, the MRU window is opened as the bottom-most window. You can use
-command modifiers like |:topleft| or |:botright| with the :MRU command to
-control where the window is opened. Example: >
-
-	:topleft MRU
-
+By default, the MRU window is opened as the bottom-most window. If you are
+using Vim version 8.0 and above, then you can use command modifiers like
+|:topleft| or |:botright| or |:vertical| with the :MRU command to control
+where the window is opened. Example: >
+
+	:topleft MRU			" horizontally split topmost window
+	:botright MRU			" horizontally split bottommost window
+	:vertical topleft MRU		" vertically split far-left window
+	:vertical botright MRU		" vertically split far-right window
 <
 By default, the height of the MRU window is 8 or the value specified by the
 g:MRU_Window_Height variable. You can pass a count to the :MRU command to use
 a different height. Example: >
 
 	:15MRU
+	:vertical topleft 20MRU
 <
 To display only files matching a pattern from the MRU list in the MRU window,
 you can specify a pattern to the |:MRU| command. Example: >

+ 51 - 0
test/unit_tests.vim

@@ -1283,6 +1283,57 @@ func Test_45()
   set nomodified
 endfunc
 
+" ==========================================================================
+" Test46
+" Specify a count to the :MRU command to set the MRU window height/width
+" ==========================================================================
+func Test_46()
+  let test_name = 'test46'
+  only
+  " default height is 8
+  MRU
+  if winnr() != 2 || winheight(0) != 8
+    call LogResult(test_name, 'FAIL (1)')
+    return
+  endif
+  close
+
+  " use a specific height value
+  15MRU
+  if winnr() != 2 || winheight(0) != 15
+    call LogResult(test_name, 'FAIL (2)')
+    return
+  endif
+  close
+
+  if v:version >= 800
+    " use a specific height value with a command modifier
+    topleft 12MRU
+    if winnr() != 1 || winheight(0) != 12
+      call LogResult(test_name, 'FAIL (3)')
+      return
+    endif
+    close
+
+    " check for the width (leftmost window)
+    vertical topleft 20MRU
+    if winnr() != 1 || winwidth(0) != 20
+      call LogResult(test_name, 'FAIL (4)')
+      return
+    endif
+    close
+
+    " check for the width (rightmost window)
+    vertical botright 25MRU
+    if winnr() != 2 || winwidth(0) != 25
+      call LogResult(test_name, 'FAIL (5)')
+      return
+    endif
+    close
+  endif
+
+  call LogResult(test_name, 'pass')
+endfunc
 " ==========================================================================
 
 " Create the files used by the tests