eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'EditTextView':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: EditTextView


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--View
               |
               +--ListView
                  |
                  +--TextView
                     |
                     +--EditTextView
                        |
                        +--ComposedTextView
                        |
                        +--EditField
                        |
                        +--RCSConflictEditTextView
                        |
                        +--TextCollector

Package:
stx:libwidg
Category:
Views-Text
Version:
rev: 1.733 date: 2018/04/27 15:16:22
user: stefan
file: EditTextView.st directory: libwidg
module: stx stc-classLibrary: libwidg
Author:
Claus Gittinger

Description:


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)


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)

[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


Related information:

    CodeView
    Workspace
    TextView
    ListView
    EditField

Class protocol:

defaults
o  defaultCompletionSupportClass

o  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

o  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

o  updateStyleCache
extract values from the styleSheet and cache them in class variables
usage example(s):
     self updateStyleCache

specs
o  searchReplaceDialogSpec
This resource specification was automatically generated
by the UIPainter of ST/X.
usage example(s):
     UIPainter new openOnClass:DAPASX::ProjectEditorTextView andSelector:#searchReplaceDialogSpec


Instance protocol:

Compatibility-ST80
o  autoAccept: aBoolean
ignored for now

o  continuousAccept: aBoolean
ignored for now

o  cutSelection

o  deselect
remove the selection

o  enabled: aBoolean
(comment from inherited method)
this is the basic machanism to enable/disable a view.
empty in this class; may be redefined by subclasses

o  find: pattern

o  insert: aString at: aCharacterPosition
insert a string at aCharacterPosition.

o  insertAndSelect: aString at: aCharacterPosition
insert a selected string at aCharacterPosition.

o  pasteSelection

o  replaceSelectionWith: aString

o  selectAt: pos
move the cursor before cursorPosition.

o  textHasChanged

o  textHasChanged: aBoolean
ST-80 compatibility: set/clear the modified flag.

accessing
o  codeAspect
Applications should set it explictly, however, to make it behave like

o  codeAspect: aSymbol

o  completionSupport

o  completionSupport: anEditTextViewCompletionSupport

o  completionSupportClass

o  editedClass

o  editedLanguage

o  editedLanguage: aProgrammingLanguage
Sets the edited language. Only defined here to make it polymorph with Workspace

o  editedMethod

o  editedMethodOrClass

o  editedMethodOrClass: methodOrClass
Sets the edited method or class. Only defined here to make it polymorph with Workspace

o  hasSelectionOrTextInCursorLine

o  selectionOrTextOfCursorLine

o  selectionOrTextOfCursorLine: doSelect

accessing-behavior
o  acceptAction
return the action to be performed on accept (or nil)

o  acceptAction: aBlock
set the action to be performed on accept

o  acceptChannel
return the valueHolder holding true if text was accepted.
By placing a true into this channel, an accept can also be forced.

o  acceptChannel: aValueHolder
set the valueHolder holding true if text was accepted.
By placing a true into this channel, an accept can also be forced.

o  acceptEnabled: aBoolean
enable/disable accept. This greys the corresponding item in the menu

o  accepted
return true if text was accepted

o  accepted: aBoolean
set/clear the accepted flag.
This may force my current contents to be placed into my model.

o  autoIndent: aBoolean

o  codeAspectHolder

o  codeAspectHolder: something

o  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)

o  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)

o  disableIfInvisible: aBoolean

o  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.

o  editModeHolder

o  editModeInsert

o  editModeInsertAndSelect

o  editModeOverwrite

o  exceptionBlock: aBlock
define the action to be triggered when user tries to modify
readonly text

o  fixedSize
make the texts size fixed (no lines may be added).
OBSOLETE: use readOnly

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  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)

o  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)

o  insertMode: aBoolean

o  insertModeHolder

o  isInInsertMode

o  isNotReadOnly
return true, if the text is not readonly.

