bugGNU Octave - Bugs: bug #60869, Ampersand character in uimenu label

 
 

bug #60869: Ampersand character in uimenu label

Submitted by:  Guillaume <gyom>
Submitted on:  Thu 01 Jul 2021 03:55:25 PM UTC  
 
Category:  GUI Severity:  3 - Normal
Priority:  3 - Low Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  Open
Release:  dev Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 02 Jul 2021 04:52:21 PM UTC, comment #4: 

Thanks for testing.

For the second set of results, I think they are using the convention that doubling a special character stops it from being special.  In strings, for example, doubling the single quote character just renders one quote character.

x = 'don''t'
x = don't

But, I also agree that this doesn't mean the interpreter should also add spaces.

Rik <rik5>
Project Administrator
Fri 02 Jul 2021 02:34:39 PM UTC, comment #3: 

For your two examples, I get:
'A&B'   -> 'AB_' (underscore B)
'A&\tB' -> 'A&B'

Furthermore:
'A&& B' -> 'A & B'
'A&&B'  -> 'A & B'
'A& B'  -> 'A& B'

The space added before '&' in the last examples puzzles me.

Guillaume <gyom>
Thu 01 Jul 2021 08:48:43 PM UTC, comment #2: 

Confirmed.

Can you determine exactly which conditions generate a keyboard shortcut?  For example, does the '&' character have to be preceded by whitespace as well?

H = figure;
uimenu (H, 'Label', 'A&B');

Is the Label that is displayed 'A&B' or 'AB' with 'B' being a keyboard shortcut?

Also, is it any whitespace that stops interpretation of the ampersand as a shortcut?

H = figure;
uimenu (H, 'Label', sprintf ('A&\tB'));

Is the label 'A& B' or does Matlab make a Tab the shortcut key?

Rik <rik5>
Project Administrator
Thu 01 Jul 2021 03:56:57 PM UTC, comment #1: 

Apologies. Use "Label" instead of "Text" (I open another bug report for this):

H = figure ();
uimenu (H, "Label", "A & B");
uimenu (H, "Label", "A &B");

Guillaume <gyom>
Thu 01 Jul 2021 03:55:25 PM UTC, original submission:  

The ampersand character in the text of a label is used to specify mnemonic keyboard shortcut. In Matlab, if the character that follows is a space, this is disabled and the ampersand character is instead displayed. Screenshot attached showing the difference between Matlab and Octave.

H = figure ();
uimenu (H, "Text", "A & B");
uimenu (H, "Text", "A &B");

Guillaume <gyom>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #51635:  uimenu.png added by gyom (15KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by gyom (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-07-01 rik5 Priority5 - Normal => 3 - Low
        StatusNone => Confirmed
    2021-07-01 gyom Attached File- => Added uimenu.png, #51635

    Back to the top


    Powered by Savane 3.6