Bug 176209 - percentage (%) sign doubles when pasted
Summary: percentage (%) sign doubles when pasted
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: 1.1
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-27 03:14 UTC by Orcan Ogetbil
Modified: 2009-05-18 22:00 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Orcan Ogetbil 2008-11-27 03:14:23 UTC
Version:           1.1 (using KDE 4.1.3)
OS:                Linux
Installed from:    Fedora RPMs

How to Reproduce?
1- Launch konversation, join some channel.

Do one of the following two:
2- In the input box, type some expression that involves the percentage sign (%). For example: "50% of dogs are male". Select that expression with the mouse. Copy it to cache (ctrl+c)
-OR-
2- Select some text that includes the percentage sign (%) from the messages that is already posted by someone else. Copy it to cache (ctrl+c)

3- Click anywhere in the input box so that nothing is selected. Now paste what is in the cache (ctrl+v or middle mouse button)

Expected result:
Whatever is copied to the cache should be pasted. e.g: "50% of dogs are male"

Actual result:
The percentage sign gets doubled when pasted: e.g. "50%% of dogs are male"
Comment 1 Juan Carlos Torres 2008-11-27 03:53:29 UTC
This is actually not a bug, but a feature. In Konversation, a single % will trigger text formatting options such as bold (%B), italics (%I), and colors (See Insert menu -> IRC Colors). The only way to display a plain "%" in the text is to "escape" it by typing two % ("%%"). Konversation knows that when you copy and paste a "%" sign, you want to really display a "%" so it automatically escapes it.
Comment 2 Juan Carlos Torres 2008-11-27 04:03:13 UTC
I forgot to mention, if you don't want this behavior, you can turn it off in Settings menu -> Configure Konversation -> Behavior -> Chat Window -> Disable variable expansion checkbox.
Comment 3 Orcan Ogetbil 2008-11-27 04:41:30 UTC
Thanks for the quick reply.
I thought about % being an escape character. I should have looked at the documentation, I guess. But what fooled me was, when I type "50% of dogs are male" with a single % and hit ENTER my messages is posted properly on the channel. The % sign doesn't gets lost, which is not the case for most implementations of an escape character.

Anyhow, you are contradicting yourself :) Let me demonstrate:

You are saying that % is an escape character. That means that you are expecting the user to type %% to display a single %. That's fine. But then you shouldn't double the number of % signs that are copied from the input box. Those are already doubled by the user.

I am pretty sure there is a bug somewhere, but not necessarily the way I reported in the first place. Should I open another one?
Comment 4 Eike Hein 2008-11-27 12:28:21 UTC
No, it's fine to keep this report open. Personally, I think this is a bug as well; I have to look at the code, but I doubt it's so "smart" as to double the percent sign intentionally, and if it were, that'd be an example of the kind of trying-to-outguess-the-user pseudo-smartness I don't really like, especially when it doesn't actually work.

Variable expansion only hits when an actual variable is named (e.g. %B for bold), otherwise, typing a single % is fine, so there's no reason to double it in the example provided here. And if the copied input box text *would* include something like %B, auto-escaping would still be wrong to do because the chances are the user does want bold in the text. I actually can't think of any scenario in which auto-doubling the percent sign on copy would make sense.

Reopening.
Comment 5 Travis McHenry 2009-04-18 08:27:42 UTC
Anyone against me removing the code that does this? It's just 6 lines but it's more of a bug than a feature imo.
Comment 6 Eike Hein 2009-04-18 14:23:30 UTC
IIRC it was a workaround against some Qt 3 bug. psn added it I think; he would know more then. As it is it's definitely annoying.
Comment 7 Peter Simonsson 2009-05-18 22:00:16 UTC
SVN commit 969744 by psn:

Don't double % on paste.
BUG: 176209


 M  +0 -6      ircinput.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=969744