o  isReadOnly
return true, if the text is readonly.

o  modeLabelHolder
a valueHolder, which contains 'L' (learnMode), I (insertMode) or empty

o  modified
return true if text was modified

o  modified: aBoolean
set/clear the modified flag

o  modifiedChannel
return the valueHolder holding true if text was modified

o  modifiedChannel: aValueHolder
set the valueHolder holding true if text was modified

o  readOnly
make the text readonly.
Obsolete because it is obfuscating (looks like a getter)
- use #readOnly:

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  readOnly: aBoolean
make the text readonly (aBoolean == true) or writable (aBoolean == false).
The argument may also be a valueHolder.

o  reallyModifiedChannel
return the valueHolder holding true if text was really modified.
For compatibility with views which use the modified flag for syntax highlighting.

o  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)

o  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.

o  st80Mode: aBooleanOrNil

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  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.

o  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

o  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

o  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.

o  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.

accessing-contents
o  at: lineNr basicPut: aLine
change a line without change notification.
this is not undoably, unless you care for yourself

o  at: lineNr put: aLine
replace a line by something new.
this is not undoably, unless you care for yourself

o  characterAfterCursor
return the character one after the cursor - space if beyond line.

o  characterBeforeCursor
return the character to the left of cursor - space if beyond line, nil if at the beginning.

o  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

o  contents
return the contents as a String or Text (i.e. with emphasis)

o  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

o  contents: something keepUndoHistory: keepUndoHistory
set the contents and optionally clear the undo history.
The contents-change is not undoable.

o  contentsAsString
return the contents as a String (i.e. without emphasis)

o  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)

o  cursorCol
return the cursors col (1..).
This is the absolute col; NOT the visible col

o  cursorColHolder
return a valueHolder for the cursors column (1..).

o  cursorLine
return the cursors line (1..).
This is the absolute line; NOT the visible line

o  cursorLineAndColumnHolder
return a valueHolder for the cursors line and column as an
array of the form { lineNr . col }
This can be used directly as a model to react on cursor movement

o  cursorLineAndColumnLabelHolder
return a valueHolder for the cursors 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)

o  cursorLineHolder
return a valueHolder for the cursors line (1..).
This is the absolute line; NOT the visible line

o  lineStringBeforeCursor
return the line's string before the cursor.
Pad with spaces up to the cursor position if beyond the end of line

o  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)

o  setContents: something
replace the whole contents by something new
AND clear the remembered undo actions

accessing-dimensions
o  absoluteXOfPosition: positionInText
( an extension from the stx:libtool package )

o  absoluteYOfCursor
( an extension from the stx:libtool package )

o  xOfCursor
take the end of the selection, if any

o  xOfPosition: positionInText
( an extension from the stx:libtool package )

o  yOfCursor
( an extension from the stx:libtool package )

o  yOfPosition: positionInText
( an extension from the stx:libtool package )

accessing-look
o  cursorForegroundColor: color1 backgroundColor: color2
set both cursor foreground and cursor background colors

o  cursorType
return the style of the text cursor.
Currently, supported are: #none
#block, #frame, #ibeam, #caret, #solidCaret
#bigCaret and #bigSolidCaret

o  cursorType: aCursorTypeSymbol
set the style of the text cursor.
Currently, supported are: #none
#block, #frame, #ibeam, #caret, #solidCaret
#bigCaret and #bigSolidCaret

o  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.

o  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
o  lastReplacementInfo

o  lastStringToReplace: aString

o  previousReplacements
accessor for the code completion

change & update
o  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 mode, it gets a value: message,
If there is an acceptAction, it is called.

o  argForChangeMessage
return the argument to be passed with the change notification.
Defined as separate method for easier subclassability.

o  getListFromModel
get my contents from the model.
Redefined to ignore updates resulting from my own changes
(i.e. if lockUpdates is true).

o  update: something with: aParameter from: changedObject
(comment from inherited method)
model changed (not more information)

