diff --git a/.ci/common/github_commenter.vim b/.ci/common/github_commenter.vim index 0885e967d..539131b9d 100644 --- a/.ci/common/github_commenter.vim +++ b/.ci/common/github_commenter.vim @@ -16,8 +16,11 @@ function! s:update_log(log, summary, new_log) abort let end = i endif endfor - return a:log . "\n" . a:new_log - + if begin != -1 && end != -1 + else + return a:log . "\n" . a:new_log + endif + endfunction if !empty(s:log) if $LINT == 'vader' diff --git a/autoload/SpaceVim/api/data/list.vim b/autoload/SpaceVim/api/data/list.vim index dfe247a40..888948978 100644 --- a/autoload/SpaceVim/api/data/list.vim +++ b/autoload/SpaceVim/api/data/list.vim @@ -10,6 +10,7 @@ function! SpaceVim#api#data#list#get() abort \ 'has' : '', \ 'has_index' : '', \ 'listpart' : '', + \ 'replace' : '', \ }, \ "function('s:' . v:key)" \ ) @@ -101,4 +102,12 @@ function! s:has_index(list, index) abort return 0 <= a:index && a:index < len(a:list) endfunction +function! s:replace(list, begin, end, re_list) + if a:begin <= a:end && a:begin >= 0 && a:end < len(a:list) + return a:list[:a:begin - 1] + a:re_list + a:list[a:end + 1:] + else + return a:list + endif +endf + " vim:set et sw=2 cc=80: diff --git a/test/api/data/list.vader b/test/api/data/list.vader index 219e0bc85..8b8cf19e1 100644 --- a/test/api/data/list.vader +++ b/test/api/data/list.vader @@ -11,3 +11,4 @@ Execute ( SpaceVim api: data#list ): AssertEqual list.char_range('a', 'c'), ['a', 'b', 'c'] AssertEqual list.has(['a', 'c'], 'a'), 1 AssertEqual list.has_index(['a', 'c'], 1), 1 + AssertEqual list.replace([1, 2, 3, 4, 5, 6, 7], 3, 5, [0, 0, 0, 0]), [1, 2, 3, 0, 0, 0, 0, 7]