Opened 12 years ago

Closed 12 years ago

#1617 closed bug (fixed)

DeskCalc BS button only deletes Keyboard presses, not mouse

Reported by: hai_cu_be Owned by: jackburton
Priority: normal Milestone: R1
Component: Applications/DeskCalc Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

Try doing the following in "Desk Calculator".

  1. Use the mouse and click button "1" then "2".
  2. Use keyboard and press "3" and then "4".
  3. Use mouse again and press button "5" then "6".

Now, Press the BS button, first once, see how it only erases the 3,4 from the keyboard presses. Now press again and it'll put it back again.

I'm pretty sure it should delete no matter if pressed through mouse or keyboard.

SEcondly, it erases BOTH the 3 and 4, instead of just deleting one at the time

Thirdly, I would consider using "Del" instead of BS, which really doesn't make sense.

I've put all these 3 together as the general status of the BS button is to rewrite the code for it completely I suppose.

Change History (9)

comment:1 by jackburton, 12 years ago

Owner: changed from stippi to jackburton

comment:2 by jackburton, 12 years ago

Status: newassigned

comment:3 by stippi, 12 years ago

Hi Stefano, thanks for picking this up. I investigated this one a bit the other day and it should have to do with Undo and the codepath for it. If you use TextView::Insert() directly, no Undo event is generated and this is the cause for the bug. I don't know if the original DeskCalc worked the same way as the current one, you probably need to make a test to find out if R5 TextView::Insert() generates an Undo step... if not, the problem is in DeskCalc, since BS just invokes Undo().

in reply to:  3 comment:4 by jackburton, 12 years ago

Replying to stippi:

Hi Stefano, thanks for picking this up. I investigated this one a bit the other day and it should have to do with Undo and the codepath for it. If you use TextView::Insert() directly, no Undo event is generated and this is the cause for the bug. I don't know if the original DeskCalc worked the same way as the current one, you probably need to make a test to find out if R5 TextView::Insert() generates an Undo step... if not, the problem is in DeskCalc, since BS just invokes Undo().

Yes, thank you, I already studied a bit the code. AFAIK, BTextView::Insert() doesn't generate an Undo step, so I think we should just replace the BTextView::Undo() call with an appropriate BTextView::Delete() call.

comment:5 by stippi, 12 years ago

Though I like the feature of a "Undo last typing" better than the feature to delete the last character from the string. BS could be renamed then.

in reply to:  5 comment:6 by jackburton, 12 years ago

Replying to stippi:

Though I like the feature of a "Undo last typing" better than the feature to delete the last character from the string. BS could be renamed then.

You mean just like it works now, or also including in the undo the mouse-typed stuff ?

comment:7 by stippi, 12 years ago

Yes, like it works now for stuff you typed, but also for stuff you entered via mouse.

comment:8 by jackburton, 12 years ago

Since BTextView only generate an Undo step for stuff entered via keyboard, and since extending its undo capabilities isn't that simple, I'll just "fix" the current problem. Feel free to open a new enhancement ticket for the other part, stippi.

comment:9 by jackburton, 12 years ago

Resolution: fixed
Status: assignedclosed

Fixed in hrev23786.

Note: See TracTickets for help on using tickets.