commenting
o  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).

o  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.

o  uncommentFrom: 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 removed).

o  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
o  basicCursorReturn
move cursor to start of next line; scroll if at end of visible text

o  characterPositionOfCursor

o  cursorBacktab
move cursor to prev tabstop

o  cursorCol: newCol
move cursor to some column in the current line

o  cursorDown
move cursor down; scroll if at end of visible text;
beep if at end of physical text.

o  cursorDown: n
move cursor down by n lines; scroll if at end of visible text

o  cursorHome
scroll to top AND move cursor to first line of text.

o  cursorLeft
move cursor to left

o  cursorLeft: n
move cursor to left

o  cursorLine: line col: col
this positions onto physical - not visible - line

o  cursorLine: line col: col makeVisible: makeVisibleBoolean
this positions onto physical - not visible - line

o  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

o  cursorReturn
move cursor to start of next line; scroll if at end of visible text

o  cursorReturn: withPossibleAutoIndent
move cursor to start of next line; scroll if at end of visible text

o  cursorRight
move cursor to right

o  cursorRight: n
move cursor to right

o  cursorShown: aBoolean
change cursor visibility
return true if cursor was visible before.

o  cursorTab
move cursor to next tabstop

o  cursorToBeginOfLine
move cursor to the start of the current line

o  cursorToBottom
move cursor to the last line of text (col 1)

o  cursorToCharacterPosition: pos
compute line/col from character position (1..)
and move the cursor onto that char

o  cursorToEnd
move cursor down below last line of text

o  cursorToEndOfLine
move cursor to end of current line

o  cursorToEndOfText
move cursor to the end of the text (behind the last character in last line)

o  cursorToEndOfWord
move the cursor to the end of the word

o  cursorToFirstVisibleLine
place cursor into the first visible line; do not scroll.

o  cursorToLastVisibleLine
place cursor into the first visible line; do not scroll.

o  cursorToNextWord
move the cursor to the beginning of the next word

o  cursorToPreviousWord
move the cursor to the beginning of this or the previous word

o  cursorToTop
move cursor to absolute home

o  cursorUp
move cursor up; scroll if at start of visible text

o  cursorUp: n
move cursor up n lines; scroll if at start of visible text

o  cursorVisibleLine: visibleLineNr col: colNr
put cursor to visibleline/col

o  cursorX: x y: y
put cursor to position next to x/y coordinate in view

o  drawCursor
draw the cursor if shown and cursor is visible.
(but not, if there is a selection - to avoid confusion)

o  drawCursor: 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

o  drawCursorCharacter
draw the cursor.
(i.e. the cursor if no selection)
- helper for many cursor methods

o  drawFocusCursor
draw the cursor when the focus is in the view.

o  drawNoFocusCursor
draw the cursor for the case when the view has no keyboard focus

o  gotoLine: aLineNumber
position cursor onto line, aLineNumber.
Make certain that this line is visible

o  hideCursor
make cursor invisible if currently invisible

o  makeCursorVisible
scroll text to make cursorline visible
(i.e. to have cursorLine in visible area)

o  makeCursorVisibleAndShowCursor: flag
scroll to make cursorLine visible;
if flag is true, draw the cursor

o  setCursorCol: colNr
strictly private: set the cursorCol

o  setCursorLine: lineNr
strictly private: set the cursorLine

o  setCursorLine: lineNr col: colNr
strictly private: set the cursorLine, col and update the visibleLine

o  setValidatedCursorCol: colNr
strictly private: set the cursorCol

o  setValidatedCursorLine: lineNr
strictly private: set the cursorLine and update the visibleLine

o  setValidatedCursorLine: lineNr col: colNr
strictly private: set the cursorLine, col and update the visibleLine

o  showCursor
make cursor visible if currently invisible

o  singleQuoteSelection
place single quotes around the selected text

