The Trunk: Morphic-mt.1603.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-mt.1603.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1603.mcz

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

Name: Morphic-mt.1603
Author: mt
Time: 6 December 2019, 6:00:07.36633 pm
UUID: 17d97c9d-3396-5648-bf6c-48edf00bf7fd
Ancestors: Morphic-mt.1600

Fixes some visual glitches regarding initial text selection in windows and a window's focus look.

Note that the instVar 'selectionInterval' in PluggableTextMorph is a cache because paragraphs and editors get replaced very frequently. The message #selectionInterval points to the editor, not that instVar. There are no senders of #selectionInterval: either. I will make that more clear in the future. There is a lot of inconsistent stuff lying around in our text-morph infrastructure.

Note that this is Morphic-mt.1603 because I have 1601 and 1602 in the inbox. :-)

=============== Diff against Morphic-mt.1600 ===============

Item was changed:
  ----- Method: Morph>>containingWindow (in category 'structure') -----
  containingWindow
  "Answer a window that contains the receiver. Try to use the model to find the right window. If I do not have a model, use the model of one of my owners. We could also just use #isSystemWindow. This, however, gives system windows the chance to refrain from taking ownership of this morph."
 
  | component |
  component := self.
  component model isNil ifTrue: [component := self firstOwnerSuchThat: [:m| m model notNil]].
  ^(component isNil or: [component isWindowForModel: component model])
  ifTrue: [component]
+ ifFalse: [(component firstOwnerSuchThat: [:m | m isWindowForModel: component model])
+ "For models composed of models, we have to use #isSystemWindow."
+ ifNil: [component firstOwnerSuchThat: [:m | m isSystemWindow]]]!
- ifFalse: [component firstOwnerSuchThat:[:m| m isWindowForModel: component model]]!

Item was added:
+ ----- Method: PluggableTextMorph>>restoreSelectionInterval (in category 'editor access') -----
+ restoreSelectionInterval
+
+ selectionInterval ifNotNil: [
+ self selectionInterval: selectionInterval].!

Item was changed:
+ ----- Method: PluggableTextMorph>>selectionInterval (in category 'editor access') -----
- ----- Method: PluggableTextMorph>>selectionInterval (in category 'interactive error protocol') -----
  selectionInterval
  ^ textMorph editor selectionInterval!

Item was changed:
+ ----- Method: PluggableTextMorph>>selectionInterval: (in category 'editor access') -----
- ----- Method: PluggableTextMorph>>selectionInterval: (in category 'model access') -----
  selectionInterval: sel
+ textMorph editor selectInterval: sel.!
- selectionInterval := sel!

Item was changed:
  ----- Method: SystemWindow>>updateFocusLookForKeyboardFocus (in category 'focus') -----
  updateFocusLookForKeyboardFocus
+ "Ensure that the window holding the current keyboard focus looks focused. Note that the focus window is not necessarily the receiver of this message."
 
  | f w |
  (((f := self activeHand keyboardFocus) notNil and: [(w := f containingWindow) notNil])
  and: [w isActive])
  ifTrue: [
  (self class windowsIn: self world) do: [:window |
  w ~~ window ifTrue: [window lookUnfocused]].
+ w lookFocused]
+ ifFalse: [
+ "If there is no valid focus holder, we must not look focused even if we are the key window."
+ self lookUnfocused]!
- w lookFocused]!

Item was added:
+ ----- Method: TextMorphForEditView>>doLayoutIn: (in category 'layout') -----
+ doLayoutIn: layoutBounds
+
+ | shouldRestoreSelection |
+ self flag: #workaround. "mt: The combination of 'releaseParagraph; paragraph' resets the selection. We should find a better way for this in the future. Sigh...."
+
+ shouldRestoreSelection := paragraph isNil.
+
+ super doLayoutIn: layoutBounds.
+
+ shouldRestoreSelection ifTrue: [
+ self editView ifNotNil: [:view |
+ view restoreSelectionInterval]].!