From 3f6b71a8d3f01f8d38d0595ade98c9fa82e8c57b Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 1 Jun 2020 18:34:15 -0400 Subject: [PATCH] Remove length limits on sections/keys/values editorconfig/editorconfig#429 --- .gitmodules | 3 ++- autoload/editorconfig_core/ini.vim | 21 +++++---------------- tests/core/tests | 2 +- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/.gitmodules b/.gitmodules index 8cf01bc40..314331ea1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,5 @@ url = https://github.com/editorconfig/editorconfig-plugin-tests.git [submodule "core_tests"] path = tests/core/tests - url = https://github.com/editorconfig/editorconfig-core-test.git + url = https://github.com/goodhoko/editorconfig-core-test.git + branch = feature/remove-length-limits diff --git a/autoload/editorconfig_core/ini.vim b/autoload/editorconfig_core/ini.vim index 279b381d3..5d1821104 100644 --- a/autoload/editorconfig_core/ini.vim +++ b/autoload/editorconfig_core/ini.vim @@ -39,7 +39,7 @@ endif " Allow ``]`` and escaped ``;`` and ``#`` characters in section headers. " In fact, allow \ to escape any single character - it needs to cover at " least \ * ? [ ! ] { }. -unlockvar s:SECTCRE s:OPTCRE s:MAX_SECTION_NAME s:MAX_PROPERTY_NAME s:MAX_PROPERTY_VALUE +unlockvar s:SECTCRE s:OPTCRE let s:SECTCRE = '\v^\s*\[(%([^\\#;]|\\.)+)\]' " Regular expression for parsing option name/values. @@ -48,11 +48,7 @@ let s:SECTCRE = '\v^\s*\[(%([^\\#;]|\\.)+)\]' " any characters to eol let s:OPTCRE = '\v\s*([^:=[:space:]][^:=]*)\s*([:=])\s*(.*)$' -let s:MAX_SECTION_NAME = 4096 -let s:MAX_PROPERTY_NAME = 50 -let s:MAX_PROPERTY_VALUE = 255 - -lockvar s:SECTCRE s:OPTCRE s:MAX_SECTION_NAME s:MAX_PROPERTY_NAME s:MAX_PROPERTY_VALUE +lockvar s:SECTCRE s:OPTCRE " }}}2 " === Main ============================================================== {{{1 @@ -123,13 +119,8 @@ function! s:parse(config_filename, target_filename, lines) if len(l:mo) let l:sectname = l:mo[1] let l:in_section = 1 - if strlen(l:sectname) > s:MAX_SECTION_NAME - " Section name too long => ignore the section - let l:matching_section = 0 - else - let l:matching_section = s:matches_filename( - \ a:config_filename, a:target_filename, l:sectname) - endif + let l:matching_section = s:matches_filename( + \ a:config_filename, a:target_filename, l:sectname) if g:editorconfig_core_vimscript_debug echom 'In section ' . l:sectname . ', which ' . @@ -177,9 +168,7 @@ function! s:parse(config_filename, target_filename, lines) echom printf('Saw opt <%s>=<%s>', l:optname, l:optval) endif - if l:matching_section && - \ strlen(l:optname) <= s:MAX_PROPERTY_NAME && - \ strlen(l:optval) <= s:MAX_PROPERTY_VALUE + if l:matching_section let l:options[l:optname] = l:optval endif else diff --git a/tests/core/tests b/tests/core/tests index 6c8fe6815..a4fcbb3e7 160000 --- a/tests/core/tests +++ b/tests/core/tests @@ -1 +1 @@ -Subproject commit 6c8fe6815b12f96f4b357d610ee1cd8da074880a +Subproject commit a4fcbb3e7d256e1de2027f5e2d3a0ae83175ac2b