Merge jv
authorMerge Script
Mon, 02 May 2016 06:46:50 +0200
branchjv
changeset 5692 2fb164455e7c
parent 5688 60766cc55bfd (diff)
parent 5691 bbe1d9a93740 (current diff)
child 5696 939848e2b8cb
Merge
EditTextView.st
ListView.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Mon May 02 06:46:50 2016 +0200
@@ -0,0 +1,16 @@
+
+syntax: glob
+*Init.c   
+makefile
+*.so
+*.H
+*.o
+*.STH
+*.sc
+objbc
+objvc
+*.class
+java/libs/*.jar
+java/libs-src/*.jar
+*-Test.xml
+st.chg
--- a/EditField.st	Sun May 01 18:21:59 2016 +0200
+++ b/EditField.st	Mon May 02 06:46:50 2016 +0200
@@ -1948,7 +1948,7 @@
     DefaultBackgroundColor notNil ifTrue:[
         bgColor := DefaultBackgroundColor onDevice:device.
 "/        bgColor ditherForm notNil ifTrue:[
-"/            bgColor := (bgColor copy) exactOrNearestOn:self graphicsDevice
+"/            bgColor := (bgColor copy) exactOrNearestOn:device
 "/        ].
         self viewBackground:bgColor.
     ].
--- a/EditTextView.st	Sun May 01 18:21:59 2016 +0200
+++ b/EditTextView.st	Mon May 02 06:46:50 2016 +0200
@@ -473,6 +473,69 @@
         top2 open.
                                                                         [exEnd]
 "
+!
+
+selection_and_cursor_movement
+"
+Changes done to implement 'standard' behaviour (that's how vast majority of widgets used in todays desktops behaves)
+as opposed to 'traditional' which is what how it was in St/X 'ever since'
+
+* Numerous off-by-one bugs
+
+* Extending selection by dragging:
+  Scenario:
+    1. Select & drag to expand beggining of the selection (i.e., drag from 'end' to 'beggining'
+    2. Stop dragging
+    3. Press Shift-Left / Shift-Right (to refine selection)
+
+    Traditional ST/X: end of selection is moved
+    Standard:  beginning of selection is moved
+      (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox)
+
+* Extending selection by Shift-Home / Shift-End
+  Scenario:
+    1. Position cursor in the middle of the line
+    2. Press Shift-Home (line for beginning should be selected)
+    3. Press Shift-Right (to refine selection)
+
+    Traditional ST/X: end of selection is moved
+    Standard:  beginning of selection is moved
+      (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox)
+
+* Selection flip by Shift-Home / Shift-End
+  Scenario A:
+    1. Position cursor in the middle of the line to column C
+    2. Press Shift-Home (line from beginning should be selected)
+    2. Press Shift-End
+
+    Traditional ST/X: end of selection is moved so whole line is selected
+    Standard: Selection 'flips' so part of line from column C to the end is selected
+      (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox)
+
+  Scenario B:
+    1. Position cursor in the middle of the line to column C
+    2. Press Shift-End (column C to the end of line should be selected)
+    2. Press Shift-Home
+
+    Traditional ST/X: beginning of selection is moved so whole line is selected
+    Standard: Selection 'flips' so part of line from the beginning to column C is selected
+      (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox)
+
+  NOTE: This could be controlled by 
+    UserPreferences current selectionExtensionMode
+
+
+* Extending selection with Ctrl-Shift-Left / Ctrl-Shift-Right
+  Scenario A:
+    1. Position cursor in the middle of the line to column C
+    2. Select word
+    3. Press Ctrl-Shift-Right, Ctrl-Shift-Right
+
+    Traditional ST/X: nothing happens at all
+    Standard: Selection is extended to include a space (first press) and a word right to previously selected one
+      (checked on Notepad, Gedit (GTK+), Sublime (Win+Lin), Eclipse, Firefox)
+
+"
 ! !
 
 !EditTextView class methodsFor:'defaults'!
@@ -1063,7 +1126,11 @@
      This selection will not be replaced by followup user input,
      so multiple pastes will be possible."
 
-    typeOfSelection := #paste
+    self hasSelection ifTrue:[ 
+        typeOfSelection := #paste
+    ].
+
+    "Modified: / 02-05-2015 / 21:17:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 editModeHolder
@@ -4766,7 +4833,9 @@
 cursorKeyPress:key shifted:shifted
     <resource: #keyboard (#CursorRight #CursorDown #CursorUp #CursorDown)>
 
-    |n|
+    | n oldTypeOfSelection |
+
+    oldTypeOfSelection := typeOfSelection.
 
     self changeTypeOfSelectionTo:nil.
 
@@ -4774,6 +4843,7 @@
         (shifted and:[selectionStartLine isNil]) ifTrue:[
             selectionStartLine := selectionEndLine := clickStartLine := cursorLine.
             selectionStartCol := selectionEndCol := clickStartCol := cursorCol.
+            cursorCol := cursorCol + 1.
             expandingTop := false.
             self validateNewSelection.
             self setPrimarySelection.
@@ -4782,34 +4852,43 @@
             ^ self.
         ].
 
-        selectionStartLine notNil ifTrue:[
-            self cursorMovementAllowed ifTrue:[
-                "/
-                "/ treat the whole selection as cursor
-                "/
-                self setCursorLine:(selectionEndLine ? selectionStartLine).
-                selectionEndCol == 0 ifTrue:[
-                    selectionEndCol := 1.
+        self cursorMovementAllowed ifTrue:[
+            shifted ifTrue:[
+                self addToSelectionAfter:[ self cursorRight ]
+            ] ifFalse:[
+                "/ Compensate for Claus paste-cursordown-paste feature.
+                "/ Right after paste the cursor is at the beginning of the
+                "/ selection. But if immediately after paste user moves cursor right
+                "/ (but without shift!!!!!!), she probably wants to move past the 
+                "/ pasted text, not into it. This is how every other editor behaves.
+                oldTypeOfSelection == #paste ifTrue:[
+                    cursorLine := selectionEndLine.
+                    cursorCol := selectionEndCol + 1.
                 ].
-                self setCursorCol:selectionEndCol.
-                shifted ifTrue:[
-                    self expandSelectionRight.
-                    ^ self
+
+                "/ If there's selection, unselect and move cursor
+                "/ to the end of selection.
+                self hasSelection ifTrue:[ 
+                    self setCursorLine: selectionEndLine.
+                    self setCursorCol: selectionEndCol + 1.
+                    self unselect; makeCursorVisible.
+                    ^ self.
                 ].
                 self unselect; makeCursorVisible.
-                cursorCol == 1 ifTrue:[^ self].
+                self cursorRight.
             ].
         ].
-        self cursorRight.
         ^ self
     ].
     (key == #CursorDown) ifTrue:[
         (shifted and:[selectionStartLine isNil]) ifTrue:[
             selectionStartLine := clickStartLine := cursorLine. selectionEndLine := cursorLine + 1.
-            selectionStartCol := clickStartCol := selectionEndCol := cursorCol.
-            selectionEndCol == 1 ifTrue:[
-                selectionEndCol := 0.
-            ].
+            selectionStartCol := clickStartCol := cursorCol.
+            selectionEndCol := cursorCol - 1.
+"/            selectionEndCol == 1 ifTrue:[
+"/                selectionEndCol := 0.
+"/            ].
+            self setCursorLine: cursorLine + 1.
             self validateNewSelection.
             self selectionChanged.
             self redrawLine:selectionStartLine.
@@ -4823,30 +4902,45 @@
                 "/
                 "/ treat the whole selection as cursor
                 "/
-                self setCursorLine:(selectionEndLine ? selectionStartLine).
-                self setCursorCol:selectionStartCol.
-                (cursorCol == 0 or:[selectionEndCol == 0]) ifTrue:[
-                    self setCursorCol:1.
-                    self setCursorLine:(cursorLine - 1).
-                ].
-                self makeCursorVisible.
-
-                shifted ifTrue:[
-                    clickLine := cursorLine.
-                    clickCol := cursorCol.
-                    self expandSelectionDown.
-                    ^ self
-                ].
-                self unselect.
+"/                self setCursorLine:(selectionEndLine ? selectionStartLine).
+"/                self setCursorCol:selectionStartCol.
+"/                (cursorCol == 0 or:[selectionEndCol == 0]) ifTrue:[
+"/                    self setCursorCol:1.
+"/                    self setCursorLine:(cursorLine - 1).
+"/                ].
+"/                self makeCursorVisible.
+"/
+"/                shifted ifTrue:[
+"/                    clickLine := cursorLine.
+"/                    clickCol := cursorCol.
+"/                    self setCursorLine: cursorLine + 1.
+"/                    self expandSelectionDown.
+"/                    ^ self
+"/                ].
+"/                self unselect.
             ].
         ].
-
-        n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorDown).
-        self cursorDown:n.
-        "/
-        "/ flush keyboard to avoid runaway cursor
-        "/
-        self sensor flushKeyboardFor:self.
+        self cursorMovementAllowed ifTrue:[
+            n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorDown).
+            shifted ifTrue:[
+                self addToSelectionAfter:[ self cursorDown:n ]
+            ] ifFalse:[
+                "/ If there's selection, unselect and move cursor
+                "/ one line below last selection line but at the
+                "/ selectionStartCol column. This behavior is
+                "/ useful when pasting...
+                self hasSelection ifTrue:[ 
+                    self setCursorLine: selectionEndLine.
+                    self setCursorCol: selectionStartCol.
+                ].    
+                self unselect; makeCursorVisible.
+                self cursorDown:n.
+            ].  
+            "/
+            "/ flush keyboard to avoid runaway cursor
+            "/
+            self sensor flushKeyboardFor:self.
+        ].
         ^ self
     ].
     (key == #CursorLeft or:[key == #CursorUp]) ifTrue:[
@@ -4857,6 +4951,7 @@
                     selectionStartLine := selectionEndLine := clickStartLine := cursorLine.
                     selectionEndCol := clickStartCol := cursorCol-1.
                     selectionStartCol := cursorCol-1.
+                    self setCursorCol: cursorCol-1.
                     self validateNewSelection.
                     self selectionChanged.
                     self redrawLine:selectionStartLine.
@@ -4865,7 +4960,8 @@
             ] ifFalse:[
                 cursorLine > 1 ifTrue:[
                     selectionEndLine := clickStartLine := cursorLine.
-                    selectionEndCol := selectionStartCol := clickStartCol := cursorCol.
+                    selectionStartCol := clickStartCol := cursorCol.
+                    selectionEndCol := cursorCol - 1.
                     selectionStartLine := cursorLine - 1.
                     selectionEndCol == 1 ifTrue:[
                         selectionEndCol := 0.
@@ -4873,41 +4969,57 @@
                     self validateNewSelection.
                     self selectionChanged.
                     self redrawFromLine:selectionStartLine to:cursorLine.
+                    self setCursorLine: cursorLine - 1.  
                     ^ self
                 ]
             ]
         ].
 
-        selectionStartLine notNil ifTrue:[
+        self hasSelection ifTrue:[
             self cursorMovementAllowed ifTrue:[
                 "/
                 "/ treat the whole selection as cursor
                 "/
-                self setCursorLine:selectionStartLine.
-                self setCursorCol:selectionStartCol.
-                (key == #CursorLeft) ifTrue:[
-                    self setCursorCol:(cursorCol+1).  "/ compensate for followup crsr-left
-                ].
-                self makeCursorVisible.
-
-                shifted ifTrue:[
-                    (key == #CursorUp) ifTrue:[
-                        clickLine := cursorLine.
-                        self expandSelectionUp.
-                    ] ifFalse:[
-                        self expandSelectionLeft.
-                    ].
-                    ^ self
-                ].
-                self unselect.
+"/                self setCursorLine:selectionStartLine.
+"/                self setCursorCol:selectionStartCol.
+"/                self makeCursorVisible.
+"/
+"/                shifted ifFalse:[
+"/                    self unselect.
+"/                ]
             ].
         ].
         (key == #CursorLeft) ifTrue:[
-            self cursorLeft. ^self
+            shifted ifTrue:[
+                self addToSelectionAfter:[self cursorLeft].
+            ] ifFalse:[
+                "/ If there's selection, unselect and move cursor
+                "/ to the end of selection.   
+                self hasSelection ifTrue:[ 
+                    self setCursorLine:selectionStartLine.
+                    self setCursorCol:selectionStartCol.
+                    self unselect; makeCursorVisible.                    
+                    ^ self.
+                ].
+                self unselect; makeCursorVisible.
+                self cursorLeft. 
+            ].
+            ^self
         ].
         (key == #CursorUp)        ifTrue:[
             n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorUp).
-            self cursorUp:n.
+            shifted ifTrue:[
+                self addToSelectionAfter: [ self cursorUp:n ]
+            ] ifFalse:[
+                "/ If there's selection, unselect and move cursor
+                "/ to the beggining of selection.   
+                self hasSelection ifTrue:[ 
+                    self setCursorLine:selectionStartLine.
+                    self setCursorCol:selectionStartCol.
+                ].    
+                self unselect; makeCursorVisible.
+                self cursorUp:n.
+            ].
             "/
             "/ flush keyboard to avoid runaway cursor
             "/
@@ -4916,7 +5028,7 @@
         ].
     ].
 
-    "Modified: / 17-04-2012 / 21:01:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 28-03-2014 / 12:32:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 doKeyPress:key x:x y:y
@@ -5132,18 +5244,15 @@
 "
 
     (key == #BeginOfLine) ifTrue:[
-        "/ cg: this is complete rubbish - you have to define a mapping from
-        "/ some shifted key to selectFromBeginOfLine
-        "/ (otherwise, no shifted key could ever be mapped to BegnOfLine)
-        "/ see code below.
-        false "shiftPressed" ifTrue: [
+        shiftPressed ifTrue: [
             "/ "Original St/X code - now use Ctrl modifier"
             "/ self unselect.
             "/ self cursorHome.
             "Jan's modification"
-            "/ self addToSelectionAfter:[ self cursorToBeginOfLine ].
+            self addToSelectionAfter:[ self cursorToBeginOfLine ].
             "/ Jan's modification modified by his own request ;-))
-            self selectFromBeginOfLine.
+            "/ JV: Well, does not work correctly. Better to fix addToSelectionAfter: 
+            "/ self selectFromBeginOfLine.
         ] ifFalse: [
             self unselect.
             ctrlPressed ifTrue:[
@@ -5154,24 +5263,16 @@
         ].
         ^ self
     ].
-    (key == #BSelectFromeginOfLine) ifTrue:[
-        self selectFromBeginOfLine.
-        ^ self
-    ].
-
     (key == #EndOfLine) ifTrue:[
-        "/ cg: this is complete rubbish - you have to define a mapping from
-        "/ some shifted key to selectFromBeginOfLine
-        "/ (otherwise, no shifted key could ever be mapped to BegnOfLine)
-        "/ see code below.
-        false "shiftPressed" ifTrue:[
+        shiftPressed ifTrue:[
             "/ "Original St/X code - now use Ctrl modifier"
             "/ self unselect.
             "/ self cursorToBottom
             " Jan's modification"
-            "/ self addToSelectionAfter:[ self cursorToEndOfLine ] .
+            self addToSelectionAfter:[ self cursorToEndOfLine ] .
             "/ Jan's modification modified by his own request ;-))
-            self selectToEndOfLine.
+            "/ JV: Well, does not work correctly. Better to fix addToSelectionAfter:
+            "/  self selectToEndOfLine.
         ] ifFalse:[
             self unselect.
             ctrlPressed ifTrue:[
@@ -5182,15 +5283,27 @@
         ].
         ^ self
     ].
-
-    (key == #SelectToEndOfLine) ifTrue:[
-        self selectToEndOfLine.
-        ^ self
-    ].
-
-    (key == #NextWord) ifTrue:[self cursorToNextWord. ^self].
+    (key == #NextWord) ifTrue:[
+        shiftPressed ifTrue:[
+            self addToSelectionAfter:[  
+                self cursorToNextWord. 
+            ]
+        ] ifFalse:[ 
+            self cursorToNextWord
+        ].
+        ^self
+    ].
     (key == #EndOfWord) ifTrue:[self cursorToEndOfWord. ^self].
-    (key == #PreviousWord) ifTrue:[self cursorToPreviousWord. ^self].
+    (key == #PreviousWord) ifTrue:[
+        shiftPressed ifTrue:[
+            self addToSelectionAfter:[      
+                self cursorToPreviousWord. 
+            ]
+        ] ifFalse:[ 
+            self cursorToPreviousWord.                                
+        ].
+        ^self
+    ].
     (key == #GotoLine) ifTrue:[self gotoLine. ^self].
 
     (rawKey == #CursorRight
@@ -5386,7 +5499,7 @@
 
     "Modified: / 06-02-1998 / 11:59:59 / stefan"
     "Modified: / 14-07-2011 / 12:08:28 / cg"
-    "Modified: / 26-09-2013 / 17:52:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 31-03-2014 / 16:27:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 executeKeyboardMacro:cmdMacro
@@ -5407,6 +5520,47 @@
     ].
 !
 
+extendSelectionToX:x y:y setPrimarySelection:aBoolean
+    | movedVisibleLine movedLine movedCol movedUp |
+
+    movedVisibleLine := self visibleLineOfY:y.
+    movedLine := self visibleLineToAbsoluteLine:movedVisibleLine.
+
+    (x < leftMargin) ifTrue:[
+        movedCol := 0
+    ] ifFalse:[
+        movedCol := self colOfX:x inVisibleLine:movedVisibleLine
+    ].
+
+    "find out if we are before or after initial click"
+    movedUp := false.
+    (movedLine < (clickStartLine ? movedLine)) ifTrue:[
+        movedUp := true
+    ] ifFalse:[
+        (movedLine == (clickStartLine ? movedLine)) ifTrue:[
+            (movedCol < (clickStartCol ? movedCol)) ifTrue:[
+                movedUp := true
+            ]
+        ]
+    ].
+
+    self hasSelection ifTrue:[ 
+        movedUp ifTrue:[
+            "/ Set cursor to selection start
+            self setCursorLine: selectionStartLine col: selectionStartCol
+        ] ifFalse:[ 
+            "/ Set cursor to selection end
+            self setCursorLine: selectionEndLine col: selectionEndCol + 1
+        ].
+    ].
+
+
+
+    super extendSelectionToX:x y:y setPrimarySelection:aBoolean.
+
+    "Created: / 02-05-2015 / 07:33:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 handleNonCommandKey:keyArg
     |selStartLineBefore selStartColBefore selEndLineBefore selEndColBefore key|
 
@@ -5418,8 +5572,17 @@
     key := keyArg.
 
     typeOfSelection == #paste ifTrue:[
-        "pasted selection will NOT be replaced by keystroke"
-        self unselect
+        "Pasted selection will NOT be replaced by keystroke (non-standard, St/X feature)"
+
+        "/ After paste, the cursor is at the beginning to support
+        "/ paste-cursordown-paste. Compensate for this here - we want
+        "/ to continue editing after the end of the selection.
+        "/ This is
+        cursorLine := selectionEndLine.
+        cursorCol := selectionEndCol + 1.
+
+        "/ Cursor position set, we can unselect.
+        self unselect.
     ].
 
     selStartLineBefore := selectionStartLine.
@@ -5520,6 +5683,7 @@
     completionSupport notNil ifTrue:[ completionSupport postKeyPress:keyArg ].
 
     "Modified (comment): / 25-01-2012 / 00:30:11 / cg"
+    "Modified: / 30-08-2013 / 20:10:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 keyPress:key x:x y:y
@@ -6813,9 +6977,15 @@
     c2 := (cursorCol - 1).
     self selectFromLine:l1 col:c1 toLine:l2 col:c2.
     typeOfSelection := #paste. "/ sigh - cleared by #selectFromLine:
+    "/ For Claus to support paste-cursordown-paste :-)
+    "/ Move cursor the the beggining of the selection so subsequent
+    "/ cursor move will start there.
+    self setCursorLine: l1.
+    self setCursorCol: c1.
 
     "Modified: / 14-02-1996 / 11:14:14 / stefan"
     "Modified: / 25-01-2012 / 00:31:30 / cg"
+    "Modified: / 30-08-2013 / 00:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 pasteAsStringLiteral
@@ -7890,39 +8060,96 @@
 
 !EditTextView methodsFor:'selections'!
 
-addToSelectionAfter:aBlock
-    <resource: #obsolete>
-
-    "evaluate aBlock while unselected.
-     Restore the previous selection afterwards.
-     CG: I am not sure, if this is a leftover and is still used at all.
-         It is therefore temporarily marked as obsolete. Please check
-         and let me know."
-
-    |startLine startCol endLine endCol |
+addToSelectionAfter:aBlock 
+    "Extends the selection accroding to cursor position
+     after evaluation of `aBlock`. Used to implement
+     Shift-Up/Down/Left/Right, Shift-Home & Shift-End."
+
+    "/ Following comment is in czech and thus now very useful.
+    "/ However I (JV) kept it here as this is one of the very
+    "/ first fix/hack we made to Smalltalk/X ages ago, if not
+    "/ the very first one. Actually, this method and comment was 
+    "/ written by Martin Dvorak. Yeah, being bit nostalgic...
+
+    "Pokud existuje selekce, upravi ji
+     podle aktualni pozice kurzoru a pozice
+     po provedeni blocku.
+     Urceno k implementaci Shift-Home a Shift-End
+     Nejak nevim, jak to presneji popsat :-)"
+
+    | startLine startCol endLine endCol curLine curCol cursorAtTheBeginning cursorAtTheEnd cursorWasShown flip extModeStandard |
+
+    curLine := cursorLine.
+    curCol := cursorCol.
 
     self hasSelection ifTrue: [
-        startLine := selectionStartLine .
-        startCol := selectionStartCol .
-        endLine := selectionEndLine .
-        endCol := selectionEndCol .
-    ] ifFalse: [
-        startLine := endLine :=  cursorLine .
-        startCol := endCol := cursorCol .
-    ].
-
-    "deselectim a provedu presun kurzoru..."
-    self unselect .
-    aBlock value .
-
-    "funguje dost mizerne, jen na jednom radku..."
-    (startCol - cursorCol) abs <= (endCol - cursorCol) abs
-        ifTrue: [
+        startLine := selectionStartLine.
+        startCol := selectionStartCol.
+        endLine := selectionEndLine.
+        endCol := selectionEndCol.
+    ] ifFalse:[
+        startLine := endLine := curLine.
+        startCol := curCol.
+        endCol := curCol - 1.
+    ].
+
+    cursorAtTheBeginning := (startLine == curLine) and:[startCol == curCol].
+    cursorAtTheEnd := (endLine == curLine) and:[endCol == (curCol - 1)]. 
+    self assert: cursorAtTheBeginning | cursorAtTheEnd.
+
+
+    cursorWasShown := self hideCursor.
+    aBlock value.
+
+    cursorAtTheBeginning ifTrue:[
+        (cursorCol == (endCol + 1) and:[cursorLine == endLine]) ifTrue:[
+                self unselect; showCursor.
+                ^self
+        ].
+
+        flip := cursorLine == endLine and:[cursorCol > endCol].
+        flip ifTrue:[ 
+            extModeStandard := UserPreferences current selectionExtensionMode == #standard.
+        ].
+        (cursorLine > endLine or:[flip]) ifTrue:[
+            (flip and:[ extModeStandard ]) ifTrue:[
+                startLine := endLine.
+                startCol := endCol + 1.
+            ].
+            endLine := cursorLine.
+            endCol := cursorCol - 1
+        ] ifFalse:[
+            startLine := cursorLine.
             startCol := cursorCol.
-        ] ifFalse: [
-            endCol := cursorCol - 1.
-        ].
+        ]
+    ] ifFalse:[
+        cursorAtTheEnd ifTrue:[
+            (cursorCol == startCol and:[cursorLine == startLine]) ifTrue:[
+                self unselect; showCursor.
+                ^self
+            ].
+            flip := cursorLine == startLine and:[cursorCol < startCol].
+            flip ifTrue:[ 
+                extModeStandard := UserPreferences current selectionExtensionMode == #standard.
+            ].  
+            (cursorLine < startLine or:[flip]) ifTrue:[
+                (flip and:[ extModeStandard ]) ifTrue:[
+                    endLine := startLine.
+                    endCol := startCol - 1.
+                ].
+                startLine := cursorLine.
+                startCol := cursorCol
+            ] ifFalse:[
+                endLine := cursorLine.
+                endCol := cursorCol - 1.
+            ]
+        ].
+    ].
     self selectFromLine:startLine col:startCol toLine: endLine col:endCol .
+    cursorWasShown ifTrue:[self showCursor].
+
+    "Modified: / 27-03-2014 / 10:05:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (comment): / 25-03-2014 / 17:18:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 autoMoveCursorToEndOfSelection
@@ -8095,14 +8322,18 @@
 !
 
 selectFromLine:startLine col:startCol toLine:endLine col:endCol
-    "when a range is selected, position the cursor behind the selection
-     for easier editing. Also typeOfSelection is nilled here."
 
     super selectFromLine:startLine col:startCol toLine:endLine col:endCol.
-    (selectionEndLine notNil and:[self autoMoveCursorToEndOfSelection]) ifTrue:[
-        self cursorLine:selectionEndLine col:(selectionEndCol + 1).
-    ].
+    "JV: That's actually rubbish as then you loose the original positon
+     and if user wants to extend/shring the selection further, you don't know
+     from which end to do it!!"
+"/    (selectionEndLine notNil and:[self autoMoveCursorToEndOfSelection]) ifTrue:[
+"/        self cursorLine:selectionEndLine col:(selectionEndCol + 1).
+"/    ].
     typeOfSelection := nil
+
+    "Modified: / 27-08-2013 / 13:28:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (comment): / 27-08-2013 / 15:58:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 selectToEndOfLine
@@ -8933,5 +9164,10 @@
 
 version_CVS
     ^ '$Header$'
+!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
 ! !
 
--- a/FontPanel.st	Sun May 01 18:21:59 2016 +0200
+++ b/FontPanel.st	Mon May 02 06:46:50 2016 +0200
@@ -886,7 +886,7 @@
 "/    
 "/    fontShown notNil ifTrue:[^ fontShown].
 "/
-"/    allFonts := self graphicsDevice 
+"/    allFonts := device 
 "/                    fontsInFamily:(currentFamily ? '*')
 "/                    face:(currentFace ? '*')
 "/                    style:(currentStyle ? '*')
@@ -933,7 +933,7 @@
             fntDescr face.
         ]
 
-"/    ^ self graphicsDevice facesInFamily:aFamilyName filtering:filter.
+"/    ^ device facesInFamily:aFamilyName filtering:filter.
 !
 
 getFamilyList 
@@ -968,7 +968,7 @@
     fontsPerFamily := d.
     ^ d keys asOrderedCollection sort
 "/
-"/    ^ self graphicsDevice fontFamiliesFiltering:combinedFilter.
+"/    ^ device fontFamiliesFiltering:combinedFilter.
 !
 
 getSizesInFamily:aFamilyName face:face style:style filtering:filter
@@ -1017,13 +1017,13 @@
     ^ sizes asOrderedCollection sort.
 
 "/    sizeUnit == #px ifTrue:[
-"/        ^ self graphicsDevice 
+"/        ^ device 
 "/             pixelSizesInFamily:(currentFamily ? '*')
 "/             face:(currentFace ? '*')
 "/             style:(currentStyle ? '*')
 "/             filtering:filter.
 "/    ] ifFalse:[
-"/        ^ self graphicsDevice 
+"/        ^ device 
 "/             sizesInFamily:(currentFamily ? '*')
 "/             face:(currentFace ? '*')
 "/             style:(currentStyle ? '*')
@@ -1048,7 +1048,7 @@
             fntDescr style.
         ]
 
-"/    ^ self graphicsDevice stylesInFamily:aFamilyName face:aFace filtering:filter.
+"/    ^ device stylesInFamily:aFamilyName face:aFace filtering:filter.
 !
 
 showPreview
--- a/ListView.st	Sun May 01 18:21:59 2016 +0200
+++ b/ListView.st	Mon May 02 06:46:50 2016 +0200
@@ -441,6 +441,23 @@
 "
 ! !
 
+!ListView class methodsFor:'initialization'!
+
+initialize
+    "Invoked at system start or when the class is dynamically loaded."
+
+    "/ please change as required (and remove this comment)
+
+    "/ DefaultForegroundColor := nil.
+    "/ DefaultBackgroundColor := nil.
+    DefaultTabPositions := self tab4Positions.
+    "/ UserDefaultTabPositions := nil.
+    "/ DefaultLeftMargin := nil.
+    "/ DefaultTopMargin := nil.
+
+    "Modified: / 22-04-2016 / 20:42:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !ListView class methodsFor:'defaults'!
 
 defaultTabPositions
@@ -479,8 +496,8 @@
                        #'text.tabPositions'
                        #'text.font')>
 
-    DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Black.
-    DefaultBackgroundColor := StyleSheet colorAt:'text.backgroundColor' default:White.
+    DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Color black.
+    DefaultBackgroundColor := StyleSheet colorAt:'text.backgroundColor' default:Color white.
     DefaultFont := StyleSheet fontAt:'text.font'.
     "/ that's not style, but a personal setting
     "/ DefaultTabPositions := StyleSheet at:'text.tabPositions'.
@@ -1163,7 +1180,7 @@
              don't use scroll here to avoid double redraw
             "
             viewOrigin := viewOrigin isNil ifTrue:[0@0] ifFalse:[(viewOrigin x) @ 0].
-            transformation := nil.
+            gc transformation:nil.
 
             oldFirst ~~ firstLineShown ifTrue:[
                 self originChanged:0 @ ((oldFirst - 1) * fontHeight negated).
@@ -1608,13 +1625,13 @@
     aFont isNil ifTrue:[
         ^ self error:'nil font' mayProceed:true
     ].
-    font ~~ aFont ifTrue:[
-        super font:(aFont onDevice:device).
+    gc font ~~ aFont ifTrue:[
         preferredExtent := nil.
         widthOfWidestLine := nil. "/ i.e. unknown
+        super font:aFont.
         self getFontParameters.
         realized ifTrue:[
-            (font graphicsDevice == device) ifTrue:[
+            (gc font graphicsDevice == gc device) ifTrue:[
                 self computeNumberOfLinesShown.
                 shown ifTrue:[
                     self redrawFromVisibleLine:1 to:nLinesShown
@@ -1785,7 +1802,7 @@
 !
 
 model:aModel
-    "define the receiver's model, from which the text is
+    "define the receivers model, from which the text is
      to be aquired via list- or aspect-messages, whenever its aspect
      changes."
 
@@ -2023,34 +2040,34 @@
     self paint:bg.
 
     (lineString notNil and:[lineString isString not]) ifTrue:[
-	w := lineString widthFrom:col to:(col min:len) on:self.
-	w <= 0 ifTrue:[
-	    w := font width.
-	    self fillRectangleX:x y:yf width:w height:fontHeight.
-	    self paint:fg
-	].
-	self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
-	    self drawVisibleLine:visLineNr with:fg and:bg
-	].
-	^ self
+        w := lineString widthFrom:col to:(col min:len) on:self.
+        w <= 0 ifTrue:[
+            w := gc font width.
+            self fillRectangleX:x y:yf width:w height:fontHeight.
+            self paint:fg
+        ].
+        self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
+            self drawVisibleLine:visLineNr with:fg and:bg
+        ].
+        ^ self
     ].
 
     (lineString isNil or:[col > len]) ifTrue:[
-	self fillRectangleX:x y:yf width:(font width) height:fontHeight.
-	self paint:fg
+        self fillRectangleX:x y:yf width:(gc font width) height:fontHeight.
+        self paint:fg
     ] ifFalse:[
-	characterString := lineString copyFrom:col to:col.
-
-	"/ remove lines color emphasis, to enforce color.
-	"/ otherwise blue text is not visible if selection-bg is blue
-	characterString := self withoutColorEmphasis:characterString ifFg:fg andBg:bg.
-	w := characterString widthOn:self.
-
-	self fillRectangleX:x y:yf width:w height:fontHeight.
-	self paint:fg.
-	self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
-	    self displayString:characterString x:x y:(y + fontAscent)
-	]
+        characterString := lineString copyFrom:col to:col.
+
+        "/ remove lines color emphasis, to enforce color.
+        "/ otherwise blue text is not visible if selection-bg is blue
+        characterString := self withoutColorEmphasis:characterString ifFg:fg andBg:bg.
+        w := characterString widthOn:self.
+
+        self fillRectangleX:x y:yf width:w height:fontHeight.
+        self paint:fg.
+        self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
+            self displayString:characterString x:x y:(y + fontAscent)
+        ]
     ]
 
     "Modified: / 15.12.1999 / 23:21:12 / cg"
@@ -2122,7 +2139,7 @@
                     fontIsFixedWidth ifTrue:[
                         w := (eCol - sCol + 1) * fontWidth
                     ] ifFalse:[
-                        w := font widthOf:lineString from:sCol to:eCol
+                        w := gc font widthOf:lineString from:sCol to:eCol
                     ]
                 ] ifFalse:[
                     w := lineString widthFrom:sCol to:endCol on:self
@@ -2133,16 +2150,16 @@
                               height:fontHeight.
             ].
             self paint:fg on:bg.
-            w notNil ifTrue:[
-                "/ clip req'd for VISTAs new font rendering (which seems to shoot over the compute
-                self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
-                    "/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
-                    self displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
-                ]
-            ] ifFalse:[
+"/            w notNil ifTrue:[
+"/                "/ clip req'd for VISTAs new font rendering (which seems to shoot over the compute
+"/                self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
+"/                    "/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
+"/                    self displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
+"/                ]
+"/            ] ifFalse:[
                 "/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
-                self displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
-            ].
+                self displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent) opaque:false maxWidth:self width
+"/            ].
         ]
     ]
 
@@ -2236,13 +2253,11 @@
 
 fillRectangleX:x y:y width:w height:h
     "fill rectangle; checks whether the rectangle already is filled with
-     the current paint (#redrawX:y:w:h).
-    "
-    backgroundAlreadyClearedColor ~~ paint ifTrue:[
-	super fillRectangleX:x y:y width:w height:h
+     the current paint (#redrawX:y:w:h)."
+
+    backgroundAlreadyClearedColor ~~ self paint ifTrue:[
+        super fillRectangleX:x y:y width:w height:h
     ]
-
-
 !
 
 invalidateLine:line
@@ -2341,7 +2356,7 @@
 mouseWheelZoom:amount
     "CTRL-wheel action"
 
-    |oldSize newSize delta mul|
+    |oldSize newSize delta mul currentFont|
 
     amount > 0 ifTrue:[
         "/ delta := 1.  mul := 1.
@@ -2351,11 +2366,12 @@
         delta := 0. mul := 0.8.
     ].
 
-    font sizeUnit == #px ifFalse:[
-        oldSize := font size.
+    currentFont := gc font.
+    currentFont sizeUnit == #px ifFalse:[
+        oldSize := currentFont size.
         newSize := ((oldSize + delta)* mul) max:2.
         newSize ~= oldSize ifTrue:[
-            self font:(font asSize:newSize).
+            self font:(currentFont asSize:newSize).
         ]
     ].
 !
@@ -2373,7 +2389,7 @@
     startLine := self visibleLineOfY:y.
     stopLine := self visibleLineOfY:(y + h).
 
-    saveClip := clipRect.
+    saveClip := gc clippingBoundsOrNil.
     self clippingRectangle:(Rectangle left:x top:y width:w height:h).
     self paint:bgColor.
     self fillRectangleX:x y:y width:w height:h.
@@ -2668,7 +2684,7 @@
             linePixelWidth := lineString widthOn:self
         ] ifFalse:[
             lineString := lineString string.
-            linePixelWidth := font widthOf:lineString.
+            linePixelWidth := gc font widthOf:lineString.
         ]
     ] ifFalse:[
         linePixelWidth := 0
@@ -2690,7 +2706,7 @@
     "/ use a binary search, initialized with some guess.
 
     "/ a guess: take some 'average' character's width and compute an initial guess
-    runCol := x // (font widthOf:'e').
+    runCol := x // (gc font widthOf:'e').
     runCol := runCol min:lineString size.
 
 "/    runCol := lineString size // 2.
@@ -2700,8 +2716,8 @@
         posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
         posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
     ] ifFalse:[
-        posLeft := font widthOf:lineString from:1 to:(runCol - 1).
-        posRight := font widthOf:lineString from:1 to:runCol.
+        posLeft := gc font widthOf:lineString from:1 to:(runCol - 1).
+        posRight := gc font widthOf:lineString from:1 to:runCol.
     ].
 
     done := (posLeft <= xRel) and:[posRight > xRel].
@@ -2716,7 +2732,7 @@
             hasEmphasis ifTrue:[
                 posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
             ] ifFalse:[
-                posRight := font widthOf:lineString from:1 to:runCol
+                posRight := gc font widthOf:lineString from:1 to:runCol
             ]
         ] ifFalse:[
             (posLeft > xRel) ifTrue:[
@@ -2726,7 +2742,7 @@
                 hasEmphasis ifTrue:[
                     posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
                 ] ifFalse:[
-                    posLeft := font widthOf:lineString from:1 to:(runCol - 1)
+                    posLeft := gc font widthOf:lineString from:1 to:(runCol - 1)
                 ]
             ]
         ].
@@ -2843,10 +2859,10 @@
      Therefore, this method should be redefined in views which will be used
      with national characters (i.e. editTextViews)."
 
-    |hMax|
-
-    font := font onDevice:device.
-    hMax := font height.
+    |hMax newDeviceFont|
+
+    newDeviceFont := gc createFontOnDevice.
+    hMax := newDeviceFont height.
 
     includesNonStrings == true ifTrue:[
         "/
@@ -2865,14 +2881,14 @@
                               ].
 
     ].
-    fontHeight := font maxHeight.
+    fontHeight := newDeviceFont maxHeight.
     "/ fontHeight := font height.
     fontHeight := fontHeight max:(hMax + lineSpacing).
-    fontAscent := font ascent. "/ maxAscent. -- see SelectionInListViews selection in motif style
+    fontAscent := newDeviceFont ascent. "/ maxAscent. -- see SelectionInListViews selection in motif style
     "/ fontAscent := font maxAscent "ascent". "/ maxAscent. -- see SelectionInListViews selection in motif style
     "/ fontAscent := (font maxAscent + font ascent) // 2. "/ maxAscent. -- see SelectionInListViews selection in motif style
-    fontWidth := font width.
-    fontIsFixedWidth := font isFixedWidth.
+    fontWidth := newDeviceFont width.
+    fontIsFixedWidth := newDeviceFont isFixedWidth.
 
     "Modified: 3.7.1997 / 12:24:25 / cg"
 !
@@ -2881,14 +2897,12 @@
     "ask my model (if any) for the text via the listMsg.
      If there is no listMessage, try aspect for backward compatibility."
 
-    |newText msg doCompareIfUnchanged|
+    |newText msg|
 
     model notNil ifTrue:[
         msg := listMsg ? aspectMsg.
 
         msg notNil ifTrue:[
-            doCompareIfUnchanged := compareModelOnUpdate.
-
             newText := model perform:msg.
             "/ cg: this makes many optimizations (virtualArray) useless;
             "/ I do not think that this is a good idea:
@@ -2896,15 +2910,9 @@
             "/ so I changed it to:
             (newText notNil and:[newText isString]) ifTrue:[
                 newText := newText asStringCollection.
-            ] ifFalse:[
-                newText == model ifTrue:[
-                    "/ I must operate on a copy
-                    newText := model asNewOrderedCollection.
-                    "/ doCompareIfUnchanged := false.
-                ].
             ].
 
-            doCompareIfUnchanged ifTrue:[
+            compareModelOnUpdate ifTrue:[
                 "/ see if there is a change at all.
                 "/ use to compare using =, but that's not enough in case of emphasis change.
                 newText size == list size ifTrue:[
@@ -3068,7 +3076,7 @@
             newW := 0
         ] ifFalse:[
             (newEntry isSingleByteString) ifTrue:[
-                newW := font widthOf:newEntry
+                newW := gc font widthOf:newEntry
             ] ifFalse:[
                 newW := newEntry widthOn:self
             ].
@@ -3081,7 +3089,7 @@
                 oldW := 0
             ] ifFalse:[
                 (oldEntry isSingleByteString) ifTrue:[
-                    oldW := font widthOf:oldEntry
+                    oldW := gc font widthOf:oldEntry
                 ] ifFalse:[
                     oldW := oldEntry widthOn:self
                 ].
@@ -3204,7 +3212,7 @@
 
     entry isNil ifTrue:[^ 0].
     (entry isSingleByteString) ifTrue:[
-        ^ font widthOf:entry
+        ^ gc font widthOf:entry
     ].
     ^ entry widthOn:self
 
@@ -3242,7 +3250,7 @@
     self from:first to:last do:[:line |
         line notNil ifTrue:[
             (line isSingleByteString) ifTrue:[
-                thisLen := font widthOf:line
+                thisLen := gc font widthOf:line
             ] ifFalse:[
                 thisLen := line widthOn:self
             ].
@@ -3325,7 +3333,7 @@
                     lText := (line widthOn:self) + (fontWidth * (tcol - lineSize))
                 ] ifFalse:[
                     (line isSingleByteString) ifTrue:[
-                        lText := (font widthOf:line from:1 to:tcol)
+                        lText := (gc font widthOf:line from:1 to:tcol)
                     ] ifFalse:[
                         lText := line widthFrom:1 to:tcol on:self.
                     ]
@@ -3439,9 +3447,11 @@
 heightForLines:numberOfLines
     "return the height of the receiver, if numberOfLines are to be displayed"
 
+    |realFont|
+
     "need a device font for query"
-    font := font onDevice:device.
-    ^ numberOfLines * fontHeight + topMargin + font descent + (lineSpacing) + (margin * 2)
+    realFont := gc createFontOnDevice.
+    ^ numberOfLines * fontHeight + topMargin + realFont descent + (lineSpacing) + (margin * 2)
 
     "Created: 27.1.1996 / 16:55:39 / cg"
 !
@@ -3450,7 +3460,7 @@
     "return the height of the contents in pixels
      - used for scrollbar interface"
 
-    | numLines |
+    | numLines  realFont|
 
     numLines := self numberOfLines.
     numLines == 0 ifTrue:[^ 0].
@@ -3464,11 +3474,11 @@
     "
      need device-font for query
     "
-    font := font onDevice:device.
+    realFont := gc createFontOnDevice.
     ^ numLines * fontHeight "don't take font height here - think of LabelAndIcons"
 "/                            + textStartTop
                             - (lineSpacing // 2)
-                            + (font descent)
+                            + (realFont descent)
 "/                            + (font descent)
 "/                            + (font descent * 2) "makes it look better"
                                 .
@@ -3599,9 +3609,9 @@
 !
 
 preferredExtentForLines:numLines cols:numCols
-    ^ (((font widthOf:'x') * numCols + margin + margin)
+    ^ (((gc font widthOf:'x') * numCols + margin + margin)
       @
-      (fontHeight * numLines + margin + margin + font descent + lineSpacing + topMargin)).
+      (fontHeight * numLines + margin + margin + gc font descent + lineSpacing + topMargin)).
 
     "Modified: 26.5.1996 / 12:26:41 / cg"
 !
@@ -3629,11 +3639,12 @@
         ^ widthOfWidestLine + (leftMargin * 2)
     ].
 
-    (d := device) isNil ifTrue:[
+    (d := gc device) isNil ifTrue:[
         "/ mhmh - really dont know yet
         d := Screen current
     ].
-    f := font := font onDevice:d.
+    f := gc font onDevice:d.
+    gc font:f.
 
     checkedLinesForWidthOfContentsComputation isNil ifTrue:[
         start := 1.
@@ -3722,7 +3733,8 @@
         "/ mhmh - really dont know yet
         d := Screen current
     ].
-    f := font := font onDevice:d.
+    f := gc font onDevice:d.
+    gc font:f.
 
     (line isSingleByteString) ifTrue:[
         ^ f widthOf:line
@@ -3960,7 +3972,7 @@
     "return the amount to scroll when stepping up/down.
      Here, the scrolling unit is characters."
 
-    ^ font width
+    ^ gc font width
 
     "Created: / 21.5.1999 / 15:55:06 / cg"
 !
@@ -3990,7 +4002,7 @@
      no, the above does not look good, if you click / select at the
      far right - makes selecting so difficult ...
     "
-    (xVis >= 0 and:[xVis < (width - font width)]) ifTrue:[^ self].
+    (xVis >= 0 and:[xVis < (width - gc font width)]) ifTrue:[^ self].
 
     self scrollHorizontalTo:(xWant - (width // 2)).
 !
@@ -4197,20 +4209,20 @@
     leftOffset := viewOrigin x.
 
     aColNr == 1 ifTrue:[
-	leftOffset ~~ 0 ifTrue:[
-	    self scrollLeft:leftOffset.
-	].
-	^ self
+        leftOffset ~~ 0 ifTrue:[
+            self scrollLeft:leftOffset.
+        ].
+        ^ self
     ].
 
-    pxlOffset := font width * (aColNr - 1).
+    pxlOffset := gc font width * (aColNr - 1).
 
     pxlOffset < leftOffset ifTrue:[
-	self scrollLeft:(leftOffset - pxlOffset)
+        self scrollLeft:(leftOffset - pxlOffset)
     ] ifFalse:[
-	pxlOffset > leftOffset ifTrue:[
-	    self scrollRight:(pxlOffset - leftOffset)
-	]
+        pxlOffset > leftOffset ifTrue:[
+            self scrollRight:(pxlOffset - leftOffset)
+        ]
     ]
 !
 
@@ -4409,7 +4421,7 @@
      to be visible if it is positioned right behind the longest line of text.
      The default returned here is the width of a blank (to beautify italic text)"
 
-    ^ font width
+    ^ gc font width
 !
 
 scrollTo:anOrigin redraw:doRedraw
@@ -5410,5 +5422,12 @@
 
 version_CVS
     ^ '$Header$'
+!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
 ! !
 
+
+ListView initialize!
--- a/Make.proto	Sun May 01 18:21:59 2016 +0200
+++ b/Make.proto	Mon May 02 06:46:50 2016 +0200
@@ -70,6 +70,13 @@
 
 
 
+# Enforce recompilation of package definition class if Mercurial working
+# copy state changes. Together with --guessVersion it ensures that package
+# definition class always contains correct binary revision string.
+ifneq (**NOHG**, $(shell hg root 2> /dev/null || echo -n '**NOHG**'))
+stx_libwidg.$(O): $(shell hg root)/.hg/dirstate
+endif
+
 
 
 
--- a/TextView.st	Sun May 01 18:21:59 2016 +0200
+++ b/TextView.st	Mon May 02 06:46:50 2016 +0200
@@ -293,15 +293,15 @@
     "extract values from the styleSheet and cache them in class variables"
 
     <resource: #style (#'textView.background'
-		       #'text.selectionForegroundColor'
-		       #'text.selectionBackgroundColor'
-		       #'text.alternativeSelectionForegroundColor'
-		       #'text.alternativeSelectionBackgroundColor'
-		       #'textView.font'
-		       #'text.wordSelectCatchesBlanks'
-		       #'text.st80Selections')>
-
-    DefaultViewBackground := StyleSheet colorAt:'textView.background' default:White.
+                       #'text.selectionForegroundColor'
+                       #'text.selectionBackgroundColor'
+                       #'text.alternativeSelectionForegroundColor'
+                       #'text.alternativeSelectionBackgroundColor'
+                       #'textView.font'
+                       #'text.wordSelectCatchesBlanks'
+                       #'text.st80Selections')>
+
+    DefaultViewBackground := StyleSheet colorAt:'textView.background' default:Color white.
     DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'.
     DefaultSelectionBackgroundColor := StyleSheet colorAt:'text.selectionBackgroundColor'.
 "/    DefaultAlternativeSelectionForegroundColor := StyleSheet colorAt:'text.alternativeSelectionForegroundColor' default:DefaultSelectionForegroundColor.
@@ -385,61 +385,61 @@
 
     <resource: #canvas>
 
-    ^ 
+    ^
     #(FullSpec
        name: searchDialogSpec
-       window: 
+       window:
       (WindowSpec
-         label: 'String search'
-         name: 'String search'
-         min: (Point 10 10)
-         max: (Point 1280 1024)
+	 label: 'String search'
+	 name: 'String search'
+	 min: (Point 10 10)
+	 max: (Point 1280 1024)
          bounds: (Rectangle 0 0 429 349)
        )
-       component: 
+       component:
       (SpecCollection
-         collection: (
-          (LabelSpec
-             label: 'SearchPattern:'
-             name: 'label'
-             layout: (LayoutFrame 1 0.0 3 0 -1 1.0 20 0)
-             level: 0
-             translateLabel: true
-             adjust: left
-           )
-          (ComboBoxSpec
-             name: 'patternComboBox'
-             layout: (LayoutFrame 2 0.0 26 0 -2 1.0 48 0)
-             activeHelpKey: searchPattern
-             tabable: true
-             model: searchPattern
-             immediateAccept: false
-             acceptOnLeave: true
-             acceptOnReturn: true
-             acceptOnTab: true
-             acceptOnLostFocus: true
-             acceptOnPointerLeave: false
-             autoSelectInitialText: true
-             comboList: patternList
-           )
-          (VerticalPanelViewSpec
-             name: 'VerticalPanel1'
+	 collection: (
+	  (LabelSpec
+	     label: 'SearchPattern:'
+	     name: 'label'
+	     layout: (LayoutFrame 1 0.0 3 0 -1 1.0 20 0)
+	     level: 0
+	     translateLabel: true
+	     adjust: left
+	   )
+	  (ComboBoxSpec
+	     name: 'patternComboBox'
+	     layout: (LayoutFrame 2 0.0 26 0 -2 1.0 48 0)
+	     activeHelpKey: searchPattern
+	     tabable: true
+	     model: searchPattern
+	     immediateAccept: false
+	     acceptOnLeave: true
+	     acceptOnReturn: true
+	     acceptOnTab: true
+	     acceptOnLostFocus: true
+	     acceptOnPointerLeave: false
+	     autoSelectInitialText: true
+	     comboList: patternList
+	   )
+	  (VerticalPanelViewSpec
+	     name: 'VerticalPanel1'
              layout: (LayoutFrame 0 0.0 52 0 0 1.0 -32 1)
-             horizontalLayout: fit
-             verticalLayout: top
-             component: 
-            (SpecCollection
-               collection: (
-                (CheckBoxSpec
-                   label: 'Case Sensitive'
-                   name: 'ignoreCaseCheckBox'
-                   activeHelpKey: searchCaseSensitive
-                   level: 0
-                   tabable: true
-                   model: caseSensitive
-                   translateLabel: true
+	     horizontalLayout: fit
+	     verticalLayout: top
+	     component:
+	    (SpecCollection
+	       collection: (
+		(CheckBoxSpec
+		   label: 'Case Sensitive'
+		   name: 'ignoreCaseCheckBox'
+		   activeHelpKey: searchCaseSensitive
+		   level: 0
+		   tabable: true
+		   model: caseSensitive
+		   translateLabel: true
                    extent: (Point 429 24)
-                 )
+		 )
                 (ViewSpec
                    name: 'MatchBox'
                    component: 
@@ -468,16 +468,16 @@
                     
                    )
                    extent: (Point 429 24)
-                 )
-                (CheckBoxSpec
-                   label: 'Search Full Words'
-                   name: 'CheckBox2'
-                   activeHelpKey: searchFullWord
-                   level: 0
-                   enableChannel: searchFullWordEnabled
-                   tabable: true
-                   model: searchFullWord
-                   translateLabel: true
+		 )
+		(CheckBoxSpec
+		   label: 'Search Full Words'
+		   name: 'CheckBox2'
+		   activeHelpKey: searchFullWord
+		   level: 0
+		   enableChannel: searchFullWordEnabled
+		   tabable: true
+		   model: searchFullWord
+		   translateLabel: true
                    extent: (Point 429 24)
                  )
                 (CheckBoxSpec
@@ -489,31 +489,31 @@
                    model: searchAtBeginOfLineOnly
                    translateLabel: true
                    extent: (Point 429 24)
-                 )
-                (CheckBoxSpec
-                   label: 'Variable Only'
-                   name: 'CheckBox1'
-                   activeHelpKey: searchVariable
-                   level: 0
-                   visibilityChannel: searchVariableVisible
-                   enableChannel: searchVariableEnabled
-                   tabable: true
-                   model: searchVariable
-                   translateLabel: true
-                   labelChannel: stringWithVariableUnderCursorHolder
+		 )
+		(CheckBoxSpec
+		   label: 'Variable Only'
+		   name: 'CheckBox1'
+		   activeHelpKey: searchVariable
+		   level: 0
+		   visibilityChannel: searchVariableVisible
+		   enableChannel: searchVariableEnabled
+		   tabable: true
+		   model: searchVariable
+		   translateLabel: true
+		   labelChannel: stringWithVariableUnderCursorHolder
                    extent: (Point 429 24)
-                 )
-                (CheckBoxSpec
-                   label: 'Select Lines'
-                   name: 'CheckBox3'
-                   activeHelpKey: selectLines
-                   level: 0
-                   initiallyInvisible: true
-                   tabable: true
-                   model: selectLines
-                   translateLabel: true
-                   extent: (Point 302 24)
-                 )
+		 )
+		(CheckBoxSpec
+		   label: 'Select Lines'
+		   name: 'CheckBox3'
+		   activeHelpKey: selectLines
+		   level: 0
+		   initiallyInvisible: true
+		   tabable: true
+		   model: selectLines
+		   translateLabel: true
+		   extent: (Point 302 24)
+		 )
                 (CheckBoxSpec
                    label: 'Wrap at End of Text (forward only)'
                    name: 'CheckBox7'
@@ -530,35 +530,35 @@
                    verticalLayout: fit
                    ignoreInvisibleComponents: false
                    elementsChangeSize: true
-                   component: 
-                  (SpecCollection
-                     collection: (
-                      (CheckBoxSpec
+		   component:
+		  (SpecCollection
+		     collection: (
+		      (CheckBoxSpec
                          label: 'Replace By:'
-                         name: 'CheckBox4'
-                         activeHelpKey: replaceText
-                         level: 0
-                         enableChannel: replaceEnabled
-                         tabable: true
-                         model: replaceBoolean
-                         translateLabel: true
+			 name: 'CheckBox4'
+			 activeHelpKey: replaceText
+			 level: 0
+			 enableChannel: replaceEnabled
+			 tabable: true
+			 model: replaceBoolean
+			 translateLabel: true
                          resizeForLabel: true
                          useDefaultExtent: true
-                       )
-                      (InputFieldSpec
-                         name: 'ReplaceEntryField'
-                         activeHelpKey: replaceText
-                         visibilityChannel: replaceBoolean
-                         enableChannel: replaceBoolean
-                         model: replaceTextHolder
-                         acceptOnReturn: true
-                         acceptOnTab: true
-                         acceptOnPointerLeave: true
+		       )
+		      (InputFieldSpec
+			 name: 'ReplaceEntryField'
+			 activeHelpKey: replaceText
+			 visibilityChannel: replaceBoolean
+			 enableChannel: replaceBoolean
+			 model: replaceTextHolder
+			 acceptOnReturn: true
+			 acceptOnTab: true
+			 acceptOnPointerLeave: true
                          extent: (Point 299 24)
-                       )
-                      )
-                    
-                   )
+		       )
+		      )
+
+		   )
                    extent: (Point 429 24)
                  )
                 (CheckBoxSpec
@@ -582,60 +582,60 @@
                    model: replacePreserveCaseBoolean
                    translateLabel: true
                    extent: (Point 429 24)
-                 )
-                )
-              
-             )
-           )
-          (HorizontalPanelViewSpec
-             name: 'horizontalPanelView'
+		 )
+		)
+
+	     )
+	   )
+	  (HorizontalPanelViewSpec
+	     name: 'horizontalPanelView'
              layout: (LayoutFrame 0 0.0 -32 1.0 -16 1.0 0 1.0)
-             level: 0
-             horizontalLayout: fitSpace
-             verticalLayout: center
-             horizontalSpace: 3
-             verticalSpace: 3
-             ignoreInvisibleComponents: true
-             reverseOrderIfOKAtLeft: true
-             component: 
-            (SpecCollection
-               collection: (
-                (ActionButtonSpec
-                   label: 'Cancel'
-                   name: 'cancelButton'
-                   level: 2
-                   translateLabel: true
-                   tabable: true
-                   model: cancel
+	     level: 0
+	     horizontalLayout: fitSpace
+	     verticalLayout: center
+	     horizontalSpace: 3
+	     verticalSpace: 3
+	     ignoreInvisibleComponents: true
+	     reverseOrderIfOKAtLeft: true
+	     component:
+	    (SpecCollection
+	       collection: (
+		(ActionButtonSpec
+		   label: 'Cancel'
+		   name: 'cancelButton'
+		   level: 2
+		   translateLabel: true
+		   tabable: true
+		   model: cancel
                    useDefaultExtent: true
-                 )
-                (ActionButtonSpec
-                   label: 'Prev'
-                   name: 'prevButton'
-                   level: 2
-                   translateLabel: true
-                   tabable: true
-                   model: prevAction
+		 )
+		(ActionButtonSpec
+		   label: 'Prev'
+		   name: 'prevButton'
+		   level: 2
+		   translateLabel: true
+		   tabable: true
+		   model: prevAction
                    useDefaultExtent: true
-                 )
-                (ActionButtonSpec
-                   label: 'Next'
-                   name: 'nextButton'
-                   level: 2
-                   borderWidth: 1
-                   translateLabel: true
-                   tabable: true
-                   model: nextAction
-                   isDefault: true
+		 )
+		(ActionButtonSpec
+		   label: 'Next'
+		   name: 'nextButton'
+		   level: 2
+		   borderWidth: 1
+		   translateLabel: true
+		   tabable: true
+		   model: nextAction
+		   isDefault: true
                    useDefaultExtent: true
-                 )
-                )
-              
-             )
-             keepSpaceForOSXResizeHandleH: true
-           )
-          )
-        
+		 )
+		)
+
+	     )
+	     keepSpaceForOSXResizeHandleH: true
+	   )
+	  )
+
        )
      )
 ! !
@@ -792,11 +792,11 @@
 setupForFile:aFileName
     "setup a textView on a file; return the textView"
 
-    |textView f|
+    |textView|
 
     textView := self setupEmpty.
     aFileName notNil ifTrue:[
-	textView setupForFile:aFileName.
+        textView setupForFile:aFileName.
     ].
 
     ^ textView
@@ -1178,7 +1178,7 @@
     selectionFgColor := color1 onDevice:device.
     selectionBgColor := color2 onDevice:device.
     self hasSelection ifTrue:[
-	self invalidate
+        self invalidate
     ]
 
     "Modified: 29.5.1996 / 16:22:15 / cg"
@@ -1264,7 +1264,7 @@
      matchingFamilyFonts matchingFamilyFaceFonts matchingFamilyFaceStyleFonts
      matchingFamilyFaceStyleSizeFonts|
 
-    fontsEncoding := font encoding.
+    fontsEncoding := gc font encoding.
 
     pref := FontDescription preferredFontEncodingFor:newEncoding.
 
@@ -1281,10 +1281,10 @@
 
     device flushListOfAvailableFonts.
     matchingFonts := device listOfAvailableFonts select:filter.
-    matchingFamilyFonts := matchingFonts select:[:f | f family = font family].
-    matchingFamilyFaceFonts := matchingFamilyFonts select:[:f | f face = font face].
-    matchingFamilyFaceStyleFonts := matchingFamilyFaceFonts select:[:f | f style = font style].
-    matchingFamilyFaceStyleSizeFonts := matchingFamilyFaceStyleFonts select:[:f | f size = font size].
+    matchingFamilyFonts := matchingFonts select:[:f | f family = gc font family].
+    matchingFamilyFaceFonts := matchingFamilyFonts select:[:f | f face = gc font face].
+    matchingFamilyFaceStyleFonts := matchingFamilyFaceFonts select:[:f | f style = gc font style].
+    matchingFamilyFaceStyleSizeFonts := matchingFamilyFaceStyleFonts select:[:f | f size = gc font size].
     matchingFamilyFaceStyleSizeFonts size > 0 ifTrue:[
         defaultFont := matchingFamilyFaceStyleSizeFonts first
     ] ifFalse:[
@@ -1338,27 +1338,27 @@
     "mouse-move while button was pressed - handle selection changes"
 
     (clickLine isNil or:[clickPos isNil]) ifTrue:[
-        dragIsActive := false.
-        ^ self
+	dragIsActive := false.
+	^ self
     ].
 
     dragIsActive ifTrue:[
-        (clickPos dist:(x@y)) >= 5.0 ifTrue:[
-            dragIsActive := false.
-
-            self hasSelection ifTrue:[
-                dropSource startDragIn:self at:(x@y)
-            ]
-        ].
-        ^ self
+	(clickPos dist:(x@y)) >= 5.0 ifTrue:[
+	    dragIsActive := false.
+
+	    self hasSelection ifTrue:[
+		dropSource startDragIn:self at:(x@y)
+	    ]
+	].
+	^ self
     ].
 
     "is it the select or 1-button ?"
     buttonState == 0 ifTrue:[^ self].
     self sensor leftButtonPressed ifFalse:[
-        "/ self setPrimarySelection.
-        "/ self selectionChanged.
-        ^ self
+	"/ self setPrimarySelection.
+	"/ self selectionChanged.
+	^ self
     ].
 "/    (device buttonMotionMask:buttonState includesButton:#select) ifFalse:[
 "/        (device buttonMotionMask:buttonState includesButton:1) ifFalse:[
@@ -1369,25 +1369,25 @@
     "if moved outside of view, start autoscroll"
 
     ((y < 0) and:[firstLineShown ~~ 0]) ifTrue:[
-        self compressMotionEvents:false.
+	self compressMotionEvents:false.
         (self startAutoScrollUp:y negated) ifTrue:[
             ^ self
         ].
     ].
     (y > height) ifTrue:[
-        self compressMotionEvents:false.
-        (self startAutoScrollDown:(y - height)) ifTrue:[ 
+	self compressMotionEvents:false.
+        (self startAutoScrollDown:(y - height)) ifTrue:[
             ^ self
         ].
     ].
     ((x < 0) and:[viewOrigin x ~~ 0]) ifTrue:[
-        self compressMotionEvents:false.
+	self compressMotionEvents:false.
         (self startAutoScrollLeft:x) ifTrue:[
             ^ self
         ].
     ].
     (x > width) ifTrue:[
-        self compressMotionEvents:false.
+	self compressMotionEvents:false.
         (self startAutoScrollRight:(x - width)) ifTrue:[
             ^ self
         ].
@@ -1395,7 +1395,7 @@
 
     "move inside - stop autoscroll if any"
     autoScrollBlock notNil ifTrue:[
-        self stopScrollSelect
+	self stopScrollSelect
     ].
 
     self extendSelectionToX:x y:y setPrimarySelection:false.
@@ -1475,20 +1475,20 @@
     "mouse- button release - turn off autoScroll if any"
 
     (button == 1) ifTrue:[
-        self hasSelection ifTrue:[
-            self setPrimarySelection.
-            self selectionChanged.
-        ].
-
-        autoScrollBlock notNil ifTrue:[
-            self stopScrollSelect
-        ].
-        dragIsActive ifTrue:[
-            self unselect
-        ].
-        clickPos := nil.
+	self hasSelection ifTrue:[
+	    self setPrimarySelection.
+	    self selectionChanged.
+	].
+
+	autoScrollBlock notNil ifTrue:[
+	    self stopScrollSelect
+	].
+	dragIsActive ifTrue:[
+	    self unselect
+	].
+	clickPos := nil.
     ] ifFalse:[
-        super buttonRelease:button x:x y:y
+	super buttonRelease:button x:x y:y
     ].
     dragIsActive := false.
 
@@ -1510,153 +1510,153 @@
     "
     ((sel := self selection) size == 1
     and:[(sel := sel at:1) size == 1]) ifTrue:[
-        ch := sel at:1.
-
-        ((self isOpeningParenthesis:ch)
-        or:[ (self isClosingParenthesis:ch) ]) ifTrue:[
-            self
-                searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
-                ifFound:[:line :col |
-                              |prevLine prevCol moveBack pos1|
-
-                              prevLine := firstLineShown.
-                              prevCol := viewOrigin x.
-                              self selectFromLine:selectionStartLine col:selectionStartCol
-                                           toLine:line col:col.
-
-                              self sensor ctrlDown ifFalse:[
-                                  "/ undo scroll operation ...
-                                  self withCursor:Cursor eye do:[
-                                      |delayCount|
-
-                                      moveBack := false.
-                                      (self isClosingParenthesis:ch) ifTrue:[
-                                           (firstLineShown ~~ prevLine or:[prevCol ~~ viewOrigin x]) ifTrue:[
-                                               moveBack := true
-                                           ]
-                                      ] ifFalse:[
-                                           selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
-                                               self makeLineVisible:selectionEndLine.
-                                               moveBack := true
-                                           ]
-                                      ].
-                                      moveBack ifTrue:[
-                                           delayCount  := 0.
-                                           pos1 := x@y.
-                                           self invalidateRepairNow:true.
-                                           Delay waitForSeconds:MatchDelayTime.
-                                           delayCount := delayCount + MatchDelayTime.
-                                           [self sensor hasUserEventFor:self] whileFalse:[
-                                                Delay waitForSeconds:MatchDelayTime / 2.
-                                                delayCount := delayCount + (MatchDelayTime / 2).
-                                                delayCount > 2 ifTrue:[
-                                                    self cursor:Cursor eyeClosed.
-                                                ].
-                                                delayCount >= 2.3 ifTrue:[
-                                                    self cursor:Cursor eye.
-                                                    delayCount := 0.
-                                                ]
-                                           ].
-                                           self scrollToLine:prevLine; scrollToCol:prevCol.
-                                      ].
-                                  ]
-                              ].
-                              ^ self.
-                          ]
-                ifNotFound:[self showNotFound]
-                onError:[self beep]
-                openingCharacters:((parenthesisSpecification at:#open) ", '([{'")
-                closingCharacters:((parenthesisSpecification at:#close) ", ')]}'").
-            selectStyle := nil
-        ]
+	ch := sel at:1.
+
+	((self isOpeningParenthesis:ch)
+	or:[ (self isClosingParenthesis:ch) ]) ifTrue:[
+	    self
+		searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
+		ifFound:[:line :col |
+			      |prevLine prevCol moveBack pos1|
+
+			      prevLine := firstLineShown.
+			      prevCol := viewOrigin x.
+			      self selectFromLine:selectionStartLine col:selectionStartCol
+					   toLine:line col:col.
+
+			      self sensor ctrlDown ifFalse:[
+				  "/ undo scroll operation ...
+				  self withCursor:Cursor eye do:[
+				      |delayCount|
+
+				      moveBack := false.
+				      (self isClosingParenthesis:ch) ifTrue:[
+					   (firstLineShown ~~ prevLine or:[prevCol ~~ viewOrigin x]) ifTrue:[
+					       moveBack := true
+					   ]
+				      ] ifFalse:[
+					   selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
+					       self makeLineVisible:selectionEndLine.
+					       moveBack := true
+					   ]
+				      ].
+				      moveBack ifTrue:[
+					   delayCount  := 0.
+					   pos1 := x@y.
+					   self invalidateRepairNow:true.
+					   Delay waitForSeconds:MatchDelayTime.
+					   delayCount := delayCount + MatchDelayTime.
+					   [self sensor hasUserEventFor:self] whileFalse:[
+						Delay waitForSeconds:MatchDelayTime / 2.
+						delayCount := delayCount + (MatchDelayTime / 2).
+						delayCount > 2 ifTrue:[
+						    self cursor:Cursor eyeClosed.
+						].
+						delayCount >= 2.3 ifTrue:[
+						    self cursor:Cursor eye.
+						    delayCount := 0.
+						]
+					   ].
+					   self scrollToLine:prevLine; scrollToCol:prevCol.
+				      ].
+				  ]
+			      ].
+			      ^ self.
+			  ]
+		ifNotFound:[self showNotFound]
+		onError:[self beep]
+		openingCharacters:((parenthesisSpecification at:#open) ", '([{'")
+		closingCharacters:((parenthesisSpecification at:#close) ", ')]}'").
+	    selectStyle := nil
+	]
     ].
 
     (self st80SelectMode or:[ self sensor ctrlDown]) ifTrue:[
-        "/ st80 selects:
-        "/   - if clicked right after a parenthesis -> select to matching parenthesis
-        "/   - if clicked right after a quote -> select to matching quote (unless escaped ;-)
-        "/   - if clicked at beginning of the line  -> select that line
-        "/   - if clicked at the top of the text    -> select all
-        "/ however, do none of the above, if clicked on a parenthesis
-        clickCol == 1 ifTrue:[
-            clickLine == 1 ifTrue:[
-                self selectAll.
-                ^ self.
-            ].
-            self selectLineAtY:y.
-            selectStyle := #line.
-            ^ self
-        ].
-
-        matchCol := nil.
-        "/ see what is to the left of that character ...
-        clickCol > 1 ifTrue:[
-            ch := self characterAtLine:clickLine col:clickCol-1.
-            (self isOpeningParenthesis:ch) ifTrue:[
-                matchCol := clickCol - 1
-            ] ifFalse:[
-                ('"''|' includes:ch) ifTrue:[
-                    scanCol := clickCol - 1.
-                    fwdScan := true.
-                    scanCh := ch.
-                ]
-            ]
-        ].
-        fwdSelect := true.
-        (matchCol isNil and:[scanCol isNil]) ifTrue:[
-            clickCol < (self listAt:clickLine) size ifTrue:[
-                ch := self characterAtLine:clickLine col:clickCol+1.
-                (self isClosingParenthesis:ch) ifTrue:[
-                    matchCol := clickCol + 1.
-                    fwdSelect := false.
-                ] ifFalse:[
-                    ('"''|' includes:ch) ifTrue:[
-                        scanCol := clickCol + 1.
-                        fwdScan := false.
-                        scanCh := ch.
-                    ]
-                ]
-            ].
-        ].
-        matchCol notNil ifTrue:[
-            self
-                searchForMatchingParenthesisFromLine:clickLine col:matchCol
-                ifFound:[:line :col |
-                          self selectFromLine:clickLine col:matchCol+(fwdSelect ifTrue:1 ifFalse:-1)
-                                       toLine:line col:col-(fwdSelect ifTrue:1 ifFalse:-1)]
-                ifNotFound:[self showNotFound]
-                onError:[self beep]
-                openingCharacters:((parenthesisSpecification at:#open) , '([{')
-                closingCharacters:((parenthesisSpecification at:#close) , ')]}').
-            ^ self
-        ].
-        scanCol notNil ifTrue:[
-            "/ if its an EOL comment, do it differently
-            ch := self characterAtLine:clickLine col:clickCol.
-            ch == $/ ifTrue:[
-                self selectFromLine:clickLine col:clickCol+1 toLine:clickLine+1 col:0.
-                ^ self
-            ].
-
-            self
-                scanFor:scanCh fromLine:clickLine col:scanCol forward:fwdScan
-                ifFound:[:line :col |
-                            |selStart selEnd|
-
-                            fwdScan ifTrue:[
-                                selStart := scanCol+1.
-                                selEnd := col-1.
-                            ] ifFalse:[
-                                selStart := scanCol-1.
-                                selEnd := col+1.
-                            ].
-                            self selectFromLine:clickLine col:selStart
-                                 toLine:line col:selEnd.
-                            ^ self
-                           ]
-                ifNotFound:[self showNotFound].
-            ^ self
-        ]
+	"/ st80 selects:
+	"/   - if clicked right after a parenthesis -> select to matching parenthesis
+	"/   - if clicked right after a quote -> select to matching quote (unless escaped ;-)
+	"/   - if clicked at beginning of the line  -> select that line
+	"/   - if clicked at the top of the text    -> select all
+	"/ however, do none of the above, if clicked on a parenthesis
+	clickCol == 1 ifTrue:[
+	    clickLine == 1 ifTrue:[
+		self selectAll.
+		^ self.
+	    ].
+	    self selectLineAtY:y.
+	    selectStyle := #line.
+	    ^ self
+	].
+
+	matchCol := nil.
+	"/ see what is to the left of that character ...
+	clickCol > 1 ifTrue:[
+	    ch := self characterAtLine:clickLine col:clickCol-1.
+	    (self isOpeningParenthesis:ch) ifTrue:[
+		matchCol := clickCol - 1
+	    ] ifFalse:[
+		('"''|' includes:ch) ifTrue:[
+		    scanCol := clickCol - 1.
+		    fwdScan := true.
+		    scanCh := ch.
+		]
+	    ]
+	].
+	fwdSelect := true.
+	(matchCol isNil and:[scanCol isNil]) ifTrue:[
+	    clickCol < (self listAt:clickLine) size ifTrue:[
+		ch := self characterAtLine:clickLine col:clickCol+1.
+		(self isClosingParenthesis:ch) ifTrue:[
+		    matchCol := clickCol + 1.
+		    fwdSelect := false.
+		] ifFalse:[
+		    ('"''|' includes:ch) ifTrue:[
+			scanCol := clickCol + 1.
+			fwdScan := false.
+			scanCh := ch.
+		    ]
+		]
+	    ].
+	].
+	matchCol notNil ifTrue:[
+	    self
+		searchForMatchingParenthesisFromLine:clickLine col:matchCol
+		ifFound:[:line :col |
+			  self selectFromLine:clickLine col:matchCol+(fwdSelect ifTrue:1 ifFalse:-1)
+				       toLine:line col:col-(fwdSelect ifTrue:1 ifFalse:-1)]
+		ifNotFound:[self showNotFound]
+		onError:[self beep]
+		openingCharacters:((parenthesisSpecification at:#open) , '([{')
+		closingCharacters:((parenthesisSpecification at:#close) , ')]}').
+	    ^ self
+	].
+	scanCol notNil ifTrue:[
+	    "/ if its an EOL comment, do it differently
+	    ch := self characterAtLine:clickLine col:clickCol.
+	    ch == $/ ifTrue:[
+		self selectFromLine:clickLine col:clickCol+1 toLine:clickLine+1 col:0.
+		^ self
+	    ].
+
+	    self
+		scanFor:scanCh fromLine:clickLine col:scanCol forward:fwdScan
+		ifFound:[:line :col |
+			    |selStart selEnd|
+
+			    fwdScan ifTrue:[
+				selStart := scanCol+1.
+				selEnd := col-1.
+			    ] ifFalse:[
+				selStart := scanCol-1.
+				selEnd := col+1.
+			    ].
+			    self selectFromLine:clickLine col:selStart
+				 toLine:line col:selEnd.
+			    ^ self
+			   ]
+		ifNotFound:[self showNotFound].
+	    ^ self
+	]
     ].
 
     "
@@ -1665,14 +1665,14 @@
     wordStartLine := selectionStartLine.
     wordEndLine := selectionEndLine.
     selectStyle == #wordLeft ifTrue:[
-        wordStartCol := selectionStartCol + 1
+	wordStartCol := selectionStartCol + 1
     ] ifFalse:[
-        wordStartCol := selectionStartCol.
+	wordStartCol := selectionStartCol.
     ].
     selectStyle == #wordRight ifTrue:[
-        wordEndCol := selectionEndCol - 1
+	wordEndCol := selectionEndCol - 1
     ] ifFalse:[
-        wordEndCol := selectionEndCol
+	wordEndCol := selectionEndCol
     ]
 
     "Created: / 11-09-1997 / 04:12:55 / cg"
@@ -1696,156 +1696,156 @@
     movedLine := self visibleLineToAbsoluteLine:movedVisibleLine.
 
     (x < leftMargin) ifTrue:[
-        movedCol := 0
+	movedCol := 0
     ] ifFalse:[
-        movedCol := self colOfX:x inVisibleLine:movedVisibleLine
+	movedCol := self colOfX:x inVisibleLine:movedVisibleLine
     ].
     y < 0 ifTrue:[
-        movedCol := 0
+	movedCol := 0
     ].
     ((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[
-        selectionStartLine notNil ifTrue:[
-            ^ self
-        ].
-        (clickPos isNil
-        or:[(clickPos x - x) abs < 3
-            and:[(clickPos y - y) abs < 3]]) ifTrue:[
-            ^ self
-        ].
-        selectionStartLine := clickLine.
-        selectionStartCol := clickCol.
-        selectionEndLine := selectionStartLine.
-        selectionEndCol := selectionStartCol.
-
-        oldStartLine := selectionStartLine.
-        oldEndLine := selectionEndLine.
-        oldStartCol := selectionStartCol.
-        oldEndCol := selectionEndCol-1.
+	selectionStartLine notNil ifTrue:[
+	    ^ self
+	].
+	(clickPos isNil
+	or:[(clickPos x - x) abs < 3
+	    and:[(clickPos y - y) abs < 3]]) ifTrue:[
+	    ^ self
+	].
+	selectionStartLine := clickLine.
+	selectionStartCol := clickCol.
+	selectionEndLine := selectionStartLine.
+	selectionEndCol := selectionStartCol.
+
+	oldStartLine := selectionStartLine.
+	oldEndLine := selectionEndLine.
+	oldStartCol := selectionStartCol.
+	oldEndCol := selectionEndCol-1.
     ] ifFalse:[
-        selectionStartLine isNil ifTrue:[
-            selectionStartLine := selectionEndLine := clickLine.
-            selectionStartCol := selectionEndCol := clickCol.
-        ].
-        oldStartLine := selectionStartLine.
-        oldEndLine := selectionEndLine.
-        oldStartCol := selectionStartCol.
-        oldEndCol := selectionEndCol.
+	selectionStartLine isNil ifTrue:[
+	    selectionStartLine := selectionEndLine := clickLine.
+	    selectionStartCol := selectionEndCol := clickCol.
+	].
+	oldStartLine := selectionStartLine.
+	oldEndLine := selectionEndLine.
+	oldStartCol := selectionStartCol.
+	oldEndCol := selectionEndCol.
     ].
     oldEndLine isNil ifTrue:[
-        oldEndLine := selectionEndLine ? clickLine ? movedLine.
+	oldEndLine := selectionEndLine ? clickLine ? movedLine.
     ].
     oldEndCol isNil ifTrue:[
-        oldEndCol := selectionEndCol ? clickCol.
+	oldEndCol := selectionEndCol ? clickCol.
     ].
 
     "find out if we are before or after initial click"
     movedUp := false.
     clickStartLine isNil ifTrue:[
-        clickStartLine := movedLine.
+	clickStartLine := movedLine.
     ].
     clickStartCol isNil ifTrue:[
-        clickStartCol := movedCol.
+	clickStartCol := movedCol.
     ].
 
     (movedLine < clickStartLine) ifTrue:[
-        movedUp := true
+	movedUp := true
     ] ifFalse:[
-        (movedLine == clickStartLine) ifTrue:[
-            (movedCol < clickStartCol) ifTrue:[
-                movedUp := true
-            ]
-        ]
+	(movedLine == clickStartLine) ifTrue:[
+	    (movedCol < clickStartCol) ifTrue:[
+		movedUp := true
+	    ]
+	]
     ].
 
     movedUp ifTrue:[
-        "change selectionStart"
-        selectionStartCol := movedCol.
-        selectionStartLine := movedLine.
-        selectionEndCol := clickStartCol.
-        selectionEndLine := clickStartLine.
-        selectStyle notNil ifTrue:[
-            selectionEndCol := wordEndCol.
-            selectionEndLine := wordEndLine.
-        ]
+	"change selectionStart"
+	selectionStartCol := movedCol.
+	selectionStartLine := movedLine.
+	selectionEndCol := clickStartCol.
+	selectionEndLine := clickStartLine.
+	selectStyle notNil ifTrue:[
+	    selectionEndCol := wordEndCol.
+	    selectionEndLine := wordEndLine.
+	]
     ] ifFalse:[
-        "change selectionEnd"
-        selectionEndCol := movedCol.
-        selectionEndLine := movedLine.
-        selectionStartCol := clickStartCol.
-        selectionStartLine := clickStartLine.
-        selectStyle notNil ifTrue:[
-            selectionStartCol := wordStartCol.
-            selectionStartLine := wordStartLine.
-        ]
+	"change selectionEnd"
+	selectionEndCol := movedCol.
+	selectionEndLine := movedLine.
+	selectionStartCol := clickStartCol.
+	selectionStartLine := clickStartLine.
+	selectStyle notNil ifTrue:[
+	    selectionStartCol := wordStartCol.
+	    selectionStartLine := wordStartLine.
+	]
     ].
 
     selectionStartLine isNil ifTrue:[^ self].
 
     (selectionStartCol == 0) ifTrue:[
-        selectionStartCol := 1
+	selectionStartCol := 1
     ].
 
     "
      if in word-select, just catch the rest of the word
     "
     (selectStyle notNil and:[selectStyle startsWith:'word']) ifTrue:[
-        movedUp ifTrue:[
-            selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol
-        ] ifFalse:[
-            selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol.
-            selectionEndCol == 0 ifTrue:[
-                selectionEndLine := selectionEndLine + 1
-            ]
-        ].
+	movedUp ifTrue:[
+	    selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol
+	] ifFalse:[
+	    selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol.
+	    selectionEndCol == 0 ifTrue:[
+		selectionEndLine := selectionEndLine + 1
+	    ]
+	].
     ].
 
     selectStyle == #line ifTrue:[
-        movedUp ifTrue:[
-            selectionStartCol := 1.
-        ] ifFalse:[
-            selectionEndCol := 0.
-            selectionEndLine := selectionEndLine + 1
-        ]
+	movedUp ifTrue:[
+	    selectionStartCol := 1.
+	] ifFalse:[
+	    selectionEndCol := 0.
+	    selectionEndLine := selectionEndLine + 1
+	]
     ].
 
     self validateNewSelection.
     aBoolean ifTrue:[
-        self setPrimarySelection.
-        self selectionChanged.
+	self setPrimarySelection.
+	self selectionChanged.
     ].
 
     "/ The searchAction is mantained until a cut/replace or a search with a user selection is done
 "/    self clearSearchAction.
 
     (oldStartLine == selectionStartLine) ifTrue:[
-        (oldStartCol ~~ selectionStartCol) ifTrue:[
-            self 
-                redrawLine:oldStartLine
-                      from:((selectionStartCol min:oldStartCol) max:1)
-                        to:((selectionStartCol max:oldStartCol) max:1)
-        ]
+	(oldStartCol ~~ selectionStartCol) ifTrue:[
+	    self
+		redrawLine:oldStartLine
+		      from:((selectionStartCol min:oldStartCol) max:1)
+			to:((selectionStartCol max:oldStartCol) max:1)
+	]
     ] ifFalse:[
-        self 
-            redrawFromLine:(oldStartLine?selectionStartLine min:selectionStartLine)
-                        to:(oldStartLine?selectionStartLine max:selectionStartLine)
+	self
+	    redrawFromLine:(oldStartLine?selectionStartLine min:selectionStartLine)
+			to:(oldStartLine?selectionStartLine max:selectionStartLine)
     ].
 
     (oldEndLine == selectionEndLine) ifTrue:[
-        (oldEndCol notNil and:[oldEndCol ~~ selectionEndCol]) ifTrue:[
-            self redrawLine:oldEndLine
-                       from:((selectionEndCol min:oldEndCol) max:1)
-                         to:((selectionEndCol max:oldEndCol) max:1)
-        ]
+	(oldEndCol notNil and:[oldEndCol ~~ selectionEndCol]) ifTrue:[
+	    self redrawLine:oldEndLine
+		       from:((selectionEndCol min:oldEndCol) max:1)
+			 to:((selectionEndCol max:oldEndCol) max:1)
+	]
     ] ifFalse:[
-        selectionEndLine isNil ifTrue:[
-            selectionStartLine := nil.
-            self redraw.
-        ] ifFalse:[
-            (selectionStartLine notNil) ifTrue:[
-                self redrawFromLine:(oldEndLine min:selectionEndLine)
-                                 to:(oldEndLine max:selectionEndLine)
-            ]
-        ]
+	selectionEndLine isNil ifTrue:[
+	    selectionStartLine := nil.
+	    self redraw.
+	] ifFalse:[
+	    (selectionStartLine notNil) ifTrue:[
+		self redrawFromLine:(oldEndLine min:selectionEndLine)
+				 to:(oldEndLine max:selectionEndLine)
+	    ]
+	]
     ].
     clickLine := movedLine.
     clickCol := movedCol
@@ -1947,13 +1947,13 @@
     selectionFgColor isNil ifTrue:[selectionFgColor := bgColor].
     selectionBgColor := DefaultSelectionBackgroundColor.
     selectionBgColor isNil ifTrue:[
-        device hasColors ifTrue:[
+	device hasColors ifTrue:[
             DefaultSelectionForegroundColor isNil ifTrue:[
                 selectionFgColor := fgColor
             ].
             selectionBgColor := Color green
         ] ifFalse:[
-            device hasGrayscales ifTrue:[
+	    device hasGrayscales ifTrue:[
                 DefaultSelectionForegroundColor isNil ifTrue:[
                     selectionFgColor := fgColor
                 ].
@@ -1977,7 +1977,7 @@
     lastSearchIgnoredCase := true.
 
     parenthesisSpecification isNil ifTrue:[
-        parenthesisSpecification := DefaultParenthesisSpecification.
+	parenthesisSpecification := DefaultParenthesisSpecification.
     ].
 
     "I handle menus myself"
@@ -2030,10 +2030,10 @@
     self withWaitCursorDo:[
         fp := FontPanel new.
         fp withChangeFontInViewsAllCheckBox:true.
-        newFont := fp fontFromUserInitial:font.
+        newFont := fp fontFromUserInitial:self font.
     ].
     newFont notNil ifTrue:[
-        self font:newFont.
+	self font:newFont.
         fp changeFontInAllViews ifTrue:[
             "/ user checked this box - change the defaults,
             "/ and update all other textviews now.
@@ -2148,9 +2148,9 @@
 fontLargerOrSmaller:largerBoolean
     |newFont|
 
-    newFont := font asSize:(largerBoolean
-                            ifTrue:[font size + 1]
-                            ifFalse:[(font size-1) max:4]).
+    newFont := gc font asSize:(largerBoolean
+			    ifTrue:[gc font size + 1]
+			    ifFalse:[(gc font size-1) max:4]).
     self font:newFont.
 
     "Modified: / 27-02-1996 / 00:53:51 / cg"
@@ -2233,9 +2233,9 @@
      searchAtBeginOfLineOnlyHolder updateReturnKeyBehavior|
 
     searchBarActionBlock notNil ifTrue:[
-        self resetVariablesBeforeNewSearch.
-        searchBarActionBlock value:#search value:self.
-        ^ self
+	self resetVariablesBeforeNewSearch.
+	searchBarActionBlock value:#search value:self.
+	^ self
     ].
 
     modal := (UserPreferences current searchDialogIsModal).   "/ thats experimental
@@ -2261,49 +2261,49 @@
     self setSearchPatternWithMatchEscapes: match.
 
     lastSearchPattern notNil ifTrue:[
-        initialString := lastSearchPattern.
+	initialString := lastSearchPattern.
     ].
 "/  No longer force the current selection to be the initialString
 "/    self hasSelectionWithinSingleLine ifTrue:[
 "/        initialString := self selection asString.
 "/    ].
     initialString isNil ifTrue:[
-        LastSearchPatterns size > 0 ifTrue:[
-            initialString := LastSearchPatterns first.
-        ]
+	LastSearchPatterns size > 0 ifTrue:[
+	    initialString := LastSearchPatterns first.
+	]
     ].
 
     initialString notNil ifTrue:[
-        patternHolder value:initialString.
+	patternHolder value:initialString.
     ].
 
     fwd := true.
 
     doSearch := [:fwd |
-        |isVariableSearch pattern searchAction|
-
-        self resetVariablesBeforeNewSearch.
-
-        isVariableSearch := self searchVariableVisible
-                                and:[searchVariableHolder value
-                                and:[selectedVariable notNil]].
-
-        isVariableSearch ifTrue:[
+	|isVariableSearch pattern searchAction|
+
+	self resetVariablesBeforeNewSearch.
+
+	isVariableSearch := self searchVariableVisible
+				and:[searchVariableHolder value
+				and:[selectedVariable notNil]].
+
+	isVariableSearch ifTrue:[
             searchAction := 
                 [
                     self searchVariableWithSyntaxElement:selectedVariable forward:fwd
                 ].
-        ] ifFalse:[
-            lastSearchWasVariableSearch := false.
-            LastSearchIgnoredCase := lastSearchIgnoredCase := (caseHolder value not).
-            LastSearchWasMatch := lastSearchWasMatch := matchHolder value.
+	] ifFalse:[
+	    lastSearchWasVariableSearch := false.
+	    LastSearchIgnoredCase := lastSearchIgnoredCase := (caseHolder value not).
+	    LastSearchWasMatch := lastSearchWasMatch := matchHolder value.
             LastSearchWasMatchWithRegex := matchWithRegexHolder value.
             LastSearchWasWrapAtEndOfText := wrapAtEndHolder value.
             LastSearchWasReplace :=replaceBooleanHolder value.
             LastSearchReplacedString := replaceTextHolder value.
             
-            pattern := patternHolder value.
-            pattern notEmptyOrNil ifTrue:[
+	    pattern := patternHolder value.
+	    pattern notEmptyOrNil ifTrue:[
                 searchAction := 
                     [
                         self searchUsingSpec:(
@@ -2318,20 +2318,20 @@
                                 atBeginOfLineOnly:searchAtBeginOfLineOnlyHolder value
                                 wrapAtEnd:wrapAtEndHolder value).
                     ]
-            ]
-        ].
-
-        replaceBooleanHolder value ifTrue:[
+	    ]
+	].
+
+	replaceBooleanHolder value ifTrue:[
             |selStart replacement replaceAction|
 
             replacement := replaceTextHolder value.
-            isVariableSearch ifTrue:[
-                "/ must replace from the end towards beginning,
-                "/ because syntax-elements do not update their position, when
-                "/ the text is changed (in replace).
-
-                selectedVariable := selectedVariable lastElementInChain.
-                self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
+	    isVariableSearch ifTrue:[
+		"/ must replace from the end towards beginning,
+		"/ because syntax-elements do not update their position, when
+		"/ the text is changed (in replace).
+
+		selectedVariable := selectedVariable lastElementInChain.
+		self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
                 searchAction := 
                     [
                         selectedVariable := selectedVariable previousElement.
@@ -2340,7 +2340,7 @@
                         ].
                         "/ self searchVariableWithSyntaxElement:selectedVariable forward:false
                     ].
-            ].
+	    ].
 
             replaceAction := [ self replace:replacement ].
             replacePreserveCaseBooleanHolder value ifTrue:[
@@ -2353,10 +2353,10 @@
                 ].    
             ].    
 
-            selStart := self characterPositionOfSelection.
+	    selStart := self characterPositionOfSelection.
 
             replaceAction value.
-            searchAction value.
+	    searchAction value.
             
             replaceAllBooleanHolder value ifTrue:[
                 [self characterPositionOfSelection ~= selStart] whileTrue:[
@@ -2365,9 +2365,9 @@
                     searchAction value.
                 ]
             ]
-        ] ifFalse:[
-            searchAction value.
-        ].
+	] ifFalse:[
+	    searchAction value.
+	].
     ].
 
     bindings := IdentityDictionary new.
@@ -2402,21 +2402,21 @@
     bindings at:#patternList put:LastSearchPatterns.
 
     self supportsSyntaxElements ifFalse:[
-        bindings at:#searchVariableVisible put:false.
+	bindings at:#searchVariableVisible put:false.
     ] ifTrue:[
-        bindings at:#searchVariableVisible put:true.
-        selectedVariable := self syntaxElementForSelectedVariable.
-        bindings at:#searchVariableEnabled put:(selectedVariable notNil).
-        selectedVariable notNil ifTrue:[
-            bindings
-                at:#stringWithVariableUnderCursorHolder
+	bindings at:#searchVariableVisible put:true.
+	selectedVariable := self syntaxElementForSelectedVariable.
+	bindings at:#searchVariableEnabled put:(selectedVariable notNil).
+	selectedVariable notNil ifTrue:[
+	    bindings
+		at:#stringWithVariableUnderCursorHolder
                 put:(resources string:'Variable ("%1")' with:selectedVariable name).
             "/ searchVariableHolder value:true.
-        ] ifFalse:[
-            bindings
-                at:#stringWithVariableUnderCursorHolder
+	] ifFalse:[
+	    bindings
+		at:#stringWithVariableUnderCursorHolder
                 put:(resources string:'Variable (none selected)').
-        ].
+	].
     ].
     bindings at:#searchVariable put:searchVariableHolder.
 
@@ -2450,20 +2450,20 @@
         ].
     
     replaceBooleanHolder onChangeEvaluate:
-        [
-            replaceBooleanHolder value ifTrue:[
-                (bldr componentAt:#ReplaceEntryField) requestFocus   
-            ] ifFalse:[
-                (bldr componentAt:#patternComboBox) requestFocus   
-            ].
+	[
+	    replaceBooleanHolder value ifTrue:[
+		(bldr componentAt:#ReplaceEntryField) requestFocus
+	    ] ifFalse:[
+		(bldr componentAt:#patternComboBox) requestFocus
+	    ].
             updateReturnKeyBehavior value.
-        ].
+	].
 
     modal ifTrue:[
-        searchBox := SimpleDialog new.
+	searchBox := SimpleDialog new.
     ] ifFalse:[
-        searchBox := ApplicationModel new.
-        searchBox createBuilder.
+	searchBox := ApplicationModel new.
+	searchBox createBuilder.
     ].
     searchBox resources:(self resources).
 
@@ -2479,19 +2479,19 @@
     modal ifTrue:[
         updateReturnKeyBehavior value.
         searchBox openDialogAtPointer.
-        searchBox accepted ifTrue:[ doSearch value:fwd ].
+	searchBox accepted ifTrue:[ doSearch value:fwd ].
     ] ifFalse:[
-        (bldr componentAt:#nextButton) isReturnButton:false.
-        (bldr componentAt:#cancelButton)
-                label:(resources string:'Close');
-                action:[searchBox closeRequest].
-        "/ searchBox masterApplication:self application.
-        self topView beMaster.
-        searchBox window
-                beSlave;
-                openInGroup:(self windowGroup).
-
-        "/ searchBox window open.
+	(bldr componentAt:#nextButton) isReturnButton:false.
+	(bldr componentAt:#cancelButton)
+		label:(resources string:'Close');
+		action:[searchBox closeRequest].
+	"/ searchBox masterApplication:self application.
+	self topView beMaster.
+	searchBox window
+		beSlave;
+		openInGroup:(self windowGroup).
+
+	"/ searchBox window open.
         searchBox window assignKeyboardFocusToFirstKeyboardConsumer.
     ]
 
@@ -2543,35 +2543,35 @@
     filename := aFilename asFilename.
 
     self withWriteCursorDo:[
-        |aStream|
-
-        (FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
-            msg := resources 
-                        stringWithCRs:'Refused to write file ''%1'' !!\(ST/X internal permission check)'
-                        with:filename name.
-        ] ifTrue:[
-            [
-                doAppend ifTrue:[
-                    aStream := filename appendingWriteStream.
-                ] ifFalse:[
-                    aStream := filename newReadWriteStream.
-                ].
+	|aStream|
+
+	(FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
+	    msg := resources
+			stringWithCRs:'Refused to write file ''%1'' !!\(ST/X internal permission check)'
+			with:filename name.
+	] ifTrue:[
+	    [
+		doAppend ifTrue:[
+		    aStream := filename appendingWriteStream.
+		] ifFalse:[
+		    aStream := filename newReadWriteStream.
+		].
                 aStream eolMode:eolMode.
-                self fileOutContentsOn:aStream compressTabs:compressTabs encoding:externalEncoding.
-                aStream syncData; close.
-                contentsWasSaved := true.
-                defaultFileNameForFileDialog := filename.
-            ] on:FileStream openErrorSignal do:[:ex|
-                msg := resources stringWithCRs:'Cannot write file ''%1'' !!\(%2)'
-                                with:filename name
-                                with:FileStream lastErrorString.
-            ].
-        ].
+		self fileOutContentsOn:aStream compressTabs:compressTabs encoding:externalEncoding.
+		aStream syncData; close.
+		contentsWasSaved := true.
+		defaultFileNameForFileDialog := filename.
+	    ] on:FileStream openErrorSignal do:[:ex|
+		msg := resources stringWithCRs:'Cannot write file ''%1'' !!\(%2)'
+				with:filename name
+				with:FileStream lastErrorString.
+	    ].
+	].
     ].
 
     msg notNil ifTrue:[
-        Dialog warn:msg.
-        ^ false
+	Dialog warn:msg.
+	^ false
     ].
     ^ true
 
@@ -2691,7 +2691,7 @@
 !TextView methodsFor:'native widget support'!
 
 nativeWindowType
-    "return a symbol describing my native window type 
+    "return a symbol describing my native window type
      (may be used internally by the device as a native window creation hint,
       if the device supports native windows)"
 
@@ -2738,30 +2738,30 @@
 
     "/ This is now obsolete, as we are always using unicode internally.
     "/ so the following line should be changed to encoderToEncodeFrom:unicode to:xxx.
-    encoder := CharacterEncoder encoderToEncodeFrom:characterEncoding into:encodingSymOrNil.
+    encoder := CharacterEncoder encoderToEncodeFrom:gc characterEncoding into:encodingSymOrNil.
     encoder isNullEncoder ifTrue:[
-        (list contains:[:lineOrNil|
-                            |s|
-                            lineOrNil notNil
-                            and:[(s := lineOrNil string string) isWideString
-                            and:[s asSingleByteStringIfPossible isWideString]]
-                       ]
-        ) ifTrue:[
-            (Dialog confirm:'The text contains non-8bit characters. Encode as UTF8?') ifFalse:[
-                ^ self
-            ]
-        ].
-        encoder := CharacterEncoder encoderToEncodeFrom:#unicode into:#utf8
+	(list contains:[:lineOrNil|
+			    |s|
+			    lineOrNil notNil
+			    and:[(s := lineOrNil string string) isWideString
+			    and:[s asSingleByteStringIfPossible isWideString]]
+		       ]
+	) ifTrue:[
+	    (Dialog confirm:'The text contains non-8bit characters. Encode as UTF8?') ifFalse:[
+		^ self
+	    ]
+	].
+	encoder := CharacterEncoder encoderToEncodeFrom:#unicode into:#utf8
     ].
 
     aStream isFileStream ifTrue:[
-        "on some systems, writing linewise is very slow (via NFS)
-         therefore we convert to a string and write it in big chunks.
-         To avoid creating huge strings, we do it in blocks of 1000 lines,
-         limiting temporary string creation to about 50-80k.
-        "
-        startNr := 1.
-        nLines := list size.
+	"on some systems, writing linewise is very slow (via NFS)
+	 therefore we convert to a string and write it in big chunks.
+	 To avoid creating huge strings, we do it in blocks of 1000 lines,
+	 limiting temporary string creation to about 50-80k.
+	"
+	startNr := 1.
+	nLines := list size.
         (aStream eolMode notNil
         and:[aStream eolMode ~= #nl]) ifTrue:[
             "/ must do it lineWise ...
@@ -2773,7 +2773,7 @@
             ].
         ] ifFalse:[
             [startNr <= nLines] whileTrue:[
-                string := list 
+                string := list
                             asStringWithCRsFrom:startNr
                             to:((startNr + 1000) min:nLines)
                             compressTabs:compressTabs.
@@ -2799,19 +2799,19 @@
      line separation. This is required, to allow for proper handling of
      national characters, such as A-diaresis ..."
 
-    |italicFont boldFont|
-
-    font := font onDevice:device.
+    |italicFont boldFont currentDeviceFont |
+
+    currentDeviceFont := gc createFontOnDevice.
     "/ do we really need this info now?
     "/ on unix, it seems to work with the next two lines commented;
     "/ should probably check on windows too
-    italicFont := font asItalic onDevice:device.
-    boldFont := font asBold onDevice:device.
-
-    fontHeight := font height.
-    fontAscent := font ascent. 
-    fontWidth := font width.
-    fontIsFixedWidth := font isFixedWidth.
+    italicFont := currentDeviceFont asItalic onDevice:self device.
+    boldFont := currentDeviceFont asBold onDevice:self device.
+
+    fontHeight := currentDeviceFont height.
+    fontAscent := currentDeviceFont ascent. 
+    fontWidth := currentDeviceFont width.
+    fontIsFixedWidth := currentDeviceFont isFixedWidth.
 
     "/ fA := font maxAscent. 
     italicFont notNil ifTrue:[ 
@@ -2826,8 +2826,8 @@
     ]. 
 
     includesNonStrings == true ifTrue:[
-        "/ for now, we do not support variable height entries ...
-        fontHeight := fontHeight max:(list first heightOn:self).
+	"/ for now, we do not support variable height entries ...
+	fontHeight := fontHeight max:(list first heightOn:self).
     ].
     fontHeight := fontHeight + lineSpacing.
 
@@ -3003,8 +3003,8 @@
 
 textChanged
     self isNativeWidget ifTrue:[
-        drawableId notNil ifTrue:[
-            device changeText:self contents in:drawableId
+        gc drawableId notNil ifTrue:[
+            gc device changeText:self contents in:gc drawableId
         ]
     ].
     super textChanged
@@ -3049,13 +3049,13 @@
     "if there is a margin, clear it - a helper for selection drawing"
 
     (leftMargin ~~ 0) ifTrue:[
-        viewOrigin x <= margin ifTrue:[
-            self paint:color.
-            self fillRectangleX:margin-viewOrigin x
-                              y:(self yOfVisibleLine:visLine)- (lineSpacing//2)
-                          width:leftMargin
-                         height:fontHeight
-        ]
+	viewOrigin x <= margin ifTrue:[
+	    self paint:color.
+	    self fillRectangleX:margin-viewOrigin x
+			      y:(self yOfVisibleLine:visLine)- (lineSpacing//2)
+			  width:leftMargin
+			 height:fontHeight
+	]
     ]
 
     "Created: 6.3.1996 / 14:22:55 / cg"
@@ -3192,50 +3192,50 @@
 
     (selectionStartLine notNil and:[selectionEndLine notNil
     and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
-        line := self visibleLineToAbsoluteLine:visLineNr.
-        (line between:selectionStartLine and:selectionEndLine) ifTrue:[
-            (line == selectionStartLine) ifTrue:[
-                (line == selectionEndLine) ifTrue:[
-                    "it's part-of-single-line selection"
-                    self clearMarginOfVisibleLine:visLineNr with:bgColor.
-                    (selectionStartCol > 1) ifTrue:[
-                        super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
-                    ].
-                    self drawVisibleLineSelected:visLineNr from:selectionStartCol to:selectionEndCol.
-                    super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
-                    ^ self
-                ].
-
-                "it's the first line of a multi-line selection"
-                (selectionStartCol ~~ 1) ifTrue:[
-                    self clearMarginOfVisibleLine:visLineNr with:bgColor.
-                    super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
-                ] ifFalse:[
-                    viewOrigin x == 0 ifTrue:[
-                        self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
-                    ]
-                ].
-                self drawVisibleLineSelected:visLineNr from:selectionStartCol.
-                ^ self
-            ].
-
-            (line == selectionEndLine) ifTrue:[
-                "it's the last line of a multi-line selection"
-                (selectionEndCol == 0) ifTrue:[
-                    ^ super redrawVisibleLine:visLineNr
-                ].
-
-                self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
-                self drawVisibleLineSelected:visLineNr from:1 to:selectionEndCol.
-                super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
-                ^ self
-            ].
-
-            "it's a full line in a multi-line selection"
-            self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
-            self drawVisibleLineSelected:visLineNr.
-            ^ self
-        ]
+	line := self visibleLineToAbsoluteLine:visLineNr.
+	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
+	    (line == selectionStartLine) ifTrue:[
+		(line == selectionEndLine) ifTrue:[
+		    "it's part-of-single-line selection"
+		    self clearMarginOfVisibleLine:visLineNr with:bgColor.
+		    (selectionStartCol > 1) ifTrue:[
+			super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
+		    ].
+		    self drawVisibleLineSelected:visLineNr from:selectionStartCol to:selectionEndCol.
+		    super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
+		    ^ self
+		].
+
+		"it's the first line of a multi-line selection"
+		(selectionStartCol ~~ 1) ifTrue:[
+		    self clearMarginOfVisibleLine:visLineNr with:bgColor.
+		    super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
+		] ifFalse:[
+		    viewOrigin x == 0 ifTrue:[
+			self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
+		    ]
+		].
+		self drawVisibleLineSelected:visLineNr from:selectionStartCol.
+		^ self
+	    ].
+
+	    (line == selectionEndLine) ifTrue:[
+		"it's the last line of a multi-line selection"
+		(selectionEndCol == 0) ifTrue:[
+		    ^ super redrawVisibleLine:visLineNr
+		].
+
+		self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
+		self drawVisibleLineSelected:visLineNr from:1 to:selectionEndCol.
+		super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
+		^ self
+	    ].
+
+	    "it's a full line in a multi-line selection"
+	    self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
+	    self drawVisibleLineSelected:visLineNr.
+	    ^ self
+	]
     ].
     super redrawVisibleLine:visLineNr
 
@@ -3252,18 +3252,18 @@
     "/
     (selectionStartLine notNil and:[selectionEndLine notNil
     and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
-        line := self visibleLineToAbsoluteLine:visLine.
-        (line between:selectionStartLine and:selectionEndLine) ifTrue:[
-            ((line == selectionStartLine)
-            and: [col < selectionStartCol]) ifFalse:[
-                ((line == selectionEndLine)
-                and: [col > selectionEndCol]) ifFalse:[
-                    "its in the selection"
-                    self drawVisibleLineSelected:visLine col:col.
-                    ^ self.
-                ]
-            ]
-        ]
+	line := self visibleLineToAbsoluteLine:visLine.
+	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
+	    ((line == selectionStartLine)
+	    and: [col < selectionStartCol]) ifFalse:[
+		((line == selectionEndLine)
+		and: [col > selectionEndCol]) ifFalse:[
+		    "its in the selection"
+		    self drawVisibleLineSelected:visLine col:col.
+		    ^ self.
+		]
+	    ]
+	]
     ].
     self drawVisibleLine:visLine col:col with:fgColor and:bgColor
 
@@ -3310,75 +3310,75 @@
     allOut := false.
     (selectionStartLine isNil or:[selectionEndLine isNil
     or:[selectionStartCol isNil or:[selectionEndCol isNil]]]) ifTrue:[
-        allOut := true
+	allOut := true
     ] ifFalse:[
-        (line between:selectionStartLine and:selectionEndLine) ifFalse:[
-            allOut := true
-        ] ifTrue:[
-            (selectionStartLine == selectionEndLine) ifTrue:[
-                ((endCol < selectionStartCol)
-                or:[startCol > selectionEndCol]) ifTrue:[
-                    allOut := true
-                ] ifFalse:[
-                    ((startCol >= selectionStartCol)
-                    and:[endCol <= selectionEndCol]) ifTrue:[
-                        allIn := true
-                    ]
-                ]
-            ] ifFalse:[
-                (line == selectionStartLine) ifTrue:[
-                    (endCol < selectionStartCol) ifTrue:[
-                        allOut := true
-                    ] ifFalse:[
-                        (startCol >= selectionStartCol) ifTrue:[
-                            allIn := true
-                        ]
-                    ]
-                ] ifFalse:[
-                    (line == selectionEndLine) ifTrue:[
-                        (startCol > selectionEndCol) ifTrue:[
-                            allOut := true
-                        ] ifFalse:[
-                            (endCol <= selectionEndCol) ifTrue:[
-                                allIn := true
-                            ]
-                        ]
-                    ] ifFalse:[
-                        allIn := true
-                    ]
-                ]
-            ]
-        ]
+	(line between:selectionStartLine and:selectionEndLine) ifFalse:[
+	    allOut := true
+	] ifTrue:[
+	    (selectionStartLine == selectionEndLine) ifTrue:[
+		((endCol < selectionStartCol)
+		or:[startCol > selectionEndCol]) ifTrue:[
+		    allOut := true
+		] ifFalse:[
+		    ((startCol >= selectionStartCol)
+		    and:[endCol <= selectionEndCol]) ifTrue:[
+			allIn := true
+		    ]
+		]
+	    ] ifFalse:[
+		(line == selectionStartLine) ifTrue:[
+		    (endCol < selectionStartCol) ifTrue:[
+			allOut := true
+		    ] ifFalse:[
+			(startCol >= selectionStartCol) ifTrue:[
+			    allIn := true
+			]
+		    ]
+		] ifFalse:[
+		    (line == selectionEndLine) ifTrue:[
+			(startCol > selectionEndCol) ifTrue:[
+			    allOut := true
+			] ifFalse:[
+			    (endCol <= selectionEndCol) ifTrue:[
+				allIn := true
+			    ]
+			]
+		    ] ifFalse:[
+			allIn := true
+		    ]
+		]
+	    ]
+	]
     ].
     allOut ifTrue:[
-        super redrawVisibleLine:visLine from:startCol to:endCol.
-        ^ self
+	super redrawVisibleLine:visLine from:startCol to:endCol.
+	^ self
     ].
 
     allIn ifTrue:[
-        self drawVisibleLineSelected:visLine from:startCol to:endCol
+	self drawVisibleLineSelected:visLine from:startCol to:endCol
     ] ifFalse:[
-        "redraw part before selection"
-        ((line == selectionStartLine)
-         and:[startCol <= selectionStartCol]) ifTrue:[
-            super redrawVisibleLine:visLine from:startCol
-                                              to:(selectionStartCol - 1).
-            leftCol := selectionStartCol
-        ] ifFalse:[
-            leftCol := startCol
-        ].
-        "redraw selected part"
-        (selectionEndLine > line) ifTrue:[
-            rightCol := endCol
-        ] ifFalse:[
-            rightCol := selectionEndCol min:endCol
-        ].
-        self drawVisibleLineSelected:visLine from:leftCol to:rightCol.
-
-        "redraw part after selection"
-        (rightCol < endCol) ifTrue:[
-            super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol
-        ]
+	"redraw part before selection"
+	((line == selectionStartLine)
+	 and:[startCol <= selectionStartCol]) ifTrue:[
+	    super redrawVisibleLine:visLine from:startCol
+					      to:(selectionStartCol - 1).
+	    leftCol := selectionStartCol
+	] ifFalse:[
+	    leftCol := startCol
+	].
+	"redraw selected part"
+	(selectionEndLine > line) ifTrue:[
+	    rightCol := endCol
+	] ifFalse:[
+	    rightCol := selectionEndCol min:endCol
+	].
+	self drawVisibleLineSelected:visLine from:leftCol to:rightCol.
+
+	"redraw part after selection"
+	(rightCol < endCol) ifTrue:[
+	    super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol
+	]
     ].
 
     "special care for first and last line of selection:
@@ -3388,14 +3388,14 @@
     and:[(startCol == 1)
     and:[selectionStartLine < selectionEndLine]])
     ifTrue:[
-        self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
+	self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
     ].
 
     ((line == selectionStartLine)
     and:[(startCol == 1)
     and:[selectionStartLine < selectionEndLine]])
     ifTrue:[
-        self clearMarginOfVisibleLine:visLine with:bgColor.
+	self clearMarginOfVisibleLine:visLine with:bgColor.
     ].
 
     ((line > selectionStartLine)
@@ -3403,7 +3403,7 @@
     and:[selectionStartLine < selectionEndLine
     and:[line < selectionEndLine]]])
     ifTrue:[
-        self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
+	self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
     ]
 
     "Modified: 6.3.1996 / 14:23:26 / cg"
@@ -4494,16 +4494,16 @@
     realPattern := pattern.
 
     isMatch ifTrue: [
-        (realPattern startsWith:$*) ifTrue:[
+	(realPattern startsWith:$*) ifTrue:[
             realPattern := realPattern copyButFirst
-        ].
-        (realPattern endsWith:$*) ifTrue:[
+	].
+	(realPattern endsWith:$*) ifTrue:[
             realPattern := realPattern copyButLast
-        ].
+	].
     ].
 
     self selectFromLine:line col:col
-                 toLine:line col:(col + realPattern size - 1).
+		 toLine:line col:(col + realPattern size - 1).
     self makeLineVisible:line
 !
 
@@ -4567,31 +4567,31 @@
     |l t|
 
     selectionStartLine notNil ifTrue:[
-        expandingTop == true ifTrue:[
-            l := selectionStartLine.
-            selectionStartLine := selectionStartLine + 1.
-            (selectionStartLine > clickLine
-            or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]])
-            ifTrue:[
-                t := selectionStartLine.
-                selectionStartLine := selectionEndLine.
-                selectionEndLine := t.
-                t := selectionStartCol.
-                selectionStartCol := selectionEndCol.
-                selectionEndCol := t.
-                expandingTop := false
-            ].
-        ] ifFalse:[
-            l := selectionEndLine.
-            selectionEndLine := selectionEndLine + 1.
-        ].
+	expandingTop == true ifTrue:[
+	    l := selectionStartLine.
+	    selectionStartLine := selectionStartLine + 1.
+	    (selectionStartLine > clickLine
+	    or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]])
+	    ifTrue:[
+		t := selectionStartLine.
+		selectionStartLine := selectionEndLine.
+		selectionEndLine := t.
+		t := selectionStartCol.
+		selectionStartCol := selectionEndCol.
+		selectionEndCol := t.
+		expandingTop := false
+	    ].
+	] ifFalse:[
+	    l := selectionEndLine.
+	    selectionEndLine := selectionEndLine + 1.
+	].
 "/        self redrawLine:l.
 "/        self redrawLine:l+1.
-        self validateNewSelection.
-        self setPrimarySelection.
-        self selectionChanged.
-        self redrawFromLine:l to:l+1.
-        self makeSelectionVisible.
+	self validateNewSelection.
+	self setPrimarySelection.
+	self selectionChanged.
+	self redrawFromLine:l to:l+1.
+	self makeSelectionVisible.
     ].
 
     "Created: / 01-03-1996 / 23:35:08 / cg"
@@ -4603,34 +4603,34 @@
     |c l t c1 c2|
 
     selectionStartLine notNil ifTrue:[
-        expandingTop == true ifTrue:[
-            selectionStartCol == 0 ifTrue:[^ self].
-            l := selectionStartLine.
-            selectionStartCol := (selectionStartCol - 1) max:1.
-            c := selectionStartCol.
-        ] ifFalse:[
-            l := selectionEndLine.
-            selectionEndCol := (selectionEndCol - 1) max:0.
-            c := selectionEndCol.
-            selectionEndLine == selectionStartLine ifTrue:[
-                selectionEndCol <= selectionStartCol ifTrue:[
-                    t := selectionStartCol. selectionStartCol := selectionEndCol.
-                    selectionEndCol := t.
-                    expandingTop := true.
-                    c := selectionStartCol.
-                ]
-            ].
-        ].
-        c1 := c.
-        c2 := c1 + 1.
-        c1 == 0 ifTrue:[
-            c1 := 1
-        ].
-        self validateNewSelection.
-        self setPrimarySelection.
-        self selectionChanged.
-        self redrawLine:l from:c1 to:c2.
-        self makeSelectionVisible.
+	expandingTop == true ifTrue:[
+	    selectionStartCol == 0 ifTrue:[^ self].
+	    l := selectionStartLine.
+	    selectionStartCol := (selectionStartCol - 1) max:1.
+	    c := selectionStartCol.
+	] ifFalse:[
+	    l := selectionEndLine.
+	    selectionEndCol := (selectionEndCol - 1) max:0.
+	    c := selectionEndCol.
+	    selectionEndLine == selectionStartLine ifTrue:[
+		selectionEndCol <= selectionStartCol ifTrue:[
+		    t := selectionStartCol. selectionStartCol := selectionEndCol.
+		    selectionEndCol := t.
+		    expandingTop := true.
+		    c := selectionStartCol.
+		]
+	    ].
+	].
+	c1 := c.
+	c2 := c1 + 1.
+	c1 == 0 ifTrue:[
+	    c1 := 1
+	].
+	self validateNewSelection.
+	self setPrimarySelection.
+	self selectionChanged.
+	self redrawLine:l from:c1 to:c2.
+	self makeSelectionVisible.
     ].
 
     "Modified: / 18-03-1996 / 17:05:46 / cg"
@@ -4641,29 +4641,29 @@
     |l c t|
 
     selectionStartLine notNil ifTrue:[
-        expandingTop == true ifTrue:[
-            l := selectionStartLine.
-            c := selectionStartCol.
-            selectionStartCol := selectionStartCol + 1.
-            l == selectionEndLine ifTrue:[
-                c >= selectionEndCol ifTrue:[
-                    expandingTop := false.
-                    t := selectionStartCol. selectionStartCol := selectionEndCol.
-                    selectionEndCol := t.
-                    c := selectionStartCol.
-                ]
-            ]
-        ] ifFalse:[
-            l := selectionEndLine.
-            c := selectionEndCol.
-            selectionEndCol := selectionEndCol + 1.
-        ].
-
-        self validateNewSelection.
-        self setPrimarySelection.
-        self selectionChanged.
-        self redrawLine:l from:(c max:1) to:c+1.
-        self makeSelectionVisible.
+	expandingTop == true ifTrue:[
+	    l := selectionStartLine.
+	    c := selectionStartCol.
+	    selectionStartCol := selectionStartCol + 1.
+	    l == selectionEndLine ifTrue:[
+		c >= selectionEndCol ifTrue:[
+		    expandingTop := false.
+		    t := selectionStartCol. selectionStartCol := selectionEndCol.
+		    selectionEndCol := t.
+		    c := selectionStartCol.
+		]
+	    ]
+	] ifFalse:[
+	    l := selectionEndLine.
+	    c := selectionEndCol.
+	    selectionEndCol := selectionEndCol + 1.
+	].
+
+	self validateNewSelection.
+	self setPrimarySelection.
+	self selectionChanged.
+	self redrawLine:l from:(c max:1) to:c+1.
+	self makeSelectionVisible.
     ].
 
     "Created: / 01-03-1996 / 23:33:17 / cg"
@@ -4675,33 +4675,33 @@
     |l t|
 
     selectionStartLine notNil ifTrue:[
-        expandingTop == true ifTrue:[
-            selectionStartLine := (selectionStartLine - 1) max:1.
-            l := selectionStartLine.
-        ] ifFalse:[
-            selectionEndLine := (selectionEndLine - 1) max:0.
-
-            l := selectionEndLine.
-            (selectionEndLine < clickLine
-            or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])])
-            ifTrue:[
-                t := selectionStartLine.
-                selectionStartLine := selectionEndLine.
-                selectionEndLine := t.
-                t := selectionStartCol.
-                selectionStartCol := selectionEndCol.
-                selectionEndCol := t.
-                l := selectionStartLine.
-                expandingTop := true
-            ].
-        ].
-        self validateNewSelection.
-        self setPrimarySelection.
-        self selectionChanged.
-        "/ self redrawLine:l.
-        "/ self redrawLine:l+1.
-        self redrawFromLine:l to:l+1.
-        self makeSelectionVisible.
+	expandingTop == true ifTrue:[
+	    selectionStartLine := (selectionStartLine - 1) max:1.
+	    l := selectionStartLine.
+	] ifFalse:[
+	    selectionEndLine := (selectionEndLine - 1) max:0.
+
+	    l := selectionEndLine.
+	    (selectionEndLine < clickLine
+	    or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])])
+	    ifTrue:[
+		t := selectionStartLine.
+		selectionStartLine := selectionEndLine.
+		selectionEndLine := t.
+		t := selectionStartCol.
+		selectionStartCol := selectionEndCol.
+		selectionEndCol := t.
+		l := selectionStartLine.
+		expandingTop := true
+	    ].
+	].
+	self validateNewSelection.
+	self setPrimarySelection.
+	self selectionChanged.
+	"/ self redrawLine:l.
+	"/ self redrawLine:l+1.
+	self redrawFromLine:l to:l+1.
+	self makeSelectionVisible.
     ].
 
     "Modified: / 06-03-1996 / 14:12:06 / cg"
@@ -4731,9 +4731,9 @@
 !
 
 hasSingleFullLineSelected
-    ^ (selectionStartLine notNil 
+    ^ (selectionStartLine notNil
       and:[selectionEndLine notNil
-      and:[selectionEndLine == (selectionStartLine+1)  
+      and:[selectionEndLine == (selectionStartLine+1)
       and:[selectionStartCol == 1
       and:[selectionEndCol == 0
     ]]]])
@@ -4804,7 +4804,7 @@
     |line1 col1 line2 col2|
 
     pos1 > pos2 ifTrue:[
-        ^ self unselect
+	^ self unselect
     ].
     line1 := self lineOfCharacterPosition:pos1.
     col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
@@ -4819,44 +4819,51 @@
 selectFromLine:startLine col:startCol toLine:endLine col:endCol
     "select a piece of text and redraw that area"
 
-    ((selectionStartLine = startLine)
-      and:[ (selectionStartCol = startCol)
-      and:[ (selectionEndLine = endLine)
-      and:[ (selectionEndCol = endCol) ]]]) ifTrue:[^ self ].
-
-    self unselect.
+    | oldStartCol oldEndCol oldStartLine oldEndLine |
+
+    oldStartCol := selectionStartCol ? startCol.
+    oldStartLine := selectionStartLine ? startLine.
+    oldEndCol := selectionEndCol ? endCol.
+    oldEndLine := selectionEndLine ? endLine.  
+
+    self unselectWithoutRedraw.
     startLine notNil ifTrue:[
-        "new:"
-        endLine < startLine ifTrue:[
-            ^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol
-        ].
-        (endLine == startLine and:[endCol < startCol]) ifTrue:[
-            endCol ~~ 0 ifTrue:[
-                self selectFromLine:endLine col:endCol toLine:startLine col:startCol.
-            ].
-            ^ self
-        ].
-
-" old:
-        endLine < startLine ifTrue:[^ self].
-        (startLine == endLine and:[endCol < startCol]) ifTrue:[^ self].
-"
-        selectionStartLine := startLine.
-        selectionStartCol := startCol.
-        selectionEndLine := endLine.
-        selectionEndCol := endCol.
-        self validateNewSelection.
-        self setPrimarySelection.
-        self selectionChanged.
-
-        (selectionStartLine == selectionEndLine) ifTrue:[
-            self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol
-        ] ifFalse:[
-            selectionStartLine to:selectionEndLine do:[:lineNr |
-                self redrawLine:lineNr
-            ]
-        ].
-        selectStyle := nil.
+	"new:"
+	endLine < startLine ifTrue:[
+	    ^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol
+	].
+	(endLine == startLine and:[endCol < startCol]) ifTrue:[
+	    endCol ~~ 0 ifTrue:[
+		self selectFromLine:endLine col:endCol toLine:startLine col:startCol.
+	    ].
+	    ^ self
+	].
+
+        " old:
+	endLine < startLine ifTrue:[^ self].
+	(startLine == endLine and:[endCol < startCol]) ifTrue:[^ self].
+        "
+
+	selectionStartLine := startLine.
+	selectionStartCol := startCol.
+	selectionEndLine := endLine.
+	selectionEndCol := endCol.
+	self validateNewSelection.
+	self setPrimarySelection.
+	self selectionChanged.
+
+        (selectionStartLine == selectionEndLine 
+            and:[oldStartLine == selectionStartLine 
+                and:[oldEndLine == selectionEndLine]]) ifTrue:[
+                    self redrawLine:selectionStartLine 
+                               from:(selectionStartCol min: oldStartCol) 
+                                 to:(selectionEndCol max: oldEndCol)
+                ] ifFalse:[
+                    (selectionStartLine min: oldStartLine) to: (selectionEndLine max: oldEndLine) do:[:lineNr |
+                        self redrawLine:lineNr
+                    ]
+                ].
+	selectStyle := nil.
     ]
 
     "
@@ -4872,7 +4879,7 @@
     "
 
     "Modified: / 02-01-1997 / 13:32:25 / cg"
-    "Modified: / 17-04-2012 / 21:00:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 28-08-2013 / 01:16:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 selectFromLine:startLine toLine:endLine
@@ -4974,8 +4981,8 @@
     sel notEmptyOrNil ifTrue:[
         "/ this is rubbish; we are now always using unicode internally
         "/ any many more conversions would be needed at many places...
-        (characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[
-            sel := sel encodeFrom:characterEncoding into:#'iso10646-1'
+        (gc characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[
+            sel := sel encodeFrom:gc characterEncoding into:#'iso10646-1'
         ].
     ].
     ^ sel
@@ -5022,8 +5029,8 @@
     "can be redefined for notification or special actions"
 
     device notNil ifTrue:[
-	"On X11, be nice and set the PRIMARY selection.
-	 (#setPrimaryText:ownerView: is void in DeviceWorkstation)"
+        "On X11, be nice and set the PRIMARY selection.
+         (#setPrimaryText:ownerView: is void in DeviceWorkstation)"
 	device setPrimaryText: self selectionAsString ownerView: self.
     ].
 
@@ -5147,6 +5154,11 @@
 
 version_CVS
     ^ '$Header$'
+!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
 ! !
 
 
--- a/stx_libwidg.st	Sun May 01 18:21:59 2016 +0200
+++ b/stx_libwidg.st	Mon May 02 06:46:50 2016 +0200
@@ -49,6 +49,52 @@
 "
 ! !
 
+!stx_libwidg class methodsFor:'accessing - hg - settings'!
+
+hgEnsureCopyrightMethod
+    "If true, then #copyright method is automatically compiled in each class
+     (but iff project definition defines it)
+
+     Default is true (compile such method) but if the repository is mirror of CVS and
+     you want to merge back to CVS at some point, you may want to not compile them
+     to keep changes against CVS minimal"
+
+    ^false
+
+    "Created: / 09-10-2013 / 15:39:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+hgEnsureVersion_HGMethod
+    "If true, then #version_HG method is automatically compiled in each class.
+
+     Default is true (compile such method) but if the repository is mirror of CVS and
+     you want to merge back to CVS at some point, you may want to not compile them
+     to keep changes against CVS minimal. 
+
+     If false, version_HG is compiled only in classes that has been modified
+     and commited.
+
+     Note that Mercurial can live without them
+     just fine"
+
+    ^false
+
+    "Created: / 09-10-2013 / 15:39:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+hgRemoveContainesForDeletedClasses
+    "If true, then containers for removed classes are __AUTOMATICALLY__ removed from the
+     repositoru. If false, obsolete containes are kept.
+
+     Default is true (remove obsolete containers) but if the repository is mirror of CVS and
+     you want to merge back to CVS at some point, you may want to return false to avoid deletions
+     of obsolete files. Usefull when branching off an old CVS repo with loads of mess."
+
+    ^false
+
+    "Created: / 09-10-2013 / 15:39:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !stx_libwidg class methodsFor:'description'!
 
 excludedFromPreRequisites
@@ -254,5 +300,9 @@
 
 version_CVS
     ^ '$Header$'
+!
+
+version_HG
+    ^ '$Changeset: <not expanded> $'
 ! !
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/EditTextViewTests.st	Mon May 02 06:46:50 2016 +0200
@@ -0,0 +1,56 @@
+"{ Package: 'stx:libwidg/tests' }"
+
+"{ NameSpace: Smalltalk }"
+
+TestCase subclass:#EditTextViewTests
+	instanceVariableNames:'textView textViewInteractor'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Views-Text-Tests'
+!
+
+!EditTextViewTests methodsFor:'running'!
+
+setUp
+    | topView |
+
+    Smalltalk loadPackage: 'stx:goodies/sunitext/ui'.
+
+    topView := StandardSystemView new.
+    topView extent: 320 @ 200.
+    topView label: self printString.
+    textView := EditTextView origin: 0.0@0.0 extent: 1.0@1.0 in: topView.
+    textViewInteractor := textView interactor.
+
+
+    topView open.
+    topView waitUntilVisible.
+
+    "Created: / 23-07-2014 / 07:15:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 24-02-2015 / 08:22:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+tearDown
+    textView topView destroy.
+
+    "Created: / 23-07-2014 / 07:17:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 24-02-2015 / 08:17:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!EditTextViewTests methodsFor:'tests'!
+
+test_01
+    textView contents: 'Hello, here is Smalltalk X'.
+    textView setCursorCol: 14.
+
+    textViewInteractor type: #SelectWord.
+    self assert: textView selectionAsString = 'is'.
+
+    textViewInteractor type: #CtrlShiftCursorRight.
+    textViewInteractor type: #CtrlShiftCursorRight.
+
+    self assert: textView selectionAsString = 'is Smalltalk'.
+
+    "Created: / 24-02-2015 / 08:21:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/Make.proto	Mon May 02 06:46:50 2016 +0200
@@ -0,0 +1,144 @@
+# $Header$
+#
+# DO NOT EDIT
+# automagically generated from the projectDefinition: stx_libwidg_tests.
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp or projectDefinition-build again - otherwise, your changes are lost.
+#
+# The Makefile as generated by this Make.proto supports the following targets:
+#    make         - compile all st-files to a classLib
+#    make clean   - clean all temp files
+#    make clobber - clean all
+#
+# This file contains definitions for Unix based platforms.
+# It shares common definitions with the win32-make in Make.spec.
+
+#
+# position (of this package) in directory hierarchy:
+# (must point to ST/X top directory, for tools and includes)
+TOP=../..
+INCLUDE_TOP=$(TOP)/..
+
+# subdirectories where targets are to be made:
+SUBDIRS=
+
+
+# subdirectories where Makefiles are to be made:
+# (only define if different from SUBDIRS)
+# ALLSUBDIRS=
+
+REQUIRED_SUPPORT_DIRS=
+
+# if your embedded C code requires any system includes,
+# add the path(es) here:,
+# ********** OPTIONAL: MODIFY the next lines ***
+# LOCALINCLUDES=-Ifoo -Ibar
+LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/goodies/smallsense -I$(INCLUDE_TOP)/stx/goodies/sunit -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libview -I$(INCLUDE_TOP)/stx/libwidg
+
+
+# if you need any additional defines for embedded C code,
+# add them here:,
+# ********** OPTIONAL: MODIFY the next lines ***
+# LOCALDEFINES=-Dfoo -Dbar -DDEBUG
+LOCALDEFINES=
+
+LIBNAME=libstx_libwidg_tests
+STCLOCALOPT='-package=$(PACKAGE)' -I. $(LOCALINCLUDES) $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -headerDir=.  -varPrefix=$(LIBNAME)
+
+
+# ********** OPTIONAL: MODIFY the next line ***
+# additional C-libraries that should be pre-linked with the class-objects
+LD_OBJ_LIBS=
+LOCAL_SHARED_LIBS=
+
+
+# ********** OPTIONAL: MODIFY the next line ***
+# additional C targets or libraries should be added below
+LOCAL_EXTRA_TARGETS=
+
+OBJS= $(COMMON_OBJS) $(UNIX_OBJS)
+
+
+
+all:: preMake classLibRule postMake
+
+pre_objs::  
+
+
+
+
+
+
+# Enforce recompilation of package definition class if Mercurial working
+# copy state changes. Together with --guessVersion it ensures that package
+# definition class always contains correct binary revision string.
+ifneq (**NOHG**, $(shell hg root 2> /dev/null || echo -n '**NOHG**'))
+stx_libwidg_tests.$(O): $(shell hg root)/.hg/dirstate
+endif
+
+
+
+
+# run default testsuite for this package
+test: $(TOP)/goodies/builder/reports
+	$(MAKE) -C $(TOP)/goodies/builder/reports -f Makefile.init
+	$(TOP)/goodies/builder/reports/report-runner.sh -D . -r Builder::TestReport -p $(PACKAGE)
+
+
+
+# add more install actions here
+install::
+
+# add more install actions for aux-files (resources) here
+installAux::
+
+# add more preMake actions here
+preMake::
+
+# add more postMake actions here
+postMake:: cleanjunk
+
+# build all mandatory prerequisite packages (containing superclasses) for this package
+prereq:
+	cd ../../libbasic && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../goodies/refactoryBrowser/helpers && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../goodies/refactoryBrowser/parser && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../goodies/regex && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../libbasic2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../libbasic3 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../libcomp && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../libui && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../libview && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../libview2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../goodies/refactoryBrowser/browser && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../goodies/sunit && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../ && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../goodies/refactoryBrowser/lint && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../libhtml && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../libwidg2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../libtool && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../goodies/smallsense && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+
+
+# build all packages containing referenced classes for this package
+# they are not needed to compile the package (but later, to load it)
+references:
+
+
+cleanjunk::
+	-rm -f *.s *.s2
+
+clean::
+	-rm -f *.o *.H
+
+clobber:: clean
+	-rm -f *.so *.dll
+
+
+# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
+$(OUTDIR)stx_libwidg_tests.$(O) stx_libwidg_tests.$(H): stx_libwidg_tests.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(STCHDR)
+
+# ENDMAKEDEPEND --- do not remove this line
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/Make.spec	Mon May 02 06:46:50 2016 +0200
@@ -0,0 +1,63 @@
+# $Header$
+#
+# DO NOT EDIT
+# automagically generated from the projectDefinition: stx_libwidg_tests.
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp or projectDefinition-build again - otherwise, your changes are lost.
+#
+# This file contains specifications which are common to all platforms.
+#
+
+# Do NOT CHANGE THESE DEFINITIONS
+# (otherwise, ST/X will have a hard time to find out the packages location from its packageID,
+#  to find the source code of a class and to find the library for a package)
+MODULE=stx
+MODULE_DIR=libwidg/tests
+PACKAGE=$(MODULE):$(MODULE_DIR)
+
+
+# Argument(s) to the stc compiler (stc --usage).
+#  -headerDir=. : create header files locally
+#                (if removed, they will be created as common
+#  -Pxxx       : defines the package
+#  -Zxxx       : a prefix for variables within the classLib
+#  -Dxxx       : defines passed to to CC for inline C-code
+#  -Ixxx       : include path passed to CC for inline C-code
+#  +optspace   : optimized for space
+#  +optspace2  : optimized more for space
+#  +optspace3  : optimized even more for space
+#  +optinline  : generate inline code for some ST constructs
+#  +inlineNew  : additionally inline new
+#  +inlineMath : additionally inline some floatPnt math stuff
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCLOCALOPTIMIZATIONS=+optinline +inlineNew
+# STCLOCALOPTIMIZATIONS=+optspace3
+STCLOCALOPTIMIZATIONS=+optspace3
+
+
+# Argument(s) to the stc compiler (stc --usage).
+#  -warn            : no warnings
+#  -warnNonStandard : no warnings about ST/X extensions
+#  -warnEOLComments : no warnings about EOL comment extension
+#  -warnPrivacy     : no warnings about privateClass extension
+#  -warnUnused      : no warnings about unused variables
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCWARNINGS=-warn
+# STCWARNINGS=-warnNonStandard
+# STCWARNINGS=-warnEOLComments
+STCWARNINGS=-warnNonStandard
+
+COMMON_CLASSES= \
+	stx_libwidg_tests \
+
+
+
+
+COMMON_OBJS= \
+    $(OUTDIR_SLASH)stx_libwidg_tests.$(O) \
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/Makefile.init	Mon May 02 06:46:50 2016 +0200
@@ -0,0 +1,27 @@
+#
+# DO NOT EDIT
+#
+# make uses this file (Makefile) only, if there is no
+# file named "makefile" (lower-case m) in the same directory.
+# My only task is to generate the real makefile and call make again.
+# Thereafter, I am no longer used and needed.
+#
+# MACOSX caveat:
+#   as filenames are not case sensitive (in a default setup),
+#   we cannot use the above trick. Therefore, this file is now named
+#   "Makefile.init", and you have to execute "make -f Makefile.init" to
+#   get the initial makefile.  This is now also done by the toplevel CONFIG
+#   script.
+
+.PHONY: run
+
+run: makefile
+	$(MAKE) -f makefile
+
+#only needed for the definition of $(TOP)
+include Make.proto
+
+makefile: mf
+
+mf:
+	$(TOP)/rules/stmkmf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/abbrev.stc	Mon May 02 06:46:50 2016 +0200
@@ -0,0 +1,5 @@
+# automagically generated by the project definition
+# this file is needed for stc to be able to compile modules independently.
+# it provides information about a classes filename, category and especially namespace.
+EditTextViewTests EditTextViewTests stx:libwidg/tests 'Views-Text-Tests' 1
+stx_libwidg_tests stx_libwidg_tests stx:libwidg/tests '* Projects & Packages *' 3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/bc.mak	Mon May 02 06:46:50 2016 +0200
@@ -0,0 +1,99 @@
+# $Header$
+#
+# DO NOT EDIT
+# automagically generated from the projectDefinition: stx_libwidg_tests.
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp or projectDefinition-build again - otherwise, your changes are lost.
+#
+# Notice, that the name bc.mak is historical (from times, when only borland c was supported).
+# This file contains make rules for the win32 platform using either borland-bcc or visual-c.
+# It shares common definitions with the unix-make in Make.spec.
+# The bc.mak supports the following targets:
+#    bmake         - compile all st-files to a classLib (dll)
+#    bmake clean   - clean all temp files
+#    bmake clobber - clean all
+#
+# Historic Note:
+#  this used to contain only rules to make with borland
+#    (called via bmake, by "make.exe -f bc.mak")
+#  this has changed; it is now also possible to build using microsoft visual c
+#    (called via vcmake, by "make.exe -f bc.mak -DUSEVC")
+#
+TOP=..\..
+INCLUDE_TOP=$(TOP)\..
+
+
+
+!INCLUDE $(TOP)\rules\stdHeader_bc
+
+!INCLUDE Make.spec
+
+LIBNAME=libstx_libwidg_tests
+MODULE_PATH=libwidg\tests
+RESFILES=tests.$(RES)
+
+
+
+LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\goodies\smallsense -I$(INCLUDE_TOP)\stx\goodies\sunit -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libview -I$(INCLUDE_TOP)\stx\libwidg
+LOCALDEFINES=
+
+STCLOCALOPT=-package=$(PACKAGE) -I. $(LOCALINCLUDES) -headerDir=. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES)  -varPrefix=$(LIBNAME)
+LOCALLIBS=
+
+OBJS= $(COMMON_OBJS) $(WIN32_OBJS)
+
+ALL::  classLibRule
+
+classLibRule: $(OUTDIR) $(OUTDIR)$(LIBNAME).dll
+
+!INCLUDE $(TOP)\rules\stdRules_bc
+
+# build all mandatory prerequisite packages (containing superclasses) for this package
+prereq:
+	pushd ..\..\libbasic & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\goodies\refactoryBrowser\helpers & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\goodies\refactoryBrowser\parser & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\goodies\regex & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\libbasic2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\libbasic3 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\libcomp & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\libui & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\libview & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\goodies\refactoryBrowser\browser & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\goodies\sunit & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd .. & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\goodies\refactoryBrowser\lint & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\libhtml & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\libwidg2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\libtool & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\goodies\smallsense & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+
+
+
+
+
+
+
+test: $(TOP)\goodies\builder\reports\NUL
+	pushd $(TOP)\goodies\builder\reports & $(MAKE_BAT)
+	$(TOP)\goodies\builder\reports\report-runner.bat -D . -r Builder::TestReport -p $(PACKAGE)
+        
+clean::
+	del *.$(CSUFFIX)
+
+
+# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
+$(OUTDIR)stx_libwidg_tests.$(O) stx_libwidg_tests.$(H): stx_libwidg_tests.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(STCHDR)
+
+# ENDMAKEDEPEND --- do not remove this line
+
+# **Must be at end**
+
+# Enforce recompilation of package definition class if Mercurial working
+# copy state changes. Together with --guessVersion it ensures that package
+# definition class always contains correct binary revision string.
+!IFDEF HGROOT
+$(OUTDIR)stx_libwidg_tests.$(O): $(HGROOT)\.hg\dirstate
+!ENDIF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/bmake.bat	Mon May 02 06:46:50 2016 +0200
@@ -0,0 +1,12 @@
+@REM -------
+@REM make using Borland bcc32
+@REM type bmake, and wait...
+@REM do not edit - automatically generated from ProjectDefinition
+@REM -------
+@SET DEFINES=
+@REM Kludge got Mercurial, cannot be implemented in Borland make
+@FOR /F "tokens=*" %%i in ('hg root') do SET HGROOT=%%i
+@IF "%HGROOT%" NEQ "" SET DEFINES=%DEFINES% "-DHGROOT=%HGROOT%"
+make.exe -N -f bc.mak  %DEFINES% %*
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lccmake.bat	Mon May 02 06:46:50 2016 +0200
@@ -0,0 +1,8 @@
+@REM -------
+@REM make using lcc compiler
+@REM type lccmake, and wait...
+@REM do not edit - automatically generated from ProjectDefinition
+@REM -------
+make.exe -N -f bc.mak -DUSELCC=1 %*
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libInit.cc	Mon May 02 06:46:50 2016 +0200
@@ -0,0 +1,34 @@
+/*
+ * $Header$
+ *
+ * DO NOT EDIT
+ * automagically generated from the projectDefinition: stx_libwidg_tests.
+ */
+#define __INDIRECTVMINITCALLS__
+#include <stc.h>
+
+#ifdef WIN32
+# pragma codeseg INITCODE "INITCODE"
+#endif
+
+#if defined(INIT_TEXT_SECTION) || defined(DLL_EXPORT)
+DLL_EXPORT void _libstx_libwidg_tests_Init() INIT_TEXT_SECTION;
+DLL_EXPORT void _libstx_libwidg_tests_InitDefinition() INIT_TEXT_SECTION;
+#endif
+
+void _libstx_libwidg_tests_InitDefinition(pass, __pRT__, snd)
+OBJ snd; struct __vmData__ *__pRT__; {
+__BEGIN_PACKAGE2__("libstx_libwidg_tests__DFN", _libstx_libwidg_tests_InitDefinition, "stx:libwidg/tests");
+_stx_137libwidg_137tests_Init(pass,__pRT__,snd);
+
+__END_PACKAGE__();
+}
+
+void _libstx_libwidg_tests_Init(pass, __pRT__, snd)
+OBJ snd; struct __vmData__ *__pRT__; {
+__BEGIN_PACKAGE2__("libstx_libwidg_tests", _libstx_libwidg_tests_Init, "stx:libwidg/tests");
+_stx_137libwidg_137tests_Init(pass,__pRT__,snd);
+
+
+__END_PACKAGE__();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/mingwmake.bat	Mon May 02 06:46:50 2016 +0200
@@ -0,0 +1,16 @@
+@REM -------
+@REM make using mingw gnu compiler
+@REM type mingwmake, and wait...
+@REM do not edit - automatically generated from ProjectDefinition
+@REM -------
+@SET DEFINES=
+@REM Kludge got Mercurial, cannot be implemented in Borland make
+@FOR /F "tokens=*" %%i in ('hg root') do SET HGROOT=%%i
+@IF "%HGROOT%" NEQ "" SET DEFINES=%DEFINES% "-DHGROOT=%HGROOT%"
+
+@pushd ..\..\rules
+@call find_mingw.bat
+@popd
+make.exe -N -f bc.mak %DEFINES% %USEMINGW_ARG% %*
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/stx_libwidg_tests.st	Mon May 02 06:46:50 2016 +0200
@@ -0,0 +1,123 @@
+"{ Package: 'stx:libwidg/tests' }"
+
+"{ NameSpace: Smalltalk }"
+
+LibraryDefinition subclass:#stx_libwidg_tests
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'* Projects & Packages *'
+!
+
+
+!stx_libwidg_tests class methodsFor:'description'!
+
+excludedFromPreRequisites
+    "list packages which are to be explicitely excluded from the automatic constructed
+     prerequisites list. If empty, everything that is found along the inheritance of any of
+     my classes is considered to be a prerequisite package."
+
+    ^ #(
+    )
+!
+
+mandatoryPreRequisites
+    "list packages which are mandatory as a prerequisite.
+     This are packages containing superclasses of my classes and classes which
+     are extended by myself.
+     They are mandatory, because we need these packages as a prerequisite for loading and compiling.
+     This method is generated automatically,
+     by searching along the inheritance chain of all of my classes."
+
+    ^ #(
+        #'stx:goodies/smallsense'    "SmallSense::AbstractTestCase - superclass of EditTextViewTests"
+        #'stx:goodies/sunit'    "TestAsserter - superclass of EditTextViewTests"
+        #'stx:libbasic'    "LibraryDefinition - superclass of stx_libwidg_tests"
+    )
+!
+
+referencedPreRequisites
+    "list packages which are a prerequisite, because they contain
+     classes which are referenced by my classes.
+     We do not need these packages as a prerequisite for compiling or loading,
+     however, a class from it may be referenced during execution and having it
+     unloaded then may lead to a runtime doesNotUnderstand error, unless the caller
+     includes explicit checks for the package being present.
+     This method is generated automatically,
+     by searching all classes (and their packages) which are referenced by my classes."
+
+    ^ #(
+        #'stx:libview'    "StandardSystemView - referenced by EditTextViewTests>>setUp"
+        #'stx:libwidg'    "EditTextView - referenced by EditTextViewTests>>setUp"
+    )
+!
+
+subProjects
+    "list packages which are known as subprojects.
+     The generated makefile will enter those and make there as well.
+     However: they are not forced to be loaded when a package is loaded;
+     for those, redefine requiredPrerequisites."
+
+    ^ #(
+    )
+! !
+
+!stx_libwidg_tests class methodsFor:'description - contents'!
+
+classNamesAndAttributes
+    "lists the classes which are to be included in the project.
+     Each entry in the list may be: a single class-name (symbol),
+     or an array-literal consisting of class name and attributes.
+     Attributes are: #autoload or #<os> where os is one of win32, unix,..."
+
+    ^ #(
+        "<className> or (<className> attributes...) in load order"
+        (EditTextViewTests autoload)
+        #'stx_libwidg_tests'
+    )
+!
+
+extensionMethodNames
+    "list class/selector pairs of extensions.
+     A correponding method with real names must be present in my concrete subclasses"
+
+    ^ #(
+    )
+! !
+
+!stx_libwidg_tests class methodsFor:'description - project information'!
+
+companyName
+    "Returns a company string which will appear in <lib>.rc.
+     Under win32, this is placed into the dlls file-info"
+
+    ^ 'eXept Software AG'
+!
+
+description
+    "Returns a description string which will appear in nt.def / bc.def"
+
+    ^ 'Smalltalk/X Class library'
+!
+
+legalCopyright
+    "Returns a copyright string which will appear in <lib>.rc.
+     Under win32, this is placed into the dlls file-info"
+
+    ^ 'Copyright Claus Gittinger 1988-2015\nCopyright eXept Software AG 1998-2015'
+!
+
+productName
+    "Returns a product name which will appear in <lib>.rc.
+     Under win32, this is placed into the dlls file-info.
+     This method is usually redefined in a concrete application definition"
+
+    ^ 'Smalltalk/X'
+! !
+
+!stx_libwidg_tests class methodsFor:'documentation'!
+
+version_HG
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/vcmake.bat	Mon May 02 06:46:50 2016 +0200
@@ -0,0 +1,20 @@
+@REM -------
+@REM make using Microsoft Visual C compiler
+@REM type vcmake, and wait...
+@REM do not edit - automatically generated from ProjectDefinition
+@REM -------
+
+@if not defined VSINSTALLDIR (
+    pushd ..\..\rules
+    call vcsetup.bat
+    popd
+)
+@SET DEFINES=
+@REM Kludge got Mercurial, cannot be implemented in Borland make
+@FOR /F "tokens=*" %%i in ('hg root') do SET HGROOT=%%i
+@IF "%HGROOT%" NEQ "" SET DEFINES=%DEFINES% "-DHGROOT=%HGROOT%"
+make.exe -N -f bc.mak -DUSEVC=1 %DEFINES% %*
+
+
+
+