Current result is updated on every cursor movement

Issue #708 closed
Philip Federici created an issue

Cursor movements with left/right arrow keys, and with home/end keys (fn + left/right arrow on Apple laptop/wireless keyboards) should not update the "Current result" tooltip.

Moving the cursor does not intervene in the calculation itself and thus cannot affect the result; it is just a means to change the insert position, and should be prompt and never become extremely CPU demanding as it can now.

The phenomenon is easily reproducible: just type a calculation and then move the cursor through it, or better keep the left arrow pressed down to see to what extent it can affect the CPU usage. The more the operands, the higher the CPU usage (see attachments).

If those keys can be prevented from prompting an update of the "Current result", they definitely must.

OS X 10.11.6 MacBook Pro 5,2 (Early 2009)

Comments (7)

  1. Pol Welter

    Can anyone else reproduce this? On my machine (W7) keeping the arrow key pressed will raise the CPU usage by about 10%. It is not happening if the input bar is empty.

  2. Helder Correia repo owner

    Yes, I was aware of the unnecessary painting updates to the result tip by using the arrow keys and similar. Though I had never measured the CPU load before. I can confirm the ~10% usage on Linux.

  3. Philip Federici reporter

    It might be a good idea to keep the update behaviour when the shift key is held down, to update the "Selection result" appropriately. Still, it would be better if it had a short delay, say half a second, to allow selecting without loading the CPU on each cursor movement.

  4. Helder Correia repo owner

    I found out that CPU usage comes from QPlainTextEdit itself. Fixed constant repaint of result tip by removing unnecessary timers in commit 9fa7084.

  5. Log in to comment