Permalink
Browse files

Sanitize filename expanded from '%' in ex mode

  • Loading branch information...
1 parent 1846f05 commit cbdb9a6d34f4107fb70ce30931b2f484cb6bdf0e @ethercrow ethercrow committed Sep 16, 2012
Showing with 12 additions and 10 deletions.
  1. +12 −10 yi/src/library/Yi/Keymap/Vim.hs
@@ -1261,16 +1261,18 @@ exMode self prompt = do
-- current buffer is minibuffer
-- actual file is in the second buffer in bufferStack
bufferRef <- withEditor $ gets (head . drop 1 . bufferStack)
- maybeCurrentFileName <- withGivenBuffer bufferRef (gets file)
-
- case maybeCurrentFileName of
- Just fn -> withBuffer $ do
- -- now modifying minibuffer
- point <- pointB
- deleteNAt Forward 1 (point-1)
- insertN fn
-
- Nothing -> return ()
+ currentFileName <- withGivenBuffer bufferRef $
+ fmap bufInfoFileName bufInfoB
+
+ let sanitizedFileName = case currentFileName of
+ ('/':'/':f) -> '/':f
+ otherwise -> currentFileName
+
+ -- now modifying minibuffer
+ withBuffer $ do
+ point <- pointB
+ deleteNAt Forward 1 (point-1)
+ insertN sanitizedFileName
| otherwise = exFileNameComplete f
b_complete = exSimpleComplete matchingBufferNames

0 comments on commit cbdb9a6

Please sign in to comment.