ledger/vim-ledger

Can not `:LedgerAlign`: amount moved inside account

artkpv opened this issue · 2 comments

Thanks for the great plugin!

Bug:

  1. Having:
2014/09/28 Received from btc-e.com
    Активы:Текущие активы:Bitcoin wallet - 100000000000000000000000000000000X     mBTC 113.3
    Активы:Текущие активы:btc-e.com
  1. Select and enter: :'<,'>LedgerAlign

  2. Result:

2014/09/28 Received from btc-e.com
    Активы:Текущие активы:Bitcoin wallet - 10000000mBTC 113.30000000000000000000000000X
    Активы:Текущие активы:btc-e.com

Notes. The same if \t used to separate. The same if " - " removed.

Can confirm, this seems to happen, if the column set in g:ledger_align_at is too small. This is not only problematic with very long account names, but also with comments, if the decimal point in the amount is omitted. The line
Expenses:Foo €30 ; some long comment
is aligned so that the comment ends in the column given by g:ledger_align_at instead of the amount.

As a workaround, increase g:ledger_align_at (and don't omit the decimal point like me). It would be nice, if ledger.vim could automatically determine the align_at value based on the longest account name.

This bug was fixed thanks to @mildred's contribution merged at long last in #73.