ans not automatically inserted when typing an operator on fresh start

Issue #812 closed
Mikko Syrjä created an issue

If I start the program with history reloading, I can see the latest result, but ans is not available. Also, ans seems to be available after clearing history.

Syncing ans with history could make UI more straightforward: if you see the latest result in history, you can use it.

I already tested it in my repo and it is quite simple to implement.

Small concern is that ans being available after history clearing could be considered as an important feature for someone.

What do you think?

Comments (10)

  1. Helder Correia repo owner

    If I start the program with history reloading, I can see the latest result, but ans is not available.

    I can't reproduce this with master branch on Linux. @syrja What OS and SpeedCrunch version are you on?

  2. Mikko Syrjä reporter

    Happens with both official 0.12 on Windows and master branch on Linux.

    Both "Save History on Exit" and "Automatic Result Reuse" on.

    • 1+1 = 2
    • /2 -> ans/2 = 1
    • restart program
    • /2 -> compile error
  3. Pol Welter

    So your issue is not about ans not being available after restarting the program (which it is), but only that it is not automatically inserted when typing an operator?

  4. Helder Correia repo owner

    That's a completely different issue. ansis readily available on restart, but using an arithmetic operator to automatically insert ansdoes not work as expected.

  5. Mikko Syrjä reporter

    Yes, the problem is with automatic insertion. I should have been clearer in original report.

    Regarding the suggested fix in my repo, there seems to be unused member variable Editor::m_isAnsAvailable and setter function Editor::setAnsAvailable().

    Is it meant for something?

  6. Tey'

    m_isAnsAvailable used to be read in Editor::autoCalc() and Editor::autoCalcSelection(), but it's been removed in cbd154e, probably because the expression would fail anyway if ans is not available (@heldercorreia can you confirm?). If so, it can be removed indeed.

    BTW @syrja, please submit your changes and fixes through pull requests, as it's easier for us to study and merge them that way. In particular for #808, as no one seems to be against it.

  7. Log in to comment