Login  Register

The Inbox: Morphic-ct.1718.mcz

Posted by commits-2 on Jan 24, 2021; 4:23pm
URL: https://forum.world.st/The-Inbox-Morphic-ct-1718-mcz-tp5126450.html

A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1718.mcz

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

Name: Morphic-ct.1718
Author: ct
Time: 24 January 2021, 5:22:59.352273 pm
UUID: f630cc0f-15e2-5642-94f6-6277bb8d7bd4
Ancestors: Morphic-mt.1710

PluggableTextMorph: Fixes #selectAll to keep the current scroll position intact, as it is best practice in most modern editor implementations such as Chromium.

I'm very open to refactoring proposals, but otherwise I don't care if you merge this as-is. :-)

=============== Diff against Morphic-mt.1710 ===============

Item was changed:
  ----- Method: Editor>>selectAll: (in category 'typing/selecting keys') -----
  selectAll: aKeyboardEvent
  "select everything, invoked by cmd-a.  1/17/96 sw"
 
  self insertAndCloseTypeIn.
  self selectFrom: 1 to: self string size.
+ morph skipOnceScrollSelectionIntoView.
  ^ true!

Item was changed:
  ----- Method: PluggableTextMorph>>scrollSelectionIntoView: (in category 'editor access') -----
  scrollSelectionIntoView: event
  "Scroll my text into view. Due to line composition mechanism, we must never use the right of a character block because the lines last character block right value always comes from a global container and is *not* line specific."
 
  self rememberSelectionInterval.
 
+ (self valueOfProperty: #skipScrollSelectionIntoView ifAbsent: [false]) ifTrue: [
+ self removeProperty: #skipScrollSelectionIntoView.
+ ^ true].
+
  textMorph editor hasSelection
  ifFalse: [self scrollToShow: (textMorph editor startBlock withWidth: 1)]
  ifTrue: [
  self scrollToShow: (textMorph editor startBlock topLeft corner: textMorph editor stopBlock bottomLeft).
  self scrollToShow: (textMorph editor pointBlock withWidth: 1). "Ensure text cursor visibility."].
 
  ^ true!

Item was added:
+ ----- Method: TextMorph>>skipOnceScrollSelectionIntoView (in category 'as yet unclassified') -----
+ skipOnceScrollSelectionIntoView
+
+ self owner owner setProperty: #skipScrollSelectionIntoView toValue: true.!