o  undrawCursor
undraw the cursor (i.e. redraw the character(s) under the cursor)

o  updateCursorVisibleLine
strictly private: set the visibleLine from the cursorLine.
notice: visibleLine will be set to nil if the cursor is not visible

o  validateCursorCol: col inLine: line
check of col is a valid cursor position; return a new col-nr if not.
Here, no limits are enforced (and col 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)

o  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

o  withCursorOffDo: aBlock
evaluate aBlock with cursor off; turn it on afterwards.

drag & drop
o  allowDrop: aBoolean
enable/disable drop support

o  canDrop: aDropContext
public from d&d.
I accept textObjects and fileObjects only.

o  canDropObjects: aCollectionOfDropObjects
public from d&d.
I accept textObjects and fileObjects only.

o  drop: aDropContext
public from d&d.
drop objects (new API)

o  dropFileObject: aDropObject
drop objects
For bw. compatibility, also collections of drop objects are handled (may vanish)

o  dropObject: aDropObject
drop objects
For bw. compatibility, also collections of drop objects are handled (may vanish)

o  dropObjects: aCollectionOfDropObjects
public from d&d.
drop objects (old API)

editing
o  applyConverterToSelection: converter
apply a converter to the selected text

o  convertSelectionToLowercase
to-lower selected text

o  convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
toLower/toUppercaseFirst/toUpper selected text

o  convertSelectionToUppercase
to-upper selected text

o  convertSelectionToUppercaseFirst
to-upperFirst selected text

o  copyAndDeleteSelection
copy the selection into the pastBuffer and delete it

o  deleteCharAtCursor
delete single character under cursor; does not merge lines

o  deleteCharAtLine: lineNr col: colNr
delete a single character at colNr in line lineNr

o  deleteCharBeforeCursor
delete single character to the left of cursor and move cursor to left

o  deleteCharsAtLine: lineNr fromCol: colNr
delete characters from colNr up to the end in line lineNr

o  deleteCharsAtLine: lineNr fromCol: startCol toCol: endCol
delete characters from startCol to endCol in line lineNr

o  deleteCharsAtLine: lineNr toCol: colNr
delete characters from start up to colNr in line lineNr

o  deleteCursorLine
delete the line where the cursor sits

o  deleteFromCharacterPosition: charPos1 to: charPos2
delete a substring at a character position

o  deleteFromLine: startLine col: startCol toLine: endLine col: endCol
delete all text from startLine/startCol to endLine/endCol -
joining lines if necessary

o  deleteFromLine: startLineNr toLine: endLineNr
delete some lines

o  deleteLine: lineNr
delete line

o  deleteLineWithoutRedraw: lineNr
delete line - no redraw;
return true, if something was really deleted

o  deleteLinesWithoutRedrawFrom: startLine to: endLine
delete lines - no redraw;
return true, if something was really deleted

o  deleteSelection
delete the selection

o  deleteWordBeforeCursor
delete the word to the left of cursor and move cursor to left

o  indentSelectionBy1
indent selected line-range
by 1 space (i.e. to the right)

o  insert: aCharacter atLine: lineNr col: colNr
insert a single character at lineNr/colNr;
set emphasis to character at current position

o  insertCharAtCursor: aCharacter
insert a single character at cursor-position - advance cursor.

o  insertLine: aString before: lineNr
insert the line aString before line lineNr

o  insertLines: aStringCollection before: lineNr
insert a bunch before line lineNr

o  insertLines: someText from: start to: end before: lineNr
insert a bunch of lines before line lineNr.
The cursor position is left unchanged.

o  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

o  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

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  insertSelectedStringAtCursor: aString
insert the argument, aString at cursor position and select it

o  insertString: aString atCharacterPosition: charPos
insert the argument, aString at a character position

o  insertString: aString atLine: lineNr col: colNr
insert the string, aString at line/col;
handle cr's correctly

