2 Star 0 Fork 54

openMajun/vim

forked from src-openEuler/vim 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-vim-fix-garbled-characters-display-when-file-name-ma.patch 1.54 KB
一键复制 编辑 原始数据 按行查看 历史
From 150fab01a9e9eb61061bf145998b608c5c9c470e Mon Sep 17 00:00:00 2001
From: lvying6 <lvying6@huawei.com>
Date: Tue, 14 Jul 2020 16:43:33 +0800
Subject: [PATCH] vim: fix garbled characters display when file name matches
warning or error in tar file
Reference: https://github.com/vim/vim/issues/6425
The problem is, the tar.vim plugin checks if the last line matches
warning or error or a few other keywords and if it does, it aborts.
Signed-off-by: lvying6 <lvying6@huawei.com>
---
runtime/autoload/tar.vim | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim
index dc670db..168a2f1 100644
--- a/runtime/autoload/tar.vim
+++ b/runtime/autoload/tar.vim
@@ -184,7 +184,12 @@ fun! tar#Browse(tarfile)
" call Dret("tar#Browse : a:tarfile<".a:tarfile.">")
return
endif
- if line("$") == curlast || ( line("$") == (curlast + 1) && getline("$") =~ '\c\%(warning\|error\|inappropriate\|unrecognized\)')
+ " If there was an error message, the last line probably matches some keywords but
+ " should also contain whitespace for readability. Make sure not to match a
+ " filename that contains the keyword (error/warning/unrecognized/inappropriate, etc)
+ if line("$") == curlast || ( line("$") == (curlast + 1) &&
+ \ getline("$") =~# '\c\<\%(warning\|error\|inappropriate\|unrecognized\)\>' &&
+ \ getline("$") =~ '\s' )
redraw!
echohl WarningMsg | echo "***warning*** (tar#Browse) ".a:tarfile." doesn't appear to be a tar file" | echohl None
keepj sil! %d
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openMajun/vim.git
git@gitee.com:openMajun/vim.git
openMajun
vim
vim
master

搜索帮助