|
Class: EditTextView
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--ListView
|
+--TextView
|
+--EditTextView
|
+--ComposedTextView
|
+--EditField
|
+--RCSConflictEditTextView
|
+--TextCollector
- Package:
- stx:libwidg
- Category:
- Views-Text
- Version:
- rev:
1.910
date: 2024/04/28 07:55:41
- user: cg
- file: EditTextView.st directory: libwidg
- module: stx stc-classLibrary: libwidg
a view for editable text - adds editing functionality to TextView
Also, it adds accept functionality, and defines a new actionBlock:
acceptAction to be performed for accept
If used with a model, this is informed by sending it a changeMsg with
the current contents as argument.
(however, it is possible to define both changeMsg and acceptAction)
Please read the historic notice in the ListView class.
[Instance variables:]
cursorLine <Number> line where cursor sits (1..)
cursorVisibleLine <Number> visible line where cursor sits (1..nLinesShown)
cursorCol <Number> col where cursor sits (1..)
cursorShown <Boolean> true, if cursor is currently shown
readOnly <Boolean> true, if text may not be edited
modifiedChannel <ValueHolder> holding true, if text has been modified.
cleared on accept.
acceptChannel <ValueHolder> holding true, if text has been accepted.
fixedSize <Boolean> true, if no lines may be added/removed
exceptionBlock <Block> block to be evaluated when readonly text is about to be modified
if it returns true, the modification will be done anyway.
if it returns anything else, the modification is not done.
cursorFgColor <Color> color used for cursor drawing
cursorBgColor <Color> color used for cursor drawing
cursorType <Symbol> how the cursor is drawn; currently implemented
are #none, #block (solid-block cursor), #ibeam
(vertical bar at insertion point)
and #caret (caret below insertion-point).
see cursorType: for an up-to-date list.
cursorTypeNoFocus <Symbol> like above, if view has no focus
nil means: hide the cursor.
undoAction <Block> block which undoes last cut, paste or replace
(not yet fully implemented)
typeOfSelection <Symbol> #paste, if selection created by paste, nil otherwise
this affects the next keyPress: if #paste it does not
replace; otherwise it replaces the selection.
lastCut <String> last cut or replaced string
lastReplacementInfo <LastReplacementInfo> holds the information about the last replace action
lastStringToReplace is the string to be replaced by lastReplacement
lastReplacement is the string to replace lastStringToReplace
lastStringFromReplaceForNextSearch <String> string to be taken be the next search action
(cleared after a new selection)
replacing <Boolean> true if entered characters replace last selection
showMatchingParenthesis <Boolean> if true, shows matching parenthesis
when entering one; this is the default.
hasKeyboardFocus <Boolean> true if this view has the focus
acceptAction <Block> accept action - evaluated passing the contents as
argument
tabMeansNextField <Boolean> if true, Tab is ignored as input and shifts keyboard
focus to the next field. For editTextViews, this is false
by default (i.e. tabs can be entered into the text).
For some subclasses (inputFields), this may be true.
trimBlankLines <Boolean> if true, trailing blanks are
removed when editing.
Also, empty lines are represented as nil in the lines collection.
Default is true.
wordWrap <Boolean> Currently not used.
lockUpdates <Boolean> internal, private
prevCursorState <Boolean> temporary, private
cursorMovementWhenUpdating
<Symbol> defines where the cursor is to be positioned if the
model changes its value by some outside activity
(i.e. not by user input into the field).
Can be one of:
#keep / nil -> stay where it was
#endOfText -> cursor to the end
#endOfLine -> stay in the line, but move to end
#beginOfText -> cursor to the beginning
#beginOfLine -> stay in the line, but move to begin
The default is #beginOfText
dropTarget <DropTarget|nil>
drop operation descriptor or nil (drop disabled)
updatesLocked <Boolean> disables textChanged notifications towards the model.
needed when multiple editoperations (i.e. delete folowed by insert as a replace)
would otherwise trigger multiple change messages,
which might confuse the model (especially: replace selection by keystroke,
if a typeConverting model is converting the intermediate empty contents to a default number)
userPreference values:
userPreferences.st80EditMode
<Boolean> if true, cursor positioning is
done as in vi or ST80; i.e.
wysiwyg mode is somewhat relaxed,
in that the cursor cannot be
positioned behind a lines end.
This is not yet completely implemented.
used globals:
DeleteHistory <Text> last 1000 lines of deleted text
(but only if this variable exists already)
[Classvars]:
SupportMultiCursors temporary boolean while multiCursors are being
implemented. Will support CTRL-click to add another
cursor,which will also insert typed characters.
SupportMultiCursors := true.
SupportMultiCursors := false.
[styleSheet parameters:]
textCursorForegroundColor <Color> cursor fg color; default: text background
textCursorBackgroundColor <Color> cursor bg color; default: text foreground
textCursorNoFocusForegroundColor
<Color> cursor fg color if no focus; default: cursor fg color
textCursorType <Symbol> cursor type; default: #block
copyrightCOPYRIGHT (c) 1989 by Claus Gittinger
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
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
defaults
-
defaultCompletionSupportClass
-
-
st80Mode
-
return true, if the st80 editing mode is turned on.
This setting affects the behavior of the cursor, when positioned
beyond the end of a line or the end of the text.
This method is here for backward compatibility, when this flag was stored
in a class var. It is now in the user's settings.
Please do not call it, but go to the prefs directly, to make it easier to find those getters.
Usage example(s):
EditTextView st80Mode:true
EditTextView st80Mode:false
|
-
st80Mode: aBoolean
-
turns on/off st80 behavior, where the cursor cannot be positioned
beyond the end of a line or the last line.
This method is here for backward compatibility, when this flag was stored
in a class var. It is now in the user's settings.
Please do not call it, but go to the prefs directly, to make it easier to find those setters.
Usage example(s):
EditTextView st80Mode:true
EditTextView st80Mode:false
|
-
updateStyleCache
-
extract values from the styleSheet and cache them in class variables
Usage example(s):
special access
-
lastSubMenuLabel
-
specs
-
searchReplaceDialogSpec
-
This resource specification was automatically generated
by the UIPainter of ST/X.
Usage example(s):
UIPainter new openOnClass:EditTextView andSelector:#searchReplaceDialogSpec
|
Compatibility-ST80
-
autoAccept: aBoolean
-
ignored for now
-
continuousAccept: aBoolean
-
ignored for now
-
cutSelection
-
-
deselect
-
remove the selection
-
enabled: aBoolean
-
(comment from inherited method)
this is the basic machanism to enable/disable a view.
empty in this class; redefined by many subclasses
-
find: pattern
-
-
insert: aString at: aCharacterPosition
-
insert a string at aCharacterPosition.
Usage example(s):
|top v|
top := StandardSystemView new.
top extent:300@300.
v := EditTextView origin:0.0@0.0 corner:1.0@1.0 in:top.
top openAndWaitUntilVisible.
v contents:'1234567890\1234567890\1234567890\' withCRs.
v insert:'<- hello there' at:5.
|
-
insertAndSelect: aString at: aCharacterPosition
-
insert a selected string at aCharacterPosition.
Usage example(s):
|v|
v := EditTextView new openAndWaitUntilVisible.
v contents:'1234567890\1234567890\1234567890\' withCRs.
v insertAndSelect:'<- hello there' at:5.
|
-
pasteSelection
-
-
replaceSelectionWith: aString
-
this is a VisualWorks compatibility method;
same as replaceSelectionBy:
-
selectAt: pos
-
move the cursor before cursorPosition.
-
textHasChanged
-
-
textHasChanged: aBoolean
-
ST-80 compatibility: set/clear the modified flag.
accessing
-
codeAspect
-
Applications should set it explictly, however, to make it behave like
-
codeAspect: aSymbol
-
-
completionSupport
-
-
completionSupport: anEditTextViewCompletionSupport
-
-
completionSupportClass
-
-
editedClass
-
-
editedLanguage
-
marked as obsolete by exept MBP at 16-09-2021
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
editedLanguage: aProgrammingLanguage
-
marked as obsolete by exept MBP at 16-09-2021
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
editedMethod
-
-
editedMethodOrClass
-
-
editedMethodOrClass: methodOrClass
-
Sets the edited method or class. Only defined here to make it polymorph with Workspace
-
hasSelectionOrTextInCursorLine
-
-
programmingLanguage
-
Get the edited programming language.
Only defined here to make it polymorph with Workspace
-
programmingLanguage: aProgrammingLanguage
-
Sets the edited programming language.
Only defined here to make it polymorph with Workspace
-
selectionOrTextOfCursorLine
-
-
selectionOrTextOfCursorLine: doSelect
-
accessing-behavior
-
acceptAction
-
return the action to be performed on accept (or nil)
-
acceptAction: aBlock
-
set the action to be performed on accept
-
acceptChannel
-
return the valueHolder holding true if text was accepted.
By placing a true into this channel, an accept can also be forced.
-
acceptChannel: aValueHolder
-
set the valueHolder holding true if text was accepted.
By placing a true into this channel, an accept can also be forced.
-
acceptEnabled: aBoolean
-
enable/disable accept. This greys the corresponding item in the menu
-
accepted
-
return true if text was accepted
-
accepted: aBoolean
-
set/clear the accepted flag.
This may force my current contents to be placed into my model.
-
autoIndent
-
true if autoIndent mode is on
-
autoIndent: aBoolean
-
set to true for autoIndent mode
-
autoIndentHolder
-
holds true if autoIndent mode is on
-
codeAspectHolder
-
-
codeAspectHolder: something
-
-
cursorMovementWhenUpdating
-
return what is be done with the cursor,
when I get a new text (via the model or the #contents/#list)
Allowed arguments are:
#keep / nil -> stay where it was
#endOfText -> position cursor to the end
#beginOfText -> position cursor to the beginning
#endOfLine -> position cursor to the current lines end
#beginOfLine -> position cursor to the current lines start
The default is #beginOfText.
This may be useful for fields which get new values assigned from
the program (i.e. not from the user)
-
cursorMovementWhenUpdating: aSymbolOrNil
-
define what should be done with the cursor,
when I get a new text (via the model or the #contents/#list)
Allowed arguments are:
#keep / nil -> stay where it was
#endOfText -> position cursor to the end
#beginOfText -> position cursor to the beginning
#endOfLine -> position cursor to the current lines end
#beginOfLine -> position cursor to the current lines start
The default is #beginOfText.
This may be useful for fields which get new values assigned from
the program (i.e. not from the user)
-
disableIfInvisible: aBoolean
-
-
dontReplaceSelectionOnInput
-
remember that the current selection was created by a paste operation
(as opposed to an explicit selection by the user).
This selection will not be replaced by followup user input,
so multiple pastes will be possible.
-
editModeHolder
-
the edit mode (insert, overwrite,...)
-
editModeInsert
-
set to insert mode
-
editModeInsertAndSelect
-
set to selecting insert mode
-
editModeOverwrite
-
set to overwrite mode
-
exceptionBlock: aBlock
-
define the action to be triggered when user tries to modify
readonly text
-
generateTextAfterEndHook: aBlock
-
some applications may want to dynamically generate lines below the bottom line,
when the cursor is moved there.
For example, disassembly views or memory dumps (hex-dumps),
which want to automatically generate additional lines lazily,
but which cannot afford to generate the whole text in advance
(eg: who wants to disassemble gigabytes?).
If set, this hook is called whenever the cursor is about to be moved below the
last line, getting the new lineNr (i.e > contents size) as argument.
It may generate more text (by setting my contents) and return a new cursor line
number, into which the cursor should be moved
(eg. if 10 additional lines are generated, it may want to return oldSize+1,
to make the cursor end in the last line which was inserted)
-
generateTextBeforeStartHook: aBlock
-
some applications may want to dynamically generate lines above the top
line, when the cursor is moved there.
For example, disassembly views or memory dumps (hex-dumps),
which want to automatically generate additional lines lazily,
but which cannot afford to generate the whole text in advance
(eg: who wants to disassemble gigabytes?).
If set, this hook is called whenever the cursor is about to be moved above the
top, getting the new lineNr (i.e < 1) as argument.
It may generate more text (by setting my contents) and return a new cursor line
number, into which the cursor should be moved
(eg. if 10 additional lines are generated, it may want to return 10, to make the
cursor end in the last line which was inserted)
-
insertMode: aBoolean
-
set to true if inserting (as opposed to overwrite)
-
insertModeHolder
-
holds true if inserting (as opposed to overwrite)
-
isInInsertMode
-
true if inserting (as opposed to overwrite)
-
isNotReadOnly
-
return true, if the text is not readonly.
-
isReadOnly
-
return true, if the text is readonly.
-
lineEndCRLF: aBoolean
-
If aBoolean is true, use CRLF (as in windows) for end of line.
Otherwise and default use Character cr (which in newline as in unix).
-
modeLabelHolder
-
a valueHolder, which contains 'L' (learnMode), I (insertMode) or empty
-
modified
-
return true if text was modified
-
modified: aBoolean
-
set/clear the modified flag
-
modifiedChannel
-
return the valueHolder holding true if text was modified
-
modifiedChannel: aValueHolder
-
set the valueHolder holding true if text was modified
-
readOnly: aBooleanOrValueHolder
-
make the text readonly (aBoolean == true) or writable (aBoolean == false).
The argument may also be a valueHolder.
-
reallyModified
-
return true if text was really modified.
For compatibility with views which use the modified flag for syntax highlighting.
-
reallyModifiedChannel
-
return the valueHolder holding true if text was really modified.
For compatibility with views which use the modified flag for syntax highlighting.
-
st80EditMode
-
If on, the cursor wraps at the line end (like in vi or st80);
if off, we have the Rand-editor behavior (random access)
-
st80EditMode: aBooleanOrNil
-
set/clear the st80Mode flag.
If on, the cursor wraps at the line end (like in vi or st80);
if off, we have the Rand-editor behavior (random access)
if nil, the setting follows the current userPref setting.
-
tabMeansNextField: aBoolean
-
set/clear tabbing to the next field.
If true, Tab is ignored and shifts the keyboard focus.
If false, tabs can be entered into the text.
The default is true for editTextView, false for single-line
input fields.
-
tabRequiresControl
-
returns true, if a focus tabbing requires a control-key to be pressed.
The default is true for editTextView, false for other widgets,
to allow for easier text entry
-
tabRequiresControl: aBoolean
-
controls if a focus tabbing requires a control-key to be pressed.
The default is true for editTextView, false for other widgets,
to allow for easier text entry
-
trimBlankLines
-
If true, the blank lines are trimmed to zero size and trailing blank lines are removed;
if false, they are left as is;
if nil, the setting follows the current userPref setting.
-
trimBlankLines: aBooleanOrNil
-
If true, the blank lines are trimmed to zero size and trailing blank lines are removed;
if false, they are left as is;
if nil, the setting follows the current userPref setting.
-
trimLastCR
-
If true, the last line is returned without a trailing CR character;
The default is false; this is only used by very specialized editors.
-
trimLastCR: aBooleanOrNil
-
If true, the last line is returned without a trailing CR character;
The default is false; this is only used by very specialized editors.
accessing-contents
-
at: lineNr basicPut: aLine
-
change a line without change notification.
this is not undoably, unless you care for yourself
-
at: lineNr put: aLine
-
replace a line by something new.
this is not undoably, unless you care for yourself
-
characterAfterCursor
-
return the character one after the cursor - space if beyond line.
-
characterBeforeCursor
-
return the character to the left of cursor - space if beyond line, nil if at the beginning.
-
characterUnderCursor
-
return the character under the cursor - space if beyond line.
For non-block cursors, this is the character immediately to the right
of the insertion-bar or caret.
For block cursors, this is the highlighted cursor-character
-
contents
-
return the contents as a String or Text (i.e. with emphasis).
Cares for trimBlankLines and trimLastCR options.
Usage example(s):
Logger debug:'Contents: ',contents.
|
-
contents: aStringOrStringCollectionOrNil
-
replace the whole contents by something new.
this is not undoably, unless you care for yourself.
See replaceContentsWith:newContents for an undoable version of this
-
contents: something keepUndoHistory: keepUndoHistory
-
set the contents and optionally clear the undo history.
The contents-change is not undoable.
-
contentsAsString
-
return the contents as a String (i.e. without emphasis).
Trims always (i.e. ignores trimBlankLines and trimLastCR options)
-
contentsAsStringWithTabs
-
return the contents as a String (i.e. without emphasis)
and with leading spaces replaced by tab characters
(i.e. as would be written to a file).
Trims always (i.e. ignores trimBlankLines and trimLastCR options)
-
contentsTrimmedLastCr: theContents
-
returns the contents without a trailing LF or CRLF.
-
cursorCol
-
return the cursors col (1..).
This is the absolute col; NOT the visible col
-
cursorColHolder
-
return a valueHolder for the cursors column (1..).
-
cursorLine
-
return the cursors line (1..).
This is the absolute line; NOT the visible line
-
cursorLineAndColumnHolder
-
return a valueHolder for the cursor's line and column as an
array of the form { lineNr . col }
This can be used directly as a model to react on cursor movement
-
cursorLineAndColumnLabelHolder
-
return a valueHolder for the cursor's line and column as an info string
of the form 'line : col'.
This can be used directly as a model for a GUI label showing the cursor position (eg in the lower right)
-
cursorLineHolder
-
return a valueHolder for the cursors line (1..).
This is the absolute line; NOT the visible line
-
lineStringBeforeCursor
-
return the line's string before the cursor.
Pad with spaces up to the cursor position if beyond the end of line
-
lineStringFromCursor
-
return the line's string beginning at the cursor position to the line's end.
-
list: newCollectionOfLinesOrNil
-
replace the whole contents by something new.
this is not undoably, unless you care for yourself.
Positions the cursor as defined in cursorMovementWhenUpdating
(which defaults to: home)
-
setContents: something
-
replace the whole contents by something new
AND clear the remembered undo actions
-
wordBeforeCursor
-
return the word to the left of cursor - empty string if there is none
-
wordBeforeCursorConsisitingOfCharactersMatching: characterMatchBlock
-
return the word to the left of cursor, where characters match the given condition;
empty string if there is none
accessing-dimensions
-
absoluteXOfPosition: positionInText
( an extension from the stx:libtool package )
-
-
absoluteYOfCursor
( an extension from the stx:libtool package )
-
-
xOfCursor
-
take the end of the selection, if any
-
xOfPosition: positionInText
( an extension from the stx:libtool package )
-
-
yOfCursor
( an extension from the stx:libtool package )
-
-
yOfPosition: positionInText
( an extension from the stx:libtool package )
-
accessing-look
-
cursorForegroundColor: color1 backgroundColor: color2
-
set both cursor foreground and cursor background colors
-
cursorType
-
return the style of the text cursor.
Currently, supported are: #none
#block, #frame, #ibeam, #caret, #solidCaret
#bigCaret and #bigSolidCaret
-
cursorType: aCursorTypeSymbol
-
set the style of the text cursor.
Currently, supported are: #none
#block, #frame, #ibeam, #caret, #solidCaret
#bigCaret and #bigSolidCaret
-
cursorTypeNoFocus
-
return the style of the text cursor when the view has no focus.
If left unspecified, this is the same as the regular cursorType.
-
cursorTypeNoFocus: aCursorTypeSymbol
-
set the style of the text cursor when the view has no focus.
If left unspecified, this is the same as the regular cursorType.
accessing-replace
-
lastReplacementInfo
-
-
lastStringToReplace: aString
-
-
previousReplacements
-
accessor for the code completion
change & update
-
accept
-
accept the current contents by executing the accept-action and/or
changeMessage.
Historically, ST/X used a callBack (acceptAction);
and ST80/VW used the model, into which the text is stored.
We support both; if there is a model, it gets a value: message,
If there is an acceptAction, it is called.
-
argForChangeMessage
-
return the argument to be passed with the change notification.
Defined as separate method for easier subclassability.
-
getListFromModel
-
get my contents from the model.
Redefined to ignore updates resulting from my own changes
(i.e. if lockUpdates is true).
-
update: something with: aParameter from: changedObject
-
(comment from inherited method)
model changed (not more information)
commenting
-
commentFrom: line1 to: line2 commentStrings: commentStrings
-
helper function to comment out a block.
All lines from line1 to line2 get an end-of-line comment
in the first col
(if no eol comment is available, a bracketing comment is used).
Usage example(s):
Add a line tha documents who did comment the lines and when this was done.
Will be undone by EditTextView >> #uncommentFrom:to:commentStrings:
|
-
commentSelection: commentStrings
-
convenient function to comment out a block.
All lines from line1 to line2 get an end-of-line comment
in the first col.
-
uncommentFrom: line1 to: line2In commentStrings: commentStrings
-
helper function to comment out a block.
All lines from line1 to line2 get an end-of-line comment
in the first col.
(if no eol comment is available, a bracketing comment is removed).
-
uncommentSelection: commentStrings
-
convenient function to comment out a block.
All lines from line1 to line2 get an end-of-line comment
in the first col.
cursor handling
-
basicCursorReturn
-
move cursor to start of next line; scroll if at end of visible text
-
cannotMoveCursorPastEnd
-
-
characterPositionOfCursor
-
-
cursorBacktab
-
move cursor to prev tabstop
-
cursorCol: newCol
-
move cursor to some column in the current line
-
cursorDown
-
move cursor down; scroll if at end of visible text;
beep if at end of physical text.
-
cursorDown: n
-
move cursor down by n lines; scroll if at end of visible text
-
cursorHome
-
scroll to top AND move cursor to first line of text.
-
cursorLeft
-
move cursor to left
-
cursorLeft: n
-
move cursor to left
-
cursorLine: line col: col
-
this positions onto physical - not visible - line
-
cursorLine: line col: col makeVisible: makeVisibleBoolean
-
this positions onto physical - not visible - line
-
cursorMovementAllowed
-
return true, if the user may move the cursor around
(via button-click, or cursor-key with selection).
By default, true is returned, but this may be redefined
in special subclasses (such as a terminal view), where
this is not wanted
-
cursorReturn
-
move cursor to start of next line; scroll if at end of visible text
-
cursorReturn: withPossibleAutoIndent
-
move cursor to start of next line; scroll if at end of visible text
-
cursorRight
-
move cursor to right
-
cursorRight: n
-
move cursor to right
-
cursorShown: aBoolean
-
change cursor visibility
return true if cursor was visible before.
-
cursorTab
-
move cursor to next tabstop
-
cursorToBeginOfLine
-
move cursor to the start of the current line
-
cursorToBottom
-
move cursor to the last line of text (col 1)
-
cursorToCharacterPosition: pos
-
compute line/col from character position (1..)
and move the cursor onto that char
-
cursorToEnd
-
move cursor down below last line of text
-
cursorToEndOfLine
-
move cursor to end of current line
-
cursorToEndOfText
-
move cursor to the end of the text (behind the last character in last line)
-
cursorToEndOfWord
-
move the cursor to the end of the word
-
cursorToFirstVisibleLine
-
place cursor into the first visible line; do not scroll.
-
cursorToLastVisibleLine
-
place cursor into the first visible line; do not scroll.
-
cursorToNextWord
-
move the cursor to the beginning of the next word
-
cursorToPreviousWord
-
move the cursor to the beginning of this or the previous word
-
cursorToTop
-
move cursor to absolute home
-
cursorUp
-
move cursor up; scroll if at start of visible text
-
cursorUp: n
-
move cursor up n lines; scroll if at start of visible text
-
cursorVisibleLine: visibleLineNr col: colNr
-
put cursor to visibleline/col
-
cursorX: x y: y
-
put cursor to position next to x/y coordinate in view
-
drawCursor
-
draw the cursor if shown and cursor is visible.
(but not, if there is a selection - to avoid confusion)
-
drawCursor: cursorType line: line col: col with: fgColor and: bgColor
-
draw a cursor - the central method
the argument cursorType specifies what type
of cursor should be drawn (as specified in the styleSheet).
Currently, supported are:
#none,
#block, #frame, #ibeam, #caret, #solidCaret
#bigCaret and #bigSolidCaret
-
drawCursor: cursorType with: fgColor and: bgColor
-
draw the cursor;
the argument cursorType specifies what type
of cursor should be drawn.
Currently, supported are: #none,
#block, #frame, #ibeam, #caret, #solidCaret
#bigCaret and #bigSolidCaret.
If multiple cursors are currently defined, draw them all.
-
drawCursorCharacter
-
draw the cursor.
(i.e. the cursor if no selection)
- helper for many cursor methods
-
drawFocusCursor
-
draw the cursor when the focus is in the view.
-
drawNoFocusCursor
-
draw the cursor for the case when the view has no keyboard focus
-
gotoCharacterPosition: aCharacterPosition
-
position cursor onto that char position.
Make certain that the line is visible
-
gotoLine: aLineNumber
-
position cursor onto line, aLineNumber.
Make certain that this line is visible
-
hideCursor
-
make cursor invisible if currently invisible
-
makeCursorVisible
-
scroll text to make cursorline visible
(i.e. to have cursorLine in visible area)
-
makeCursorVisibleAndShowCursor: flag
-
scroll to make cursorLine visible;
if flag is true, draw the cursor
-
setCursorCol: colNr
-
strictly private: set the cursorCol
-
setCursorLine: lineNr
-
strictly private: set the cursorLine
-
setCursorLine: lineNr col: colNr
-
strictly private: set the cursorLine, col and update the visibleLine
-
setValidatedCursorCol: colNr
-
strictly private: set the cursorCol
-
setValidatedCursorLine: lineNr
-
strictly private: set the cursorLine and update the visibleLine
-
setValidatedCursorLine: lineNr col: colNr
-
strictly private: set the cursorLine, col and update the visibleLine
-
showCursor
-
make cursor visible if currently invisible
-
singleQuoteSelection
-
place single quotes around the selected text
-
undrawCursor
-
undraw the cursor (i.e. redraw the character(s) under the cursor)
-
updateCursorVisibleLine
-
strictly private: set the visibleLine from the cursorLine.
notice: visibleLine will be set to nil if the cursor is not visible
-
validateCursorCol: colNr inLine: lineNr
-
check if colNr is a valid cursor position; return a new colNr if not.
Here, no limits are enforced (and colNr is returned),
but it may be redefined in EditFields or views which don't like the
cursor to be positioned behind the end of a textLine (vi/st-80 behavior)
-
validateCursorLine: line
-
check if line is a valid cursor line; return a fixed line-nr if not.
Here, no limits are enforced (and line is returned), but it may be
redefined in views which don't like the cursor to be positioned
behind the end of the text (vi/st-80 behavior), or want to
skip reserved regions
-
withCursorOffDo: aBlock
-
evaluate aBlock with cursor off; turn it on afterwards.
cursor handling (multi)
-
addMultiCursorAtLine: line col: col
-
-
drawMultiCursors: cursorType with: fgColor and: bgColor
-
draw a cursor; the argument cursorType specifies what type
of cursor should be drawn.
Currently, supported are: #none,
#block, #frame, #ibeam, #caret, #solidCaret
#bigCaret and #bigSolidCaret
-
getMultiCursors
-
-
setMultiCursors: aCollection
-
-
undrawCursors
-
undraw all cursors (i.e. redraw the character(s) under the cursors)
-
withCursorForEachMultiCursorDo: aBlock
-
evaluate a block with cursorLine+cursorCol temporarily set to each multiCursor
drag & drop
-
allowDrop: aBoolean
-
enable/disable drop support
-
canDrop: aDropContext
-
public from d&d.
I accept textObjects and fileObjects only.
-
canDropObjects: aCollectionOfDropObjects
-
public from d&d.
I accept textObjects and fileObjects only.
-
drop: aDropContext
-
public from d&d.
drop objects (new API)
-
dropFileObject: aDropObject
-
drop objects
For bw. compatibility, also collections of drop objects are handled (may vanish)
-
dropObject: aDropObject
-
drop objects
For bw. compatibility, also collections of drop objects are handled (may vanish)
-
dropObjects: aCollectionOfDropObjects
-
public from d&d.
drop objects (old API)
editing
-
applyConverterToSelection: converter
-
apply a converter to the selected text
-
basicReplaceLine: lineNr with: newText
-
undoably replace a line at lineNr;
Does not tell dependents
-
convertSelectionToLowercase
-
to-lower selected text
-
convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
-
toLower/toUppercaseFirst/toUpper selected text
-
convertSelectionToUppercase
-
to-upper selected text
-
convertSelectionToUppercaseFirst
-
to-upperFirst selected text
-
copyAndDeleteSelection
-
copy the selection into the pastBuffer and delete it
-
deleteCharAtCursor
-
delete single character under cursor; does not merge lines
-
deleteCharAtLine: lineNr col: colNr
-
delete a single character at colNr in line lineNr
-
deleteCharBeforeCursor
-
delete single character to the left of cursor and move cursor to left
-
deleteCharsAtLine: lineNr fromCol: colNr
-
delete characters from colNr up to the end in line lineNr
-
deleteCharsAtLine: lineNr fromCol: startCol toCol: endCol
-
delete characters from startCol to endCol in line lineNr;
Tells dependents
-
deleteCharsAtLine: lineNr fromCol: startCol toCol: endCol notify: doNotify
-
delete characters from startCol to endCol in line lineNr;
Tells dependents
-
deleteCharsAtLine: lineNr toCol: colNr
-
delete characters from start up to colNr in line lineNr
-
deleteCursorLine
-
delete the line where the cursor sits
-
deleteFromCharacterPosition: charPos1 to: charPos2
-
delete a substring at a character position
-
deleteFromCursorToEndOfLine
-
delete characters from the current cursor position to the end of line
-
deleteFromLine: startLine col: startCol toLine: endLine col: endCol
-
delete all text from startLine/startCol to endLine/endCol -
joining lines if necessary
-
deleteFromLine: startLineNr toLine: endLineNr
-
delete some lines
-
deleteLine: lineNr
-
delete line
-
deleteLineWithoutRedraw: lineNr
-
delete line - no redraw;
return true, if something was really deleted
-
deleteLinesWithoutRedrawFrom: startLine to: endLine
-
delete lines - no redraw;
return true, if something was really deleted
-
deleteSelection
-
delete the selection
-
deleteSpacesBeforeCursor
-
delete all whitespace left of cursor but not beyond the current line
and move cursor to left
-
deleteWordBeforeCursor
-
delete the word to the left of cursor and move cursor to left
-
indentSelectionBy1
-
indent selected line-range
by 1 space (i.e. to the right)
-
insert: aCharacter atLine: lineNr col: colNr
-
insert a single character at lineNr/colNr;
set emphasis to character at current position
-
insertCharAtCursor: aCharacter
-
insert a single character at cursor-position - advance cursor.
-
insertLine: aString before: lineNr
-
insert the line aString before line lineNr
-
insertLines: aStringCollection before: lineNr
-
insert a bunch before line lineNr
-
insertLines: someText from: start to: end before: lineNr
-
insert a bunch of lines before line lineNr.
The cursor position is left unchanged.
-
insertLines: lines withCR: withCr
-
insert a bunch of lines at cursor position.
Cursor is moved behind insertion.
If withCr is true, append cr after last line
-
insertSelectedStringAtCursor: aString
-
insert the argument, aString at cursor position and select it
-
insertString: aString atCharacterPosition: charPos
-
insert the argument, aString at a character position
-
insertString: aString atLine: lineNr col: colNr
-
insert the string, aString at line/col;
handle cr's correctly
-
insertStringAtCursor: aString
-
insert the argument, aString at cursor position
handle cr's correctly.
A nil argument is interpreted as an empty line.
-
insertStringWithoutCRs: aString atLine: lineNr col: colNr
-
insert aString (which has no crs) at lineNr/colNr
-
insertStringWithoutCRsAtCursor: aString
-
insert a string (which has no crs) at cursor position
- advance cursor
-
insertTabAtCursor
-
insert spaces to next tab
-
joinLines
-
join lines (remove line-break)
-
joinLinesRemovingSpaces
-
join lines (remove line-break) removing spaces at the end/beginning.
Position the cursor to the join point
-
mergeLine: lineNr
-
merge line lineNr with line lineNr+1
-
mergeLine: lineNr removeBlanks: removeBlanks
-
merge line lineNr with line lineNr+1
-
parenthizeSelection
-
place parentheses around the selected text.
if already parenthized, de-parenthize it
-
parenthizeSelectionWith: openingCharacter and: closingCharacter
-
if already parenthized, de-parenthize it
-
removeTrailingBlankLines
-
remove all blank lines at end of text
New implementation!
Until now, only the blank lines after the cursor were deleted.
This functionality is now preserved in the method 'removeTrailingBlankLinesAfterCursor',
but is not currently used.
-
removeTrailingBlankLinesAfterCursor
-
remove all blank lines at end of text and after the current cursor line
-
replace: aCharacter atLine: lineNr col: colNr
-
replace a single character at lineNr/colNr
-
replace: patternArg by: replacePatternArg all: all ignoreCase: ignoreCase
-
-
replaceCharAtCursor: aCharacter
-
undoably replace a single character at cursor-position - advance cursor
-
replaceContentsWith: newContents
-
undoably replace everything
-
replaceFromCharacterPosition: charPos1 to: charPos2 with: newString
-
undoably replace a substring at a character position
-
replaceLine: lineNr with: newText
-
undoably replace a line at lineNr;
tells dependents
-
replaceLines: lines withCR: withCr
-
undoably a bunch of lines at cursor position. Cursor
is moved behind replacement.
If withCr is true, move to the beginning of the next line
after the last line
-
replaceSelectionBy: aStringOrSingleCharacter
-
undoably delete the selection (if any) and insert aStringOrSingleCharacter, a character or string;
leave cursor after insertion
-
replaceSelectionBy: aStringOrSingleCharacter keepCursor: keep
-
undoably delete the selection (if any) and insert aStringOrSingleCharacter, a character or string;
leave cursor after insertion or leave it, depending on keep
-
replaceSelectionBy: aStringOrSingleCharacter keepCursor: keep select: selectNewText
-
undoably delete the selection (if any) and insert something, a character or string;
leave cursor after insertion or leave it, depending on keep.
If selectNewText is true, select the new text; otherwise deselect
-
replaceString: aString atLine: lineNr col: colNr
-
undoably replace multiple characters starting at lineNr/colNr.
This is not prepared to encounter special chars (except TAB) in the string.
-
replaceString: aString to: aNewString ignoreCase: ignoreCase
-
-
replaceStringAtCursor: aString
-
replace multiple characters at cursor-position - advance cursor
-
replaceTABAtCursor
-
replace a single character at cursor-position by a TAB character
-
selectWordBeforeCursor
-
select the word to the left of cursor
-
splitLine: lineNr before: colNr
-
split the line linNr before colNr; the right part (from colNr)
is cut off and inserted after lineNr; the view is redrawn
-
undentSelectionBy1
-
undent selected line-range
by 1 space (i.e. to the left)
-
withAutoIndent: aBoolean do: aBlock
-
-
withoutRedrawAt: lineNr put: aString
-
replace a line at lineNr
-
withoutRedrawInsertLine: aString before: lineNr
-
insert the argument, aString before line lineNr; the string
becomes line lineNr; everything else is moved down; the view
is not redrawn
-
withoutRedrawInsertLines: lines from: start to: end before: lineNr
-
insert a bunch of lines before line lineNr; the view is not redrawn
-
withoutRedrawInsertStringWithoutCRs: aString atLine: lineNr col: colNr
-
insert aString (which has no crs) at lineNr/colNr
-
wrapLines
-
wrap lines (insert line-break)
editing-basic
-
basicDeleteCharsAtLine: lineNr fromCol: startCol toCol: endCol
-
delete characters from startCol to endCol in line lineNr;
Does not tell dependents
-
basicDeleteFromLine: startLineNr toLine: endLineNr
-
delete some lines.
Does not tell dependents
-
basicDeleteLineWithoutRedraw: lineNr
-
delete line - no redraw;
Does not tell dependents
return true, if something was really deleted
-
basicInsert: aCharacter atLine: lineNr col: colNr
-
insert a single character at lineNr/colNr;
set emphasis to character at current position.
Does not tell dependents
-
basicListAt: lineNr put: newLine
-
redefinable for special subclasses (with virtual list)
-
basicListRemoveFromIndex: startLineNr toIndex: endLineNr
-
redefinable for special subclasses (with virtual list)
-
basicMergeLine: lineNr removeBlanks: removeBlanks
-
merge line lineNr with line lineNr+1.
Does not tell dependents
-
basicReplace: aCharacter atLine: lineNr col: colNr
-
replace a single character at lineNr/colNr.
Does not tell dependents
-
basicReplaceString: aString atLine: lineNr col: colNr
-
replace multiple characters starting at lineNr/colNr.
This is not prepared to encounter special chars (except TAB)
in the string.
Does not tell dependents
-
basicSplitLine: lineNr before: colNr
-
split the line linNr before colNr; the right part (from colNr)
is cut off and inserted after lineNr; the view is redrawn.
Does not tell dependents
-
basicWithoutRedrawInsertLines: lines from: start to: end before: lineNr
-
insert a bunch of lines before line lineNr; the view is not redrawn.
Tabs are expanded here with a tab=8 setting (independent of any editor-setting,
because the text might have been pasted from an alien view.
Does not tell dependents
-
basicWithoutRedrawInsertStringWithoutCRs: aString atLine: lineNr col: colNr
-
insert aString (which has no crs) at lineNr/colNr.
Tabs are expanded here with a tab=8 setting (independent of any editor-setting,
because the text might have been pasted from an alien view.
Does not tell dependents
event handling
-
buttonMotion: buttonState x: x y: y
-
mouse-move while button was pressed - handle selection changes.
With CTRL, multicursors are defined
-
buttonPress: button x: x y: y
-
hide the cursor when button is activated
-
buttonRelease: button x: x y: y
-
move the cursor to the click-position of previous button press
-
cursorKeyPress: key shifted: shifted
-
-
doKeyPress: key x: x y: y
-
handle keyboard input
-
executeKeyboardMacro: cmdMacro
-
-
handleNonCommandKey: keyArg
-
pasted selection will NOT be replaced by keystroke
-
handleReturnPressed
-
return key pressed - handle autoIndent
-
handleReturnPressed: shiftPressed
-
return key pressed - handle autoIndent
-
keyPress: key x: x y: y
-
handle keyboard input
-
mapped
-
view was made visible
-
maybeShowMatchingParenthesisFor: characterBeforeCursor
-
emacs style parenthesis shower
-
multiCursorKeyPress: key
-
add another cursor at top or bottom, same column
-
requestAutoAccept
-
request to accept: this is invoked when a dialog closes via accept or cancel.
This forces my value to be accepted into my model.
Any widget may suppress the ok/cancel, by returning false.
-
showMatchingParenthesisAtLine: line col: col
-
want to wait 240ms, but not if another keyPress
-
sizeChanged: how from: oldExtentOrNil
-
my view has changed the size (not the contents).
Make certain, that the cursor is visible after the sizechange,
if it was visible before
-
unmapped
-
(comment from inherited method)
the view has been unmapped
(either by some outside action - i.e. window manager iconified me,
or due to unmapping of my parentView).
focus handling
-
focusOut
-
(comment from inherited method)
lost keyboard focus (via the window manager).
Nothing done here
-
hasKeyboardFocus: aBoolean
-
sent by the windowGroup, a delegate or myself to make me show a block cursor
(otherwise, I would not know about this)
-
showFocus: explicit
-
in addition to however my superclass thinks how a focusView is to be
displayed, show the cursor when I got the focus
-
showNoFocus: explicit
-
the view lost the keyboard focus
(either explicit, via tabbing; or implicit, by pointer movement)
- change any display attributes as req'd.
-
wantsFocusWithPointerEnter
-
return true, if I want the focus when
the mouse pointer enters
formatting
-
executekeyboardMacroNamed: macroName
-
try to execute the keyboard macro;
return true if that worked, false otherwise
Usage example(s):
EditTextView open
contents:'bla';
selectAll;
executekeyboardMacroNamed:#IndentBy4.
EditTextView open
contents:'bla';
selectAll;
executekeyboardMacroNamed:#blabla.
|
-
indent
-
indent a line-range - this is done by searching for the
last non-empty line before the selection, and changing the indent
of the selected line-range based on that line's indent.
-
indentBy4
-
self executekeyboardMacroNamed:#IndentBy4.
-
indentBy8
-
self executekeyboardMacroNamed:#IndentBy4.
-
indentBy: n
-
-
indentByTab
-
-
indentFromLine: start toLine: end
-
indent a line-range - this is done by searching for the
last non-empty line before start, and change the indent
of the selected line-range based on that line's indent.
-
indentFromLine: start toLine: end by: delta
-
indent (if delta is > 0) or undent (if delta < 0)
a line-range.
-
leftIndentForLine: lineNr
-
compute an appropriate indent for a line.
This is done by searching for the last non-empty line before it
and returning its indent.
If the previous line ends with a bracket, adjust by the tab spacing as required.
cg: changed: only look for the single previous line.
-
undentBy4
-
self executekeyboardMacroNamed:#UndentBy4.
-
undentBy8
-
self executekeyboardMacroNamed:#UndentBy4.
-
undentBy: n
-
-
undentByTab
-
initialization
-
fetchDeviceResources
-
fetch device colors, to avoid reallocation at redraw time
-
initEvents
-
enable enter/leave events in addition
-
initStyle
-
initialize style specific stuff
-
initialize
-
initialize a new EditTextView;
setup some instance variables
-
initializeCompletionSupport
-
-
release
-
macros
-
executeLearnedKeyboardMacro
-
replay the characters as learned previously
-
learnMode
-
true if currently learning
-
learnMode: aBoolean
-
toggle the learn-mode
-
learnModeHolder
-
a holder returning true, if in learn mode
-
rememberLearnedMacroAs: nameString
-
-
toggleLearnMode
-
toggle the learn-mode
menu & menu actions
-
canDivertOutput
-
only for text collectors
-
checkPossiblyRepetitiveReplace: thisOriginal with: thisReplacement
-
hook for possible intelligence (check for repeated replacements)
-
convertSelectionToDecimal
-
-
convertSelectionToHex
-
-
copySelection
-
copy contents into smalltalk copybuffer.
Redefined to move the (currently hidden cursor) to the selection's end
-
cut
-
cut selection into copybuffer
-
cutBox
-
Cut a rectangular text area (INed/MAXed-like)
defined by the selectionStartCol and endCol
-
defaultForGotoLine
-
return a default value to show in the gotoLine box
-
defaultForGotoPosition
-
return a default value to show in the gotoPosition box
-
deleteCopyToClipboard: toClipboard
-
cut selection into copybuffer
-
editMenu
-
return the view's middleButtonMenu
-
getTextSelectionFromHistory
-
present the copyBufferHistory as a shortened list (first line of each),
and let user select from it.
Return the corresponding copyBuffer text or nil.
Used with 'Paste Previous' menu function
-
getTextSelectionOrTextSelectionFromHistory
-
return either the (xterm-) selection or the clipBoard depending on
-
googleSpellingSuggestion
-
insert the google-spelling suggestion for the selected text.
Requires that the SOAP stuff is loaded and working.
-
googleTranslate: fromToModeString
-
translate the selected text and paste it after the selection.
fromToModeString is of the form sourceLang_destLang
-
googleTranslate: original from: sourceLang to: targetLang
-
translate the selected text and return it
-
googleTranslateFrom: sourceLang to: targetLang
-
translate the selected text and paste it after the selection.
-
insertClearBox
-
Clear a rectangular text area (INed/MAXed-like)
defined by the selectionStartCol and endCol
-
insertDateAndTime
-
insert the current date and time string
-
insertFile
-
insert contents of a file
- ask user for filename using a fileSelectionBox.
-
insertFileAsStringLiteral
-
insert a file's contents as a string literal.
Almost the same as the insert file, but single-quotes are doubled,
to make it a legal string literal
-
insertFileAsStringLiteral: asStringLiteral
-
insert contents of a file; either as-is or as a string literal.
- ask user for filename using a fileSelectionBox.
-
insertURL
-
insert contents of a URL
- ask user for URL using a dialog.
-
insertURLAsStringLiteral: asStringLiteral
-
insert contents of a file; either as-is or as a string literal.
- ask user for filename using a fileSelectionBox.
-
insertUUID
-
insert a new UUID's string
-
insertUnicode
-
open a Dialog requesting an integer value and insert it as unicode character
-
inspectSelectedJSON
-
inspect the selected (decoded) JSON text.
Or all, if there is no selection
-
inspectSelectedString
-
inspect the selected text
-
internalSpellingSuggestion
-
insert the internal-spelling suggestion for the selected text.
Requires that the RefactoryBrowser/line/spelCheck stuff is loaded.
-
isDivertingOutput
-
only for text collectors
-
lastSubMenuLabel
-
-
manageSnippets
-
-
paste
-
paste the copybuffer; if there is a selection, unselect first.
Then paste at cursor position.
-
paste: someText
-
paste someText at cursor
-
paste: someText withCR: withCR
-
paste someText at cursor
-
pasteAsStringLiteral
-
insert clipboard string as a string literal.
Almost the same as a normal paste, but single-quotes are doubled,
to make it a legal string literal
-
pasteBox
-
paste the copybuffer as a box;
if there is a selection, unselect first.
Then paste at cursor position.
-
pasteBox: someText
-
paste someText at cursor
-
pasteBox: someText withCR: withCR
-
paste someText at cursor
-
pasteOrReplace
-
paste the copybuffer; if there is a selection, replace it.
otherwise paste at cursor position.
Replace is not done for selections which were created by a paste,
to allow multiple paste operations in a row.
-
pasteOrReplace: someText
-
paste someText; if there is a selection, replace it.
otherwise paste at cursor position. Replace is not done
for originating by a paste, to allow multiple
paste.
-
pasteOrReplaceBox
-
paste the copybuffer as a box;
if there is a selection, unselect first.
Then paste at cursor position.
-
pasteOrReplaceByKeyPress
-
paste a previous item from the copybuffer history.
(i.e. repaste some previously deleted or copied text)
-
pasteOrReplaceFromHistory
-
paste a previous item from the copybuffer history.
(i.e. repaste some previously deleted or copied text)
-
performLastSubMenuSelectorAgain
-
-
replace
-
replace the selection by the contents of the copybuffer
-
replace: someText
-
replace the selection by someText
-
searchReplace
-
search for a string - show a box to enter searchpattern
replace for the found searchpattern or replace all searchpattern found to a new pattern - show a box to enter replacepattern
- currently no regular expressions are handled.
-
selectionDecodeBase64
-
-
selectionDecodeBase64Image
-
-
selectionEncodeBase64
-
-
selectionInspectBase64Image
-
-
selectionMakeHTMLTable
-
highly special...
-
selectionRot13
-
a naive caesar cypher
-
showDeleted
-
open a readonly editor on all deleted text
-
showLineLimitInMenu
-
only for text collectors
-
sort: how ignoreCase: ignoreCase fromLine: start toLine: end
-
sort/reorder the selected lines.
how:
#lines
#linesByFirstWord
#linesByNthWord
#linesByNthNumber
#linesByNthHexNumber
#words
#linesByLength
#reverse
-
sortSelection: how ignoreCase: ignoreCase
-
sort the selected lines
-
specialCharacters
-
open the special characters input window
-
splitLinesAtCharacterOrString
-
ask user for the character and split after it
-
toggleTabSetting
-
toggle between 4-col and 8-col tabs
-
toggleTabSettingForAllViews
-
toggle between 4-col and 8-col tabs here and in all other text views
-
undoablePaste: someText
-
-
undoablePaste: someText info: infoOrNil
-
-
undoablePasteBox: someText
-
-
undoablePasteBox: someText info: infoOrNil
-
-
undoablePasteOrReplace: someText info: infoOrNil
-
-
undoablePasteReplacingAll: someText info: infoOrNil
-
-
withSelfAndTextForPasteDo: aBlock
-
common code for paste/replace of the copybuffer
-
withSelfAndTextForPasteFromHistoryDo: aBlock
-
common code for paste/replace from the copyBuffer history
private
-
beep
-
output an audible beep or bell on my screen device
-
checkModificationsAllowed
-
check if the text can be modified (i.e. is not readOnly), return true or false.
If not, and an exceptionBlock has been defined, evaluate it.
The exceptionBlock can be provided by the application or user of the textView,
and may show a warnBox or whatever, or ask again.
It can return true to allow the modification
-
checkModificationsAllowedFlashIfNot: doFlashIfNot
-
check if the text can be modified (i.e. is not readOnly), return true or false.
If not, and an exceptionBlock has been defined, evaluate it.
The exceptionBlock can be provided by the application or user of the textView,
and may show a warnBox or whatever, or ask again.
It can return true to allow the modification.
If either no exceptionBlock was defined or it returned false,
and doFlashIfNot is true then flash the view to tell the user.
-
currentSelectionBgColor
-
hasKeyboardFocus ifFalse:[^ Color lightGrey].
-
currentSelectionFgColor
-
-
resetVariablesBeforeNewSearch
-
clear the autosearch action, when the first pattern is searched for
-
setLastStringToReplace: aString
-
This method will set the information coming from the last replace into the replacementInfo
-
suppressEmphasisInSelection
-
selection is shown without emphasis
-
textChanged
-
my text was modified (internally).
Sent whenever text has been edited to set the modified flag if required.
(not to confuse with contentsChanged, which is triggered when the size has changed,
and is used to notify scrollers, other views etc.)
-
textChangedButNoSizeChange
-
my text was modified (internally).
Sent whenever text has been edited (not to confuse with
contentsChanged, which is triggered when the size has changed, and
is used to notify scrollers, other views etc.)
queries
-
addAuthorToCommentLines
-
-
canAccept
-
true if text can be accepts.
Used to disable the menu if there is nothing selector or the text is readonly
-
canCut
-
true if there is a selection possibly to be cut.
Used to disable the menu if there is nothing selector or the text is readonly
-
canDoAgain
-
true if there is a possible repeat last edit operation.
Used to disable the menu if there is nothing
-
canDoLastSubMenuSelectorAgain
-
-
currentLine
-
the current line (for relative gotos)
-
hasSearchActionSelection
-
(comment from inherited method)
Here we fake the use of typeOfSelection which is really in EditTextView
-
isKeyboardConsumer
-
return true, if the receiver is a keyboard consumer;
Return true here if not readOnly, redefined from SimpleView.
-
language
-
return the programming language (which cares for eg. syntax).
is called in Workflow::ExecutionCodeEditorSmalltalkOrJavaScript #findNodeForInterval:,
seems like a Tools::CodeView2 which implements #language was expected,
but also this class (CodeView) is the receiver at times
-
specClass
-
returns my spec class (for UI editor)
Usage example(s):
redefined, since the name of my specClass is nonStandard (i.e. not EditTextSpec)
|
-
tabMeansNextField
-
return true, if a Tab character should shift focus.
queries-contents
-
widthOfContents
-
return the width of the contents in pixels.
Redefined to add the size of a space (for the cursor).
this enables us to scroll one position further than the longest
line (and possibly see the cursor behind the line)
realization
-
realize
-
make the view visible - scroll to make the cursor visible.
redrawing
-
redrawCursorIfBetweenVisibleLine: startVisLine and: endVisLine
-
redraw the cursor, if it sits in a line range
-
redrawCursorIfInVisibleLine: visLine
-
redraw the cursor, if it sits in visible line
-
redrawFromVisibleLine: startVisLine to: endVisLine
-
redraw a visible line range
-
redrawVisibleLine: visLine
-
redraw a visible line
-
redrawVisibleLine: visLine col: colNr
-
redraw the single character in visibleline at colNr
-
redrawVisibleLine: visLine from: startCol
-
redraw a visible line from startCol to the end of line
-
redrawVisibleLine: visLine from: startCol to: endCol
-
redraw a visible line from startCol to endCol
scrolling
-
additionalMarginForHorizontalScroll
-
return the number of pixels by which we may scroll more than the actual
width of the document would allow.
This is redefined by editable textViews, to allo for the cursor
to be visible if it is positioned right behind the longest line of text.
The default returned here is 10 pixels, which should be ok for most cursors
-
halfPageDown
-
half a page down - to keep cursor on same visible line, it has to be moved
within the real text
-
halfPageUp
-
half a page up - to keep cursor on same visible line, it has to be moved
within the real text
-
originChanged: delta
-
sent after scrolling - have to show the cursor if it was on before
-
originWillChange
-
sent before scrolling - have to hide the cursor
-
pageDown
-
page down - to keep cursor on same visible line, it has to be moved
within the real text
-
pageUp
-
page up - to keep cursor on same visible line, it has to be moved
within the real text
searching
-
searchBwd: pattern ifAbsent: aBlock
-
do a backward search
-
searchBwd: pattern ignoreCase: ign ifAbsent: aBlock
-
do a backward search
-
searchBwd: pattern ignoreCase: ign startingAtLine: startLine col: startCol ifAbsent: aBlock
-
do a backward search
-
searchForAndSelectMatchingParenthesis
-
select characters enclosed by matching parenthesis if one is under cusor
-
searchForMatchingParenthesis
-
search for a matching parenthesis starting at cursor position.
Search for the corresponding character is done forward if it's an opening,
backwards if it's a closing parenthesis.
Positions the cursor if found, beeps if not
-
searchFwd: pattern ignoreCase: ign match: match startingAtLine: startLine col: startCol ifAbsent: aBlock
-
do a forward search
-
searchFwd: pattern ignoreCase: ign startingAtLine: startLine col: startCol ifAbsent: aBlock
-
do a forward search
-
searchFwd: pattern startingAtLine: startLine col: startCol ifAbsent: aBlock
-
do a forward search
-
searchPatternForSearchBar
-
Returns the next searchPattern from the user selection or from the autoSearch
-
setSearchPatternWithMatchEscapes: match
-
set the searchpattern from the selection if there is one, and position
cursor to start of pattern
-
showMatch: pattern isMatch: isMatch atLine: line col: col endCol: encColOrNil
-
(comment from inherited method)
after a search, highlight the matched pattern.
The code below needs a rewrite to take care of match-characters
(for now, it only highlights simple patterns and '*string*' correctly)
-
startPositionForSearchBackward
-
-
startPositionForSearchBackwardBasedOnCursorOrSelection
-
-
startPositionForSearchForward
-
-
startPositionForSearchForwardBasedOnCursorOrSelection
-
if there is no selection and the cursor is at the origin,
selections
-
addToSelectionAfter: aBlock
-
evaluate aBlock while unselected.
Restore the previous selection afterwards.
CG: I am not sure, if this is a leftover and is still used at all.
It is therefore temporarily marked as obsolete. Please check
and let me know.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
autoMoveCursorToEndOfSelection
-
return true, if the cursor should be automatically moved to the
end of a selection.
Redefined to return false in terminalViews, where the cursor should
not be affected by selecting
-
changeTypeOfSelectionTo: newType
-
typeOfSelection defines how the selection was created,
and affects what happens when the user pastes or types in new text:
#searchActionn - text will be replaced
#search - text will be replaced
#deadKey - text will be eaten/affects next key
nil - text will be inserted after the selection
#paste - same
#completionText - same
-
findNextWordAfterSelectionAndAddToSelection
-
selectionStartCol isNil ifTrue:[
-
searchPatternFromUserSelectionOrReplace
-
-
selectAll
-
select the whole text.
redefined to send super selectFrom... since we don't want the
cursor to be moved in this case.
-
selectAllInitially
-
select the whole text. This is called only once during the initialization
for editFields which are shown in a table or tree.
The selectAll is called via this method to allow for easier redefinition and
to distinguish auto-select from user-initiated selects.
-
selectCursorLine
-
select cursorline
-
selectCursorLineFromBeginning
-
select cursorline up to cursor position
-
selectExpandCursorLine
-
expand selection by one line or select cursorline
-
selectFromBeginOfLine
-
select the text from the beginning of the current line to the current cursor position.
-
selectFromBeginning
-
select the text from the beginning to the current cursor position.
-
selectFromLine: startLine col: startCol toLine: endLine col: endCol
-
when a range is selected, position the cursor behind the selection
for easier editing. Also typeOfSelection is nilled here.
-
selectToEndOfLine
-
select the text from the current cursor position to the end of the current line
-
selectUpToEnd
-
select the text from the current cursor position to the end.
-
selectWordUnderCursor
-
select the word under the cursor
-
unselect
-
forget and unhilight selection - must take care of cursor here
undo & again
-
addUndo: action
-
must do this delayed; otherwise we get redraw errors from split
-
again
-
repeat the last action (which was a cut or replace).
If current selection is not last string, search forward to
next occurrence of it before repeating the last operation.
-
hasRedoAction
-
-
hasUndoAction
-
-
multipleAgain
-
repeat the last action (which was a cut or replace) until search fails
-
nonUndoableDo: aBlock
-
-
redo
-
undo the last undo
-
undo
-
undo the last edit operation
-
undoableDo: aBlock
-
-
undoableDo: aBlock info: aString
-
will trigger an error-dialog there (no need for undo-carekeeping)
DeleteCharacters
DeleteRange
EditAction
EditMode
ExecutingMacroQuery
LastReplacementInfo
PasteString
ReplaceCharacter
ReplaceCharacters
ReplaceContents
ReplaceLine
ReplaceLines
RestoreSelectionAndCursor
non MVC operation:
basic setup:
|top textView|
top := StandardSystemView new.
top extent:300@200.
textView := EditTextView new.
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
top addSubView:textView.
textView contents:('/etc/hosts' asFilename contentsOfEntireFile).
top open.
|
with vertical scrollbar:
|top scrollView textView|
top := StandardSystemView new.
top extent:300@200.
scrollView := ScrollableView for:EditTextView.
textView := scrollView scrolledView.
scrollView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
top addSubView:scrollView.
textView contents:('/etc/hosts' asFilename contentsOfEntireFile).
top open.
|
with horizontal & vertical scrollbars:
|top scrollView textView|
top := StandardSystemView new.
top extent:300@200.
scrollView := HVScrollableView for:EditTextView.
textView := scrollView scrolledView.
scrollView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
top addSubView:scrollView.
textView contents:('/etc/hosts' asFilename contentsOfEntireFile).
top open.
|
set the action for accept:
|top textView|
top := StandardSystemView new.
top extent:300@200.
textView := EditTextView new.
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
top addSubView:textView.
textView contents:('/etc/hosts' asFilename contentsOfEntireFile).
textView acceptAction:[:contents |
Transcript showCR:'will not overwrite the file with:'.
Transcript showCR:contents asString
].
top open.
|
non-string (text) items:
|top textView list|
list := '/etc/hosts' asFilename contentsOfEntireFile asStringCollection.
1 to:list size by:2 do:[:nr |
list at:nr put:(Text string:(list at:nr)
emphasis:(Array with:#bold with:(#color->Color red)))
].
top := StandardSystemView new.
top extent:300@200.
textView := EditTextView new.
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
top addSubView:textView.
textView contents:list.
top open.
|
MVC operation:
(the examples model here is a plug simulating a real model;
real world applications would not use a plug ..)
|top textView model|
model := Plug new.
model respondTo:#accepted:
with:[:newContents |
Transcript showCR:'will not overwrite the file with:'.
Transcript showCR:newContents asString
].
model respondTo:#getList
with:['/etc/hosts' asFilename contentsOfEntireFile].
top := StandardSystemView new.
top extent:300@200.
textView := EditTextView new.
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
top addSubView:textView.
textView listMessage:#getList;
model:model;
changeMessage:#accepted:;
aspect:#list.
top open.
|
two textViews on the same model:
|top1 textView1 top2 textView2 model currentContents|
model := Plug new.
model respondTo:#accepted:
with:[:newContents |
Transcript showCR:'accepted:'.
Transcript showCR:newContents asString.
currentContents := newContents.
model changed:#contents
].
model respondTo:#getList
with:[Transcript showCR:'query'.
currentContents].
top1 := StandardSystemView new.
top1 extent:300@200.
textView1 := EditTextView new.
textView1 origin:0.0 @ 0.0 corner:1.0 @ 1.0.
top1 addSubView:textView1.
textView1 listMessage:#getList;
model:model;
aspect:#contents;
changeMessage:#accepted:.
top1 open.
top2 := StandardSystemView new.
top2 extent:300@200.
textView2 := EditTextView new.
textView2 origin:0.0 @ 0.0 corner:1.0 @ 1.0.
top2 addSubView:textView2.
textView2 listMessage:#getList;
model:model;
aspect:#contents;
changeMessage:#accepted:.
top2 open.
|
|