From db6ea063352ec1c88c7bc0839fa2bf75bae56cf0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 10 Jul 2014 22:01:47 +0200 Subject: Updated runtime files. --- runtime/plugin/matchparen.vim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'runtime/plugin') diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim index b490f45eb..23c79382f 100644 --- a/runtime/plugin/matchparen.vim +++ b/runtime/plugin/matchparen.vim @@ -1,6 +1,6 @@ " Vim plugin for showing matching parens " Maintainer: Bram Moolenaar -" Last Change: 2014 Jun 17 +" Last Change: 2014 Jul 09 " Exit quickly when: " - this plugin was already loaded (or disabled) @@ -54,14 +54,15 @@ function! s:Highlight_Matching_Pair() let c_col = col('.') let before = 0 - let c = getline(c_lnum)[c_col - 1] + let text = getline(c_lnum) + let c = text[c_col - 1] let plist = split(&matchpairs, '.\zs[:,]') let i = index(plist, c) if i < 0 " not found, in Insert mode try character before the cursor if c_col > 1 && (mode() == 'i' || mode() == 'R') let before = 1 - let c = getline(c_lnum)[c_col - 2] + let c = text[c_col - 2] let i = index(plist, c) endif if i < 0 @@ -87,7 +88,7 @@ function! s:Highlight_Matching_Pair() " Find the match. When it was just before the cursor move it there for a " moment. if before > 0 - let save_cursor = winsaveview() + let save_cursor = getcurpos() call cursor(c_lnum, c_col - before) endif @@ -147,7 +148,7 @@ function! s:Highlight_Matching_Pair() endtry if before > 0 - call winrestview(save_cursor) + call setpos('.', save_cursor) endif " If a match is found setup match highlighting. -- cgit v1.2.1