# HG changeset patch # User Claus Gittinger # Date 1359234700 -3600 # Node ID 1fe68567471def5eb76666c4b9221bcdad83213b # Parent c71755f2c04a6d97b56c25fa1af3b1443f54a81f resizehandle diff -r c71755f2c04a -r 1fe68567471d TextView.st --- a/TextView.st Mon Jan 21 14:46:16 2013 +0100 +++ b/TextView.st Sat Jan 26 22:11:40 2013 +0100 @@ -1,6 +1,6 @@ " COPYRIGHT (c) 1989 by Claus Gittinger - All Rights Reserved + All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the @@ -37,7 +37,7 @@ copyright " COPYRIGHT (c) 1989 by Claus Gittinger - All Rights Reserved + All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the @@ -80,27 +80,27 @@ contentsWasSaved set to true, whenever saved in a file externalEncoding external encoding, used when text is saved to - a file. Usually something like - #jis7, #euc, #sjis etc. - (currently only passed down from the - fileBrowser) + a file. Usually something like + #jis7, #euc, #sjis etc. + (currently only passed down from the + fileBrowser) dropSource drag operation descriptor or nil (dragging disabled) - dragIsActive true, drag operation is activated - - searchAction an autosearch action; typically set by the browser. - Will be used as default when searchFwd/searchBwd is - pressed. If the searchPattern is changed, no autosearch - action will be executed. + dragIsActive true, drag operation is activated + + searchAction an autosearch action; typically set by the browser. + Will be used as default when searchFwd/searchBwd is + pressed. If the searchPattern is changed, no autosearch + action will be executed. searchBarActionBlock search action block for embedded search - panel. Used as second chance for searchFwd/bwd + panel. Used as second chance for searchFwd/bwd [class variables:] - ST80Selections enables ST80 style doubleclick behavior - (right after opening parenthesis, right before - closing parenthesis, at begin of a line - at begin of text) + ST80Selections enables ST80 style doubleclick behavior + (right after opening parenthesis, right before + closing parenthesis, at begin of a line + at begin of text) [StyleSheet parameters:] @@ -113,14 +113,14 @@ text.selectionBackgroundColor defaults to textForegroundColor text.alternativeSelectionForegroundColor pasted text (i.e. paste will not replace) - defaults to selectionForegroundColor + defaults to selectionForegroundColor text.alternativeSelectionBackgroundColor pasted text (i.e. paste will not replace) - defaults to selectionBackgroundColor + defaults to selectionBackgroundColor [author:] - Claus Gittinger + Claus Gittinger [see also:] - EditTextView CodeView Workspace + EditTextView CodeView Workspace " ! @@ -131,18 +131,18 @@ they may also be opened as a textEditor; open a (readonly) textView on some information text: - [exBegin] - TextView - openWith:'read this' - title:'demonstration' - [exEnd] + [exBegin] + TextView + openWith:'read this' + title:'demonstration' + [exEnd] the same, but open it modal: - [exBegin] - TextView - openModalWith:'read this first' - title:'demonstration' - [exEnd] + [exBegin] + TextView + openModalWith:'read this first' + title:'demonstration' + [exEnd] open it modal (but editable) on some text: @@ -153,26 +153,26 @@ However, usually an applicationModel is installed as the editor-topViews application. This would get a closeRequest, where it could handle things. - [exBegin] - |m textView| - - m := 'read this first' asValue. - textView := EditTextView openModalOnModel:m. - textView modified ifTrue:[ - (self confirm:'text was not accepted - do it now ?') - ifTrue:[ - m value:textView contents - ] - ]. - - Transcript showCR:m value. - [exEnd] + [exBegin] + |m textView| + + m := 'read this first' asValue. + textView := EditTextView openModalOnModel:m. + textView modified ifTrue:[ + (self confirm:'text was not accepted - do it now ?') + ifTrue:[ + m value:textView contents + ] + ]. + + Transcript showCR:m value. + [exEnd] open a textEditor on some file: - [exBegin] - EditTextView openOn:'Makefile' - [exEnd] + [exBegin] + EditTextView openOn:'Makefile' + [exEnd] " @@ -183,29 +183,29 @@ on:aModel aspect:aspect change:change menu:menu initialSelection:initial "for ST-80 compatibility" - ^ (self new) - on:aModel - aspect:aspect - list:aspect - change:change - menu:menu - initialSelection:initial + ^ (self new) + on:aModel + aspect:aspect + list:aspect + change:change + menu:menu + initialSelection:initial ! with:someText - ^ (self new) - contents:someText + ^ (self new) + contents:someText ! ! !TextView class methodsFor:'class initialization'! initialize DefaultParenthesisSpecification isNil ifTrue:[ - DefaultParenthesisSpecification := IdentityDictionary new. - DefaultParenthesisSpecification at:#open put:#( $( $[ ${ "$> $<") . - DefaultParenthesisSpecification at:#close put:#( $) $] $} "$> $<"). - DefaultParenthesisSpecification at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ). - DefaultParenthesisSpecification at:#eolComment put:'"/'. "/ sigh - must be 2 characters + DefaultParenthesisSpecification := IdentityDictionary new. + DefaultParenthesisSpecification at:#open put:#( $( $[ ${ "$> $<") . + DefaultParenthesisSpecification at:#close put:#( $) $] $} "$> $<"). + DefaultParenthesisSpecification at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ). + DefaultParenthesisSpecification at:#eolComment put:'"/'. "/ sigh - must be 2 characters ]. ! ! @@ -221,11 +221,11 @@ i := self classResources at:'ICON' default:nil. i isNil ifTrue:[ - nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'. - i := Smalltalk imageFromFileNamed:nm forClass:self. + nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'. + i := Smalltalk imageFromFileNamed:nm forClass:self. ]. i notNil ifTrue:[ - i := i onDevice:Display + i := i onDevice:Display ]. ^ i @@ -289,13 +289,13 @@ "extract values from the styleSheet and cache them in class variables" + #'text.selectionForegroundColor' + #'text.selectionBackgroundColor' + #'text.alternativeSelectionForegroundColor' + #'text.alternativeSelectionBackgroundColor' + #'textView.font' + #'text.wordSelectCatchesBlanks' + #'text.st80Selections')> DefaultViewBackground := StyleSheet colorAt:'textView.background' default:White. DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'. @@ -321,7 +321,7 @@ the UIHelpTool may not be able to read the specification." " - UIHelpTool openOnClass:TextView + UIHelpTool openOnClass:TextView " @@ -367,192 +367,192 @@ - ^ + ^ #(FullSpec - name: searchDialogSpec - window: + name: searchDialogSpec + window: (WindowSpec - label: 'String search' - name: 'String search' - min: (Point 10 10) - max: (Point 1280 1024) - bounds: (Rectangle 0 0 302 242) - ) - component: + label: 'String search' + name: 'String search' + min: (Point 10 10) + max: (Point 1280 1024) + bounds: (Rectangle 0 0 302 242) + ) + 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' - layout: (LayoutFrame 0 0.0 52 0 0 1.0 -30 1) - 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 302 24) - ) - (CheckBoxSpec - label: 'Match (forward only)' - name: 'matchCheckBox' - activeHelpKey: matchSearch - level: 0 - tabable: true - model: match - translateLabel: true - extent: (Point 302 24) - ) - (CheckBoxSpec - label: 'Search Full Words' - name: 'CheckBox2' - activeHelpKey: searchFullWord - level: 0 - enableChannel: searchFullWordEnabled - tabable: true - model: searchFullWord - translateLabel: true - extent: (Point 302 24) - ) - (CheckBoxSpec - label: 'Variable Only' - name: 'CheckBox1' - activeHelpKey: searchVariable - level: 0 - visibilityChannel: searchVariableVisible - enableChannel: searchVariableEnabled - tabable: true - model: searchVariable - translateLabel: true - labelChannel: stringWithVariableUnderCursorHolder - 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) - ) - (ViewSpec - name: 'Box1' - component: - (SpecCollection - collection: ( - (CheckBoxSpec - label: 'Global Replace With:' - name: 'CheckBox4' - layout: (LayoutFrame 0 0 0 0 149 0 23 0) - activeHelpKey: replaceText - level: 0 - enableChannel: replaceEnabled - tabable: true - model: replaceBoolean - translateLabel: true - ) - (InputFieldSpec - name: 'EntryField1' - layout: (LayoutFrame 150 0 0 0 -2 1 22 0) - activeHelpKey: replaceText - visibilityChannel: replaceBoolean - enableChannel: replaceBoolean - model: replaceTextHolder - acceptOnReturn: true - acceptOnTab: true - acceptOnPointerLeave: true - ) - ) - - ) - extent: (Point 302 24) - ) - ) - - ) - ) - (HorizontalPanelViewSpec - name: 'horizontalPanelView' - layout: (LayoutFrame 0 0.0 -28 1.0 0 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 - extent: (Point 96 21) - ) - (ActionButtonSpec - label: 'Prev' - name: 'prevButton' - level: 2 - translateLabel: true - tabable: true - model: prevAction - extent: (Point 96 21) - ) - (ActionButtonSpec - label: 'Next' - name: 'nextButton' - level: 2 - borderWidth: 1 - translateLabel: true - tabable: true - model: nextAction - isDefault: true - extent: (Point 96 21) - ) - ) - - ) - keepSpaceForOSXResizeHandle: true - ) - ) - - ) + 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 -30 1) + 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 302 24) + ) + (CheckBoxSpec + label: 'Match (forward only)' + name: 'matchCheckBox' + activeHelpKey: matchSearch + level: 0 + tabable: true + model: match + translateLabel: true + extent: (Point 302 24) + ) + (CheckBoxSpec + label: 'Search Full Words' + name: 'CheckBox2' + activeHelpKey: searchFullWord + level: 0 + enableChannel: searchFullWordEnabled + tabable: true + model: searchFullWord + translateLabel: true + extent: (Point 302 24) + ) + (CheckBoxSpec + label: 'Variable Only' + name: 'CheckBox1' + activeHelpKey: searchVariable + level: 0 + visibilityChannel: searchVariableVisible + enableChannel: searchVariableEnabled + tabable: true + model: searchVariable + translateLabel: true + labelChannel: stringWithVariableUnderCursorHolder + 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) + ) + (ViewSpec + name: 'Box1' + component: + (SpecCollection + collection: ( + (CheckBoxSpec + label: 'Global Replace With:' + name: 'CheckBox4' + layout: (LayoutFrame 0 0 0 0 149 0 23 0) + activeHelpKey: replaceText + level: 0 + enableChannel: replaceEnabled + tabable: true + model: replaceBoolean + translateLabel: true + ) + (InputFieldSpec + name: 'EntryField1' + layout: (LayoutFrame 150 0 0 0 -2 1 22 0) + activeHelpKey: replaceText + visibilityChannel: replaceBoolean + enableChannel: replaceBoolean + model: replaceTextHolder + acceptOnReturn: true + acceptOnTab: true + acceptOnPointerLeave: true + ) + ) + + ) + extent: (Point 302 24) + ) + ) + + ) + ) + (HorizontalPanelViewSpec + name: 'horizontalPanelView' + layout: (LayoutFrame 0 0.0 -28 1.0 0 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 + extent: (Point 96 21) + ) + (ActionButtonSpec + label: 'Prev' + name: 'prevButton' + level: 2 + translateLabel: true + tabable: true + model: prevAction + extent: (Point 96 21) + ) + (ActionButtonSpec + label: 'Next' + name: 'nextButton' + level: 2 + borderWidth: 1 + translateLabel: true + tabable: true + model: nextAction + isDefault: true + extent: (Point 96 21) + ) + ) + + ) + keepSpaceForOSXResizeHandleH: true + ) + ) + + ) ) ! ! @@ -579,7 +579,7 @@ openModalWith:aString "start a textView with aString as initial contents" - ^ self openModalWith:aString title:nil + ^ self openModalWith:aString title:nil " TextView openModalWith:'some text' @@ -639,7 +639,7 @@ openWith:aStringOrStringCollection "start a textView with aStringOrStringCollection as initial contents" - ^ self openWith:aStringOrStringCollection selected:false + ^ self openWith:aStringOrStringCollection selected:false " TextView openWith:'some text' @@ -652,7 +652,7 @@ ! openWith:aStringOrStringCollection selected:selectedBoolean - "start a textView with aStringOrStringCollection as initial (optionally selected) contents. + "start a textView with aStringOrStringCollection as initial (optionally selected) contents. Return the textView." |textView| @@ -695,10 +695,10 @@ label := 'unnamed'. top := StandardSystemView label:label icon:self defaultIcon. - frame := HVScrollableView - for:self - miniScrollerH:true miniScrollerV:false - in:top. + frame := HVScrollableView + for:self + miniScrollerH:true miniScrollerV:false + in:top. frame origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). ^ frame scrolledView @@ -712,7 +712,7 @@ textView := self setupEmpty. aFileName notNil ifTrue:[ - textView setupForFile:aFileName. + textView setupForFile:aFileName. ]. ^ textView @@ -743,7 +743,7 @@ aTitle notNil ifTrue:[top label:aTitle]. aStringOrStringCollection notNil ifTrue:[ - textView contents:aStringOrStringCollection + textView contents:aStringOrStringCollection ]. ^ textView @@ -805,18 +805,18 @@ |encodingSymOrNil| - encodingSymOrNil := encodingArg isNil - ifTrue:[#'iso10646-1'] - ifFalse:[encodingArg asSymbol]. + encodingSymOrNil := encodingArg isNil + ifTrue:[#'iso10646-1'] + ifFalse:[encodingArg asSymbol]. characterEncoding ~~ encodingSymOrNil ifTrue:[ - "/ TODO: reencode contents if required. - (list size ~~ 0 - and:[ list contains:[:line | line size > 0]]) ifTrue:[ - (self confirm:'Your text may need to be re-coded - this is not yet supported.\\Proceed ?') - ifFalse:[^ self]. - ]. - characterEncoding := encodingSymOrNil. + "/ TODO: reencode contents if required. + (list size ~~ 0 + and:[ list contains:[:line | line size > 0]]) ifTrue:[ + (self confirm:'Your text may need to be re-coded - this is not yet supported.\\Proceed ?') + ifFalse:[^ self]. + ]. + characterEncoding := encodingSymOrNil. ]. "Modified (format): / 25-01-2012 / 00:28:27 / cg" @@ -828,7 +828,7 @@ selectionStartLine isNil ifTrue:[^ 0]. ^ self characterPositionOfLine:selectionStartLine - col:selectionStartCol + col:selectionStartCol "Modified: 14.8.1997 / 16:35:37 / cg" ! @@ -839,7 +839,7 @@ selectionStartLine isNil ifTrue:[^ 0]. ^ self characterPositionOfLine:selectionEndLine - col:selectionEndCol + col:selectionEndCol "Created: 14.8.1997 / 16:35:24 / cg" "Modified: 14.8.1997 / 16:35:45 / cg" @@ -859,7 +859,7 @@ defaultFileNameForFileDialog "return the default fileName to use for the save-box" - ^ defaultFileNameForFileDialog + ^ defaultFileNameForFileDialog ! defaultFileNameForFileDialog:aBaseName @@ -941,11 +941,11 @@ contents:newContents selected:selectedBoolean self contents:newContents. selectedBoolean ifTrue:[ - list size == 1 ifTrue:[ - self selectFromLine:1 col:1 toLine:1 col:(list at:1) size - ] ifFalse:[ - self selectAll - ] + list size == 1 ifTrue:[ + self selectFromLine:1 col:1 toLine:1 col:(list at:1) size + ] ifFalse:[ + self selectAll + ] ] " @@ -1004,10 +1004,10 @@ super setContents:something. selStartLine notNil ifTrue:[ - self - selectFromLine:selStartLine col:selStartCol - toLine:selEndLine col:selEndCol. - selectStyle := selStyle + self + selectFromLine:selStartLine col:selStartCol + toLine:selEndLine col:selEndCol. + selectStyle := selStyle ]. @@ -1030,9 +1030,9 @@ self loadTextFile:aFileName. aFileName notNil ifTrue:[ - baseName := aFileName asFilename baseName. - self topView label:baseName. - self defaultFileNameForFileDialog:baseName. + baseName := aFileName asFilename baseName. + self topView label:baseName. + self defaultFileNameForFileDialog:baseName. ]. "Created: / 25-10-2006 / 14:47:13 / cg" @@ -1061,35 +1061,35 @@ beginCol := self findBeginOfWordAtLine:selectLine col:selectCol. endCol := self findEndOfWordAtLine:selectLine col:selectCol. endCol == 0 ifTrue:[ - endLine := selectLine + 1 + endLine := selectLine + 1 ]. "is the initial character within a word ?" (wordCheck value:thisCharacter) ifTrue:[ - " - try to catch a blank ... - " - - WordSelectCatchesBlanks ifTrue:[ - ((beginCol == 1) - or:[(self characterAtLine:selectLine col:(beginCol - 1)) - ~~ Character space]) ifTrue:[ - ((self characterAtLine:selectLine col:(endCol + 1)) - == Character space) ifTrue:[ - endCol := endCol + 1. - flag := #wordRight - ] - ] ifFalse:[ - beginCol := beginCol - 1. - flag := #wordLeft - ]. - ]. + " + try to catch a blank ... + " + + WordSelectCatchesBlanks ifTrue:[ + ((beginCol == 1) + or:[(self characterAtLine:selectLine col:(beginCol - 1)) + ~~ Character space]) ifTrue:[ + ((self characterAtLine:selectLine col:(endCol + 1)) + == Character space) ifTrue:[ + endCol := endCol + 1. + flag := #wordRight + ] + ] ifFalse:[ + beginCol := beginCol - 1. + flag := #wordLeft + ]. + ]. ]. - aFiveArgBlock value:selectLine - value:beginCol - value:endLine - value:endCol - value:flag + aFiveArgBlock value:selectLine + value:beginCol + value:endLine + value:endCol + value:flag "Modified: 18.3.1996 / 17:31:04 / cg" ! ! @@ -1110,13 +1110,13 @@ selectionForegroundColor:color1 backgroundColor:color2 "set both the selection-foreground and cursor background colors. - The default is defined by the styleSheet; + The default is defined by the styleSheet; typically black-on-green for color displays and white-on-black for b&w displays." selectionFgColor := color1 onDevice:device. selectionBgColor := color2 onDevice:device. self hasSelection ifTrue:[ - self invalidate + self invalidate ] "Modified: 29.5.1996 / 16:22:15 / cg" @@ -1128,8 +1128,8 @@ "set all of model, aspect, listMessage, changeSymbol, menySymbol and selection. Added for ST-80 compatibility" - aspectSym notNil ifTrue:[aspectMsg := aspectSym. - listMsg isNil ifTrue:[listMsg := aspectSym]]. + aspectSym notNil ifTrue:[aspectMsg := aspectSym. + listMsg isNil ifTrue:[listMsg := aspectSym]]. changeSym notNil ifTrue:[changeMsg := changeSym]. listSym notNil ifTrue:[listMsg := listSym]. menuSym notNil ifTrue:[menuMsg := menuSym]. @@ -1146,15 +1146,15 @@ "enable/disable dragging support " aBoolean ifFalse:[ - dropSource := nil. + dropSource := nil. ] ifTrue:[ - dropSource isNil ifTrue:[ - dropSource := DropSource - receiver:self - argument:nil - dropObjectSelector:#collectionOfDragObjects - displayObjectSelector:nil - ] + dropSource isNil ifTrue:[ + dropSource := DropSource + receiver:self + argument:nil + dropObjectSelector:#collectionOfDragObjects + displayObjectSelector:nil + ] ]. ! @@ -1182,13 +1182,13 @@ dropSource "returns the dropSource or nil" - + ^ dropSource ! -dropSource:aDropSourceOrNil +dropSource:aDropSourceOrNil "set the dropSource or nil" - + dropSource := aDropSourceOrNil. ! ! @@ -1198,7 +1198,7 @@ "if required, query user if he/she wants to change to another font, which is able to display text encoded as specified by newEncoding" - |fontsEncoding msg filter f defaultFont pref matchingFonts + |fontsEncoding msg filter f defaultFont pref matchingFonts matchingFamilyFonts matchingFamilyFaceFonts matchingFamilyFaceStyleFonts matchingFamilyFaceStyleSizeFonts| @@ -1207,15 +1207,15 @@ pref := FontDescription preferredFontEncodingFor:newEncoding. (pref match:fontsEncoding) ifTrue:[ - ^ self + ^ self ]. (CharacterEncoder isEncoding:pref subSetOf:fontsEncoding) ifTrue:[ - ^ self + ^ self ]. filter := [:f | |coding| - (coding := f encoding) notNil - and:[pref match:coding]]. + (coding := f encoding) notNil + and:[pref match:coding]]. device flushListOfAvailableFonts. matchingFonts := device listOfAvailableFonts select:filter. @@ -1224,46 +1224,46 @@ matchingFamilyFaceStyleFonts := matchingFamilyFaceFonts select:[:f | f style = font style]. matchingFamilyFaceStyleSizeFonts := matchingFamilyFaceStyleFonts select:[:f | f size = font size]. matchingFamilyFaceStyleSizeFonts size > 0 ifTrue:[ - defaultFont := matchingFamilyFaceStyleSizeFonts first + defaultFont := matchingFamilyFaceStyleSizeFonts first ] ifFalse:[ - matchingFamilyFaceStyleFonts size > 0 ifTrue:[ - defaultFont := matchingFamilyFaceStyleFonts first - ] ifFalse:[ - matchingFamilyFaceFonts size > 0 ifTrue:[ - defaultFont := matchingFamilyFaceFonts first - ] ifFalse:[ - matchingFamilyFonts size > 0 ifTrue:[ - defaultFont := matchingFamilyFonts first - ] ifFalse:[ - matchingFonts size > 0 ifTrue:[ - defaultFont := matchingFonts first - ]. - ]. - ]. - ]. + matchingFamilyFaceStyleFonts size > 0 ifTrue:[ + defaultFont := matchingFamilyFaceStyleFonts first + ] ifFalse:[ + matchingFamilyFaceFonts size > 0 ifTrue:[ + defaultFont := matchingFamilyFaceFonts first + ] ifFalse:[ + matchingFamilyFonts size > 0 ifTrue:[ + defaultFont := matchingFamilyFonts first + ] ifFalse:[ + matchingFonts size > 0 ifTrue:[ + defaultFont := matchingFonts first + ]. + ]. + ]. + ]. ]. defaultFont isNil ifTrue:[ - defaultFont isNil ifTrue:[ - self warn:'Your display does not seem to provide any ' , newEncoding allBold , ' encoded font.\\Please select an appropriate font (iso10646-Unicode recommended)'. - pref := #'iso10646-1'. - ] + defaultFont isNil ifTrue:[ + self warn:'Your display does not seem to provide any ' , newEncoding allBold , ' encoded font.\\Please select an appropriate font (iso10646-Unicode recommended)'. + pref := #'iso10646-1'. + ] ]. msg := 'Switch to a %1 encoded font ?'. (ask not or:[self confirm:(resources stringWithCRs:msg with:pref)]) ifTrue:[ - self withWaitCursorDo:[ - f := FontPanel - fontFromUserInitial:defaultFont - title:(resources string:'Font selection') - filter:filter - encoding:pref. - - f notNil ifTrue:[ - self font:f. - ] - ] + self withWaitCursorDo:[ + f := FontPanel + fontFromUserInitial:defaultFont + title:(resources string:'Font selection') + filter:filter + encoding:pref. + + f notNil ifTrue:[ + self font:f. + ] + ] ] "Created: 26.10.1996 / 12:06:54 / cg" @@ -1276,19 +1276,19 @@ "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 ?" @@ -1303,29 +1303,29 @@ "if moved outside of view, start autoscroll" ((y < 0) and:[firstLineShown ~~ 0]) ifTrue:[ - self compressMotionEvents:false. - self startAutoScrollUp:y negated. - ^ self + self compressMotionEvents:false. + self startAutoScrollUp:y negated. + ^ self ]. (y > height) ifTrue:[ - self compressMotionEvents:false. - self startAutoScrollDown:(y - height). - ^ self + self compressMotionEvents:false. + self startAutoScrollDown:(y - height). + ^ self ]. ((x < 0) and:[viewOrigin x ~~ 0]) ifTrue:[ - self compressMotionEvents:false. - self startAutoScrollLeft:x. - ^ self + self compressMotionEvents:false. + self startAutoScrollLeft:x. + ^ self ]. (x > width) ifTrue:[ - self compressMotionEvents:false. - self startAutoScrollRight:(x - width). - ^ self + self compressMotionEvents:false. + self startAutoScrollRight:(x - width). + ^ self ]. "move inside - stop autoscroll if any" autoScrollBlock notNil ifTrue:[ - self stopScrollSelect + self stopScrollSelect ]. self extendSelectionToX:x y:y. @@ -1337,27 +1337,27 @@ "multi-mouse-click - select word under pointer" (button == 1) ifTrue:[ - clickPos := x @ y. - - "/ The searchAction is mantained until a cut/replace or a search with a user selection is done + clickPos := x @ y. + + "/ The searchAction is mantained until a cut/replace or a search with a user selection is done "/ self clearSearchAction. - clickCount notNil ifTrue:[ - clickCount := clickCount + 1. - (clickCount == 2) ifTrue:[ - self doubleClickX:x y:y - ] ifFalse:[ - (clickCount == 3) ifTrue:[ - self tripleClickX:x y:y - ] ifFalse:[ - (clickCount == 4) ifTrue:[ - self quadClickX:x y:y - ] - ] - ] - ] + clickCount notNil ifTrue:[ + clickCount := clickCount + 1. + (clickCount == 2) ifTrue:[ + self doubleClickX:x y:y + ] ifFalse:[ + (clickCount == 3) ifTrue:[ + self tripleClickX:x y:y + ] ifFalse:[ + (clickCount == 4) ifTrue:[ + self quadClickX:x y:y + ] + ] + ] + ] ] ifFalse:[ - super buttonMultiPress:button x:x y:y + super buttonMultiPress:button x:x y:y ] "Modified: 11.9.1997 / 04:15:35 / cg" @@ -1372,30 +1372,30 @@ sensor := self sensor. (button == 1) ifTrue:[ - sensor shiftDown ifTrue:[ - "mouse-click with shift - adding to selection" - self extendSelectionToX:x y:y. - ^ self - ]. - - clickVisibleLine := self visibleLineOfY:y. - clickPos := x @ y. - clickCol := self colOfX:x inVisibleLine:clickVisibleLine. - clickLine := self visibleLineToAbsoluteLine:clickVisibleLine. - clickStartLine := clickLine. - clickStartCol := clickCol. - - (self canDrag - and:[(self isInSelection:clickLine col:clickCol) - and:[UserPreferences current startTextDragWithControl not - or:[sensor ctrlDown]]]) ifTrue:[ - dragIsActive := true - ] ifFalse:[ - self unselect. - ]. - clickCount := 1 + sensor shiftDown ifTrue:[ + "mouse-click with shift - adding to selection" + self extendSelectionToX:x y:y. + ^ self + ]. + + clickVisibleLine := self visibleLineOfY:y. + clickPos := x @ y. + clickCol := self colOfX:x inVisibleLine:clickVisibleLine. + clickLine := self visibleLineToAbsoluteLine:clickVisibleLine. + clickStartLine := clickLine. + clickStartCol := clickCol. + + (self canDrag + and:[(self isInSelection:clickLine col:clickCol) + and:[UserPreferences current startTextDragWithControl not + or:[sensor ctrlDown]]]) ifTrue:[ + dragIsActive := true + ] ifFalse:[ + self unselect. + ]. + clickCount := 1 ] ifFalse:[ - super buttonPress:button x:x y:y + super buttonPress:button x:x y:y ] "Modified: / 20.5.1999 / 17:02:45 / cg" @@ -1405,15 +1405,15 @@ "mouse- button release - turn off autoScroll if any" (button == 1) ifTrue:[ - autoScrollBlock notNil ifTrue:[ - self stopScrollSelect - ]. - dragIsActive ifTrue:[ - self unselect - ]. - clickPos := nil. + 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. @@ -1428,91 +1428,91 @@ |sel ch scanCh matchCol scanCol fwdScan fwdSelect| (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 - "/ - 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 + "/ + 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 + ] ]. self selectWordAtX:x y:y. @@ -1520,66 +1520,66 @@ " special - if clicked on a parenthesis, select to matching " - ((sel := self selection) size == 1 + ((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. - ]. - ] - ] - ] - 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. + ]. + ] + ] + ] + ifNotFound:[self showNotFound] + onError:[self beep] + openingCharacters:((parenthesisSpecification at:#open) ", '([{'") + closingCharacters:((parenthesisSpecification at:#close) ", ')]}'"). + selectStyle := nil + ] ]. " @@ -1588,14 +1588,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" @@ -1605,124 +1605,124 @@ extendSelectionToX:x y:y "mouse-move while button was pressed - handle selection changes" - |movedVisibleLine movedLine movedCol - movedUp + |movedVisibleLine movedLine movedCol + movedUp oldStartLine oldEndLine oldStartCol oldEndCol| movedVisibleLine := self visibleLineOfY:y. 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. @@ -1733,32 +1733,32 @@ "/ 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 @@ -1771,8 +1771,8 @@ "handle some keyboard input (there is not much to be done here)" + #GotoLine #SelectAll #SaveAs #Print + #'F*' #'f*' #ZoomIn #ZoomOut)> (key == #Find) ifTrue:[self search. ^self]. (key == #Copy) ifTrue:[self copySelection. ^self]. @@ -1790,21 +1790,21 @@ (key == #ZoomIn or:[key == #ZoomOut]) ifTrue:[ self fontLargerOrSmaller:(key == #ZoomIn) ]. " - shift-Fn defines a key-sequence + shift-Fn defines a key-sequence Fn pastes that sequence cmd-Fn performs a 'doIt' on the sequence (Workspaces only) (see EditTextView>>keyPress:x:y and Workspace>>keyPress:x:y) " (key size > 1 and:[(key at:1) asLowercase == $f]) ifTrue:[ - (('[fF][0-9]' match:key) - or:['[fF][0-9][0-9]' match:key]) ifTrue:[ - self sensor shiftDown ifTrue:[ - UserPreferences current functionKeySequences - at:key put:(self selection) - ]. - ^ self - ]. + (('[fF][0-9]' match:key) + or:['[fF][0-9][0-9]' match:key]) ifTrue:[ + self sensor shiftDown ifTrue:[ + UserPreferences current functionKeySequences + at:key put:(self selection) + ]. + ^ self + ]. ]. super keyPress:key x:x y:y @@ -1813,7 +1813,7 @@ "Modified: / 10-03-2012 / 09:40:01 / cg" ! -mapped +mapped super mapped. selectionFgColor := selectionFgColor onDevice:device. selectionBgColor := selectionBgColor onDevice:device. @@ -1860,21 +1860,21 @@ selectionFgColor isNil ifTrue:[selectionFgColor := bgColor]. selectionBgColor := DefaultSelectionBackgroundColor. selectionBgColor isNil ifTrue:[ - device hasColors ifTrue:[ - DefaultSelectionForegroundColor isNil ifTrue:[ - selectionFgColor := fgColor - ]. - selectionBgColor := Color green - ] ifFalse:[ - device hasGrayscales ifTrue:[ - DefaultSelectionForegroundColor isNil ifTrue:[ - selectionFgColor := fgColor - ]. - selectionBgColor := Color grey - ] ifFalse:[ - selectionBgColor := fgColor - ] - ] + device hasColors ifTrue:[ + DefaultSelectionForegroundColor isNil ifTrue:[ + selectionFgColor := fgColor + ]. + selectionBgColor := Color green + ] ifFalse:[ + device hasGrayscales ifTrue:[ + DefaultSelectionForegroundColor isNil ifTrue:[ + selectionFgColor := fgColor + ]. + selectionBgColor := Color grey + ] ifFalse:[ + selectionBgColor := fgColor + ] + ] ]. "Modified: / 22-01-1997 / 11:57:53 / cg" @@ -1888,7 +1888,7 @@ dragIsActive := false. parenthesisSpecification isNil ifTrue:[ - parenthesisSpecification := DefaultParenthesisSpecification. + parenthesisSpecification := DefaultParenthesisSpecification. ]. "I handle menus myself" @@ -1912,22 +1912,22 @@ filename := aFileName asFilename. (FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[ - msg := resources string:'Refused to append to file ''%1'' !!' with:filename name. - self warn:(msg , '\\(ST/X internal permission check)' ) withCRs. - ^ self + msg := resources string:'Refused to append to file ''%1'' !!' with:filename name. + self warn:(msg , '\\(ST/X internal permission check)' ) withCRs. + ^ self ]. [ - aStream := filename appendingWriteStream. - [ - self fileOutContentsOn:aStream compressTabs:true encoding:externalEncoding. - ] ensure:[ - aStream close. - ]. - contentsWasSaved := true + aStream := filename appendingWriteStream. + [ + self fileOutContentsOn:aStream compressTabs:true encoding:externalEncoding. + ] ensure:[ + aStream close. + ]. + contentsWasSaved := true ] on:FileStream openErrorSignal do:[:ex| - msg := resources string:'cannot append to file %1 !!' with:filename name. - self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs + msg := resources string:'cannot append to file %1 !!' with:filename name. + self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs ] "Modified: / 27-07-2012 / 09:41:18 / cg" @@ -1940,7 +1940,7 @@ newFont := FontPanel fontFromUserInitial:font. newFont notNil ifTrue:[ - self font:newFont. + self font:newFont. ] "Modified: 27.2.1996 / 00:53:51 / cg" @@ -1953,11 +1953,11 @@ text := self selection. text notNil ifTrue:[ - self unselect. - - "/ forget any emphasis ... - text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]]. - self setClipboardText:text. + self unselect. + + "/ forget any emphasis ... + text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]]. + self setClipboardText:text. ] "Modified: 17.5.1996 / 08:57:54 / cg" @@ -1979,19 +1979,19 @@ list isNil ifTrue:[^ self]. self withWaitCursorDo:[ - printStream := Printer new. - printStream supportsContext ifTrue:[ - printStream printerContext font:(self font). - ]. - - Printer writeErrorSignal handle:[:ex | - self warn:('error while printing:\\' - , ex description - , '\\(printing with: ' , (Printer printCommand) , ')') withCRs - ] do:[ - self fileOutContentsOn:printStream. - ]. - printStream close + printStream := Printer new. + printStream supportsContext ifTrue:[ + printStream printerContext font:(self font). + ]. + + Printer writeErrorSignal handle:[:ex | + self warn:('error while printing:\\' + , ex description + , '\\(printing with: ' , (Printer printCommand) , ')') withCRs + ] do:[ + self fileOutContentsOn:printStream. + ]. + printStream close ]. "Created: / 06-05-1996 / 16:11:26 / cg" @@ -2007,21 +2007,21 @@ |items m| items := #( - ('Copy' copySelection Copy) - ('-' nil ) - ('Search...' search Find) - ('Goto Line...' gotoLine GotoLine) - ('-' nil ) - ('Font...' changeFont ) - ('-' nil ) - ('Save As...' save SaveAs) - ('Print' doPrint Print) - ). + ('Copy' copySelection Copy) + ('-' nil ) + ('Search...' search Find) + ('Goto Line...' gotoLine GotoLine) + ('-' nil ) + ('Font...' changeFont ) + ('-' nil ) + ('Save As...' save SaveAs) + ('Print' doPrint Print) + ). m := PopUpMenu itemList:items resources:resources. self hasSelectionForCopy ifFalse:[ - m disable:#copySelection. + m disable:#copySelection. ]. ^ m @@ -2039,9 +2039,9 @@ fontLargerOrSmaller:largerBoolean |newFont| - newFont := font size:(largerBoolean - ifTrue:[font size + 1] - ifFalse:[(font size-1) max:4]). + newFont := font size:(largerBoolean + ifTrue:[font size + 1] + ifFalse:[(font size-1) max:4]). self font:newFont. "Modified: / 27-02-1996 / 00:53:51 / cg" @@ -2050,47 +2050,47 @@ gotoLine "show a box to enter lineNumber for positioning; - The entered number may be prefixed by a + or -; + The entered number may be prefixed by a + or -; in this case, the linenumber is taken relative to the current position." |l lineNumberBox input lineToGo relative| lineNumberBox := - EnterBox - title:(resources string:'Line number (or +/- relativeNr):') - okText:(resources string:'Goto') - abortText:(resources string:'Cancel') - action:[:l | input := l]. + EnterBox + title:(resources string:'Line number (or +/- relativeNr):') + okText:(resources string:'Goto') + abortText:(resources string:'Cancel') + action:[:l | input := l]. l := self defaultForGotoLine. l notNil ifTrue:[ - l := l printString + l := l printString ]. lineNumberBox initialText:l . lineNumberBox label:(resources string:'Goto Line'). lineNumberBox showAtPointer. input size > 0 ifTrue:[ - input := input withoutSpaces. - input size > 0 ifTrue:[ - (input startsWith:$+) ifTrue:[ - relative := 1. - ] ifFalse:[ - (input startsWith:$-) ifTrue:[ - relative := -1. - ]. - ]. - relative notNil ifTrue:[ - input := input copyFrom:2. - ]. - lineToGo := Integer readFromString:input onError:nil. - lineToGo notNil ifTrue:[ - relative notNil ifTrue:[ - lineToGo := self currentLine + (lineToGo * relative) - ]. - self gotoLine:lineToGo - ] - ] + input := input withoutSpaces. + input size > 0 ifTrue:[ + (input startsWith:$+) ifTrue:[ + relative := 1. + ] ifFalse:[ + (input startsWith:$-) ifTrue:[ + relative := -1. + ]. + ]. + relative notNil ifTrue:[ + input := input copyFrom:2. + ]. + lineToGo := Integer readFromString:input onError:nil. + lineToGo notNil ifTrue:[ + relative notNil ifTrue:[ + lineToGo := self currentLine + (lineToGo * relative) + ]. + self gotoLine:lineToGo + ] + ] ]. "Modified: / 17.5.1998 / 20:07:59 / cg" @@ -2101,15 +2101,15 @@ and save contents into that file." Dialog - requestSaveFileName:(resources string:'Save contents in:') - default:defaultFileNameForFileDialog - fromDirectory:directoryForFileDialog - action:[:fileName | self saveAs:fileName] - appendAction:[:fileName | self appendTo:fileName] + requestSaveFileName:(resources string:'Save contents in:') + default:defaultFileNameForFileDialog + fromDirectory:directoryForFileDialog + action:[:fileName | self saveAs:fileName] + appendAction:[:fileName | self appendTo:fileName] ! openSearchBoxAndSearch - "search for a string - show a box to enter searchpattern + "search for a string - show a box to enter searchpattern - currently no regular expressions are handled." " @@ -2120,9 +2120,9 @@ replaceBooleanEnabledHolder replaceBooleanHolder replaceTextHolder| 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 @@ -2143,115 +2143,115 @@ 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. + fwd := true. doSearch := [:fwd | - |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. - pattern := patternHolder value. - pattern notEmptyOrNil ifTrue:[ - searchAction := [ - self searchUsingSpec:( - ListView::SearchSpec new - pattern:pattern - ignoreCase:lastSearchIgnoredCase - match: lastSearchWasMatch - variable: searchVariableHolder value - fullWord: searchFullWordHolder value - forward:fwd). - ] - ] - ]. - - replaceBooleanHolder value ifTrue:[ - |selStart| - - 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. - selectedVariable notNil ifTrue:[ - self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop. - ]. - "/ self searchVariableWithSyntaxElement:selectedVariable forward:false - ]. - ]. - - selStart := self characterPositionOfSelection. - self replace:(replaceTextHolder value). - - searchAction value. - [self characterPositionOfSelection ~= selStart] whileTrue:[ - selStart := self characterPositionOfSelection. - self replace:(replaceTextHolder value). - searchAction value. - ] - ] ifFalse:[ - searchAction value. - ]. + |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. + pattern := patternHolder value. + pattern notEmptyOrNil ifTrue:[ + searchAction := [ + self searchUsingSpec:( + ListView::SearchSpec new + pattern:pattern + ignoreCase:lastSearchIgnoredCase + match: lastSearchWasMatch + variable: searchVariableHolder value + fullWord: searchFullWordHolder value + forward:fwd). + ] + ] + ]. + + replaceBooleanHolder value ifTrue:[ + |selStart| + + 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. + selectedVariable notNil ifTrue:[ + self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop. + ]. + "/ self searchVariableWithSyntaxElement:selectedVariable forward:false + ]. + ]. + + selStart := self characterPositionOfSelection. + self replace:(replaceTextHolder value). + + searchAction value. + [self characterPositionOfSelection ~= selStart] whileTrue:[ + selStart := self characterPositionOfSelection. + self replace:(replaceTextHolder value). + searchAction value. + ] + ] ifFalse:[ + searchAction value. + ]. ]. bindings := IdentityDictionary new. bindings at:#searchPattern put:patternHolder. modal ifTrue:[ - bindings at:#nextAction put:[searchBox doAccept.]. - bindings at:#prevAction put:[fwd := false. searchBox doAccept.]. + bindings at:#nextAction put:[searchBox doAccept.]. + bindings at:#prevAction put:[fwd := false. searchBox doAccept.]. ] ifFalse:[ - bindings at:#nextAction put:[doSearch value:true. "searchBox doAccept."]. - bindings at:#prevAction put:[doSearch value:false. "fwd := false. searchBox doAccept."]. + bindings at:#nextAction put:[doSearch value:true. "searchBox doAccept."]. + bindings at:#prevAction put:[doSearch value:false. "fwd := false. searchBox doAccept."]. ]. bindings at:#caseSensitive put:caseHolder. bindings at:#match put:matchHolder. 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 - put:('Variable ("%1")' bindWith:selectedVariable value). - searchVariableHolder value:true. - ] ifFalse:[ - bindings - at:#stringWithVariableUnderCursorHolder - put:('Variable (none selected)'). - ]. + bindings at:#searchVariableVisible put:true. + selectedVariable := self syntaxElementForSelectedVariable. + bindings at:#searchVariableEnabled put:(selectedVariable notNil). + selectedVariable notNil ifTrue:[ + bindings + at:#stringWithVariableUnderCursorHolder + put:('Variable ("%1")' bindWith:selectedVariable value). + searchVariableHolder value:true. + ] ifFalse:[ + bindings + at:#stringWithVariableUnderCursorHolder + put:('Variable (none selected)'). + ]. ]. bindings at:#searchVariable put:searchVariableHolder. @@ -2263,10 +2263,10 @@ bindings at:#replaceTextHolder put:replaceTextHolder. modal ifTrue:[ - searchBox := SimpleDialog new. + searchBox := SimpleDialog new. ] ifFalse:[ - searchBox := ApplicationModel new. - searchBox createBuilder. + searchBox := ApplicationModel new. + searchBox createBuilder. ]. searchBox resources:(self resources). @@ -2280,21 +2280,21 @@ (bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown). modal ifTrue:[ - searchBox openDialog. - searchBox accepted ifTrue:[ doSearch value:fwd ]. + searchBox openDialog. + 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. - searchBox window assignKeyboardFocusToFirstInputField. + (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 assignKeyboardFocusToFirstInputField. ] "Modified: / 11-07-2006 / 11:18:38 / fm" @@ -2302,7 +2302,7 @@ ! save - "save contents into a file + "save contents into a file - ask user for filename using a fileSelectionBox." saveAction value @@ -2310,7 +2310,7 @@ saveAs:fileName "save the contents into a file named fileName" - + ^ self saveAs:fileName doAppend:false ! @@ -2325,33 +2325,33 @@ 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. - ]. - self fileOutContentsOn:aStream compressTabs:true encoding:externalEncoding. - aStream close. - contentsWasSaved := true. - defaultFileNameForFileDialog := filename. - ] on:FileStream openErrorSignal do:[:ex| - msg := resources stringWithCRs:'Cannot write file ''%1'' !!\(%2)' - with:filename name - with:FileStream lastErrorString. - ]. - ]. + |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. + ]. + self fileOutContentsOn:aStream compressTabs:true encoding:externalEncoding. + aStream 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 @@ -2359,7 +2359,7 @@ ! search - "search for a string - show a box to enter searchpattern + "search for a string - show a box to enter searchpattern - currently no regular expressions are handled." self openSearchBoxAndSearch @@ -2368,27 +2368,27 @@ "Modified: / 08-03-2012 / 14:03:10 / cg" ! -search:patternArg ignoreCase:ign forward:fwd +search:patternArg ignoreCase:ign forward:fwd "search for a string without matching" - self search:patternArg ignoreCase:ign match: false forward:fwd + self search:patternArg ignoreCase:ign match: false forward:fwd ! -search:patternArg ignoreCase:ign match: match forward:fwd +search:patternArg ignoreCase:ign match: match forward:fwd |pattern| pattern := patternArg string. pattern notEmpty ifTrue:[ - self rememberSearchPattern:pattern. - "/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign. - "/ LastSearchWasMatch := match. - fwd ifFalse:[ - lastSearchDirection := #backward. - self searchBwd:pattern ignoreCase:ign match: match. " backward search with match is not yet available " - ] ifTrue:[ - lastSearchDirection := #forward. - self searchFwd:pattern ignoreCase:ign match: match. - ] + self rememberSearchPattern:pattern. + "/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign. + "/ LastSearchWasMatch := match. + fwd ifFalse:[ + lastSearchDirection := #backward. + self searchBwd:pattern ignoreCase:ign match: match. " backward search with match is not yet available " + ] ifTrue:[ + lastSearchDirection := #forward. + self searchFwd:pattern ignoreCase:ign match: match. + ] ] "Created: / 11-07-2006 / 11:18:04 / fm" @@ -2400,11 +2400,11 @@ "/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign. "/ LastSearchWasMatch := match. aSearchSpec forward ifFalse:[ - lastSearchDirection := #backward. - self searchBwdUsingSpec:aSearchSpec + lastSearchDirection := #backward. + self searchBwdUsingSpec:aSearchSpec ] ifTrue:[ - lastSearchDirection := #forward. - self searchFwdUsingSpec:aSearchSpec + lastSearchDirection := #forward. + self searchFwdUsingSpec:aSearchSpec ] "Created: / 11-07-2006 / 11:18:04 / fm" @@ -2427,26 +2427,26 @@ |el el2| lastSearchWasVariableSearch := true. - el := fwd - ifTrue:[syntaxElementForVariable nextElement] - ifFalse:[syntaxElementForVariable previousElement]. + el := fwd + ifTrue:[syntaxElementForVariable nextElement] + ifFalse:[syntaxElementForVariable previousElement]. el notNil ifTrue:[ - "bug workaround" - (el start = syntaxElementForVariable start) ifTrue:[ - el2 := fwd - ifTrue:[el nextElement] - ifFalse:[el previousElement]. - el2 notNil ifTrue:[ - el := el2 - ] - ]. + "bug workaround" + (el start = syntaxElementForVariable start) ifTrue:[ + el2 := fwd + ifTrue:[el nextElement] + ifFalse:[el previousElement]. + el2 notNil ifTrue:[ + el := el2 + ] + ]. ]. el notNil ifTrue:[ - self selectFromCharacterPosition:el start to:el stop. - self makeLineVisible:(self lineOfCharacterPosition:el start). + self selectFromCharacterPosition:el start to:el stop. + self makeLineVisible:(self lineOfCharacterPosition:el start). ] ifFalse:[ - self showNotFound + self showNotFound ]. "Created: / 08-03-2012 / 14:08:20 / cg" @@ -2481,19 +2481,19 @@ fileOutContentsOn:aStream "save contents on a stream, replacing leading spaces by tab-characters." - self - fileOutContentsOn:aStream - compressTabs:true + self + fileOutContentsOn:aStream + compressTabs:true ! fileOutContentsOn:aStream compressTabs:compressTabs "save contents on a stream. If compressTabs is true, leading spaces will be replaced by tab-characters in the output." - self - fileOutContentsOn:aStream - compressTabs:compressTabs - encoding:nil + self + fileOutContentsOn:aStream + compressTabs:compressTabs + encoding:nil ! fileOutContentsOn:aStream compressTabs:compressTabs encoding:encodingSymOrNil @@ -2506,43 +2506,43 @@ encoder := CharacterEncoder encoderToEncodeFrom: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. - [startNr <= nLines] whileTrue:[ - string := list asStringWithCRsFrom:startNr - to:((startNr + 1000) min:nLines) - compressTabs:compressTabs. - aStream nextPutAll:(encoder encodeString:string string). - startNr := startNr + 1000 + 1. - ]. + "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. + [startNr <= nLines] whileTrue:[ + string := list asStringWithCRsFrom:startNr + to:((startNr + 1000) min:nLines) + compressTabs:compressTabs. + aStream nextPutAll:(encoder encodeString:string string). + startNr := startNr + 1000 + 1. + ]. ] ifFalse:[ - list do:[:aLine | - aLine notNil ifTrue:[ - aStream nextPutLine:(encoder encodeString:aLine). - ] ifFalse:[ - aStream cr. - ] - ] + list do:[:aLine | + aLine notNil ifTrue:[ + aStream nextPutLine:(encoder encodeString:aLine). + ] ifFalse:[ + aStream cr. + ] + ] ] "Modified: 8.6.1996 / 11:50:46 / cg" @@ -2561,10 +2561,10 @@ boldFont := font asBold onDevice:device. includesNonStrings == true ifTrue:[ - "/ for now, we do not support variable height entries ... - fontHeight := list first heightOn:self + "/ for now, we do not support variable height entries ... + fontHeight := list first heightOn:self ] ifFalse:[ - fontHeight := font maxHeight max:(italicFont maxHeight max:(boldFont maxHeight)). + fontHeight := font maxHeight max:(italicFont maxHeight max:(boldFont maxHeight)). ]. fontHeight := fontHeight + lineSpacing. fontAscent := font maxAscent max:(italicFont maxAscent max:(boldFont maxAscent)). @@ -2599,15 +2599,15 @@ nRemembered := NumRememberedSearchPatterns ? 20. LastSearchPatterns isNil ifTrue:[ - LastSearchPatterns := OrderedCollection new. + LastSearchPatterns := OrderedCollection new. ]. "/ move to top or addFirst (LastSearchPatterns includes:patternString) ifTrue:[ - LastSearchPatterns remove:patternString. + LastSearchPatterns remove:patternString. ] ifFalse:[ - LastSearchPatterns size > nRemembered ifTrue:[ - LastSearchPatterns removeLast - ] + LastSearchPatterns size > nRemembered ifTrue:[ + LastSearchPatterns removeLast + ] ]. LastSearchPatterns addFirst:patternString. @@ -2617,12 +2617,12 @@ removeTrailingWhitespace list isNil ifTrue:[^self]. list keysAndValuesDo:[:lineNR :line | - |l| - - line notNil ifTrue:[ - l := line withoutTrailingSeparators. - list at:lineNR put:l. - ] + |l| + + line notNil ifTrue:[ + l := line withoutTrailingSeparators. + list at:lineNR put:l. + ] ]. ! @@ -2647,7 +2647,7 @@ selectionEndLine := firstLineShown + nFullLinesShown. selectionEndCol := 0. prevEndLine to:selectionEndLine do:[:lineNr | - self redrawLine:lineNr + self redrawLine:lineNr ]. Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. self selectionChanged. @@ -2685,11 +2685,11 @@ endLine := self listLineToVisibleLine:selectionEndLine. endLine notNil ifTrue:[ - firstVisibleCol := self colOfX:1 inVisibleLine:endLine. - selectionEndCol < firstVisibleCol ifTrue:[ - "/ scrolling faster than selection advances... - selectionEndCol := firstVisibleCol - ]. + firstVisibleCol := self colOfX:1 inVisibleLine:endLine. + selectionEndCol < firstVisibleCol ifTrue:[ + "/ scrolling faster than selection advances... + selectionEndCol := firstVisibleCol + ]. ]. self selectionChanged. @@ -2716,7 +2716,7 @@ selectionStartLine := firstLineShown. selectionStartCol := 1. selectionStartLine to:prevStartLine do:[:lineNr | - self redrawLine:lineNr + self redrawLine:lineNr ]. Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. self selectionChanged. @@ -2726,10 +2726,10 @@ "stop auto scroll; deinstall timed-block" autoScrollBlock notNil ifTrue:[ - Processor removeTimedBlock:autoScrollBlock. - self compressMotionEvents:true. - autoScrollBlock := nil. - autoScrollDeltaT := nil + Processor removeTimedBlock:autoScrollBlock. + self compressMotionEvents:true. + autoScrollBlock := nil. + autoScrollDeltaT := nil ] ! @@ -2737,14 +2737,14 @@ "return the width in pixels for a scroll between firstLine and lastLine" selectionStartLine notNil ifTrue:[ - "/ if there is a selection which covers multiple lines, - "/ we have to scroll the whole width (to include the selection-rectangle) - - (lastLine < selectionStartLine) ifFalse:[ - (firstLine > selectionEndLine) ifFalse:[ - ^ width - ] - ]. + "/ if there is a selection which covers multiple lines, + "/ we have to scroll the whole width (to include the selection-rectangle) + + (lastLine < selectionStartLine) ifFalse:[ + (firstLine > selectionEndLine) ifFalse:[ + ^ width + ] + ]. ]. ^ super widthForScrollBetween:firstLine and:lastLine ! ! @@ -2772,11 +2772,11 @@ "if there is a margin, clear it - a helper for selection drawing" (leftMargin ~~ 0) ifTrue:[ - self paint:color. - self fillRectangleX:margin - y:(self yOfVisibleLine:visLine) - width:leftMargin - height:fontHeight + self paint:color. + self fillRectangleX:margin + y:(self yOfVisibleLine:visLine) + width:leftMargin + height:fontHeight ] "Created: 6.3.1996 / 14:22:55 / cg" @@ -2784,39 +2784,39 @@ drawSelectedFromVisibleLine:startVisLineNr to:endVisLineNr startVisLineNr to:endVisLineNr do:[:visLine | - self drawVisibleLineSelected:visLine + self drawVisibleLineSelected:visLine ] ! -drawVisibleLineSelected:visLineNr - self - drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) - inVisible:visLineNr - with:self currentSelectionFgColor and:self currentSelectionBgColor +drawVisibleLineSelected:visLineNr + self + drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) + inVisible:visLineNr + with:self currentSelectionFgColor and:self currentSelectionBgColor ! drawVisibleLineSelected:visLineNr col:col self - drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) - inVisible:visLineNr - col:col - with:self currentSelectionFgColor and:self currentSelectionBgColor + drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) + inVisible:visLineNr + col:col + with:self currentSelectionFgColor and:self currentSelectionBgColor ! drawVisibleLineSelected:visLineNr from:selectionStartCol - self - drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) - inVisible:visLineNr - from:selectionStartCol - with:self currentSelectionFgColor and:self currentSelectionBgColor. + self + drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) + inVisible:visLineNr + from:selectionStartCol + with:self currentSelectionFgColor and:self currentSelectionBgColor. ! drawVisibleLineSelected:visLineNr from:startCol to:endCol - self - drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) - inVisible:visLineNr - from:startCol to:endCol - with:self currentSelectionFgColor and:self currentSelectionBgColor. + self + drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) + inVisible:visLineNr + from:startCol to:endCol + with:self currentSelectionFgColor and:self currentSelectionBgColor. ! redrawFromVisibleLine:startVisLineNr to:endVisLineNr @@ -2828,70 +2828,70 @@ end := endVisLineNr. (end > nLinesShown) ifTrue:[ - end := nLinesShown + end := nLinesShown ]. selectionEndLine isNil ifTrue:[ - selectionStartLine := nil + selectionStartLine := nil ]. selectionStartLine isNil ifTrue:[ - specialCare := false + specialCare := false ] ifFalse:[ - startLine := self visibleLineToAbsoluteLine:startVisLineNr. - (startLine > selectionEndLine) ifTrue:[ - specialCare := false - ] ifFalse:[ - endLine := self visibleLineToAbsoluteLine:end. - (endLine < selectionStartLine) ifTrue:[ - specialCare := false - ] ifFalse:[ - specialCare := true - ] - ] + startLine := self visibleLineToAbsoluteLine:startVisLineNr. + (startLine > selectionEndLine) ifTrue:[ + specialCare := false + ] ifFalse:[ + endLine := self visibleLineToAbsoluteLine:end. + (endLine < selectionStartLine) ifTrue:[ + specialCare := false + ] ifFalse:[ + specialCare := true + ] + ] ]. "easy: nothing is selected" specialCare ifFalse:[ - super redrawFromVisibleLine:startVisLineNr to:end. - ^ self + super redrawFromVisibleLine:startVisLineNr to:end. + ^ self ]. "easy: all is selected" ((selectionStartLine < startLine) and:[selectionEndLine > endLine]) ifTrue:[ - self drawSelectedFromVisibleLine:startVisLineNr to:end. - ^ self + self drawSelectedFromVisibleLine:startVisLineNr to:end. + ^ self ]. (selectionStartLine >= firstLineShown) ifTrue:[ - "draw unselected top part" - - selVisStart := self listLineToVisibleLine:selectionStartLine. - super redrawFromVisibleLine:startVisLineNr to:(selVisStart - 1). - - "and first partial selected line" - self redrawVisibleLine:selVisStart. - - "rest starts after this one" - line1 := selVisStart + 1 + "draw unselected top part" + + selVisStart := self listLineToVisibleLine:selectionStartLine. + super redrawFromVisibleLine:startVisLineNr to:(selVisStart - 1). + + "and first partial selected line" + self redrawVisibleLine:selVisStart. + + "rest starts after this one" + line1 := selVisStart + 1 ] ifFalse:[ - line1 := 1 + line1 := 1 ]. (line1 > end) ifTrue:[^ self]. (line1 < startVisLineNr) ifTrue:[ - line1 := startVisLineNr + line1 := startVisLineNr ]. "draw middle part of selection" (selectionEndLine >= (firstLineShown + nLinesShown)) ifTrue:[ - line2 := nLinesShown + line2 := nLinesShown ] ifFalse:[ - line2 := (self listLineToVisibleLine:selectionEndLine) - 1 + line2 := (self listLineToVisibleLine:selectionEndLine) - 1 ]. (line2 > end) ifTrue:[ - line2 := end + line2 := end ]. self drawSelectedFromVisibleLine:line1 to:line2. @@ -2902,7 +2902,7 @@ self redrawVisibleLine:(line2 + 1). ((line2 + 2) <= end) ifTrue:[ - super redrawFromVisibleLine:(line2 + 2) to:end + super redrawFromVisibleLine:(line2 + 2) to:end ] ! @@ -2922,50 +2922,50 @@ |line| (selectionStartLine notNil and:[selectionEndLine 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 @@ -2981,18 +2981,18 @@ "/ care for selection "/ (selectionStartLine notNil and:[selectionEndLine 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 @@ -3006,22 +3006,22 @@ col := startCol. col == 0 ifTrue:[ - col := 1. + col := 1. ]. (selectionStartLine notNil and:[selectionEndLine notNil]) ifTrue:[ - line := self visibleLineToAbsoluteLine:visLine. - (line between:selectionStartLine and:selectionEndLine) ifTrue:[ - ((line == selectionStartLine) - or:[line == selectionEndLine]) ifTrue:[ - "since I'm lazy, redraw full line" - self redrawVisibleLine:visLine. - ^ self - ]. - "the line is fully within the selection" - self drawVisibleLineSelected:visLine from:col. - ^ self - ] + line := self visibleLineToAbsoluteLine:visLine. + (line between:selectionStartLine and:selectionEndLine) ifTrue:[ + ((line == selectionStartLine) + or:[line == selectionEndLine]) ifTrue:[ + "since I'm lazy, redraw full line" + self redrawVisibleLine:visLine. + ^ self + ]. + "the line is fully within the selection" + self drawVisibleLineSelected:visLine from:col. + ^ self + ] ]. super redrawVisibleLine:visLine from:col @@ -3038,75 +3038,75 @@ allIn := false. allOut := false. (selectionStartLine isNil or:[selectionEndLine 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: @@ -3116,14 +3116,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. ] "Modified: 6.3.1996 / 14:23:26 / cg" @@ -3136,26 +3136,26 @@ ! scanFor:aCharacter fromLine:startLine col:startCol forward:forward - ifFound:foundBlock - ifNotFound:notFoundBlock - "search for a character in the direction given by forward. + ifFound:foundBlock + ifNotFound:notFoundBlock + "search for a character in the direction given by forward. Performs foundBlock with line/col as argument if found, notFoundBlock if not." - |lineString + |lineString line "{ Class: SmallInteger }" col "{ Class: SmallInteger }" delta "{ Class: SmallInteger }" endCol "{ Class: SmallInteger }" - cc + cc maxLine "{ Class: SmallInteger }" | col := startCol. line := startLine. forward ifTrue:[ - delta := 1. + delta := 1. ] ifFalse:[ - delta := -1. + delta := -1. ]. lineString := list at:line. @@ -3163,30 +3163,30 @@ col := col + delta. [true] whileTrue:[ - lineString notNil ifTrue:[ - forward ifTrue:[ - endCol := lineString size. - ] ifFalse:[ - endCol := 1 - ]. - - col to:endCol by:delta do:[:rCol | - cc := lineString at:rCol. - cc == aCharacter ifTrue:[ - ^ foundBlock value:line value:rCol. - ] - ]. - ]. - line := line + delta. - (line < 1 or:[line > maxLine]) ifTrue:[ - ^ notFoundBlock value - ]. - lineString := list at:line. - forward ifTrue:[ - col := 1 - ] ifFalse:[ - col := lineString size - ] + lineString notNil ifTrue:[ + forward ifTrue:[ + endCol := lineString size. + ] ifFalse:[ + endCol := 1 + ]. + + col to:endCol by:delta do:[:rCol | + cc := lineString at:rCol. + cc == aCharacter ifTrue:[ + ^ foundBlock value:line value:rCol. + ] + ]. + ]. + line := line + delta. + (line < 1 or:[line > maxLine]) ifTrue:[ + ^ notFoundBlock value + ]. + lineString := list at:line. + forward ifTrue:[ + col := 1 + ] ifFalse:[ + col := lineString size + ] ]. "not reached" @@ -3208,8 +3208,8 @@ |ign match| searchBarActionBlock notNil ifTrue:[ - searchBarActionBlock value:#forward value:self. - ^ self + searchBarActionBlock value:#forward value:self. + ^ self ]. ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true. @@ -3217,17 +3217,17 @@ self setSearchPatternWithMatchEscapes: match. lastSearchPattern notNil ifTrue:[ - lastSearchDirection == #backward ifTrue:[ - self - searchBwd:lastSearchPattern - ignoreCase:ign - match: match - ] ifFalse:[ - self - searchFwd:lastSearchPattern - ignoreCase:ign - match: match - ] + lastSearchDirection == #backward ifTrue:[ + self + searchBwd:lastSearchPattern + ignoreCase:ign + match: match + ] ifFalse:[ + self + searchFwd:lastSearchPattern + ignoreCase:ign + match: match + ] ] "Created: / 03-05-1999 / 15:02:16 / cg" @@ -3241,43 +3241,43 @@ |ign selectedVariable| searchAction notNil ifTrue:[ - "/autosearch is cleared whenever there is search with user selection - (self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction]. + "/autosearch is cleared whenever there is search with user selection + (self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction]. ]. searchAction notNil ifTrue:[ - "/confusing: this is for autosearch of variables (browse variable uses, for example) - self searchUsingSearchAction:#backward. - ^ self. + "/confusing: this is for autosearch of variables (browse variable uses, for example) + self searchUsingSearchAction:#backward. + ^ self. ]. searchBarActionBlock notNil ifTrue:[ - searchBarActionBlock value:#backward value:self. - ^ self + searchBarActionBlock value:#backward value:self. + ^ self ]. lastSearchWasVariableSearch ifTrue:[ - selectedVariable := self syntaxElementForSelectedVariable. - selectedVariable notNil ifTrue:[ - self searchVariableWithSyntaxElement:selectedVariable forward:false. - ^ self. - ]. - lastSearchWasVariableSearch := false. + selectedVariable := self syntaxElementForSelectedVariable. + selectedVariable notNil ifTrue:[ + self searchVariableWithSyntaxElement:selectedVariable forward:false. + ^ self. + ]. + lastSearchWasVariableSearch := false. ]. ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true. self setSearchPatternWithMatchEscapes: false. lastSearchPattern isNil ifTrue:[ - LastSearchPatterns size > 0 ifTrue:[ - lastSearchPattern := LastSearchPatterns first - ] + LastSearchPatterns size > 0 ifTrue:[ + lastSearchPattern := LastSearchPatterns first + ] ]. lastSearchPattern notNil ifTrue:[ - lastSearchDirection := #backward. - self rememberSearchPattern:lastSearchPattern. - self - searchBwd:lastSearchPattern - ignoreCase:ign + lastSearchDirection := #backward. + self rememberSearchPattern:lastSearchPattern. + self + searchBwd:lastSearchPattern + ignoreCase:ign ] "Modified: / 08-03-2012 / 14:26:25 / cg" @@ -3296,10 +3296,10 @@ searchBwd:pattern ifAbsent:aBlock "do a backward search" - self - searchBwdUsingSpec:(ListView::SearchSpec new - pattern:pattern) - ifAbsent:aBlock + self + searchBwdUsingSpec:(ListView::SearchSpec new + pattern:pattern) + ifAbsent:aBlock "Modified: 13.9.1997 / 01:05:49 / cg" ! @@ -3308,12 +3308,12 @@ "do a backward search" self - searchBwd:pattern - ignoreCase:ign - ifAbsent:[ - self sensor compressKeyPressEventsWithKey:#FindPrev. - self showNotFound - ]. + searchBwd:pattern + ignoreCase:ign + ifAbsent:[ + self sensor compressKeyPressEventsWithKey:#FindPrev. + self showNotFound + ]. "/ lastSearchIgnoredCase := ign. lastSearchPattern := pattern string @@ -3324,11 +3324,11 @@ searchBwd:pattern ignoreCase:ign ifAbsent:aBlock "do a backward search" - self - searchBwdUsingSpec:(ListView::SearchSpec new - pattern:pattern - ignoreCase:ign) - ifAbsent:aBlock + self + searchBwdUsingSpec:(ListView::SearchSpec new + pattern:pattern + ignoreCase:ign) + ifAbsent:aBlock "Modified: 13.9.1997 / 01:05:49 / cg" "Created: 13.9.1997 / 06:18:41 / cg" @@ -3347,9 +3347,9 @@ searchBwdUsingSpec:searchSpec "do a backward search" - self - searchBwdUsingSpec:searchSpec - ifAbsent:[self showNotFound]. + self + searchBwdUsingSpec:searchSpec + ifAbsent:[self showNotFound]. "/ lastSearchIgnoredCase := false. lastSearchPattern := searchSpec pattern string @@ -3366,31 +3366,31 @@ startLine := pos y. 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 + self + searchBackwardUsingSpec:searchSpec + startingAtLine:startLine col:startCol + ifFound:[:line :col | self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col] + ifAbsent:aBlock ! searchForAndSelectMatchingParenthesisFromLine:startLine col:startCol "select characters enclosed by matching parenthesis if one is under startLine/Col" - self - searchForMatchingParenthesisFromLine:startLine col:startCol - ifFound:[:line :col | - self selectFromLine:startLine col:startCol - toLine:line col:col] - ifNotFound:[self showNotFound] - onError:[self beep] + self + searchForMatchingParenthesisFromLine:startLine col:startCol + ifFound:[:line :col | + self selectFromLine:startLine col:startCol + toLine:line col:col] + ifNotFound:[self showNotFound] + onError:[self beep] "Modified: 9.10.1997 / 12:57:34 / cg" ! searchForMatchingParenthesisFromLine:startLine col:startCol - ifFound:foundBlock - ifNotFound:notFoundBlock - onError:failBlock + ifFound:foundBlock + ifNotFound:notFoundBlock + onError:failBlock "search for a matching parenthesis; start search with character at startLine/startCol. Search for the corresponding character is done forward if its an opening, @@ -3399,20 +3399,20 @@ If there is a nesting error, evaluate failBlock." ^ self - searchForMatchingParenthesisFromLine:startLine col:startCol - ifFound:foundBlock - ifNotFound:notFoundBlock - onError:failBlock - ignoring:(parenthesisSpecification at:#ignore ifAbsent:#()) "/ #( $' $" '$[' '$]' '${' '$)' ) + searchForMatchingParenthesisFromLine:startLine col:startCol + ifFound:foundBlock + ifNotFound:notFoundBlock + onError:failBlock + ignoring:(parenthesisSpecification at:#ignore ifAbsent:#()) "/ #( $' $" '$[' '$]' '${' '$)' ) "Modified: / 12-04-2007 / 11:24:24 / cg" ! searchForMatchingParenthesisFromLine:startLine col:startCol - ifFound:foundBlock - ifNotFound:notFoundBlock - onError:failBlock - ignoring:ignoreSet + ifFound:foundBlock + ifNotFound:notFoundBlock + onError:failBlock + ignoring:ignoreSet "search for a matching parenthesis; start search with character at startLine/startCol. Search for the corresponding character is done forward if its an opening, @@ -3421,24 +3421,24 @@ If there is a nesting error, evaluate failBlock." ^ self - searchForMatchingParenthesisFromLine:startLine col:startCol - ifFound:foundBlock - ifNotFound:notFoundBlock - onError:failBlock - openingCharacters: (parenthesisSpecification at:#open) "/ #( $( $[ ${ "$> $<") - closingCharacters: (parenthesisSpecification at:#close) "/ #( $) $] $} "$> $<") - ignoredCharacters: ignoreSet - specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/ - -"/ |i direction lineString -"/ parChar charSet closingChar -"/ ignoring + searchForMatchingParenthesisFromLine:startLine col:startCol + ifFound:foundBlock + ifNotFound:notFoundBlock + onError:failBlock + openingCharacters: (parenthesisSpecification at:#open) "/ #( $( $[ ${ "$> $<") + closingCharacters: (parenthesisSpecification at:#close) "/ #( $) $] $} "$> $<") + ignoredCharacters: ignoreSet + specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/ + +"/ |i direction lineString +"/ parChar charSet closingChar +"/ ignoring "/ line "{ Class: SmallInteger }" "/ col "{ Class: SmallInteger }" "/ delta "{ Class: SmallInteger }" "/ endCol "{ Class: SmallInteger }" "/ runCol "{ Class: SmallInteger }" -"/ cc prevCC nextCC incSet decSet +"/ cc prevCC nextCC incSet decSet "/ nesting "{ Class: SmallInteger }" "/ maxLine "{ Class: SmallInteger }" "/ ign skip anySet| @@ -3512,7 +3512,7 @@ "/ ignore == cc ifTrue:[ "/ ign := true "/ ] ifFalse:[ -"/ ignore isString ifTrue:[ +"/ ignore isString ifTrue:[ "/ cc == (ignore at:2) ifTrue:[ "/ runCol > 1 ifTrue:[ "/ (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[ @@ -3578,11 +3578,11 @@ ! searchForMatchingParenthesisFromLine:startLine col:startCol - ifFound:foundBlock - ifNotFound:notFoundBlock - onError:failBlock - openingCharacters:openingCharacters - closingCharacters:closingCharacters + ifFound:foundBlock + ifNotFound:notFoundBlock + onError:failBlock + openingCharacters:openingCharacters + closingCharacters:closingCharacters "search for a matching parenthesis; start search with character at startLine/startCol. Search for the corresponding character is done forward if its an opening, @@ -3591,24 +3591,24 @@ If there is a nesting error, evaluate failBlock." ^ self - searchForMatchingParenthesisFromLine:startLine col:startCol - ifFound:foundBlock - ifNotFound:notFoundBlock - onError:failBlock - openingCharacters: openingCharacters - closingCharacters: closingCharacters - ignoredCharacters: (parenthesisSpecification at:#ignore ifAbsent:#()) - specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/ - -"/ |i direction lineString -"/ parChar charSet closingChar -"/ ignoring + searchForMatchingParenthesisFromLine:startLine col:startCol + ifFound:foundBlock + ifNotFound:notFoundBlock + onError:failBlock + openingCharacters: openingCharacters + closingCharacters: closingCharacters + ignoredCharacters: (parenthesisSpecification at:#ignore ifAbsent:#()) + specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/ + +"/ |i direction lineString +"/ parChar charSet closingChar +"/ ignoring "/ line "{ Class: SmallInteger }" "/ col "{ Class: SmallInteger }" "/ delta "{ Class: SmallInteger }" "/ endCol "{ Class: SmallInteger }" "/ runCol "{ Class: SmallInteger }" -"/ cc prevCC nextCC incSet decSet +"/ cc prevCC nextCC incSet decSet "/ nesting "{ Class: SmallInteger }" "/ maxLine "{ Class: SmallInteger }" "/ ign skip anySet| @@ -3682,7 +3682,7 @@ "/ ignore == cc ifTrue:[ "/ ign := true "/ ] ifFalse:[ -"/ ignore isString ifTrue:[ +"/ ignore isString ifTrue:[ "/ cc == (ignore at:2) ifTrue:[ "/ runCol > 1 ifTrue:[ "/ (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[ @@ -3748,13 +3748,13 @@ ! searchForMatchingParenthesisFromLine:startLine col:startCol - ifFound:foundBlock - ifNotFound:notFoundBlock - onError:failBlock - openingCharacters:openingCharacters - closingCharacters:closingCharacters - ignoredCharacters:ignoreSet - specialEOLComment:eolCommentSequence + ifFound:foundBlock + ifNotFound:notFoundBlock + onError:failBlock + openingCharacters:openingCharacters + closingCharacters:closingCharacters + ignoredCharacters:ignoreSet + specialEOLComment:eolCommentSequence "search for a matching parenthesis; start search with character at startLine/startCol. Search for the corresponding character is done forward if its an opening, @@ -3762,15 +3762,15 @@ Evaluate foundBlock with line/col as argument if found, notFoundBlock if not. If there is a nesting error, evaluate failBlock." - |i direction lineString - parChar charSet closingChar - ignoring + |i direction lineString + parChar charSet closingChar + ignoring line "{ Class: SmallInteger }" col "{ Class: SmallInteger }" delta "{ Class: SmallInteger }" endCol "{ Class: SmallInteger }" runCol "{ Class: SmallInteger }" - cc prevCC nextCC incSet decSet + cc prevCC nextCC incSet decSet nesting "{ Class: SmallInteger }" maxLine "{ Class: SmallInteger }" ign skip anySet @@ -3783,7 +3783,7 @@ parChar := self characterAtLine:startLine col:startCol. i := charSet indexOf:parChar. i == 0 ifTrue:[ - ^ failBlock value "not a parenthesis" + ^ failBlock value "not a parenthesis" ]. direction := (i <= openingCharacters size) ifTrue:[#fwd] ifFalse:[#bwd]. @@ -3795,13 +3795,13 @@ col := startCol. line := startLine. direction == #fwd ifTrue:[ - delta := 1. - incSet := openingCharacters. - decSet := closingCharacters. + delta := 1. + incSet := openingCharacters. + decSet := closingCharacters. ] ifFalse:[ - delta := -1. - incSet := closingCharacters. - decSet := openingCharacters. + delta := -1. + incSet := closingCharacters. + decSet := openingCharacters. ]. anySet := Set new. anySet addAll:incSet; addAll:decSet; addAll:ignoreSet. @@ -3814,101 +3814,101 @@ col := col + delta. [nesting ~~ 0] whileTrue:[ - (lineString notNil - and:[lineString includesAny:anySet]) ifTrue:[ - direction == #fwd ifTrue:[ - endCol := lineString size. - ] ifFalse:[ - endCol := 1 - ]. - - col to:endCol by:delta do:[:rCol | - runCol := rCol. - - cc := lineString at:runCol. - runCol < lineString size ifTrue:[ - nextCC := lineString at:runCol+1 - ] ifFalse:[ - nextCC := nil - ]. - runCol > 1 ifTrue:[ - prevCC := lineString at:runCol-1 - ] ifFalse:[ - prevCC := nil - ]. - - ign := skip := false. - - "/ check for comments. - - ((cc == eol1 and:[nextCC == eol2]) - or:[prevCC == $$ ]) ifTrue:[ - "/ do nothing - - skip := true. - ] ifFalse:[ - ignoreSet do:[:ignore | - ignore == cc ifTrue:[ - ign := true - ] ifFalse:[ - ignore isString ifTrue:[ - cc == (ignore at:2) ifTrue:[ - runCol > 1 ifTrue:[ - (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[ - skip := true - ] - ] - ] ifFalse:[ - cc == (ignore at:1) ifTrue:[ - runCol < lineString size ifTrue:[ - (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[ - skip := true - ] - ] - ] - ] - ] - ] - ] - ]. - - ign ifTrue:[ - ignoring := ignoring not - ]. - - ignoring ifFalse:[ - skip ifFalse:[ - (incSet includes:cc) ifTrue:[ - nesting := nesting + 1 - ] ifFalse:[ - (decSet includes:cc) ifTrue:[ - nesting := nesting - 1 - ] - ] - ] - ]. - - nesting == 0 ifTrue:[ - "check if legal" - skip ifFalse:[ - cc == closingChar ifFalse:[ - ^ failBlock value - ]. - ^ foundBlock value:line value:runCol. - ] - ] - ]. - ]. - line := line + delta. - (line < 1 or:[line > maxLine]) ifTrue:[ - ^ failBlock value - ]. - lineString := list at:line. - direction == #fwd ifTrue:[ - col := 1 - ] ifFalse:[ - col := lineString size - ] + (lineString notNil + and:[lineString includesAny:anySet]) ifTrue:[ + direction == #fwd ifTrue:[ + endCol := lineString size. + ] ifFalse:[ + endCol := 1 + ]. + + col to:endCol by:delta do:[:rCol | + runCol := rCol. + + cc := lineString at:runCol. + runCol < lineString size ifTrue:[ + nextCC := lineString at:runCol+1 + ] ifFalse:[ + nextCC := nil + ]. + runCol > 1 ifTrue:[ + prevCC := lineString at:runCol-1 + ] ifFalse:[ + prevCC := nil + ]. + + ign := skip := false. + + "/ check for comments. + + ((cc == eol1 and:[nextCC == eol2]) + or:[prevCC == $$ ]) ifTrue:[ + "/ do nothing + + skip := true. + ] ifFalse:[ + ignoreSet do:[:ignore | + ignore == cc ifTrue:[ + ign := true + ] ifFalse:[ + ignore isString ifTrue:[ + cc == (ignore at:2) ifTrue:[ + runCol > 1 ifTrue:[ + (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[ + skip := true + ] + ] + ] ifFalse:[ + cc == (ignore at:1) ifTrue:[ + runCol < lineString size ifTrue:[ + (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[ + skip := true + ] + ] + ] + ] + ] + ] + ] + ]. + + ign ifTrue:[ + ignoring := ignoring not + ]. + + ignoring ifFalse:[ + skip ifFalse:[ + (incSet includes:cc) ifTrue:[ + nesting := nesting + 1 + ] ifFalse:[ + (decSet includes:cc) ifTrue:[ + nesting := nesting - 1 + ] + ] + ] + ]. + + nesting == 0 ifTrue:[ + "check if legal" + skip ifFalse:[ + cc == closingChar ifFalse:[ + ^ failBlock value + ]. + ^ foundBlock value:line value:runCol. + ] + ] + ]. + ]. + line := line + delta. + (line < 1 or:[line > maxLine]) ifTrue:[ + ^ failBlock value + ]. + lineString := list at:line. + direction == #fwd ifTrue:[ + col := 1 + ] ifFalse:[ + col := lineString size + ] ]. ^ notFoundBlock value @@ -3921,55 +3921,55 @@ |ign match variable| searchAction notNil ifTrue:[ - "/ autosearch is cleared whenever there is search with user selection - (self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction]. + "/ autosearch is cleared whenever there is search with user selection + (self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction]. ]. searchAction notNil ifTrue:[ - "/ confusing: this is for autosearch of variables (browse variable uses, for example) - self searchUsingSearchAction:#forward. - ^ self. + "/ confusing: this is for autosearch of variables (browse variable uses, for example) + self searchUsingSearchAction:#forward. + ^ self. ]. searchBarActionBlock notNil ifTrue:[ - searchBarActionBlock value:#forward value:self. - ^ self + searchBarActionBlock value:#forward value:self. + ^ self ]. lastSearchWasVariableSearch ifTrue:[ - variable := self syntaxElementForSelectedVariable. - variable notNil ifTrue:[ - self searchVariableWithSyntaxElement:variable forward:true. - ^ self. - ]. - lastSearchWasVariableSearch := false. + variable := self syntaxElementForSelectedVariable. + variable notNil ifTrue:[ + self searchVariableWithSyntaxElement:variable forward:true. + ^ self. + ]. + lastSearchWasVariableSearch := false. ]. ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true. match := lastSearchWasMatch ? LastSearchWasMatch ? false. selectStyle == #wordLeft ifTrue:[ - " - remove the space from the selection - " - selectionStartCol := selectionStartCol + 1. - super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1. - selectStyle := #word. - self selectionChanged. + " + remove the space from the selection + " + selectionStartCol := selectionStartCol + 1. + super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1. + selectStyle := #word. + self selectionChanged. ]. self setSearchPatternWithMatchEscapes: match. lastSearchPattern isNil ifTrue:[ - LastSearchPatterns size > 0 ifTrue:[ - lastSearchPattern := LastSearchPatterns first - ] + LastSearchPatterns size > 0 ifTrue:[ + lastSearchPattern := LastSearchPatterns first + ] ]. lastSearchPattern notNil ifTrue:[ - self rememberSearchPattern:lastSearchPattern. - lastSearchDirection := #forward. - self - searchFwd:lastSearchPattern - ignoreCase:ign - match: match + self rememberSearchPattern:lastSearchPattern. + lastSearchDirection := #forward. + self + searchFwd:lastSearchPattern + ignoreCase:ign + match: match ] "Modified: / 08-03-2012 / 14:25:42 / cg" @@ -3989,9 +3989,9 @@ "do a forward search" self - searchFwdUsingSpec:(ListView::SearchSpec new - pattern:pattern) - ifAbsent:aBlock + searchFwdUsingSpec:(ListView::SearchSpec new + pattern:pattern) + ifAbsent:aBlock "Modified: / 21-09-2006 / 16:51:28 / cg" ! @@ -4000,13 +4000,13 @@ "do a forward search" self - searchFwdUsingSpec:(ListView::SearchSpec new - pattern:pattern - ignoreCase:ign) - ifAbsent:[ - self sensor compressKeyPressEventsWithKey:#FindNext. - self showNotFound - ]. + searchFwdUsingSpec:(ListView::SearchSpec new + pattern:pattern + ignoreCase:ign) + ifAbsent:[ + self sensor compressKeyPressEventsWithKey:#FindNext. + self showNotFound + ]. "/ lastSearchIgnoredCase := ign. lastSearchPattern := pattern string @@ -4018,10 +4018,10 @@ "do a forward search" self - searchFwdUsingSpec:(ListView::SearchSpec new - pattern:pattern - ignoreCase:ign) - ifAbsent:aBlock + searchFwdUsingSpec:(ListView::SearchSpec new + pattern:pattern + ignoreCase:ign) + ifAbsent:aBlock "Modified: 13.9.1997 / 01:05:35 / cg" "Created: 13.9.1997 / 06:18:27 / cg" @@ -4031,14 +4031,14 @@ "do a forward search" self - searchFwdUsingSpec:(ListView::SearchSpec new - pattern:pattern - ignoreCase:ign - match:match) - ifAbsent:[ - self sensor compressKeyPressEventsWithKey:#FindNext. - self showNotFound - ]. + searchFwdUsingSpec:(ListView::SearchSpec new + pattern:pattern + ignoreCase:ign + match:match) + ifAbsent:[ + self sensor compressKeyPressEventsWithKey:#FindNext. + self showNotFound + ]. "/ lastSearchIgnoredCase := ign. "/ lastSearchWasMatch := match. lastSearchPattern := pattern string @@ -4050,12 +4050,12 @@ searchFwd:pattern ignoreCase:ign match: match ifAbsent:aBlock "do a forward search" - self - searchFwdUsingSpec:(ListView::SearchSpec new - pattern:pattern - ignoreCase:ign - match:match) - ifAbsent:aBlock + self + searchFwdUsingSpec:(ListView::SearchSpec new + pattern:pattern + ignoreCase:ign + match:match) + ifAbsent:aBlock "Modified: 13.9.1997 / 01:05:35 / cg" "Created: 13.9.1997 / 06:18:27 / cg" @@ -4064,21 +4064,21 @@ searchFwd:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifAbsent:aBlock "do a forward search" - self - searchFwdUsingSpec:(ListView::SearchSpec new - pattern:pattern - ignoreCase:ign - match:match) - startingAtLine:startLine col:startCol - ifAbsent:aBlock + self + searchFwdUsingSpec:(ListView::SearchSpec new + pattern:pattern + ignoreCase:ign + match:match) + startingAtLine:startLine col:startCol + ifAbsent:aBlock ! searchFwdUsingSpec:searchSpec "do a forward search" - self - searchFwdUsingSpec:searchSpec - ifAbsent:[self showNotFound]. + self + searchFwdUsingSpec:searchSpec + ifAbsent:[self showNotFound]. "/ lastSearchIgnoredCase := false. lastSearchPattern := searchSpec pattern string @@ -4095,10 +4095,10 @@ startLine := pos y. startCol := pos x. - self - searchFwdUsingSpec:searchSpec - startingAtLine:startLine col:startCol - ifAbsent:aBlock + self + searchFwdUsingSpec:searchSpec + startingAtLine:startLine col:startCol + ifAbsent:aBlock "Modified: 13.9.1997 / 01:05:35 / cg" "Created: 13.9.1997 / 06:18:27 / cg" @@ -4107,11 +4107,11 @@ searchFwdUsingSpec:searchSpec startingAtLine:startLine col:startCol ifAbsent:aBlock "do a forward search" - self - searchForwardUsingSpec:searchSpec - startingAtLine:startLine col:startCol - ifFound:[:line :col | self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col] - ifAbsent:aBlock + self + searchForwardUsingSpec:searchSpec + startingAtLine:startLine col:startCol + ifFound:[:line :col | self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col] + ifAbsent:aBlock ! searchPattern @@ -4121,33 +4121,33 @@ ! searchUsingSearchAction:direction - self - searchUsingSearchAction:direction - ifAbsent:[ - self sensor compressKeyPressEventsWithKey:#FindNext. - self showNotFound - ] + self + searchUsingSearchAction:direction + ifAbsent:[ + self sensor compressKeyPressEventsWithKey:#FindNext. + self showNotFound + ] ! searchUsingSearchAction:direction ifAbsent:notFoundAction |pos startLine startCol| - pos := direction == #backward - ifTrue:[self startPositionForSearchBackward] - ifFalse:[self startPositionForSearchForward]. + pos := direction == #backward + 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. + ]. ]. ! @@ -4161,9 +4161,9 @@ "set the searchpattern for future searches" aStringOrNil isEmptyOrNil ifTrue:[ - lastSearchPattern := nil. + lastSearchPattern := nil. ] ifFalse:[ - lastSearchPattern := aStringOrNil asString withoutSeparators string. + lastSearchPattern := aStringOrNil asString withoutSeparators string. ]. "Modified: / 6.3.1999 / 23:47:36 / cg" @@ -4185,9 +4185,9 @@ sel := self selection. sel notNil ifTrue:[ - searchPattern := sel asString. - match ifTrue:[searchPattern := searchPattern withMatchEscapes]. - self setSearchPattern:searchPattern. + searchPattern := sel asString. + match ifTrue:[searchPattern := searchPattern withMatchEscapes]. + self setSearchPattern:searchPattern. ] "Modified: / 6.3.1999 / 23:48:04 / cg" @@ -4211,16 +4211,16 @@ realPattern := pattern. isMatch ifTrue: [ - (realPattern startsWith:$*) ifTrue:[ - realPattern := realPattern copyFrom:2 - ]. - (realPattern endsWith:$*) ifTrue:[ - realPattern := realPattern copyWithoutLast:1 - ]. + (realPattern startsWith:$*) ifTrue:[ + realPattern := realPattern copyFrom:2 + ]. + (realPattern endsWith:$*) ifTrue:[ + realPattern := realPattern copyWithoutLast:1 + ]. ]. self selectFromLine:line col:col - toLine:line col:(col + realPattern size - 1). + toLine:line col:(col + realPattern size - 1). self makeLineVisible:line ! @@ -4233,11 +4233,11 @@ savedCursor := cursor. [ - self cursor:(Cursor cross). - self beep. - Processor activeProcess millisecondDelay:300. + self cursor:(Cursor cross). + self beep. + Processor activeProcess millisecondDelay:300. ] ensure:[ - self cursor:savedCursor + self cursor:savedCursor ] "Modified: 20.2.1997 / 12:49:27 / cg" @@ -4251,11 +4251,11 @@ |startLine startCol| selectionStartLine notNil ifTrue:[ - startLine := selectionStartLine. - startCol := selectionStartCol + startLine := selectionStartLine. + startCol := selectionStartCol ] ifFalse:[ - startLine := 1. - startCol := 1 + startLine := 1. + startCol := 1 ]. ^ startCol @ startLine @@ -4269,11 +4269,11 @@ |startLine startCol| selectionStartLine notNil ifTrue:[ - startLine := selectionStartLine. - startCol := selectionStartCol + startLine := selectionStartLine. + startCol := selectionStartCol ] ifFalse:[ - startLine := 1. - startCol := 1 + startLine := 1. + startCol := 1 ]. ^ startCol @ startLine @@ -4290,30 +4290,30 @@ |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. - ]. -"/ self redrawLine:l. + 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 redrawFromLine:l to:l+1. - self makeSelectionVisible. + self validateNewSelection. + self setPrimarySelection. + self redrawFromLine:l to:l+1. + self makeSelectionVisible. ]. "Created: / 01-03-1996 / 23:35:08 / cg" @@ -4325,33 +4325,33 @@ |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 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 redrawLine:l from:c1 to:c2. + self makeSelectionVisible. ]. "Modified: / 18-03-1996 / 17:05:46 / cg" @@ -4362,28 +4362,28 @@ |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 redrawLine:l from:c 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 redrawLine:l from:c to:c+1. + self makeSelectionVisible. ]. "Created: / 01-03-1996 / 23:33:17 / cg" @@ -4395,32 +4395,32 @@ |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 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 redrawLine:l. + "/ self redrawLine:l+1. + self redrawFromLine:l to:l+1. + self makeSelectionVisible. ]. "Modified: / 06-03-1996 / 14:12:06 / cg" @@ -4456,15 +4456,15 @@ selectionEndLine isNil ifTrue:[^ false]. (line between:selectionStartLine and:selectionEndLine) ifFalse:[ - ^ false + ^ false ]. line == selectionStartLine ifTrue:[ - aColNr < selectionStartCol ifTrue:[^ false] + aColNr < selectionStartCol ifTrue:[^ false] ]. line == selectionEndLine ifTrue:[ - (selectionEndCol ~~ 0 and:[selectionEndCol < aColNr]) ifTrue:[^ false] + (selectionEndCol ~~ 0 and:[selectionEndCol < aColNr]) ifTrue:[^ false] ]. ^ true ! @@ -4475,15 +4475,15 @@ |line col| selectionStartLine notNil ifTrue:[ - expandingTop == true ifTrue:[ - line := selectionStartLine. - col := selectionStartCol. - ] ifFalse:[ - line := selectionEndLine. - col := selectionEndCol. - ]. - self makeLineVisible:line. - self makeColVisible:col inLine:line. + expandingTop == true ifTrue:[ + line := selectionStartLine. + col := selectionStartCol. + ] ifFalse:[ + line := selectionEndLine. + col := selectionEndCol. + ]. + self makeLineVisible:line. + self makeColVisible:col inLine:line. ] "Modified: 6.3.1996 / 13:53:45 / cg" @@ -4525,36 +4525,36 @@ self unselect. 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 - ]. + "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]. + endLine < startLine ifTrue:[^ self]. + (startLine == endLine and:[endCol < startCol]) ifTrue:[^ self]. " - selectionStartLine := startLine. - selectionStartCol := startCol. - selectionEndLine := endLine. - selectionEndCol := endCol. - self validateNewSelection. - self setPrimarySelection. - - (selectionStartLine == selectionEndLine) ifTrue:[ - self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol - ] ifFalse:[ - selectionStartLine to:selectionEndLine do:[:lineNr | - self redrawLine:lineNr - ] - ]. - selectStyle := nil. + selectionStartLine := startLine. + selectionStartCol := startCol. + selectionEndLine := endLine. + selectionEndCol := endCol. + self validateNewSelection. + self setPrimarySelection. + + (selectionStartLine == selectionEndLine) ifTrue:[ + self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol + ] ifFalse:[ + selectionStartLine to:selectionEndLine do:[:lineNr | + self redrawLine:lineNr + ] + ]. + selectStyle := nil. ] " @@ -4611,14 +4611,14 @@ selectLine := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y). selectLine notNil ifTrue:[ - self selectLine:selectLine + self selectLine:selectLine ] ! selectLineWhereCharacterPosition:pos "select the line, where characterPosition pos is living. The argument pos starts at 1 from the start of the text - and counts characters (i.e. can be used to convert from + and counts characters (i.e. can be used to convert from character position within a string to line-position in view)." self selectLine:(self lineOfCharacterPosition:pos) @@ -4627,13 +4627,13 @@ selectWordAtLine:line col:col "select the word at given line/col" - self - wordAtLine:line col:col do:[ - :beginLine :beginCol :endLine :endCol :style | - - self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol. - selectStyle := style - ] + self + wordAtLine:line col:col do:[ + :beginLine :beginCol :endLine :endCol :style | + + self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol. + selectStyle := style + ] "Modified: 18.3.1996 / 17:30:38 / cg" ! @@ -4647,8 +4647,8 @@ selectVisibleLine := self visibleLineOfY:y. selectLine := self visibleLineToListLine:selectVisibleLine. selectLine notNil ifTrue:[ - selectCol := self colOfX:x inVisibleLine:selectVisibleLine. - self selectWordAtLine:selectLine col:selectCol + selectCol := self colOfX:x inVisibleLine:selectVisibleLine. + self selectWordAtLine:selectLine col:selectCol ] "Modified: / 8.9.1998 / 21:22:46 / cg" @@ -4670,9 +4670,9 @@ selectionStartLine isNil ifTrue:[^ nil]. sel := self textFromLine:selectionStartLine col:(selectionStartCol max:1) toLine:selectionEndLine col:selectionEndCol. sel notNil ifTrue:[ - (characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[ - sel := sel encodeFrom:characterEncoding into:#'iso10646-1' - ]. + (characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[ + sel := sel encodeFrom:characterEncoding into:#'iso10646-1' + ]. ]. ^ sel @@ -4715,9 +4715,9 @@ "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)" - device setPrimaryText: self selectionAsString ownerView: self. + "On X11, be nice and set the PRIMARY selection. + (#setPrimaryText:ownerView: is void in DeviceWorkstation)" + device setPrimaryText: self selectionAsString ownerView: self. ]. "Created: / 17-04-2012 / 20:59:32 / Jan Vrany " @@ -4740,34 +4740,34 @@ |startLine endLine startVisLine endVisLine| selectionStartLine notNil ifTrue:[ - startLine := selectionStartLine. - endLine := selectionEndLine. - - self unselectWithoutRedraw. - - "/ if the selection is not visible, we are done - - startLine >= (firstLineShown + nLinesShown) ifTrue:[^ self]. - endLine < firstLineShown ifTrue:[^ self]. - - startLine < firstLineShown ifTrue:[ - startVisLine := 1 - ] ifFalse:[ - startVisLine := self listLineToVisibleLine:startLine - ]. - endLine >= (firstLineShown + nLinesShown) ifTrue:[ - endVisLine := nLinesShown - ] ifFalse:[ - endVisLine := self listLineToVisibleLine:endLine - ]. - - "/ if its only part of a line, just redraw what has to be - - (startLine == endLine) ifTrue:[ - super redrawVisibleLine:startVisLine from:selectionStartCol to:selectionEndCol - ] ifFalse:[ - self redrawFromVisibleLine:startVisLine to:endVisLine - ]. + startLine := selectionStartLine. + endLine := selectionEndLine. + + self unselectWithoutRedraw. + + "/ if the selection is not visible, we are done + + startLine >= (firstLineShown + nLinesShown) ifTrue:[^ self]. + endLine < firstLineShown ifTrue:[^ self]. + + startLine < firstLineShown ifTrue:[ + startVisLine := 1 + ] ifFalse:[ + startVisLine := self listLineToVisibleLine:startLine + ]. + endLine >= (firstLineShown + nLinesShown) ifTrue:[ + endVisLine := nLinesShown + ] ifFalse:[ + endVisLine := self listLineToVisibleLine:endLine + ]. + + "/ if its only part of a line, just redraw what has to be + + (startLine == endLine) ifTrue:[ + super redrawVisibleLine:startVisLine from:selectionStartCol to:selectionEndCol + ] ifFalse:[ + self redrawFromVisibleLine:startVisLine to:endVisLine + ]. ]. selectStyle := nil @@ -4804,11 +4804,11 @@ !TextView class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.345 2013-01-21 13:46:16 cg Exp $' + ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.346 2013-01-26 21:11:40 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.345 2013-01-21 13:46:16 cg Exp $' + ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.346 2013-01-26 21:11:40 cg Exp $' ! !