o  insertStringAtCursor: aString
insert the argument, aString at cursor position
handle cr's correctly. A nil argument is interpreted as an empty line.

o  insertStringWithoutCRs: aString atLine: lineNr col: colNr
insert aString (which has no crs) at lineNr/colNr

o  insertStringWithoutCRsAtCursor: aString
insert a string (which has no crs) at cursor position
- advance cursor

o  insertTabAtCursor
insert spaces to next tab

o  joinLines
join lines (remove line-break)

o  mergeLine: lineNr
merge line lineNr with line lineNr+1

o  mergeLine: lineNr removeBlanks: removeBlanks
merge line lineNr with line lineNr+1

o  parenthizeSelection
place parentheses around the selected text.
if already parenthized, de-parenthize it

o  parenthizeSelectionWith: openingCharacter and: closingCharacter
if already parenthized, de-parenthize it

o  removeTrailingBlankLines
remove all blank lines at end of text

o  replace: aCharacter atLine: lineNr col: colNr
replace a single character at lineNr/colNr

o  replace: patternArg by: replacePatternArg all: all ignoreCase: ignoreCase

o  replaceCharAtCursor: aCharacter
undoably replace a single character at cursor-position - advance cursor

o  replaceContentsWith: newContents
undoably replace everything

o  replaceFromCharacterPosition: charPos1 to: charPos2 with: newString
undoably replace a substring at a character position

o  replaceLine: lineNr with: newText
undoably replace a line at lineNr

o  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

o  replaceSelectionBy: something
undoably delete the selection (if any) and insert something, a character or string;
leave cursor after insertion

o  replaceSelectionBy: something keepCursor: keep
undoably delete the selection (if any) and insert something, a character or string;
leave cursor after insertion or leave it, depending on keep

o  replaceSelectionBy: something 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

o  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.

o  replaceString: aString to: aNewString ignoreCase: ignoreCase

o  replaceStringAtCursor: aString
replace multiple characters at cursor-position - advance cursor

o  replaceTABAtCursor
replace a single character at cursor-position by a TAB character

o  selectWordBeforeCursor
select the word to the left of cursor

o  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

o  toggleTabSetting
toggle between 4-col
and 8-col tabs

o  undentSelectionBy1
undent selected line-range
by 1 space (i.e. to the left)

o  withAutoIndent: aBoolean do: aBlock

o  withoutRedrawAt: lineNr put: aString
replace a line at lineNr

o  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

o  withoutRedrawInsertLines: lines from: start to: end before: lineNr
insert a bunch of lines before line lineNr; the view is not redrawn

o  withoutRedrawInsertStringWithoutCRs: aString atLine: lineNr col: colNr
insert aString (which has no crs) at lineNr/colNr

o  wrapLines
wrap lines (insert line-break)

editing-basic
o  basicDeleteCharsAtLine: lineNr fromCol: startCol toCol: endCol
delete characters from startCol to endCol in line lineNr

o  basicDeleteFromLine: startLineNr toLine: endLineNr
delete some lines

o  basicDeleteLineWithoutRedraw: lineNr
delete line - no redraw;
return true, if something was really deleted

o  basicInsert: aCharacter atLine: lineNr col: colNr
insert a single character at lineNr/colNr;
set emphasis to character at current position

o  basicListAt: lineNr put: newLine
redefinable for special subclasses (with virtual list)

o  basicListRemoveFromIndex: startLineNr toIndex: endLineNr
redefinable for special subclasses (with virtual list)

o  basicMergeLine: lineNr removeBlanks: removeBlanks
merge line lineNr with line lineNr+1

o  basicReplace: aCharacter atLine: lineNr col: colNr
replace a single character at lineNr/colNr

o  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.

o  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

o  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.

o  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.

event handling
o  buttonPress: button x: x y: y
hide the cursor when button is activated

o  buttonRelease: button x: x y: y
move the cursor to the click-position of previous button press

