<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p></p>
<div>The "Character lf" hack works on Windows, but I'm not sure if this behavior is officially defined by the VM. I don't know how one could detect Ctrl + Enter else ...</div>
<div><br>
</div>
<div>If you see any problems with solving this issue directly in TextMorph/Editor, we could also handle the event in FillInTheBlankMorph.</div>
<div><br>
</div>
<div>Best,</div>
<div>Christoph</div>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von commits@source.squeak.org <commits@source.squeak.org><br>
<b>Gesendet:</b> Mittwoch, 22. Januar 2020 11:21 Uhr<br>
<b>An:</b> squeak-dev@lists.squeakfoundation.org<br>
<b>Betreff:</b> [squeak-dev] The Inbox: Morphic-ct.1621.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Christoph Thiede uploaded a new version of Morphic to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Morphic-ct.1621.mcz" id="LPlnk400204" previewremoved="true">http://source.squeak.org/inbox/Morphic-ct.1621.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Morphic-ct.1621<br>
Author: ct<br>
Time: 22 January 2020, 11:21:19.533972 am<br>
UUID: facc9fb6-e535-c04f-967c-5f2ae09733c6<br>
Ancestors: Morphic-cmm.1618<br>
<br>
Proposal: Use Ctrl + Enter to accept in every textmorph, even if acceptOnCR is disabled. Useful, for example, to answer a multiline request.<br>
<br>
=============== Diff against Morphic-cmm.1618 ===============<br>
<br>
Item was changed:<br>
  ----- Method: TextEditor>>dispatchOnKeyboardEvent: (in category 'typing support') -----<br>
  dispatchOnKeyboardEvent: aKeyboardEvent <br>
         "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it."<br>
         <br>
         | honorCommandKeys typedChar |<br>
         typedChar := aKeyboardEvent keyCharacter.<br>
         <br>
         "Handle one-line input fields."<br>
+        (typedChar == Character lf or: [typedChar == Character cr and: [morph acceptOnCR]])<br>
-        (typedChar == Character cr and: [morph acceptOnCR])<br>
                 ifTrue: [^ true].<br>
         <br>
         "Clear highlight for last opened parenthesis."<br>
         self clearParens.<br>
         <br>
         "Handle line breaks and auto indent."<br>
         typedChar == Character cr ifTrue: [<br>
                 aKeyboardEvent controlKeyPressed<br>
                         ifTrue: [^ self normalCharacter: aKeyboardEvent].<br>
                 aKeyboardEvent shiftPressed<br>
                         ifTrue: [^ self lf: aKeyboardEvent].<br>
                 aKeyboardEvent commandKeyPressed<br>
                         ifTrue: [^ self crlf: aKeyboardEvent].<br>
                 ^ self crWithIndent: aKeyboardEvent].<br>
  <br>
         "Handle indent/outdent with selected text block."<br>
         typedChar == Character tab ifTrue: [<br>
                 aKeyboardEvent shiftPressed<br>
                         ifTrue: [self outdent: aKeyboardEvent. ^ true]<br>
                         ifFalse: [self hasMultipleLinesSelected<br>
                                 ifTrue: [self indent: aKeyboardEvent. ^ true]]].<br>
  <br>
         honorCommandKeys := Preferences cmdKeysInText.<br>
  <br>
         (honorCommandKeys and: [typedChar == Character enter])<br>
                 ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent].<br>
         <br>
         "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this<br>
         conflict, assume that keys other than cursor keys aren't used together with Crtl."<br>
         ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue)<br>
                 and: [aKeyboardEvent keyValue < 27])<br>
                         ifTrue: [^ aKeyboardEvent controlKeyPressed<br>
                                 ifTrue: [self<br>
                                                         perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)<br>
                                                         with: aKeyboardEvent]<br>
                                 ifFalse: [self<br>
                                                         perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)<br>
                                                         with: aKeyboardEvent]].<br>
                         <br>
         "backspace, and escape keys (ascii 8 and 27) are command keys"<br>
         ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed])<br>
                 or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue])<br>
                         ifTrue: [ ^ aKeyboardEvent shiftPressed<br>
                                 ifTrue: [self<br>
                                                         perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)<br>
                                                         with: aKeyboardEvent]<br>
                                 ifFalse: [self<br>
                                                         perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)<br>
                                                         with: aKeyboardEvent]].<br>
  <br>
         "the control key can be used to invoke shift-cmd shortcuts"<br>
         (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ])<br>
                 ifTrue: [^ self<br>
                                         perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)<br>
                                         with: aKeyboardEvent].<br>
  <br>
         "Enclose selection with brackets etc."<br>
         ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent])<br>
                 ifTrue: [^ true].<br>
  <br>
         "Automatically enclose paired characters such as brackets."<br>
         (self class autoEnclose and: [self autoEncloseFor: typedChar])<br>
                 ifTrue: [^ true].<br>
                 <br>
         "Even if no enclosing feature was used, highlight the matching bracket when closing one."<br>
         (')]}' includes: typedChar)<br>
                 ifTrue: [self blinkPrevParen: typedChar].<br>
                                         <br>
         self normalCharacter: aKeyboardEvent.<br>
         ^ false!<br>
<br>
Item was changed:<br>
  ----- Method: TextMorphForEditView>>keyStroke: (in category 'event handling') -----<br>
  keyStroke: evt<br>
         | view |<br>
         <br>
         editView deleteBalloon.<br>
         self editor model: editView model.  "For evaluateSelection"<br>
         view := editView.  "Copy into temp for case of a self-mutating doit"<br>
+        (evt keyCharacter = Character lf or: [acceptOnCR and: [evt keyCharacter = Character cr]])<br>
-        (acceptOnCR and: [evt keyCharacter = Character cr])<br>
                 ifTrue: [^ self editor accept].<br>
  <br>
         view hasUserEdited: false.<br>
         super keyStroke: evt.<br>
         view scrollSelectionIntoView.<br>
         <br>
         view hasUserEdited<br>
                 ifTrue: [       view textEdited: self contents].!<br>
<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>