Closed Bug 767323 Opened 12 years ago Closed 12 years ago

Ampersands don't appear in the windows biff icon tooltip

Categories

(MailNews Core :: Backend, defect)

x86_64
Windows 7
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 16.0

People

(Reporter: neil, Assigned: neil)

Details

Attachments

(1 file)

I happened to notice a feed in my biff icon tooltip. However the name of the account, "Blogs & News Feeds" had been corrupted - the ampersand was missing.

A search turned up the problem was a "feature" of tooltips - they delete ampersands because people writing for native Win32 use the same string for a control's label as for its tooltip, so they want the ampersand removed.

There is a way to disable this for a custom tooltip, but we're stuck with the default tooltip created by Windows Explorer.
OK, so the rule is a little more complicated than that.

The tooltip code removes one & from any run of &s.
However the underlining code also affects the display.
It allows you to quote an & with another &.
So in all you need 2n+1 &s for each run of &s.

Input	Display*
&	
&&	_
&&&	&
&&&&	&_
&&&&&	&&
&&&&&&	&&_
&&&&&&&	&&&

*Only the last "single" & actually underlines the next character.
To test biff, I open a folder (not an account) and evaluate (on one line):
top.opener.msgWindow.openFolder.server.performingBiff = true;
var Ci = Components.interfaces;
var mwi = Components.classes['@mozilla.org/messenger/osintegration;1']
                   .getService(Ci.nsIFolderListener);
mwi.OnItemIntPropertyChanged(top.opener.msgWindow.openFolder.parent,
                             "BiffState",
                             Ci.nsIMsgFolder.nsMsgBiffState_NewMail,
                             Ci.nsIMsgFolder.nsMsgBiffState_NoMail);
mwi.OnItemIntPropertyChanged(top.opener.msgWindow.openFolder.parent,
                             "BiffState",
                             Ci.nsIMsgFolder.nsMsgBiffState_NoMail,
                             Ci.nsIMsgFolder.nsMsgBiffState_NewMail);
Attached patch Proposed patchSplinter Review
I decided to fix the hard case with multiple ampersands, just in case ;-)

After replacing single ampersands with three, I then search for six ampersands, which must come from (part of) a run of ampersands. I delete one, then skip two, so that I delete one in every three as long as there are at least six.

2 -> 6 -> 5 (less than 6, so stop)
3 -> 9 -> 2 + 6 -> 2 + 5 (less than 6, so stop) -> 7
4 -> 12 -> 2 + 9 -> 2 + 2 + 6 -> 2 + 2 + 5 -> 9 etc.

Of course, only when we have properly escaped the string can we actually check whether it will fit in the notification buffer.
Assignee: nobody → neil
Attachment #635699 - Flags: review?(dbienvenu)
Comment on attachment 635699 [details] [diff] [review]
Proposed patch

you could make the function static, since it's fairly specific to this file...
Attachment #635699 - Flags: review?(dbienvenu) → review+
Severity: normal → minor
OS: Windows Server 2008 → Windows 7
Summary: Ampersands don't appear in the biff icon tooltip → Ampersands don't appear in the windows biff icon tooltip
Oops, why did I forgot to mark this as FIXED?
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 16.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: