MenuItem.st
changeset 985 5a5b476cfd6b
parent 973 cd6b8d08c9c9
child 1030 3684379a1ac8
--- a/MenuItem.st	Sat Jun 20 16:48:01 1998 +0200
+++ b/MenuItem.st	Sat Jun 20 17:15:59 1998 +0200
@@ -459,23 +459,46 @@
 filteredLabel
     "return the label without any &-chars"
 
-    |in out c|
+    |rawLabel l in out c pos emp e|
+
+    rawLabel := self rawLabel.
+    rawLabel isString ifFalse:[^ rawLabel].
+
+    "/ be careful to preserve any emphasis ...
+    "/ bad kludge ...
+    rawLabel isText ifTrue:[
+        emp := RunArray new.
+    ].
 
     out := WriteStream on:''.
-    in := self rawLabel readStream.
+    in := rawLabel readStream.
     [in atEnd] whileFalse:[
+        emp notNil ifTrue:[
+            e := rawLabel emphasisAt:(in position).
+        ].
         c := in next.
         c == $& ifTrue:[
             in peek == $& ifTrue:[
-                out nextPut:c
+                out nextPut:c.
+                emp notNil ifTrue:[
+                    emp add:e
+                ]
             ]
         ] ifFalse:[
-            out nextPut:c
+            out nextPut:c.
+            emp notNil ifTrue:[
+                emp add:e
+            ]
         ]
     ].
-    ^ out contents.
+    l := out contents.
+    emp notNil ifTrue:[
+        ^ Text string:l emphasisCollection:emp
+    ].
+    ^ l.
 
     "Created: / 19.6.1998 / 00:02:10 / cg"
+    "Modified: / 20.6.1998 / 17:15:18 / cg"
 ! !
 
 !MenuItem methodsFor:'queries'!
@@ -659,5 +682,5 @@
 !MenuItem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.22 1998-06-18 22:59:17 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.23 1998-06-20 15:15:59 cg Exp $'
 ! !