Skip to content

Commit 0077e57

Browse files
committed
Fix some gq bugs when tw was set
1 parent c92fbd2 commit 0077e57

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

indent/javascript.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,10 @@ unlet s:cpo_save
442442
function! Fixedgq(lnum, count)
443443
let l:count = a:count
444444

445+
if mode() == 'i' " gq was not pressed, but tw was set
446+
return 1
447+
endif
448+
445449
if len(getline(a:lnum)) < 80 && l:count == 1 " No need for gq
446450
return 1
447451
endif
@@ -468,7 +472,7 @@ function! Fixedgq(lnum, count)
468472
endif
469473

470474
" Try breaking after string
471-
if breakpoint[1] == indent(a:lnum)
475+
if breakpoint[1] <= indent(a:lnum)
472476
call cursor(a:lnum, 81)
473477
let breakpoint = searchpairpos('\.', '', ' ', 'cW', s:skip_expr, a:lnum)
474478
endif

0 commit comments

Comments
 (0)