o  cursorKeyPress: key shifted: shifted

o  doKeyPress: key x: x y: y
handle keyboard input

o  executeKeyboardMacro: cmdMacro

o  handleNonCommandKey: keyArg
pasted selection will NOT be replaced by keystroke

o  keyPress: key x: x y: y
handle keyboard input

o  mapped
view was made visible

o  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.

o  sizeChanged: how
make certain, cursor is visible after the sizechange

o  unmapped

focus handling
o  focusOut

o  hasKeyboardFocus: aBoolean
sent by the windowGroup, a delegate or myself to make me show a block cursor
(otherwise, I would not know about this)

o  showFocus: explicit
in addition to however my superclass thinks how a focusView is to be
displayed, show the cursor when I got the focus

o  showNoFocus: explicit
the view lost the keyboard focus
(either explicit, via tabbing; or implicit, by pointer movement)
- change any display attributes as req'd.

o  wantsFocusWithPointerEnter
return true, if I want the focus when
the mouse pointer enters

formatting
o  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.

o  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.

o  indentBy4
self executekeyboardMacroNamed:#IndentBy4.

o  indentBy8
self executekeyboardMacroNamed:#IndentBy4.

o  indentBy: n

o  indentByTab

o  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.

o  indentFromLine: start toLine: end by: delta
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.

o  leftIndentForLine: lineNr
find an appropriate indent for a line.
this is done by searching for the last non-empty line before it
and returning its indent.
cg: changed: only look for the single previous line.

o  undentBy4
self executekeyboardMacroNamed:#UndentBy4.

o  undentBy8
self executekeyboardMacroNamed:#UndentBy4.

o  undentBy: n

o  undentByTab

initialization
o  fetchDeviceResources
fetch device colors, to avoid reallocation at redraw time

o  initEvents
enable enter/leave events in addition

o  initStyle
initialize style specific stuff

o  initialize
initialize a new EditTextView;
setup some instance variables

o  initializeCompletionSupport

o  release

macros
o  executeLearnedKeyboardMacro
replay the characters as learned previously

o  learnMode
true if currently learning

o  learnMode: aBoolean
toggle the learn-mode

o  learnModeHolder
a holder returning true, if in learn mode

o  rememberLearnedMacroAs: nameString

o  toggleLearnMode
toggle the learn-mode

menu & menu actions
o  babelFishTranslate: fromToModeString
translate the selected text and paste it after the selection.
This is now obsolete, as that web service no longer exists (sigh)

o  copySelection
copy contents into smalltalk copybuffer.
Redefined to move the (currently hidden cursor) to the selection's end

o  cut
cut selection into copybuffer

o  defaultForGotoLine
return a default value to show in the gotoLine box

o  deleteCopyToClipboard: toClipboard
cut selection into copybuffer

o  editMenu
return the view's middleButtonMenu

o  getTextSelectionFromHistory

o  getTextSelectionOrTextSelectionFromHistory
return either the (xterm-) selection or the clipBoard depending on

o  googleSpellingSuggestion
insert the google-spelling suggestion for the selected text.
Requires that the SOAP stuff is loaded and working.

o  insertDateAndTime
insert the current date and time string

o  insertFile
insert contents of a file
- ask user for filename using a fileSelectionBox.

o  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

o  insertFileAsStringLiteral: asStringLiteral
insert contents of a file; either as-is or as a string literal.
- ask user for filename using a fileSelectionBox.

o  insertURL
insert contents of a URL
- ask user for URL using a dialog.

o  insertURLAsStringLiteral: asStringLiteral
insert contents of a file; either as-is or as a string literal.
- ask user for filename using a fileSelectionBox.

o  insertUUID
insert a new UUID's string

o  insertUnicode
open a Dialog requesting an integer value and insert it as unicode character

o  inspectSelectedString
inspect the selected text

