File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -371,7 +371,11 @@ function! ledger#align_commodity()
371
371
let pos = match (rhs, ' \V' . g: ledger_decimal_sep )
372
372
endif
373
373
" Go to the column that allows us to align the decimal separator at g:ledger_align_at:
374
- call s: goto_col (g: ledger_align_at - pos - 1 )
374
+ if pos > 0
375
+ call s: goto_col (g: ledger_align_at - pos - 1 )
376
+ else
377
+ call s: goto_col (g: ledger_align_at - strdisplaywidth (rhs) - 2 )
378
+ endif
375
379
" Append the part of the line that was previously removed:
376
380
exe ' normal! a' . rhs
377
381
endif
@@ -385,7 +389,7 @@ function! ledger#align_amount_at_cursor()
385
389
let pos = match (@" , g: ledger_decimal_sep ) " Returns zero when the separator is the empty string
386
390
" Paste text at the correct column and append/prepend default commodity:
387
391
if g: ledger_commodity_before
388
- call s: goto_col (g: ledger_align_at - (pos > 0 ? pos : len (@" )) - len (g: ledger_default_commodity ) - len (g: ledger_commodity_sep ) - 1 )
392
+ call s: goto_col (g: ledger_align_at - (pos > 0 ? pos : len (@" )) - len (g: ledger_default_commodity ) - len (g: ledger_commodity_sep ) - 1 )
389
393
exe ' normal! a' . g: ledger_default_commodity . g: ledger_commodity_sep
390
394
normal ! p
391
395
else
You can’t perform that action at this time.
0 commit comments