[squeak-dev] The Trunk: Morphic-eem.1784.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Fri Oct 22 10:58:14 UTC 2021


Hmm... the strange diff is unrelated to the formatting of brackets [] here. It's the changed indentation level that confused me. Oh, well.

Best,
Marcel
Am 22.10.2021 10:53:20 schrieb Marcel Taeumel <marcel.taeumel at hpi.de>:
Hi Eliot --

Thank you for the fix.

If you want me to follow to the formatting guidelines in Compiler & Co., I would appreciate it that you do so in Morphic & Co.

You changed the entire format of the method, which makes it challenging for me to review your fix. 

Best,
Marcel

P.S.: Nope, the coding style you use in Compiler & Co. is just different, not better. ;-)


Am 17.10.2021 20:34:48 schrieb commits at source.squeak.org <commits at source.squeak.org>:
Eliot Miranda uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-eem.1784.mcz

==================== Summary ====================

Name: Morphic-eem.1784
Author: eem
Time: 17 October 2021, 11:34:29.99006 am
UUID: 7e3f944d-18fc-4a6f-bb86-03c8037ec775
Ancestors: Morphic-mt.1783

Text editing bug fixes.
A paragraph may not have been composed when interrogated for test and/or graphic coordinates.

A TextEditor for a Transcript may have no history but still be asked to openTypeInFor:/closeTypeIn:.

=============== Diff against Morphic-mt.1783 ===============

Item was changed:
----- Method: NewParagraph>>fastFindFirstLineSuchThat: (in category 'private') -----
fastFindFirstLineSuchThat: lineBlock
"Perform a binary search of the lines array and return the index
of the first element for which lineBlock evaluates as true.
This assumes the condition is one that goes from false to true for
increasing line numbers (as, eg, yval > somey or start char > somex).
If lineBlock is not true for any element, return size+1."
+ lines ifNil:
+ [self composeAll].
-
^lines
findBinaryIndex: [ :each |
(lineBlock value: each)
ifTrue: [ -1 ]
ifFalse: [ 1 ] ]
ifNone: [ :lower :upper | upper ]!

Item was changed:
----- Method: TextEditor>>closeTypeIn (in category 'typing support') -----
closeTypeIn
"See comment in openTypeIn. It is important to call closeTypeIn before executing
any non-typing key, making a new selection, etc. It is called automatically for
menu commands."

| begin stop |
+ beginTypeInIndex ifNotNil:
+ [begin := beginTypeInIndex.
- beginTypeInIndex ifNotNil: [
- begin := beginTypeInIndex.
stop := self stopIndex.

+ self history ifNotNil:
+ [:myHistory|
+ myHistory current
+ contentsAfter: (stop <= begin
+ ifTrue: [self nullText]
+ ifFalse: [paragraph text copyFrom: begin to: stop-1]);
+ intervalAfter: (stop to: stop-1);
+ intervalBetween: (stop < begin
+ ifTrue: [stop to: stop-1]
+ ifFalse: [begin to: stop-1]);
+ messageToUndo: (Message selector: #undoAndReselect);
+ messageToRedo: (Message selector: #redoAndReselect).
+
+ myHistory finishRemember].
- self history current
- contentsAfter: (stop <= begin
- ifTrue: [self nullText]
- ifFalse: [paragraph text copyFrom: begin to: stop-1]);
- intervalAfter: (stop to: stop-1);
- intervalBetween: (stop < begin
- ifTrue: [stop to: stop-1]
- ifFalse: [begin to: stop-1]);
- messageToUndo: (Message selector: #undoAndReselect);
- messageToRedo: (Message selector: #redoAndReselect).
-
- self history finishRemember.

beginTypeInIndex := nil]!

Item was changed:
----- Method: TextEditor>>openTypeInFor: (in category 'typing support') -----
openTypeInFor: editType
"Set up UndoSelection to null text (to be added to by readKeyboard and backTo:),
beginTypeInBlock to keep track of the leftmost backspace, and UndoParameter to tally
how many deleted characters were backspaced over rather than 'cut'.
You can't undo typing until after closeTypeIn."

+ beginTypeInIndex ifNil:
+ [beginTypeInIndex := self startIndex.
+ self history ifNotNil:
+ [:myHistory|
+ myHistory beginRemember:
+ (TextEditorCommand new
+ type: editType;
+ contentsBefore: (self hasSelection ifTrue: [self selection] ifFalse: [self nullText]);
+ intervalBefore: (beginTypeInIndex to: self stopIndex-1)
+ yourself)]]!
- beginTypeInIndex ifNil: [
- beginTypeInIndex := self startIndex.
- self history beginRemember: (TextEditorCommand new
- type: editType;
- contentsBefore: (self hasSelection ifTrue: [self selection] ifFalse: [self nullText]);
- intervalBefore: (beginTypeInIndex to: self stopIndex-1)
- yourself)].!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211022/871ba6d0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 124647 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211022/871ba6d0/attachment-0001.png>


More information about the Squeak-dev mailing list