o  internalSpellingSuggestion
insert the internal-spelling suggestion for the selected text.
Requires that the RefactoryBrowser/line/spelCheck stuff is loaded.

o  paste
paste the copybuffer; if there is a selection, unselect first.
Then paste at cursor position.

o  paste: someText
paste someText at cursor

o  paste: someText withCR: withCR
paste someText at cursor

o  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

o  pasteBox
paste the copybuffer as a box;
if there is a selection, unselect first.
Then paste at cursor position.

o  pasteBox: someText
paste someText at cursor

o  pasteBox: someText withCR: withCR
paste someText at cursor

o  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.

o  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.

o  pasteOrReplaceBox
paste the copybuffer as a box;
if there is a selection, unselect first.
Then paste at cursor position.

o  pasteOrReplaceByKeyPress
paste a previous item from the copybuffer history.
(i.e. repaste some previously deleted or copied text)

o  pasteOrReplaceFromHistory
paste a previous item from the copybuffer history.
(i.e. repaste some previously deleted or copied text)

o  replace
replace the selection by the contents of the copybuffer

o  replace: someText
replace the selection by someText

o  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.

o  selectionDecodeBase64

o  selectionEncodeBase64

o  selectionRot13
a naive caesar cypher

o  showDeleted
open a readonly editor on all deleted text

o  sort: how ignoreCase: ignoreCase fromLine: start toLine: end
sort/reorder the selected lines.
how:
#lines
#linesByFirstWord
#linesByNthWord
#linesByNthNumber
#linesByNthHexNumber
#words
#linesByLength
#reverse

o  sortSelection: how ignoreCase: ignoreCase
sort the selected lines

o  specialCharacters

o  splitLinesAtCharacterOrString
ask user for the character and split after it

o  undoablePaste: someText

o  undoablePaste: someText info: infoOrNil

o  undoablePasteBox: someText

o  undoablePasteBox: someText info: infoOrNil

o  undoablePasteOrReplace: someText info: infoOrNil

o  undoablePasteReplacingAll: someText info: infoOrNil

o  withSelfAndTextForPasteDo: aBlock
common code for paste/replace of the copybuffer

private
o  beep
output an audible beep or bell on my screen device

o  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

o  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.

o  currentSelectionBgColor
hasKeyboardFocus ifFalse:[^ Color lightGrey].

o  currentSelectionFgColor

o  resetVariablesBeforeNewSearch
clear the autosearch action, when the first pattern is searched for

o  setLastStringToReplace: aString
This method will set the information coming from the last replace into the replacementInfo

o  suppressEmphasisInSelection
selection is shown without emphasis

o  textChanged
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.).

As some authors of this code have been very sloppy in the past
(not sending contentsChanged, but textChanged),
we do it here despite what is written above, to ensure that scrollers update correctly.

o  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
o  canAccept
true if text can be accepts.
Used to disable the menu if there is nothing selector or the text is readonly

o  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

o  canDoAgain
true if there is a possible repeat last edit operation.
Used to disable the menu if there is nothing

o  currentLine
the current line (for relative gotos)

o  hasSearchActionSelection

o  isKeyboardConsumer
return true, if the receiver is a keyboard consumer;
Return true here if not readOnly, redefined from SimpleView.

o  specClass
redefined, since the name of my specClass is nonStandard (i.e. not EditTextSpec)

o  tabMeansNextField
return true, if a Tab character should shift focus.

o  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
o  realize
make the view visible - scroll to make the cursor visible.

redrawing
o  redrawCursorIfBetweenVisibleLine: startVisLine and: endVisLine
redraw the cursor, if it sits in a line range

o  redrawCursorIfInVisibleLine: visLine
redraw the cursor, if it sits in visible line

o  redrawFromVisibleLine: startVisLine to: endVisLine
redraw a visible line range

o  redrawVisibleLine: visLine
redraw a visible line

o  redrawVisibleLine: visLine col: colNr
redraw the single character in visibleline at colNr

