aboutsummaryrefslogtreecommitdiffstats
path: root/community/vim-editorconfig/fix-config-parsing.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/vim-editorconfig/fix-config-parsing.patch')
-rw-r--r--community/vim-editorconfig/fix-config-parsing.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/community/vim-editorconfig/fix-config-parsing.patch b/community/vim-editorconfig/fix-config-parsing.patch
new file mode 100644
index 0000000000..806407d405
--- /dev/null
+++ b/community/vim-editorconfig/fix-config-parsing.patch
@@ -0,0 +1,46 @@
+From 69f86d1077b226a7535b1dec06d5bbf0fb2a89cd Mon Sep 17 00:00:00 2001
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Mon, 23 Oct 2017 18:23:33 +0200
+Subject: [PATCH] Fix trimming of empty comments
+
+For example this .editorconfig:
+
+```
+; Lorem ipsum
+;
+; dolor sit amet
+
+root = true
+```
+
+is parsed incorrectly:
+
+s:parse_properties(...) -> [], {}
+ s:trim(...) -> [';', 'root = true']
+ s:remove_comment(';') -> ';'
+
+This commit fixes this issue.
+
+Patch-Source: https://github.com/sgur/vim-editorconfig/pull/15
+---
+ autoload/editorconfig.vim | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/autoload/editorconfig.vim b/autoload/editorconfig.vim
+index b0e4240..469172d 100644
+--- a/autoload/editorconfig.vim
++++ b/autoload/editorconfig.vim
+@@ -203,9 +203,11 @@ endfunction "}}}
+ "
+ " >>> echo s:remove_comment('bar')
+ " bar
++" >>> echo s:remove_comment('#')
++"
+
+ function! s:remove_comment(line) abort "{{{
+- let pos = match(a:line, '\s*[;#].\+')
++ let pos = match(a:line, '\s*[;#].*')
+ return pos == -1 ? a:line : pos == 0 ? '' : a:line[: pos-1]
+ endfunction "}}}
+
+--