Merge jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 09 May 2016 21:43:19 +0200
branchjv
changeset 5737 98bc0782ffa1
parent 5709 219a28ca67d1 (current diff)
parent 5722 310ea67baa1c (diff)
child 5738 9498dfe97f83
Merge
EditTextView.st
ListView.st
SelectionInListView.st
TextView.st
WorkspaceCompletionSupport.st
--- a/DialogBox.st	Sat May 07 06:52:44 2016 +0200
+++ b/DialogBox.st	Mon May 09 21:43:19 2016 +0200
@@ -6585,17 +6585,18 @@
         onCancel:nil
         list:nil
         initialSelection:nil
-        entryCompletionBlock:[:s :field| 
-                                |completion|
-
-                                completion := Smalltalk selectorCompletion:s.
-                                completion second size > 1 ifTrue:[ 
-                                    UserPreferences current beepInEditor ifTrue:[                
-                                        Screen current beep
-                                    ].
-                                ].
-                                field contents:(completion first)
-                              ]
+        entryCompletionBlock:
+            [:s :field| 
+                |completion|
+
+                completion := Smalltalk selectorCompletion:s.
+                completion second size > 1 ifTrue:[ 
+                    UserPreferences current beepInEditor ifTrue:[                
+                        Screen current beep
+                    ].
+                ].
+                field contents:(completion first)
+            ]
 
     "
      Dialog 
--- a/EditTextView.st	Sat May 07 06:52:44 2016 +0200
+++ b/EditTextView.st	Mon May 09 21:43:19 2016 +0200
@@ -7881,11 +7881,11 @@
         searchBackwardFor:pattern
         ignoreCase:ign
         startingAtLine:startLine col:startCol
-        ifFound:[:line :col |
+        ifFound:[:line :col :endColOrNil |
             self cursorMovementAllowed ifTrue:[
                 self cursorLine:line col:col.
             ].
-            self showMatch:pattern isMatch:false atLine:line col:col.
+            self showMatch:pattern isMatch:false atLine:line col:col endCol:endColOrNil.
 "/            self makeLineVisible:cursorLine
             typeOfSelection := #search]
         ifAbsent:aBlock
@@ -7925,11 +7925,11 @@
         ignoreCase:ign
         match: match
         startingAtLine:startLine col:startCol
-        ifFound:[:line :col |
+        ifFound:[:line :col :endColOrNil|
             self cursorMovementAllowed ifTrue:[
                 self cursorLine:line col:col.
             ].
-            self showMatch:pattern isMatch:match atLine:line col:col.
+            self showMatch:pattern isMatch:match atLine:line col:col endCol:endColOrNil.
 "/            self makeLineVisible:cursorLine
             typeOfSelection := #search
         ]
@@ -8006,8 +8006,8 @@
     "Modified: / 07-05-2011 / 17:25:59 / cg"
 !
 
-showMatch:pattern isMatch:isMatch atLine:line col:col
-    super showMatch:pattern isMatch:isMatch atLine:line col:col.
+showMatch:pattern isMatch:isMatch atLine:line col:col endCol:encColOrNil
+    super showMatch:pattern isMatch:isMatch atLine:line col:col endCol:encColOrNil.
     typeOfSelection := #search.
 !
 
@@ -8626,6 +8626,10 @@
 
 canCombineWithNext:nextAction
     ^ false
+!
+
+isRestoreSelectionAndCursor
+    ^ false
 ! !
 
 !EditTextView::DeleteRange methodsFor:'accessing'!
@@ -9156,6 +9160,12 @@
     "Created: / 30-04-2016 / 20:14:55 / cg"
 ! !
 
+!EditTextView::RestoreSelectionAndCursor methodsFor:'queries'!
+
+isRestoreSelectionAndCursor
+    ^ true
+! !
+
 !EditTextView class methodsFor:'documentation'!
 
 version
--- a/FramedBox.st	Sat May 07 06:52:44 2016 +0200
+++ b/FramedBox.st	Mon May 09 21:43:19 2016 +0200
@@ -51,7 +51,7 @@
     showFrame to false.
 
     The distance from the outer viewBorder to the frame is controlled by
-    horizontalSpace / verticalSpace. The default is the fonts height.
+    horizontalSpace / verticalSpace. The default is the font's height.
 
     The distance from the frame to the interior area is controlled by
     innerHorizontalSpace / innerVerticalSpace. The default is 0.
--- a/ListView.st	Sat May 07 06:52:44 2016 +0200
+++ b/ListView.st	Mon May 09 21:43:19 2016 +0200
@@ -2854,7 +2854,7 @@
 
 getFontParameters
     "get some info of the used font. They are cached since we use them often ..
-     The code below uses the fonts average height parameters - these
+     The code below uses the font's average height parameters - these
      are not OK for some oversized national characters (such as A-dieresis).
      Therefore, this method should be redefined in views which will be used
      with national characters (i.e. editTextViews)."
@@ -4810,7 +4810,7 @@
                                               and:[ (self findEndOfWordAtLine:lnr col:col) == (col + patternSize - 1) ]]
                                     ) ifTrue:[
                                         (atBeginOfLineOnly not or:[col == 1]) ifTrue:[
-                                            ^ block1 value:lnr value:col.
+                                            ^ block1 value:lnr value:col optionalArgument:nil.
                                         ]
                                     ]
                                 ].