o  redrawVisibleLine: visLine from: startCol
redraw a visible line from startCol to the end of line

o  redrawVisibleLine: visLine from: startCol to: endCol
redraw a visible line from startCol to endCol

scrolling
o  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

o  halfPageDown
half a page down - to keep cursor on same visible line, it has to be moved
within the real text

o  halfPageUp
half a page up - to keep cursor on same visible line, it has to be moved
within the real text

o  originChanged: delta
sent after scrolling - have to show the cursor if it was on before

o  originWillChange
sent before scrolling - have to hide the cursor

o  pageDown
page down - to keep cursor on same visible line, it has to be moved
within the real text

o  pageUp
page up - to keep cursor on same visible line, it has to be moved
within the real text

searching
o  searchBwd: pattern ifAbsent: aBlock
do a backward search

o  searchBwd: pattern ignoreCase: ign ifAbsent: aBlock
do a backward search

o  searchBwd: pattern ignoreCase: ign startingAtLine: startLine col: startCol ifAbsent: aBlock
do a backward search

o  searchForAndSelectMatchingParenthesis
select characters enclosed by matching parenthesis if one is under cusor

o  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

o  searchFwd: pattern ignoreCase: ign match: match startingAtLine: startLine col: startCol ifAbsent: aBlock
do a forward search

o  searchFwd: pattern ignoreCase: ign startingAtLine: startLine col: startCol ifAbsent: aBlock
do a forward search

o  searchFwd: pattern startingAtLine: startLine col: startCol ifAbsent: aBlock
do a forward search

o  searchPatternForSearchBar
Returns the next searchPattern from the user selection or from the autoSearch

o  setSearchPatternWithMatchEscapes: match
set the searchpattern from the selection if there is one, and position
cursor to start of pattern

o  showMatch: pattern isMatch: isMatch atLine: line col: col endCol: encColOrNil

o  startPositionForSearchBackward

o  startPositionForSearchBackwardBasedOnCursorOrSelection

o  startPositionForSearchForward

o  startPositionForSearchForwardBasedOnCursorOrSelection
if there is no selection and the cursor is at the origin,

selections
o  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) **

o  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

o  changeTypeOfSelectionTo: newType

o  findNextWordAfterSelectionAndAddToSelection

o  searchPatternFromUserSelectionOrReplace

o  selectAll
select the whole text.
redefined to send super selectFrom... since we don't want the
cursor to be moved in this case.

o  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.

o  selectCursorLine
select cursorline

o  selectCursorLineFromBeginning
select cursorline up to cursor position

o  selectExpandCursorLine
expand selection by one line or select cursorline

o  selectFromBeginOfLine
select the text from the beginning of the current line to the current cursor position.

o  selectFromBeginning
select the text from the beginning to the current cursor position.

o  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.

o  selectToEndOfLine
select the text from the current cursor position to the end of the current line

o  selectUpToEnd
select the text from the current cursor position to the end.

o  selectWordUnderCursor
select the word under the cursor

o  unselect
forget and unhilight selection - must take care of cursor here

undo & again
o  addUndo: action

o  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.

o  hasRedoAction

o  hasUndoAction

o  multipleAgain
repeat the last action (which was a cut or replace) until search fails

o  nonUndoableDo: aBlock

o  redo
undo the last undo

o  undo
undo the last edit operation

o  undoableDo: aBlock

o  undoableDo: aBlock info: aString
will trigger an error-dialog there (no need for undo-carekeeping)


Private classes:

    DeleteCharacters
    DeleteRange
    EditAction
    EditMode
    ExecutingMacroQuery
    LastReplacementInfo
    PasteString
    ReplaceCharacter
    ReplaceCharacters
    ReplaceContents
    ReplaceLine
    ReplaceLines
    RestoreSelectionAndCursor

Examples:


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.


ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Wed, 12 Dec 2018 09:28:34 GMT