hpdeifel / hledger-iadd

A terminal UI as drop-in replacement for hledger add.
BSD 3-Clause "New" or "Revised" License
77 stars 8 forks source link

Edit prior data without undoing subsequent data #62

Open the-solipsist opened 2 years ago

the-solipsist commented 2 years ago

One common occurrence is that I reach the 3rd or 4th data entry field, and then realize that I've entered the wrong date (which is the 1st data entry field). Currently, in order to correct this, I need to undo all the data I've entered, correct the date, and re-enter all that data. The other option is to enter it into the journal, and then remember to go edit the entry manually using a text editor.

Enhancement request: Allow users to navigate to previous data fields and edit them without having to undo all subsequent data fields.

hpdeifel commented 2 years ago

This issue bugs me all the time, too. It's a bit weird to solve in the current "question/answer" design. We could remember all later answers when the user presses undo multiple steps and then prefill the input field with the old answer when she goes forward again.

I think the ultimate solution to this would be to change the current design to a form based one, so that iadd mostly behaves like a website or a traditional GUI app. In such a design multiple input fields are shown at the same time and the user can freely switch between them, which would be much more intuitive than prefilled answers, imho.

the-solipsist commented 2 years ago

I think the ultimate solution to this would be to change the current design to a form based one, so that iadd mostly behaves like a website or a traditional GUI app. In such a design multiple input fields are shown at the same time and the user can freely switch between them, which would be much more intuitive than prefilled answers, imho.

Could you do that while retaining the auto-suggestions so that people can just press enter if (a) all the amounts and accounts from a previous transaction apply, and (b) the inverse amounts (e.g., ₹-750.00 in Assets:Cash when Expenses:Gift is ₹750.00) are auto-suggested when filling out the form?

I wouldn't want to remove the advantages of hlegder-iadd over existing web forms (such as hledger-web): https://github.com/hpdeifel/hledger-iadd/issues/39#issuecomment-450498276

simonmichael commented 2 years ago

hledger add has this undo feature. I suspect being based on the wizards library might help the implementation. If so, I wonder if it would be possible/useful to base hledger-iadd on wizards as well ? Possibly even the same wizards defined for hledger add, though that's a long shot ? wizards advertises itself as UI independent, so in theory you can define a wizard (sequence of interactions) once and reuse it for multiple UIs.

hpdeifel commented 2 years ago

Could you do that while retaining the auto-suggestions so that people can just press enter if (a) all the amounts and accounts from a previous transaction apply, and (b) the inverse amounts (e.g., ₹-750.00 in Assets:Cash when Expenses:Gift is ₹750.00) are auto-suggested when filling out the form?

I wouldn't want to remove the advantages of hlegder-iadd over existing web forms (such as hledger-web): #39 (comment)

yes, of course. That's the reason I haven't started implementing such a UI. I want to make sure the existing workflows keep working - ideally down to the exact same key presses.

hpdeifel commented 2 years ago

hledger add has this undo feature. I suspect being based on the wizards library might help the implementation. If so, I wonder if it would be possible/useful to base hledger-iadd on wizards as well ? Possibly even the same wizards defined for hledger add, though that's a long shot ? wizards advertises itself as UI independent, so in theory you can define a wizard (sequence of interactions) once and reuse it for multiple UIs.

I've had a quick look at wizards, but it seems like it's specifically tailored to REPL-style applications, with primitives like line that aren't easily mapped to brick or GUIs.

simonmichael commented 2 years ago

You may be right, though the hackage description says "While both built-in IO backends operate on a console, there is no reason why wizards cannot also be used for making GUI wizard interfaces." I doubt it has been done (hledger is the only user on hackage).