@@ -4873,7 +4873,7 @@
 searchForwardUsingSpec:searchSpec startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
     "search for a pattern, if found evaluate block1 with row/col as arguments, 
      if not found evaluate block2. 
-     If the block is a three-arg block, it gets the end-col (or nil, if not found)"
+     If the block is a three-arg block, it gets the end-col (or nil, if not known)"
 
     |lineString col pattern match regexMatch ignCase fullWord atBeginOfLineOnly
      wrapAtEndOfText patternSize matcher lnr   "{Class: SmallInteger}"  
@@ -4884,6 +4884,10 @@
     pattern := searchSpec pattern.
     match := searchSpec match.
     regexMatch := searchSpec regexMatch.
+    (match and:[regexMatch not]) ifTrue:[
+        pattern := pattern globPatternAsRegexPattern.
+        regexMatch := true.
+    ].    
     ignCase := searchSpec ignoreCase.
     fullWord := searchSpec fullWord.
     atBeginOfLineOnly := searchSpec atBeginOfLineOnly.
@@ -4943,7 +4947,7 @@
                                             ^ block1 value:lnr value:foundCol optionalArgument:endCol.
                                         ]]]]]].
             ] ifFalse:[    
-                (match and:[regexMatch or:[pattern includesUnescapedMatchCharacters]]) ifTrue:[
+                (match and:[pattern includesUnescapedMatchCharacters]) ifTrue:[
                     "perform a findMatchString (glob matching)"
                     p := pattern species new:0.
                     (pattern startsWith:$*) ifFalse:[p := p , '*'].
@@ -4967,6 +4971,9 @@
                 ] ifFalse:[
                     "perform a findString (no matching)"
                     p := pattern.
+                    (match and:[pattern includesMatchCharacters]) ifTrue:[
+                        p := pattern withoutMatchEscapes
+                    ].    
                     runner 
                         value:[:lnr :col :lineString |
                             foundCol := lineString
@@ -5275,8 +5282,8 @@
     ^ atBeginOfLineOnly ? false
 !
 
-atBeginOfLineOnly:something
-    atBeginOfLineOnly := something.
+atBeginOfLineOnly:aBoolean
+    atBeginOfLineOnly := aBoolean.
 !
 
 forward
@@ -5391,11 +5398,11 @@
 !
 
 regexMatch
-    ^ regexMatch
-!
-
-regexMatch:something
-    regexMatch := something.
+    ^ regexMatch ? false
+!
+
+regexMatch:aBoolean
+    regexMatch := aBoolean.
 !
 
 variable
--- a/SelectionInListView.st	Sat May 07 06:52:44 2016 +0200
+++ b/SelectionInListView.st	Mon May 09 21:43:19 2016 +0200
@@ -2817,7 +2817,7 @@
     lineNr notNil ifTrue:[
         len := self widthOfLine:lineNr.
         len > width ifTrue:[
-            ^ (self listAt:lineNr) collect:[:ch | ch isSeparator ifTrue:[$ ] ifFalse:[ch]]  
+            ^ (self listAt:lineNr) string collect:[:ch | ch isSeparator ifTrue:[$ ] ifFalse:[ch]]  
         ].      
     ].
     ^ nil
--- a/TextView.st	Sat May 07 06:52:44 2016 +0200
+++ b/TextView.st	Mon May 09 21:43:19 2016 +0200
@@ -3647,10 +3647,12 @@
     startCol := pos x.
 
     self
-	searchBackwardUsingSpec:searchSpec
-	startingAtLine:startLine col:startCol
-	ifFound:[:line :col | self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col]
-	ifAbsent:aBlock
+        searchBackwardUsingSpec:searchSpec
+        startingAtLine:startLine col:startCol
+        ifFound:[:line :col :endColOrNil| 
+            self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col endCol:endColOrNil
+        ]
+        ifAbsent:aBlock
 !
 
 searchForAndSelectMatchingParenthesisFromLine:startLine col:startCol
@@ -4390,8 +4392,8 @@
     self
         searchForwardUsingSpec:searchSpec
         startingAtLine:startLine col:startCol
-        ifFound:[:line :col | 
-            self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col
+        ifFound:[:line :col :endColOrNil| 
+            self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col endCol:endColOrNil
         ]
         ifAbsent:aBlock
 !
@@ -4403,33 +4405,41 @@
 !
 
 searchUsingSearchAction:direction
+    "search using a searchaction which has been given by someone else.
+     Typically, this is the embedding browser, which has provided an action for
+      a language aware search (as opposed to a naive string search)"
+
     self
-	searchUsingSearchAction:direction
-	ifAbsent:[
-		    self sensor compressKeyPressEventsWithKey:#FindNext.
-		    self showNotFound
-		 ]
+        searchUsingSearchAction:direction
+        ifAbsent:[
+                    self sensor compressKeyPressEventsWithKey:#FindNext.
+                    self showNotFound
+                 ]
 !
 
 searchUsingSearchAction:direction ifAbsent:notFoundAction
+    "search using a searchaction which has been given by someone else.
+     Typically, this is the embedding browser, which has provided an action for
+      a language aware search (as opposed to a naive string search)"
+      
     |pos startLine startCol|
 
     pos :=  direction == #backward
-		ifTrue:[self startPositionForSearchBackward]
-		ifFalse:[self startPositionForSearchForward].
+                ifTrue:[self startPositionForSearchBackward]
+                ifFalse:[self startPositionForSearchForward].
     startLine := pos y.
     startCol := pos x.
 
     searchAction notNil ifTrue:[
-	searchAction
-	    value:direction
-	    value:startLine
-	    value:startCol
-	    value:[:line :col | self selectFromLine:line toLine:line]
-	    value:notFoundAction.
-	self hasSelection ifTrue: [
-	    self changeTypeOfSelectionTo: #searchAction.
-	].
+        searchAction
+            value:direction
+            value:startLine
+            value:startCol
+            value:[:line :col | self selectFromLine:line toLine:line]
+            value:notFoundAction.
+        self hasSelection ifTrue: [
+            self changeTypeOfSelectionTo: #searchAction.
+        ].
     ].
 !
 
@@ -4459,6 +4469,14 @@
     lastSearchIgnoredCase := aBoolean.
 !
 
+setSearchPattern:aString ignoreCase:ignoreCaseBoolean match:matchBoolean
+    "set the searchpattern and caseIgnore for future searches"
+
+    self setSearchPattern:aString.
+    lastSearchIgnoredCase := ignoreCaseBoolean.
+    lastSearchWasMatch := matchBoolean.
+!
+
 setSearchPatternWithMatchEscapes: match
     "set the searchpattern from the selection if there is one"
 
@@ -4477,33 +4495,43 @@
 !
 
 showMatch:pattern atLine:line col:col
+    <resource: #obsolete>
     "after a search, highlight the matched pattern.
      The code below needs a rewrite to take care of match-characters
      (for now, it only highlights simple patterns and '*string*' correctly)"
 
-    self showMatch:pattern isMatch:true atLine:line col:col
+    self showMatch:pattern isMatch:true atLine:line col:col endCol:nil
 !
 
 showMatch:pattern isMatch:isMatch atLine:line col:col
+    <resource: #obsolete>
+    "after a search, highlight the matched pattern."
+
+    self showMatch:pattern isMatch:isMatch atLine:line col:col endCol:nil
+!
+
+showMatch:pattern isMatch:isMatch atLine:line col:col endCol:encColOrNil
     "after a search, highlight the matched pattern.
      The code below needs a rewrite to take care of match-characters
      (for now, it only highlights simple patterns and '*string*' correctly)"
 
-    |realPattern|
-
-    realPattern := pattern.
-
-    isMatch ifTrue: [
-	(realPattern startsWith:$*) ifTrue:[
-            realPattern := realPattern copyButFirst
-	].
-	(realPattern endsWith:$*) ifTrue:[
-            realPattern := realPattern copyButLast
-	].
+    |endCol realPattern|
+
+    (endCol := encColOrNil) isNil ifTrue:[
+        "/ a hack.
+        realPattern := pattern.
+        isMatch ifTrue: [
+            (realPattern startsWith:$*) ifTrue:[
+                realPattern := realPattern copyButFirst
+            ].
+            (realPattern endsWith:$*) ifTrue:[
+                realPattern := realPattern copyButLast
+            ].
+        ].
+        endCol := (col + realPattern size - 1).
     ].
 
-    self selectFromLine:line col:col
-		 toLine:line col:(col + realPattern size - 1).
+    self selectFromLine:line col:col toLine:line col:endCol.
     self makeLineVisible:line
 !
 
--- a/WorkspaceCompletionSupport.st	Sat May 07 06:52:44 2016 +0200
+++ b/WorkspaceCompletionSupport.st	Mon May 09 21:43:19 2016 +0200
@@ -195,7 +195,7 @@
                                     ].    
                                     actions value:indexInSuggestions
                                 ] ifFalse:[
-                                    (actions at:indexInSuggestions) value
+                                    (actions at:indexInSuggestions) valueWithOptionalArgument:indexInSuggestions
                                 ].
                             ].
                         ].