a question about cut

John M McIntosh johnmci at smalltalkconsulting.com
Thu Sep 23 03:22:06 UTC 2004


I was testing host menu support today and as part of the testing  
noticed something odd, but in fact it's been there a long time.
You see if you select nothing in a text field (aka a ParagraphEditor)  
it makes the entire line disappear.  WHAT?

mmm a bug on my part, no.

You see ParagraphEditor>>cut reads...

cut
	"Cut out the current selection and redisplay the paragraph if  
necessary.  Undoer & Redoer: undoCutCopy:"

	self lineSelectAndEmptyCheck: [^ self].

	self replaceSelectionWith: self nullText.
	self undoer: #undoCutCopy: with: self clipboardText.
	self clipboardTextPut: UndoSelection

Part of the logic in lineSelectAndEmptyCheck: selects the entire line  
if the selection point is nil and there is a run of something to  
select, otherwise it flashes the text area. So it on purpose selects  
the line, then does the cut.

In checking VisualWorks 5.x I see it doesn't have this behavior, and  
usually I've selected some text when I do a cut.
So the question is should we change things? I just found this behavior  
a bit odd.

--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===




More information about the Squeak-dev mailing list