[Calculator][ux] Add paste support

Bug #1480662 reported by Niklas Wenzel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Calculator App
Fix Released
Medium
Unassigned
Ubuntu UX
In Progress
Medium
James Mulholland

Bug Description

We should add paste support on both the phone and on the desktop.

The primary question is how invalid input should be handled. The first suggestion would be not to insert anything if there is any issue in the pasted text, while the second one seems more reasonable to me. In my opinion we should paste as much as possible and leave out the invalid parts (the user might not even know about spaces or other invalid characters in their string).

Either way, we might want some visual feedback when the clipboard content had some invalid parts.

--- --- --- ---
UX Comment:

I'm inclined to agree with Niklas' recommendation:
If we don't support entry of characters through the App itself (because, as in the previously described examples, they aren't supported by our engine or cause it problems) we should not create a situation where the user may input those character via copy & paste either intentionally or by mistake.

As such, filtering the user's input seems the optimal course (and allows us to avoid a raft of edge cases that do not result in anything other than error states).

Related branches

Niklas Wenzel (nikwen)
Changed in ubuntu-calculator-app:
importance: Undecided → Medium
summary: - Add paste support
+ [Calculator][ux] Add paste support
Changed in ubuntu-calculator-app:
status: New → Incomplete
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

Spaces is not invalid characters, and our Calculator's engine could handle it.
Our engine is very powerful, and we don't use half od its possibilities, eg matrix, units etc.

In my opinion changing pasted formula will be very frustrating for user, because user never will know what was removed from his formula.

My proposal is to paste everything, without modification, and then user could correct that.

I would like to avoid situation, when user receive wrong result, because we modified formula.

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Yeah, I'm sorry for that bad example of using spaces.

While I agree that I'd like the app to accept any input and let the user deal with any of its issues, the calculator app is already very restrictive when it comes to letting users type stuff using a keyboard. If you want to input "sin(" for example, you have to press the "s" key. If you because you're used to it type in "sin" instead, you will end up with "sin(" and "i" being inserted.
Furthermore, there are a lot of other character combinations which are not allowed by the engine. Let's say you type in "5*2.234" but want to change it to "5*2.2+3.4" for whatever reason and start by trying to insert the dot after the "3", the calculator app won't let you. And there are many examples like this one.
That's why I believe we should, even if it's just for consistency, filter the user's input. Otherwise it will be very confusing for everyone. You can't filter the input at one place and then decide not to do it somewhere else.

Changed in ubuntu-ux:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → James Mulholland (jamesjosephmulholland)
description: updated
Changed in ubuntu-ux:
status: Triaged → Fix Committed
summary: - [Calculator][ux] Add paste support
+ [Calculator] Add paste support
Revision history for this message
Niklas Wenzel (nikwen) wrote : Re: [Calculator] Add paste support

Thanks a lot for your reply, James. However, there's still something missing. Should we notify the user when he pastes invalid content? Or should we simply insert as much as possible?

(In my opinion the latter would be superior in those cases when there aren't any downsides to filtering the input, while the former would be preferable when the pasted string is seriously broken and we can only insert a small part of it.)

Revision history for this message
Bartosz Kosiorek (gang65) wrote :

There are many issues with pasting support.
Fo example, user should paste only formula in engine format, example:
2*2/2

and it will be converted to:
2x2÷2

If user accidentely paste
2x2÷2
then to what it will be converted:
222 ?

How user should notice if he paste wrong formula?
He didn't have even have chance to correct it.

Revision history for this message
Niklas Wenzel (nikwen) wrote :

@Bartosz I did consider this when writing my implementation. All display texts will be converted back to their internal representation. Don't worry regarding this aspect.

Changed in ubuntu-calculator-app:
status: Incomplete → Triaged
status: Triaged → In Progress
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

Fix committed into lp:ubuntu-calculator-app at revision 228, scheduled for release in ubuntu-calculator-app, milestone Unknown

Changed in ubuntu-calculator-app:
status: In Progress → Fix Committed
Revision history for this message
Niklas Wenzel (nikwen) wrote :

I changed the bug status for this to Triaged again in the ubuntu-calculator-app project as we still need support for touch devices and to "In Progress" in Ubuntu UX as the following has yet to be answered (post #3):

"Should we notify the user when he pastes invalid content? Or should we simply insert as much as possible?

(In my opinion the latter would be superior in those cases when there aren't any downsides to filtering the input, while the former would be preferable when the pasted string is seriously broken and we can only insert a small part of it.)"

Changed in ubuntu-ux:
status: Fix Committed → In Progress
Changed in ubuntu-calculator-app:
status: Fix Committed → Triaged
Changed in ubuntu-calculator-app:
status: Triaged → Incomplete
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

I would like to propose, to notify user about bad paste, by "flash light" of the Formula Input Field.

I will be similar as we already have for entering incorrect formula (try to type "5*******").
I would like to "light" whole Formula Input Field, because sometimes the whole pasted text is wrong (because user make mistake), and we should notify user about that fact.

summary: - [Calculator] Add paste support
+ [Calculator][ux] Add paste support
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

Fix committed into lp:ubuntu-calculator-app at revision 235, scheduled for release in ubuntu-calculator-app, milestone Unknown

Changed in ubuntu-calculator-app:
status: Incomplete → Fix Committed
Revision history for this message
Niklas Wenzel (nikwen) wrote :

@Bartosz, that makes sense to me. Let's file a bug report. :)

By the way, I finally fixed the remaining issue: https://code.launchpad.net/~nikwen/ubuntu-calculator-app/bracket-paste-fix/+merge/279368

Revision history for this message
Niklas Wenzel (nikwen) wrote :
Changed in ubuntu-calculator-app:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.