From 2a952c03c4c2189ba678248a08dc644a80fbf634 Mon Sep 17 00:00:00 2001 From: alohaia Date: Sat, 23 Mar 2024 19:00:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20support=20for=20fullwidth=20colon?= =?UTF-8?q?=20"=EF=BC=9A"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/bullets.vim | 3 ++- spec/nested_bullets_spec.rb | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/plugin/bullets.vim b/plugin/bullets.vim index 4be95d6..84908c6 100644 --- a/plugin/bullets.vim +++ b/plugin/bullets.vim @@ -585,7 +585,8 @@ command! InsertNewBullet call insert_new_bullet() " Helper for Colon Indent " returns 1 if current line ends in a colon, else 0 fun! s:line_ends_in_colon(lnum) - return getline(a:lnum)[strlen(getline(a:lnum))-1:] ==# ':' + let l:last_char_nr = strgetchar(getline(a:lnum), strcharlen(getline(a:lnum))-1) + return l:last_char_nr == 65306 || l:last_char_nr == 58 endfun " --------------------------------------------------------- }}} diff --git a/spec/nested_bullets_spec.rb b/spec/nested_bullets_spec.rb index a20b44e..827f7e8 100644 --- a/spec/nested_bullets_spec.rb +++ b/spec/nested_bullets_spec.rb @@ -582,6 +582,12 @@ vim.type 'this bullet is indented' vim.feedkeys '\' vim.type 'this bullet is also indented' + vim.feedkeys '\\' + vim.type 'this is the third bullet that ends with a fullwidth colon:' + vim.feedkeys '\' + vim.type 'this bullet is indented' + vim.feedkeys '\' + vim.type 'this bullet is also indented' vim.write file_contents = IO.read(filename) @@ -592,6 +598,9 @@ b. this is the second bullet: \ti. this bullet is indented \tii. this bullet is also indented + c. this is the third bullet that ends with a fullwidth colon: + \ti. this bullet is indented + \tii. this bullet is also indented TEXT end end