Skip to content

Commit 39d9027

Browse files
authored
Do not insert newline on delete empty bullet (#108)
1 parent 174c944 commit 39d9027

3 files changed

Lines changed: 5 additions & 10 deletions

File tree

plugin/bullets.vim

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -427,12 +427,6 @@ endfun
427427
" }}}
428428

429429
" Generate bullets -------------------------------------- {{{
430-
fun! s:delete_empty_bullet(line_num)
431-
if g:bullets_delete_last_bullet_if_empty
432-
call setline(a:line_num, '')
433-
endif
434-
endfun
435-
436430
fun! s:insert_new_bullet()
437431
let l:curr_line_num = line('.')
438432
let l:next_line_num = l:curr_line_num + g:bullets_line_spacing
@@ -451,7 +445,10 @@ fun! s:insert_new_bullet()
451445
if l:bullet.text_after_bullet ==# ''
452446
" We don't want to create a new bullet if the previous one was not used,
453447
" instead we want to delete the empty bullet - like word processors do
454-
call s:delete_empty_bullet(l:curr_line_num)
448+
if g:bullets_delete_last_bullet_if_empty
449+
call setline(l:curr_line_num, '')
450+
let l:send_return = 0
451+
endif
455452
elseif !(l:bullet.bullet_type ==# 'abc' && s:abc2dec(l:bullet.bullet) + 1 > s:abc_max)
456453

457454
let l:next_bullet = s:next_bullet_str(l:bullet)

spec/alphabetic_bullets_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
y. this is the first bullet
129129
z. second bullet
130130
aa. third bullet
131-
132131
AY. fourth bullet
133132
AZ. fifth bullet
134133
BA. sixth bullet\n

spec/nested_bullets_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
vim.normal 'GA'
175175
vim.feedkeys '\<cr>'
176176
vim.feedkeys '\<cr>'
177+
vim.feedkeys '\<cr>'
177178
vim.type 'A. first bullet'
178179
vim.feedkeys '\<cr>'
179180
vim.feedkeys '\<C-t>'
@@ -288,10 +289,8 @@
288289
1. this is the first bullet
289290
2. second bullet
290291
\ta. third bullet
291-
292292
+ fourth bullet
293293
\t+ fifth bullet
294-
295294
* sixth bullet
296295
\t+ seventh bullet
297296

0 commit comments

Comments
 (0)