author | Claus Gittinger <cg@exept.de> |
Mon, 11 Oct 1999 17:53:55 +0200 | |
changeset 2035 | 6924861adf08 |
parent 2029 | 22629607c6eb |
child 2072 | 2308caaeb8f9 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
TextView subclass:#EditTextView |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
14 |
instanceVariableNames:'cursorLine cursorVisibleLine cursorCol cursorShown |
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
15 |
prevCursorState readOnly modifiedChannel fixedSize exceptionBlock |
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
16 |
cursorFgColor cursorBgColor cursorNoFocusFgColor cursorType |
1334 | 17 |
cursorTypeNoFocus undoAction typeOfSelection lastString |
18 |
lastReplacement lastAction replacing showMatchingParenthesis |
|
19 |
hasKeyboardFocus acceptAction lockUpdates tabMeansNextField |
|
20 |
autoIndent insertMode trimBlankLines wordWrap |
|
2035
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
21 |
replacementWordSelectStyle acceptChannel acceptEnabled st80Mode |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
22 |
disableIfInvisible' |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
23 |
classVariableNames:'DefaultCursorForegroundColor DefaultCursorBackgroundColor |
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
24 |
DefaultCursorType DefaultCursorNoFocusForegroundColor ST80Mode |
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
25 |
DefaultCursorTypeNoFocus' |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
26 |
poolDictionaries:'' |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
27 |
category:'Views-Text' |
0 | 28 |
! |
29 |
||
865 | 30 |
!EditTextView class methodsFor:'documentation'! |
0 | 31 |
|
33 | 32 |
copyright |
33 |
" |
|
34 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 35 |
All Rights Reserved |
33 | 36 |
|
37 |
This software is furnished under a license and may be used |
|
38 |
only in accordance with the terms of that license and with the |
|
39 |
inclusion of the above copyright notice. This software may not |
|
40 |
be provided or otherwise made available to, or used by, any |
|
41 |
other person. No title to or ownership of the software is |
|
42 |
hereby transferred. |
|
43 |
" |
|
44 |
! |
|
45 |
||
0 | 46 |
documentation |
47 |
" |
|
48 |
a view for editable text - adds editing functionality to TextView |
|
125 | 49 |
Also, it adds accept functionality, and defines a new actionBlock: |
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
50 |
acceptAction to be performed for accept |
125 | 51 |
|
52 |
If used with a model, this is informed by sending it a changeMsg with |
|
53 |
the current contents as argument. |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
54 |
(however, it is possible to define both changeMsg and acceptAction) |
125 | 55 |
|
309
b5c9d68e95e1
new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
56 |
Please read the historic notice in the ListView class. |
0 | 57 |
|
586 | 58 |
[Instance variables:] |
0 | 59 |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
60 |
cursorLine <Number> line where cursor sits (1..) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
61 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
62 |
cursorVisibleLine <Number> visible line where cursor sits (1..nLinesShown) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
63 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
64 |
cursorCol <Number> col where cursor sits (1..) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
65 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
66 |
cursorShown <Boolean> true, if cursor is currently shown |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
67 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
68 |
readOnly <Boolean> true, if text may not be edited |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
69 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
70 |
modifiedChannel <ValueHolder> holding true, if text has been modified. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
71 |
cleared on accept. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
72 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
73 |
acceptChannel <ValueHolder> holding true, if text has been accepted. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
74 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
75 |
fixedSize <Boolean> true, if no lines may be added/removed |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
76 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
77 |
exceptionBlock <Block> block to be evaluated when readonly text is about to be modified |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
78 |
if it returns true, the modification will be done anyway. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
79 |
if it returns anything else, the modification is not done. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
80 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
81 |
cursorFgColor <Color> color used for cursor drawing |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
82 |
cursorBgColor <Color> color used for cursor drawing |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
83 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
84 |
cursorType <Symbol> how the cursor is drawn; currently implemented |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
85 |
are #block (solid-block cursor), #ibeam |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
86 |
(vertical bar at insertion point) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
87 |
and #caret (caret below insertion-point) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
88 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
89 |
cursorTypeNoFocus <Symbol> like above, if view has no focus |
1334 | 90 |
nil means: hide the cursor. |
91 |
||
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
92 |
undoAction <Block> block which undoes last cut, paste or replace |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
93 |
(not yet fully implemented) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
94 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
95 |
typeOfSelection <Symbol> #paste, if selection created by paste, nil otherwise |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
96 |
this affects the next keyPress: if #paste it does not |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
97 |
replace; otherwise it replaces the selection. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
98 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
99 |
lastCut <String> last cut or replaced string |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
100 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
101 |
lastReplacement <String> last replacement |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
102 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
103 |
replacing <Boolean> true if entered characters replace last selection |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
104 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
105 |
showMatchingParenthesis <Boolean> if true, shows matching parenthesis |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
106 |
when entering one; this is the default. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
107 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
108 |
hasKeyboardFocus <Boolean> true if this view has the focus |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
109 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
110 |
acceptAction <Block> accept action - evaluated passing the contents as |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
111 |
argument |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
112 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
113 |
tabMeansNextField <Boolean> if true, Tab is ignored as input and shifts keyboard |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
114 |
focus to the next field. For editTextViews, this is false |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
115 |
by default (i.e. tabs can be entered into the text). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
116 |
For some subclasses (inputFields), this may be true. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
117 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
118 |
trimBlankLines <Boolean> if true, trailing blanks are |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
119 |
removed when editing. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
120 |
Default is true. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
121 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
122 |
wordWrap <Boolean> Currently not used. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
123 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
124 |
lockUpdates <Boolean> internal, private |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
125 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
126 |
prevCursorState <Boolean> temporary, private |
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
127 |
|
33 | 128 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
129 |
class variables: |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
130 |
ST80Mode <Boolean> if true, cursor positioning is |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
131 |
done as in vi or ST80; i.e. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
132 |
wysiwyg mode is somewhat relaxed, |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
133 |
in that the cursor cannot be |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
134 |
positioned behind a lines end. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
135 |
This is not yet completely implemented. |
33 | 136 |
used globals: |
137 |
||
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
138 |
DeleteHistory <Text> last 1000 lines of deleted text |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
139 |
(but only if this variable exists already) |
586 | 140 |
|
141 |
[styleSheet parameters:] |
|
121 | 142 |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
143 |
textCursorForegroundColor <Color> cursor fg color; default: text background |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
144 |
textCursorBackgroundColor <Color> cursor bg color; default: text foreground |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
145 |
textCursorNoFocusForegroundColor |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
146 |
<Color> cursor fg color if no focus; default: cursor fg color |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
147 |
textCursorType <Symbol> cursor type; default: #block |
586 | 148 |
|
149 |
[author:] |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
150 |
Claus Gittinger |
586 | 151 |
|
152 |
[see also:] |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
153 |
CodeView Workspace TextView ListView |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
154 |
EditField |
0 | 155 |
" |
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
156 |
! |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
157 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
158 |
examples |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
159 |
" |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
160 |
non MVC operation: |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
161 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
162 |
basic setup: |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
163 |
[exBegin] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
164 |
|top textView| |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
165 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
166 |
top := StandardSystemView new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
167 |
top extent:300@200. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
168 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
169 |
textView := EditTextView new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
170 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
171 |
top addSubView:textView. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
172 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
173 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
174 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
175 |
top open. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
176 |
[exEnd] |
594 | 177 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
178 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
179 |
with vertical scrollbar: |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
180 |
[exBegin] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
181 |
|top scrollView textView| |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
182 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
183 |
top := StandardSystemView new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
184 |
top extent:300@200. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
185 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
186 |
scrollView := ScrollableView for:EditTextView. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
187 |
textView := scrollView scrolledView. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
188 |
scrollView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
189 |
top addSubView:scrollView. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
190 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
191 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
192 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
193 |
top open. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
194 |
[exEnd] |
594 | 195 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
196 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
197 |
with horizontal & vertical scrollbars: |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
198 |
[exBegin] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
199 |
|top scrollView textView| |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
200 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
201 |
top := StandardSystemView new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
202 |
top extent:300@200. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
203 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
204 |
scrollView := HVScrollableView for:EditTextView. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
205 |
textView := scrollView scrolledView. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
206 |
scrollView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
207 |
top addSubView:scrollView. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
208 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
209 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
210 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
211 |
top open. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
212 |
[exEnd] |
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
213 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
214 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
215 |
set the action for accept: |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
216 |
[exBegin] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
217 |
|top textView| |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
218 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
219 |
top := StandardSystemView new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
220 |
top extent:300@200. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
221 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
222 |
textView := EditTextView new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
223 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
224 |
top addSubView:textView. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
225 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
226 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
227 |
textView acceptAction:[:contents | |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
228 |
Transcript showCR:'will not overwrite the file with:'. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
229 |
Transcript showCR:contents asString |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
230 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
231 |
top open. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
232 |
[exEnd] |
594 | 233 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
234 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
235 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
236 |
non-string (text) items: |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
237 |
[exBegin] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
238 |
|top textView list| |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
239 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
240 |
list := '/etc/hosts' asFilename contentsOfEntireFile asStringCollection. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
241 |
1 to:list size by:2 do:[:nr | |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
242 |
list at:nr put:(Text string:(list at:nr) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
243 |
emphasis:(Array with:#bold with:(#color->Color red))) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
244 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
245 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
246 |
top := StandardSystemView new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
247 |
top extent:300@200. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
248 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
249 |
textView := EditTextView new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
250 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
251 |
top addSubView:textView. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
252 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
253 |
textView contents:list. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
254 |
top open. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
255 |
[exEnd] |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
256 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
257 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
258 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
259 |
MVC operation: |
594 | 260 |
(the examples model here is a plug simulating a real model; |
261 |
real world applications would not use a plug ..) |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
262 |
[exBegin] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
263 |
|top textView model| |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
264 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
265 |
model := Plug new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
266 |
model respondTo:#accepted: |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
267 |
with:[:newContents | |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
268 |
Transcript showCR:'will not overwrite the file with:'. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
269 |
Transcript showCR:newContents asString |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
270 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
271 |
model respondTo:#getList |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
272 |
with:['/etc/hosts' asFilename contentsOfEntireFile]. |
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
273 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
274 |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
275 |
top := StandardSystemView new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
276 |
top extent:300@200. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
277 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
278 |
textView := EditTextView new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
279 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
280 |
top addSubView:textView. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
281 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
282 |
textView listMessage:#getList; |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
283 |
model:model; |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
284 |
changeMessage:#accepted:; |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
285 |
aspect:#list. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
286 |
top open. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
287 |
[exEnd] |
594 | 288 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
289 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
290 |
two textViews on the same model: |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
291 |
[exBegin] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
292 |
|top1 textView1 top2 textView2 model currentContents| |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
293 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
294 |
model := Plug new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
295 |
model respondTo:#accepted: |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
296 |
with:[:newContents | |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
297 |
Transcript showCR:'accepted:'. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
298 |
Transcript showCR:newContents asString. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
299 |
currentContents := newContents. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
300 |
model changed:#contents |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
301 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
302 |
model respondTo:#getList |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
303 |
with:[Transcript showCR:'query'. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
304 |
currentContents]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
305 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
306 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
307 |
top1 := StandardSystemView new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
308 |
top1 extent:300@200. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
309 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
310 |
textView1 := EditTextView new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
311 |
textView1 origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
312 |
top1 addSubView:textView1. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
313 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
314 |
textView1 listMessage:#getList; |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
315 |
model:model; |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
316 |
aspect:#contents; |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
317 |
changeMessage:#accepted:. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
318 |
top1 open. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
319 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
320 |
top2 := StandardSystemView new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
321 |
top2 extent:300@200. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
322 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
323 |
textView2 := EditTextView new. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
324 |
textView2 origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
325 |
top2 addSubView:textView2. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
326 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
327 |
textView2 listMessage:#getList; |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
328 |
model:model; |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
329 |
aspect:#contents; |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
330 |
changeMessage:#accepted:. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
331 |
top2 open. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
332 |
[exEnd] |
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
333 |
" |
0 | 334 |
! ! |
335 |
||
865 | 336 |
!EditTextView class methodsFor:'defaults'! |
59 | 337 |
|
1419 | 338 |
st80Mode |
339 |
"return true, if the st80 editing mode is turned on. |
|
340 |
This setting affects the behavior of the cursor, when positioned |
|
341 |
behond the end of a line or the end of the text. |
|
342 |
The default is initialized from the viewStyle." |
|
343 |
||
344 |
^ ST80Mode |
|
345 |
||
346 |
" |
|
347 |
EditTextView st80Mode:true |
|
348 |
EditTextView st80Mode:false |
|
349 |
" |
|
350 |
||
351 |
"Modified: / 16.1.1998 / 22:54:57 / cg" |
|
352 |
! |
|
353 |
||
354 |
st80Mode:aBoolean |
|
355 |
"turns on/off st80 behavior, where the cursor cannot be positioned |
|
356 |
behond the end of a line or the last line" |
|
357 |
||
358 |
ST80Mode := aBoolean. |
|
359 |
||
360 |
" |
|
361 |
EditTextView st80Mode:true |
|
362 |
EditTextView st80Mode:false |
|
363 |
" |
|
364 |
||
365 |
"Modified: / 16.1.1998 / 22:55:19 / cg" |
|
366 |
! |
|
367 |
||
59 | 368 |
updateStyleCache |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
369 |
"extract values from the styleSheet and cache them in class variables" |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
370 |
|
1390 | 371 |
<resource: #style (#'textCursor.foregroundColor' #'textCursor.backgroundColor' |
2010 | 372 |
#'textCursor.noFocusForegroundColor' |
373 |
#'textCursor.type' #'textCursor.typeNoFocus' |
|
374 |
#'editText.st80Mode')> |
|
1355 | 375 |
|
376 |
DefaultCursorForegroundColor := StyleSheet colorAt:'textCursor.foregroundColor'. |
|
377 |
DefaultCursorBackgroundColor := StyleSheet colorAt:'textCursor.backgroundColor'. |
|
378 |
DefaultCursorNoFocusForegroundColor := StyleSheet colorAt:'textCursor.noFocusForegroundColor'. |
|
379 |
DefaultCursorType := StyleSheet at:'textCursor.type' default:#block. |
|
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
380 |
DefaultCursorTypeNoFocus := StyleSheet at:'textCursor.typeNoFocus'. |
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
381 |
|
1419 | 382 |
ST80Mode := StyleSheet at:'editText.st80Mode' default:false. |
383 |
||
384 |
" |
|
385 |
self updateStyleCache |
|
386 |
" |
|
387 |
||
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
388 |
"Modified: / 20.5.1998 / 04:27:41 / cg" |
59 | 389 |
! ! |
390 |
||
2022 | 391 |
!EditTextView methodsFor:'Compatibility - ST-80'! |
1552
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
392 |
|
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
393 |
autoAccept:aBoolean |
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
394 |
"ignored for now" |
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
395 |
|
2019 | 396 |
"Created: / 5.6.1998 / 15:30:32 / cg " |
1585
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
397 |
! |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
398 |
|
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
399 |
continuousAccept:aBoolean |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
400 |
"ignored for now" |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
401 |
|
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
402 |
"Created: / 19.6.1998 / 00:03:49 / cg" |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
403 |
! |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
404 |
|
1833 | 405 |
enabled:aBoolean |
406 |
||
407 |
self readOnly:aBoolean not |
|
408 |
||
409 |
"Created: / 30.3.1999 / 15:10:23 / stefan" |
|
410 |
"Modified: / 30.3.1999 / 15:10:53 / stefan" |
|
1589
4fc01fd85b65
added #disable (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1588
diff
changeset
|
411 |
! |
4fc01fd85b65
added #disable (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1588
diff
changeset
|
412 |
|
1585
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
413 |
textHasChanged |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
414 |
^ self modified |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
415 |
|
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
416 |
"Created: / 19.6.1998 / 00:09:43 / cg" |
1552
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
417 |
! ! |
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
418 |
|
2022 | 419 |
!EditTextView methodsFor:'Compatibility - ST-80 editing'! |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
420 |
|
1390 | 421 |
cutSelection |
422 |
self cut |
|
423 |
||
424 |
"Created: / 31.10.1997 / 03:29:50 / cg" |
|
425 |
! |
|
426 |
||
1590 | 427 |
deselect |
428 |
"remove the selection" |
|
429 |
||
430 |
^ self unselect |
|
431 |
||
432 |
"Created: / 19.6.1998 / 02:41:54 / cg" |
|
433 |
! |
|
434 |
||
1732
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
435 |
find:pattern |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
436 |
self searchFwd:pattern ifAbsent:nil |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
437 |
|
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
438 |
"Created: / 29.1.1999 / 19:09:42 / cg" |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
439 |
"Modified: / 29.1.1999 / 19:10:12 / cg" |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
440 |
! |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
441 |
|
1294
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
442 |
insert:aString at:aCharacterPosition |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
443 |
"insert a string at aCharacterPosition." |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
444 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
445 |
|line col| |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
446 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
447 |
line := self lineOfCharacterPosition:aCharacterPosition. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
448 |
col := aCharacterPosition - (self characterPositionOfLine:line col:1) + 1. |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
449 |
col < 1 ifTrue:[ |
2010 | 450 |
col := 1 |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
451 |
]. |
1294
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
452 |
self insertString:aString atLine:line col:col. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
453 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
454 |
" |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
455 |
|top v| |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
456 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
457 |
top := StandardSystemView new. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
458 |
top extent:300@300. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
459 |
v := EditTextView origin:0.0@0.0 corner:1.0@1.0 in:top. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
460 |
top openAndWait. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
461 |
v contents:'1234567890\1234567890\1234567890\' withCRs. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
462 |
v insert:'<- hello there' at:5. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
463 |
" |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
464 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
465 |
"Modified: / 5.4.1998 / 17:20:08 / cg" |
1294
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
466 |
! |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
467 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
468 |
insertAndSelect:aString at:aCharacterPosition |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
469 |
"insert a selected string at aCharacterPosition." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
470 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
471 |
|line col| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
472 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
473 |
line := self lineOfCharacterPosition:aCharacterPosition. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
474 |
col := aCharacterPosition - (self characterPositionOfLine:line col:1) + 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
475 |
self insertString:aString atLine:line col:col. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
476 |
self selectFromLine:line col:col toLine:line col:col + aString size - 1 |
125 | 477 |
" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
478 |
|v| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
479 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
480 |
v := EditTextView new openAndWait. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
481 |
v contents:'1234567890\1234567890\1234567890\' withCRs. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
482 |
v insertAndSelect:'<- hello there' at:5. |
125 | 483 |
" |
1390 | 484 |
! |
485 |
||
486 |
pasteSelection |
|
487 |
self paste |
|
488 |
||
489 |
"Created: / 31.10.1997 / 03:28:53 / cg" |
|
1590 | 490 |
! |
491 |
||
492 |
replaceSelectionWith:aString |
|
493 |
^ self replaceSelectionBy:aString |
|
494 |
||
495 |
"Created: / 19.6.1998 / 02:42:32 / cg" |
|
496 |
! |
|
497 |
||
498 |
selectAt:pos |
|
499 |
"move the cursor before cursorPosition." |
|
500 |
||
501 |
self cursorToCharacterPosition:pos |
|
502 |
||
503 |
"Modified: / 19.6.1998 / 02:41:28 / cg" |
|
504 |
"Created: / 19.6.1998 / 02:43:39 / cg" |
|
505 |
! |
|
506 |
||
507 |
selectFrom:startPos to:endPos |
|
508 |
"change the selection given two aCharacterPositions." |
|
509 |
||
510 |
|line1 col1 line2 col2| |
|
511 |
||
512 |
startPos > endPos ifTrue:[ |
|
2010 | 513 |
^ self unselect |
1590 | 514 |
]. |
515 |
||
516 |
line1 := self lineOfCharacterPosition:startPos. |
|
517 |
col1 := startPos - (self characterPositionOfLine:line1 col:1) + 1. |
|
518 |
col1 < 1 ifTrue:[ |
|
2010 | 519 |
col1 := 1 |
1590 | 520 |
]. |
521 |
line2 := self lineOfCharacterPosition:endPos. |
|
522 |
col2 := startPos - (self characterPositionOfLine:line2 col:1) + 1. |
|
523 |
col2 < 1 ifTrue:[ |
|
2010 | 524 |
col2 := 1 |
1590 | 525 |
]. |
526 |
self selectFromLine:line1 col:col1 toLine:line2 col:col2 |
|
527 |
||
528 |
"Modified: / 19.6.1998 / 02:41:28 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
529 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
530 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
531 |
!EditTextView methodsFor:'accessing-behavior'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
532 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
533 |
acceptAction |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
534 |
"return the action to be performed on accept (or nil)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
535 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
536 |
^ acceptAction |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
537 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
538 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
539 |
acceptAction:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
540 |
"set the action to be performed on accept" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
541 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
542 |
acceptAction := aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
543 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
544 |
|
1108 | 545 |
acceptEnabled:aBoolean |
546 |
"enable/disable accept. This greys the corresponding item in the menu" |
|
547 |
||
548 |
acceptEnabled := aBoolean |
|
549 |
||
550 |
"Created: 7.3.1997 / 11:04:34 / cg" |
|
551 |
! |
|
552 |
||
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
553 |
autoIndent:aBoolean |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
554 |
autoIndent := aBoolean |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
555 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
556 |
"Created: 5.3.1996 / 14:37:50 / cg" |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
557 |
! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
558 |
|
2035
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
559 |
disableIfInvisible:aBoolean |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
560 |
disableIfInvisible := aBoolean |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
561 |
! |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
562 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
563 |
exceptionBlock:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
564 |
"define the action to be triggered when user tries to modify |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
565 |
readonly text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
566 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
567 |
exceptionBlock := aBlock |
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
568 |
! |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
569 |
|
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
570 |
insertMode:aBoolean |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
571 |
insertMode := aBoolean |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
572 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
573 |
"Created: 6.3.1996 / 12:24:05 / cg" |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
574 |
! |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
575 |
|
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
576 |
tabMeansNextField:aBoolean |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
577 |
"set/clear tabbing to the next field. |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
578 |
If true, Tab is ignored and shifts the keyboard focus. |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
579 |
If false, tabs can be entered into the text. |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
580 |
The default is true for editTextView, false for single-line |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
581 |
input fields." |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
582 |
|
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
583 |
tabMeansNextField := aBoolean |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
584 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
585 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
586 |
!EditTextView methodsFor:'accessing-contents'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
587 |
|
1013 | 588 |
acceptChannel |
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
589 |
"return the valueHolder holding true if text was accepted. |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
590 |
By placing a true into this channel, an accept can also be forced." |
1013 | 591 |
|
592 |
^ acceptChannel |
|
593 |
||
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
594 |
"Modified: / 30.1.1998 / 14:17:11 / cg" |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
595 |
! |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
596 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
597 |
acceptChannel:aValueHolder |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
598 |
"set the valueHolder holding true if text was accepted. |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
599 |
By placing a true into this channel, an accept can also be forced." |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
600 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
601 |
|prev| |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
602 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
603 |
prev := acceptChannel. |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
604 |
acceptChannel := aValueHolder. |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
605 |
self setupChannel:aValueHolder for:nil withOld:prev |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
606 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
607 |
"Created: / 30.1.1998 / 14:51:09 / cg" |
1013 | 608 |
! |
609 |
||
610 |
accepted |
|
611 |
"return true if text was accepted" |
|
612 |
||
613 |
^ acceptChannel value |
|
614 |
||
615 |
"Created: 14.2.1997 / 16:43:46 / cg" |
|
616 |
! |
|
617 |
||
618 |
accepted:aBoolean |
|
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
619 |
"set/clear the accepted flag. |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
620 |
This may force my current contents to be placed into my model." |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
621 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
622 |
acceptChannel value:aBoolean. |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
623 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
624 |
"Created: / 14.2.1997 / 16:44:01 / cg" |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
625 |
"Modified: / 30.1.1998 / 14:20:15 / cg" |
1013 | 626 |
! |
627 |
||
1902
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
628 |
at:lineNr basicPut:aLine |
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
629 |
"change a line without change notification" |
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
630 |
|
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
631 |
(self at:lineNr) = aLine ifFalse:[ |
2010 | 632 |
super at:lineNr put:aLine. |
1902
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
633 |
]. |
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
634 |
! |
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
635 |
|
522 | 636 |
at:lineNr put:aLine |
637 |
(self at:lineNr) = aLine ifFalse:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
638 |
super at:lineNr put:aLine. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
639 |
self textChanged |
522 | 640 |
]. |
641 |
! |
|
642 |
||
1577
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
643 |
characterBeforeCursor |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
644 |
"return the character under the cursor - space if behond line. |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
645 |
For non-block cursors, this is the character immediately to the right |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
646 |
of the insertion-bar or caret." |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
647 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
648 |
cursorCol == 1 ifTrue:[^ nil]. |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
649 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
650 |
^ self characterAtLine:cursorLine col:cursorCol-1 |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
651 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
652 |
"Created: / 17.6.1998 / 15:16:41 / cg" |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
653 |
! |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
654 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
655 |
characterUnderCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
656 |
"return the character under the cursor - space if behond line. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
657 |
For non-block cursors, this is the character immediately to the right |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
658 |
of the insertion-bar or caret." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
659 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
660 |
^ self characterAtLine:cursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
661 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
662 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
663 |
contents |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
664 |
"return the contents as a String" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
665 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
666 |
list isNil ifTrue:[^ '']. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
667 |
self removeTrailingBlankLines. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
668 |
^ list asStringWithCRs |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
669 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
670 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
671 |
cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
672 |
"return the cursors col (1..). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
673 |
This is the absolute col; NOT the visible col" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
674 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
675 |
^ cursorCol |
125 | 676 |
! |
677 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
678 |
cursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
679 |
"return the cursors line (1..). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
680 |
This is the absolute line; NOT the visible line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
681 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
682 |
^ cursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
683 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
684 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
685 |
fixedSize |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
686 |
"make the texts size fixed (no lines may be added). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
687 |
OBSOLETE: use readOnly" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
688 |
|
1018 | 689 |
self obsoleteMethodWarning:'use #readOnly:'. |
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
690 |
readOnly == true ifFalse:[ |
2010 | 691 |
readOnly := true. |
692 |
middleButtonMenu notNil ifTrue:[ |
|
693 |
middleButtonMenu disableAll:#(cut paste replace indent) |
|
694 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
695 |
] |
1018 | 696 |
|
697 |
"Modified: 14.2.1997 / 17:35:24 / cg" |
|
127 | 698 |
! |
699 |
||
1037 | 700 |
isReadOnly |
701 |
"return true, if the text is readonly." |
|
702 |
||
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
703 |
^ readOnly value |
1037 | 704 |
|
705 |
"Modified: 14.2.1997 / 17:35:56 / cg" |
|
706 |
! |
|
707 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
708 |
list:something |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
709 |
"position cursor home when setting contents" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
710 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
711 |
super list:something. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
712 |
self cursorHome |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
713 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
714 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
715 |
modified |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
716 |
"return true if text was modified" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
717 |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
718 |
^ modifiedChannel value |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
719 |
! |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
720 |
|
362
3993ba6c31a0
Expand tabs before pasting a string.
Stefan Vogel <sv@exept.de>
parents:
331
diff
changeset
|
721 |
modified:aBoolean |
1013 | 722 |
"set/clear the modified flag" |
362
3993ba6c31a0
Expand tabs before pasting a string.
Stefan Vogel <sv@exept.de>
parents:
331
diff
changeset
|
723 |
|
3993ba6c31a0
Expand tabs before pasting a string.
Stefan Vogel <sv@exept.de>
parents:
331
diff
changeset
|
724 |
modifiedChannel value:aBoolean |
1013 | 725 |
|
726 |
"Modified: 14.2.1997 / 16:44:05 / cg" |
|
362
3993ba6c31a0
Expand tabs before pasting a string.
Stefan Vogel <sv@exept.de>
parents:
331
diff
changeset
|
727 |
! |
3993ba6c31a0
Expand tabs before pasting a string.
Stefan Vogel <sv@exept.de>
parents:
331
diff
changeset
|
728 |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
729 |
modifiedChannel |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
730 |
"return the valueHolder holding true if text was modified" |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
731 |
|
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
732 |
^ modifiedChannel |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
733 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
734 |
|
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
735 |
modifiedChannel:aValueHolder |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
736 |
"set the valueHolder holding true if text was modified" |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
737 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
738 |
|prev| |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
739 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
740 |
prev := modifiedChannel. |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
741 |
modifiedChannel := aValueHolder. |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
742 |
self setupChannel:aValueHolder for:nil withOld:prev |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
743 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
744 |
"Created: / 30.1.1998 / 14:51:32 / cg" |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
745 |
! |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
746 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
747 |
readOnly |
1018 | 748 |
"make the text readonly. |
749 |
Somewhat obsolete - use #readOnly:" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
750 |
|
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
751 |
self obsoleteMethodWarning:'use #readOnly:'. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
752 |
readOnly := true |
1018 | 753 |
|
754 |
"Modified: 14.2.1997 / 17:35:56 / cg" |
|
755 |
! |
|
756 |
||
757 |
readOnly:aBoolean |
|
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
758 |
"make the text readonly (aBoolean == true) or writable (aBoolean == false). |
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
759 |
The argument may also be a valueHolder." |
1018 | 760 |
|
761 |
readOnly := aBoolean |
|
762 |
||
763 |
"Created: 14.2.1997 / 17:35:39 / cg" |
|
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
764 |
! |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
765 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
766 |
setContents:something |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
767 |
|selType| |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
768 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
769 |
selType := typeOfSelection. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
770 |
super setContents:something. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
771 |
typeOfSelection := selType. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
772 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
773 |
"Created: / 31.3.1998 / 23:35:06 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
774 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
775 |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
776 |
!EditTextView methodsFor:'accessing-look'! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
777 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
778 |
cursorForegroundColor:color1 backgroundColor:color2 |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
779 |
"set both cursor foreground and cursor background colors" |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
780 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
781 |
|wasOn| |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
782 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
783 |
wasOn := self hideCursor. |
1993 | 784 |
cursorFgColor := color1 onDevice:device. |
785 |
cursorBgColor := color2 onDevice:device. |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
786 |
wasOn ifTrue:[self showCursor] |
1333 | 787 |
! |
788 |
||
1899 | 789 |
cursorType |
790 |
"return the style of the text cursor. |
|
791 |
Currently, supported are: #block, #frame, #ibeam, #caret, #solidCaret |
|
2010 | 792 |
#bigCaret and #bigSolidCaret" |
1899 | 793 |
|
794 |
^ cursorType |
|
795 |
||
796 |
"Modified: / 5.5.1999 / 14:52:33 / cg" |
|
797 |
! |
|
798 |
||
1333 | 799 |
cursorType:aCursorTypeSymbol |
800 |
"set the style of the text cursor. |
|
801 |
Currently, supported are: #block, #frame, #ibeam, #caret, #solidCaret |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
802 |
#bigCaret and #bigSolidCaret" |
1333 | 803 |
|
1334 | 804 |
cursorType := aCursorTypeSymbol. |
1333 | 805 |
|
806 |
"Created: 21.9.1997 / 13:42:23 / cg" |
|
807 |
"Modified: 21.9.1997 / 13:43:35 / cg" |
|
1334 | 808 |
! |
809 |
||
1899 | 810 |
cursorTypeNoFocus |
811 |
"return the style of the text cursor when the view has no focus. |
|
812 |
If left unspecified, this is the same as the regular cursorType." |
|
813 |
||
814 |
^ cursorTypeNoFocus |
|
815 |
||
816 |
"Created: / 5.5.1999 / 14:52:46 / cg" |
|
817 |
! |
|
818 |
||
1334 | 819 |
cursorTypeNoFocus:aCursorTypeSymbol |
820 |
"set the style of the text cursor when the view has no focus. |
|
821 |
If left unspecified, this is the same as the regular cursorType." |
|
822 |
||
823 |
cursorTypeNoFocus := aCursorTypeSymbol |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
824 |
! ! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
825 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
826 |
!EditTextView methodsFor:'change & update '! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
827 |
|
125 | 828 |
accept |
829 |
"accept the current contents by executing the accept-action and/or |
|
830 |
changeMessage." |
|
831 |
||
1108 | 832 |
acceptEnabled == false ifTrue:[ |
2035
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
833 |
device beep. |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
834 |
^ self |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
835 |
]. |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
836 |
(disableIfInvisible == true and:[self reallyRealized not]) ifTrue:[ |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
837 |
^ self |
1108 | 838 |
]. |
839 |
||
125 | 840 |
lockUpdates := true. |
1013 | 841 |
|
842 |
"/ |
|
843 |
"/ ST-80 way of doing it |
|
844 |
"/ |
|
845 |
model notNil ifTrue:[ |
|
2035
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
846 |
self sendChangeMessageWith:self argForChangeMessage. |
1013 | 847 |
]. |
848 |
||
757
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
849 |
"/ |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
850 |
"/ ST/X way of doing things |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
851 |
"/ as a historic (and temporary) leftover, |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
852 |
"/ the block is called with a stringCollection |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
853 |
"/ - not with the actual string |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
854 |
"/ |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
855 |
acceptAction notNil ifTrue:[ |
2035
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
856 |
acceptAction value:self list |
757
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
857 |
]. |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
858 |
|
1811
348df65055eb
do not clear the modified flag on accept.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
859 |
"/ NO - must be manually reset by application |
348df65055eb
do not clear the modified flag on accept.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
860 |
"/ self modified:false. |
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
861 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
862 |
"/ self accepted:true. |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
863 |
"/ changed to: |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
864 |
acceptChannel value:true withoutNotifying:self. |
125 | 865 |
|
866 |
lockUpdates := false. |
|
757
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
867 |
|
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
868 |
"Modified: / 30.1.1998 / 14:19:00 / cg" |
131 | 869 |
! |
870 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
871 |
argForChangeMessage |
597 | 872 |
"return the argument to be passed with the change notification. |
873 |
Defined as separate method for easier subclassability." |
|
874 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
875 |
^ self contents |
597 | 876 |
|
877 |
"Modified: 29.4.1996 / 12:42:14 / cg" |
|
121 | 878 |
! |
879 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
880 |
getListFromModel |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
881 |
"get my contents from the model. |
597 | 882 |
Redefined to ignore updates resulting from my own changes |
883 |
(i.e. if lockUpdates is true)." |
|
121 | 884 |
|
885 |
" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
886 |
ignore updates from my own change |
121 | 887 |
" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
888 |
lockUpdates ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
889 |
lockUpdates := false. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
890 |
^ self |
121 | 891 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
892 |
^ super getListFromModel |
597 | 893 |
|
894 |
"Modified: 29.4.1996 / 12:42:33 / cg" |
|
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
895 |
! |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
896 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
897 |
update:something with:aParameter from:changedObject |
1438
bed1564b0640
fixed update for acceptChannel
Claus Gittinger <cg@exept.de>
parents:
1437
diff
changeset
|
898 |
changedObject == acceptChannel ifTrue:[ |
2010 | 899 |
acceptChannel value == true ifTrue:[ |
900 |
self accept. |
|
901 |
]. |
|
902 |
^ self. |
|
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
903 |
]. |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
904 |
super update:something with:aParameter from:changedObject |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
905 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
906 |
"Created: / 30.1.1998 / 14:15:56 / cg" |
1439
d1b3ca91ed8a
fixed update for acceptChannel
Claus Gittinger <cg@exept.de>
parents:
1438
diff
changeset
|
907 |
"Modified: / 1.2.1998 / 13:15:55 / cg" |
121 | 908 |
! ! |
909 |
||
910 |
!EditTextView methodsFor:'cursor handling'! |
|
911 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
912 |
cursorBacktab |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
913 |
"move cursor to prev tabstop" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
914 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
915 |
self cursorCol:(self prevTabBefore:cursorCol). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
916 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
917 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
918 |
cursorCol:newCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
919 |
"move cursor to some column in the current line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
920 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
921 |
|wasOn| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
922 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
923 |
wasOn := self hideCursor. |
672 | 924 |
cursorCol := self validateCursorCol:newCol inLine:cursorLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
925 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 926 |
|
927 |
"Modified: 22.5.1996 / 14:25:53 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
928 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
929 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
930 |
cursorDown |
632
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
931 |
"move cursor down; scroll if at end of visible text; |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
932 |
beep if at end of physical text." |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
933 |
|
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
934 |
|wasOn| |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
935 |
|
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
936 |
self cursorDown:1. |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
937 |
|
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
938 |
"/ cursor behond text ? |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
939 |
cursorLine > list size ifTrue:[ |
2010 | 940 |
wasOn := self hideCursor. |
941 |
cursorLine := self validateCursorLine:(list size + 1). |
|
942 |
cursorCol := self validateCursorCol:cursorCol inLine:cursorLine. |
|
943 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
944 |
"/ wasOn ifTrue:[self showCursor]. |
|
945 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
946 |
self beep. |
|
632
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
947 |
]. |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
948 |
|
1561
db5f27354172
make cursor correctly visible if in partial last line.
Claus Gittinger <cg@exept.de>
parents:
1560
diff
changeset
|
949 |
"Modified: / 10.6.1998 / 17:00:23 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
950 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
951 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
952 |
cursorDown:n |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
953 |
"move cursor down by n lines; scroll if at end of visible text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
954 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
955 |
|wasOn nv| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
956 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
957 |
cursorVisibleLine notNil ifTrue:[ |
2010 | 958 |
wasOn := self hideCursor. |
959 |
nv := cursorVisibleLine + n - 1. |
|
960 |
(nv >= nFullLinesShown) ifTrue:[ |
|
961 |
self scrollDown:(nv - nFullLinesShown + 1) |
|
962 |
]. |
|
963 |
cursorLine := self validateCursorLine:(cursorLine + n). |
|
964 |
cursorCol := self validateCursorCol:cursorCol inLine:cursorLine. |
|
965 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
966 |
"/ wasOn ifTrue:[self showCursor]. |
|
967 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
968 |
] ifFalse:[ |
2010 | 969 |
cursorLine isNil ifTrue:[ |
970 |
cursorLine := firstLineShown |
|
971 |
]. |
|
972 |
cursorLine := self validateCursorLine:(cursorLine + n). |
|
973 |
cursorCol := self validateCursorCol:cursorCol inLine:cursorLine. |
|
974 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
975 |
self makeCursorVisible. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
976 |
]. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
977 |
|
1561
db5f27354172
make cursor correctly visible if in partial last line.
Claus Gittinger <cg@exept.de>
parents:
1560
diff
changeset
|
978 |
"Modified: / 10.6.1998 / 16:59:17 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
979 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
980 |
|
121 | 981 |
cursorHome |
597 | 982 |
"scroll to top AND move cursor to first line of text." |
121 | 983 |
|
674 | 984 |
self cursorLine:1 col:1 |
985 |
||
986 |
"/ |wasOn| |
|
987 |
"/ |
|
988 |
"/ wasOn := self hideCursor. |
|
989 |
"/ self scrollToTop. |
|
990 |
"/ cursorLine := cursorVisibleLine := 1. |
|
991 |
"/ cursorCol := self validateCursorCol:1 inLine:cursorLine. |
|
992 |
"/ self makeCursorVisibleAndShowCursor:wasOn. |
|
993 |
||
994 |
"Modified: 22.5.1996 / 18:26:42 / cg" |
|
121 | 995 |
! |
996 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
997 |
cursorLeft |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
998 |
"move cursor to left" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
999 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1000 |
(cursorCol ~~ 1) ifTrue:[ |
2010 | 1001 |
self cursorCol:(cursorCol - 1) |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1002 |
] ifFalse:[ |
1426
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1003 |
"/ no, do not wrap back to previous line |
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1004 |
"/ cursorLine ~~ 1 ifTrue:[ |
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1005 |
"/ ST80Mode == true ifTrue:[ |
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1006 |
"/ self cursorUp. |
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1007 |
"/ self cursorToEndOfLine. |
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1008 |
"/ ] |
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1009 |
"/ ] |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1010 |
] |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1011 |
|
1426
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1012 |
"Modified: / 23.1.1998 / 12:37:13 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1013 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1014 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1015 |
cursorLine:line col:col |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1016 |
"this positions onto physical - not visible - line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1017 |
|
676 | 1018 |
|wasOn newCol| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1019 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1020 |
wasOn := self hideCursor. |
674 | 1021 |
cursorLine := self validateCursorLine:line. |
1419 | 1022 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
672 | 1023 |
(col < 1) ifTrue:[ |
2010 | 1024 |
newCol := 1 |
672 | 1025 |
] ifFalse:[ |
2010 | 1026 |
newCol := col. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1027 |
]. |
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
1028 |
st80Mode ifTrue:[ |
2010 | 1029 |
(cursorLine == list size |
1030 |
and:[cursorLine ~~ line]) ifTrue:[ |
|
1031 |
newCol := (self listAt:(list size)) size + 1. |
|
1032 |
] |
|
1419 | 1033 |
]. |
676 | 1034 |
cursorCol := self validateCursorCol:newCol inLine:cursorLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1035 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1036 |
|
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
1037 |
"Modified: / 20.6.1998 / 18:19:06 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1038 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1039 |
|
1580
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1040 |
cursorMovementAllowed |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1041 |
"return true, if the user may move the cursor around |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1042 |
(via button-click, or cursor-key with selection). |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1043 |
By default, true is returned, but this may be redefined |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1044 |
in special subclasses (such as a terminal view), where |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1045 |
this is not wanted" |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1046 |
|
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1047 |
^ true |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1048 |
|
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1049 |
"Created: / 18.6.1998 / 14:11:16 / cg" |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1050 |
! |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1051 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1052 |
cursorReturn |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1053 |
"move cursor to start of next line; scroll if at end of visible text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1054 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1055 |
|wasOn| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1056 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1057 |
self checkForExistingLine:(cursorLine + 1). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1058 |
cursorVisibleLine notNil ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1059 |
nFullLinesShown notNil ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1060 |
(cursorVisibleLine >= nFullLinesShown) ifTrue:[self scrollDown] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1061 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1062 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1063 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1064 |
wasOn := self hideCursor. |
674 | 1065 |
cursorLine := self validateCursorLine:cursorLine + 1. |
672 | 1066 |
cursorCol := self validateCursorCol:1 inLine:cursorLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1067 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1068 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1069 |
|
674 | 1070 |
"Modified: 22.5.1996 / 18:27:34 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1071 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1072 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1073 |
cursorRight |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1074 |
"move cursor to right" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1075 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1076 |
|l| |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1077 |
|
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
1078 |
st80Mode == true ifTrue:[ |
2010 | 1079 |
l := (self listAt:cursorLine). |
1080 |
cursorCol >= (l size + 1) ifTrue:[ |
|
1426
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1081 |
"/ no, do not wrap to next line |
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1082 |
"/ cursorLine < list size ifTrue:[ |
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1083 |
"/ self cursorReturn. |
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1084 |
"/ ]. |
2010 | 1085 |
^ self |
1086 |
] |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1087 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1088 |
self cursorCol:(cursorCol + 1) |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1089 |
|
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
1090 |
"Modified: / 20.6.1998 / 18:19:07 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1091 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1092 |
|
1833 | 1093 |
cursorShown:aBoolean |
1094 |
"change cursor visibility |
|
1095 |
return true if cursor was visible before." |
|
1096 |
||
1097 |
|oldState| |
|
1098 |
||
1099 |
oldState := cursorShown. |
|
1100 |
||
1101 |
aBoolean ifTrue:[ |
|
2010 | 1102 |
self drawCursor. |
1833 | 1103 |
] ifFalse:[ |
2010 | 1104 |
(cursorShown and:[shown]) ifTrue: [ |
1105 |
self undrawCursor. |
|
1106 |
]. |
|
1833 | 1107 |
]. |
1108 |
cursorShown := aBoolean. |
|
1109 |
||
1110 |
^ oldState |
|
1111 |
||
1112 |
"Modified: / 30.3.1999 / 15:32:43 / stefan" |
|
1113 |
"Created: / 30.3.1999 / 15:59:30 / stefan" |
|
1114 |
! |
|
1115 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1116 |
cursorTab |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1117 |
"move cursor to next tabstop" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1118 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1119 |
self cursorCol:(self nextTabAfter:cursorCol). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1120 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1121 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1122 |
cursorToBeginOfLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1123 |
"move cursor to start of current line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1124 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1125 |
self cursorCol:1 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1126 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1127 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1128 |
cursorToBottom |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1129 |
"move cursor to last line of text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1130 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1131 |
|wasOn newTop| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1132 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1133 |
wasOn := self hideCursor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1134 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1135 |
newTop := list size - nFullLinesShown. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1136 |
(newTop < 1) ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1137 |
newTop := 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1138 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1139 |
self scrollToLine:newTop. |
674 | 1140 |
cursorLine := self validateCursorLine:list size. |
672 | 1141 |
cursorCol := self validateCursorCol:1 inLine:cursorLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1142 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1143 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1144 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1145 |
|
674 | 1146 |
"Modified: 22.5.1996 / 18:27:45 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1147 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1148 |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1149 |
cursorToCharacterPosition:pos |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1150 |
"compute line/col from character position (1..) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1151 |
and move the cursor onto that char" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1152 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1153 |
|line col| |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1154 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1155 |
line := self lineOfCharacterPosition:pos. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1156 |
col := pos - (self characterPositionOfLine:line col:1) + 1. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1157 |
self cursorLine:line col:col |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1158 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1159 |
"Created: / 15.1.1998 / 21:55:33 / cg" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1160 |
! |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1161 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1162 |
cursorToEnd |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1163 |
"move cursor down below last line of text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1164 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1165 |
|wasOn newTop l line| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1166 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1167 |
l := list size. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1168 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1169 |
cursorLine >= l ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1170 |
line := self listAt:cursorLine. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1171 |
(line isNil or:[line isEmpty]) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1172 |
^ self |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1173 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1174 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1175 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1176 |
wasOn := self hideCursor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1177 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1178 |
l := l + 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1179 |
newTop := l - nFullLinesShown. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1180 |
(newTop < 1) ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1181 |
newTop := 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1182 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1183 |
self scrollToLine:newTop. |
674 | 1184 |
cursorLine := self validateCursorLine:l. |
672 | 1185 |
cursorCol := self validateCursorCol:1 inLine:1. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1186 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1187 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1188 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1189 |
|
674 | 1190 |
"Modified: 22.5.1996 / 18:27:53 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1191 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1192 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1193 |
cursorToEndOfLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1194 |
"move cursor to end of current line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1195 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1196 |
|line| |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1197 |
|
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1198 |
line := (self listAt:cursorLine). |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1199 |
self cursorCol:(line size + 1) |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1200 |
|
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1201 |
"Modified: 13.8.1997 / 15:34:02 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1202 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1203 |
|
131 | 1204 |
cursorToFirstVisibleLine |
1205 |
"place cursor into the first visible line; do not scroll." |
|
1206 |
||
1207 |
self cursorLine:(self visibleLineToAbsoluteLine:1) col:1 |
|
1208 |
! |
|
1209 |
||
1210 |
cursorToLastVisibleLine |
|
1211 |
"place cursor into the first visible line; do not scroll." |
|
1212 |
||
1213 |
self cursorLine:(self visibleLineToAbsoluteLine:nFullLinesShown) col:1 |
|
1214 |
! |
|
1215 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1216 |
cursorToNextWord |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1217 |
"move the cursor to the beginning of the next word" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1218 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1219 |
|col line searching| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1220 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1221 |
(cursorLine > list size) ifTrue:[^ self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1222 |
self wordAtLine:cursorLine col:cursorCol do:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1223 |
:beginLine :beginCol :endLine :endCol :style | |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1224 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1225 |
line := endLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1226 |
col := endCol + 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1227 |
searching := true. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1228 |
[searching |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1229 |
and:[(self characterAtLine:line col:col) isSeparator]] whileTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1230 |
self wordAtLine:line col:col do:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1231 |
:beginLine :beginCol :endLine :endCol :style | |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1232 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1233 |
(line > list size) ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1234 |
"break out" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1235 |
searching := false |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1236 |
] ifFalse:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1237 |
line := endLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1238 |
col := endCol + 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1239 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1240 |
] |
121 | 1241 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1242 |
self cursorLine:line col:col |
121 | 1243 |
] |
1244 |
! |
|
1245 |
||
499 | 1246 |
cursorToPreviousWord |
1247 |
"move the cursor to the beginning of this or the previous word" |
|
1248 |
||
1249 |
|col line searching l| |
|
1250 |
||
1251 |
(cursorLine > list size) ifTrue:[^ self]. |
|
1252 |
||
1253 |
self wordAtLine:cursorLine col:cursorCol do:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1254 |
:beginLine :beginCol :endLine :endCol :style | |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1255 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1256 |
line := beginLine. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1257 |
col := beginCol. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1258 |
style == #wordLeft ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1259 |
col := col + 1 |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1260 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1261 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1262 |
(cursorLine == line |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1263 |
and:[cursorCol == col]) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1264 |
searching := true. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1265 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1266 |
col > 1 ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1267 |
col := col - 1. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1268 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1269 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1270 |
[searching] whileTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1271 |
(col == 1) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1272 |
line == 1 ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1273 |
searching := false |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1274 |
] ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1275 |
line := line - 1. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1276 |
l := list at:line. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1277 |
col := l size + 1. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1278 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1279 |
] ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1280 |
(self characterAtLine:line col:col) isSeparator ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1281 |
self wordAtLine:line col:col do:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1282 |
:beginLine :beginCol :endLine :endCol :style | |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1283 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1284 |
line := beginLine. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1285 |
col := beginCol. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1286 |
style == #wordLeft ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1287 |
col := col + 1 |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1288 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1289 |
searching := false. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1290 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1291 |
] ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1292 |
col := col - 1 |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1293 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1294 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1295 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1296 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1297 |
self cursorLine:line col:col |
499 | 1298 |
] |
1299 |
||
1300 |
"Created: 8.3.1996 / 21:52:48 / cg" |
|
1301 |
"Modified: 8.3.1996 / 22:12:45 / cg" |
|
1302 |
! |
|
1303 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1304 |
cursorToTop |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1305 |
"move cursor to absolute home" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1306 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1307 |
self cursorLine:1 col:1 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1308 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1309 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1310 |
cursorUp |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1311 |
"move cursor up; scroll if at start of visible text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1312 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1313 |
self cursorUp:1 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1314 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1315 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1316 |
cursorUp:n |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1317 |
"move cursor up n lines; scroll if at start of visible text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1318 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1319 |
|wasOn nv nl| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1320 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1321 |
cursorLine isNil ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1322 |
cursorLine := firstLineShown + nFullLinesShown - 1. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1323 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1324 |
nl := cursorLine - n. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1325 |
nl < 1 ifTrue:[nl := 1]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1326 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1327 |
(nl ~~ cursorLine) ifTrue: [ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1328 |
wasOn := self hideCursor. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1329 |
cursorVisibleLine notNil ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1330 |
nv := cursorVisibleLine - n. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1331 |
nv < 1 ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1332 |
self scrollUp:(nv negated + 1) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1333 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1334 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1335 |
cursorLine := self validateCursorLine:nl. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1336 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1337 |
cursorCol := self validateCursorCol:cursorCol inLine:cursorLine. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1338 |
wasOn ifTrue:[self showCursor]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1339 |
"/ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1340 |
"/ to make cursor visible (even if below visible end): |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1341 |
"/ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1342 |
"/ self makeCursorVisibleAndShowCursor:wasOn. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1343 |
] |
672 | 1344 |
|
674 | 1345 |
"Modified: 22.5.1996 / 18:28:11 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1346 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1347 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1348 |
cursorVisibleLine:visibleLineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1349 |
"put cursor to visibleline/col" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1350 |
|
676 | 1351 |
|wasOn newCol| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1352 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1353 |
wasOn := self hideCursor. |
674 | 1354 |
cursorLine := self validateCursorLine:(self visibleLineToAbsoluteLine:visibleLineNr). |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1355 |
cursorVisibleLine := visibleLineNr. |
676 | 1356 |
newCol := colNr. |
1357 |
(newCol < 1) ifTrue:[ |
|
2010 | 1358 |
newCol := 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1359 |
]. |
676 | 1360 |
cursorCol := self validateCursorCol:newCol inLine:cursorLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1361 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1362 |
|
1597
5fdcfcedb91c
fixed cursor positioning after replaceStringAtCursor.
Claus Gittinger <cg@exept.de>
parents:
1596
diff
changeset
|
1363 |
"Modified: / 20.6.1998 / 18:40:28 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1364 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1365 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1366 |
cursorX:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1367 |
"put cursor to position next to x/y coordinate in view" |
121 | 1368 |
|
1369 |
|line col| |
|
1370 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1371 |
line := self visibleLineOfY:y. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1372 |
col := self colOfX:x inVisibleLine:line. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1373 |
self cursorVisibleLine:line col:col. |
121 | 1374 |
! |
1375 |
||
1376 |
drawCursor |
|
1377 |
"draw the cursor if shown and cursor is visible. |
|
1378 |
(but not, if there is a selection - to avoid confusion)" |
|
1379 |
||
1380 |
shown ifTrue:[ |
|
1381 |
cursorVisibleLine notNil ifTrue:[ |
|
1382 |
self hasSelection ifFalse:[ |
|
1383 |
self drawCursorCharacter |
|
1384 |
] |
|
1385 |
] |
|
1386 |
] |
|
1387 |
! |
|
1388 |
||
1389 |
drawCursor:cursorType with:fgColor and:bgColor |
|
1390 |
"draw a cursor; the argument cursorType specifies what type |
|
125 | 1391 |
of cursor should be drawn. |
728
3ef81000ee8c
new cursorTypes: #bigCaret and #bigSolidCaret
Claus Gittinger <cg@exept.de>
parents:
698
diff
changeset
|
1392 |
Currently, supported are: #block, #frame, #ibeam, #caret, #solidCaret |
2010 | 1393 |
#bigCaret and #bigSolidCaret" |
121 | 1394 |
|
666
9ac9adb80415
clip at margin when drawing a caret cursor
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
1395 |
|x y w char y2 x1 x2 oldPaint oldClip| |
121 | 1396 |
|
1397 |
self hasSelection ifTrue:[ |
|
2010 | 1398 |
" |
1399 |
hide cursor, if there is a selection |
|
1400 |
" |
|
1401 |
^ super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
|
121 | 1402 |
]. |
1403 |
||
1334 | 1404 |
cursorType == #none ifTrue:[ |
2010 | 1405 |
^ self |
1334 | 1406 |
]. |
1407 |
||
121 | 1408 |
cursorType == #block ifTrue:[ |
2010 | 1409 |
super drawVisibleLine:cursorVisibleLine |
1410 |
col:cursorCol |
|
1411 |
with:fgColor |
|
1412 |
and:bgColor. |
|
1413 |
^ self |
|
121 | 1414 |
]. |
1415 |
x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - leftOffset. |
|
1416 |
y := self yOfVisibleLine:cursorVisibleLine. |
|
1417 |
||
1449
2a54bdfff203
eliminated direct refs to paint instvar
Claus Gittinger <cg@exept.de>
parents:
1446
diff
changeset
|
1418 |
oldPaint := self paint. "/ do not clobber GC |
121 | 1419 |
cursorType == #frame ifTrue:[ |
2010 | 1420 |
super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
1421 |
||
1422 |
char := self characterUnderCursor asString. |
|
1423 |
self paint:bgColor. |
|
1424 |
self displayRectangleX:x y:y |
|
1425 |
width:(font widthOf:char) height:fontHeight. |
|
133 | 1426 |
] ifFalse:[ |
2010 | 1427 |
self paint:bgColor. |
1428 |
cursorType == #ibeam ifTrue:[ |
|
1429 |
x1 := x - 1. |
|
1430 |
y2 := y + fontHeight - 1. |
|
1431 |
self displayLineFromX:x1 y:y toX:x1 y:y2. |
|
1432 |
self displayLineFromX:x y:y toX:x y:y2. |
|
1433 |
^ self |
|
1434 |
]. |
|
1435 |
||
1436 |
cursorType == #Ibeam ifTrue:[ |
|
1437 |
x1 := x - 1. |
|
1438 |
y2 := y + fontHeight - 1. |
|
1439 |
self displayLineFromX:x1 y:y toX:x1 y:y2. |
|
1440 |
self displayLineFromX:x y:y toX:x y:y2. |
|
1441 |
self displayLineFromX:x1-2 y:y toX:x+2 y:y. |
|
1442 |
self displayLineFromX:x1-2 y:y2 toX:x+2 y:y2. |
|
1443 |
^ self |
|
1444 |
]. |
|
1445 |
||
1446 |
y := y + fontHeight - 3. |
|
1447 |
((cursorType == #bigCaret) or:[cursorType == #bigSolidCaret]) ifTrue:[ |
|
1448 |
w := (fontWidth * 2 // 3) max:4. |
|
1449 |
y2 := y + w + (w//2). |
|
1450 |
] ifFalse:[ |
|
1451 |
w := (fontWidth // 2) max:4. |
|
1452 |
y2 := y + w. |
|
1453 |
]. |
|
1454 |
x1 := x - w. |
|
1455 |
x2 := x + w. |
|
1456 |
||
1457 |
oldClip := self clippingRectangleOrNil. |
|
1458 |
self clippingRectangle:(margin@margin extent:(width-margin) @ (height-margin)). |
|
1459 |
||
1460 |
cursorType == #caret ifTrue:[ |
|
1461 |
self lineWidth:2. |
|
1462 |
self displayLineFromX:x1 y:y2 toX:x y:y. |
|
1463 |
self displayLineFromX:x y:y toX:x2 y:y2. |
|
1464 |
] ifFalse:[ |
|
1465 |
"anything else: solidCaret" |
|
1466 |
||
1467 |
self fillPolygon:(Array with:(x1 @ y2) |
|
1468 |
with:(x @ y) |
|
1469 |
with:(x2 @ y2)) |
|
1470 |
]. |
|
1471 |
||
1472 |
self clippingRectangle:oldClip |
|
121 | 1473 |
]. |
133 | 1474 |
self paint:oldPaint. |
662
4bcdf0cce3a7
dont let caret cursor become too small (with small fonts)
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
1475 |
|
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
1476 |
"Modified: 18.2.1997 / 15:19:03 / cg" |
121 | 1477 |
! |
1478 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1479 |
drawCursorCharacter |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1480 |
"draw the cursor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1481 |
(i.e. the cursor if no selection) |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1482 |
- helper for many cursor methods" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1483 |
|
1817
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
1484 |
(hasKeyboardFocus |
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
1485 |
and:[self enabled |
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
1486 |
and:[readOnly not]]) ifTrue:[ |
2010 | 1487 |
self drawFocusCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1488 |
] ifFalse:[ |
2010 | 1489 |
self drawNoFocusCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1490 |
] |
1817
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
1491 |
|
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
1492 |
"Modified: / 23.3.1999 / 13:52:48 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1493 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1494 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1495 |
drawFocusCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1496 |
"draw the cursor when the focus is in the view." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1497 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1498 |
self hasSelection ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1499 |
^ super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
1334 | 1500 |
]. |
1501 |
cursorType == #none ifTrue:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1502 |
^ self undrawCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1503 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1504 |
self drawCursor:cursorType with:cursorFgColor and:cursorBgColor. |
1334 | 1505 |
|
1506 |
"Modified: 22.9.1997 / 00:16:38 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1507 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1508 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1509 |
drawNoFocusCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1510 |
"draw the cursor for the case when the view has no keyboard focus" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1511 |
|
1334 | 1512 |
|cType| |
1513 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1514 |
self hasSelection ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1515 |
^ super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
121 | 1516 |
]. |
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
1517 |
|
1334 | 1518 |
cType := cursorTypeNoFocus ? cursorType. |
1519 |
cType == #none ifTrue:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1520 |
^ self undrawCursor |
1334 | 1521 |
]. |
1522 |
||
1523 |
cType == #block ifTrue:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1524 |
^ self drawCursor:#frame with:cursorNoFocusFgColor and:cursorBgColor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1525 |
]. |
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
1526 |
|
1334 | 1527 |
^ self drawCursor:cType with:cursorNoFocusFgColor and:cursorNoFocusFgColor. |
1528 |
||
1529 |
"Modified: 22.9.1997 / 00:16:13 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1530 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1531 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1532 |
gotoLine:aLineNumber |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1533 |
"position cursor onto line, aLineNumber. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1534 |
Make certain that this line is visible" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1535 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1536 |
self makeLineVisible:aLineNumber. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1537 |
self cursorLine:aLineNumber col:1 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1538 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1539 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1540 |
hideCursor |
1833 | 1541 |
"make cursor invisible if currently invisible" |
1542 |
||
1543 |
^ self cursorShown:false |
|
1544 |
||
1545 |
"Modified: / 30.3.1999 / 16:02:28 / stefan" |
|
121 | 1546 |
! |
1547 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1548 |
makeCursorVisible |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1549 |
"scroll text to make cursorline visible |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1550 |
(i.e. to have cursorLine in visible area)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1551 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1552 |
|line col| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1553 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1554 |
cursorLine notNil ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1555 |
line := cursorLine. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1556 |
col := cursorCol. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1557 |
" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1558 |
if there is a selection, its better to |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1559 |
have its start being visible, instead of the end |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1560 |
" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1561 |
(selectionStartLine notNil |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1562 |
and:[selectionEndLine notNil]) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1563 |
expandingTop ~~ false ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1564 |
line := selectionStartLine. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1565 |
col := selectionStartCol. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1566 |
] ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1567 |
line := selectionEndLine. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1568 |
col := selectionEndCol |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1569 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1570 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1571 |
self makeLineVisible:line. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1572 |
self makeColVisible:col inLine:line |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1573 |
] |
479
fae6d1251888
fixed Shift-Cursor selection & show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1574 |
|
fae6d1251888
fixed Shift-Cursor selection & show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1575 |
"Modified: 6.3.1996 / 13:46:46 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1576 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1577 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1578 |
makeCursorVisibleAndShowCursor:flag |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1579 |
"scroll to make cursorLine visible; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1580 |
if flag is true, draw the cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1581 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1582 |
self makeCursorVisible. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1583 |
flag ifTrue:[self showCursor] |
121 | 1584 |
! |
1585 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1586 |
showCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1587 |
"make cursor visible if currently invisible" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1588 |
|
1833 | 1589 |
^ self cursorShown:true |
1590 |
||
1591 |
"Modified: / 30.3.1999 / 16:02:34 / stefan" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1592 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1593 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1594 |
undrawCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1595 |
"undraw the cursor (i.e. redraw the character(s) under the cursor)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1596 |
|
1495
3b79070e35e4
fixed drawing of italics under cursor
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
1597 |
|prevCol line oldClip x y| |
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
1598 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1599 |
cursorVisibleLine notNil ifTrue:[ |
2010 | 1600 |
prevCol := cursorCol - 1. |
1601 |
||
1602 |
((cursorType == #caret) |
|
1603 |
or:[cursorType == #solidCaret |
|
1604 |
or:[cursorType == #bigSolidCaret |
|
1605 |
or:[cursorType == #bigCaret |
|
1606 |
or:[cursorType == #Ibeam]]]]) ifTrue:[ |
|
1607 |
"caret-cursor touches 4 characters" |
|
1608 |
((cursorCol > 1) and:[fontIsFixedWidth]) ifTrue:[ |
|
1609 |
super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol. |
|
1610 |
super redrawVisibleLine:cursorVisibleLine+1 from:prevCol to:cursorCol. |
|
1611 |
] ifFalse:[ |
|
1612 |
"care for left margin" |
|
1613 |
super redrawVisibleLine:cursorVisibleLine; redrawVisibleLine:cursorVisibleLine+1. |
|
1614 |
]. |
|
1615 |
^ self |
|
1616 |
]. |
|
1617 |
||
1618 |
cursorType == #ibeam ifTrue:[ |
|
1619 |
"ibeam-cursor touches 2 characters" |
|
1620 |
cursorCol > 1 ifTrue:[ |
|
1621 |
super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol. |
|
1622 |
] ifFalse:[ |
|
1623 |
"care for left margin" |
|
1624 |
super redrawVisibleLine:cursorVisibleLine. |
|
1625 |
]. |
|
1626 |
^ self |
|
1627 |
]. |
|
1628 |
||
1629 |
"block cursor is simple - just one character under cursor" |
|
1630 |
||
1631 |
"/ however, if italic characters are involved, we must care |
|
1632 |
"/ for the chars before/after the cursor. |
|
1633 |
"/ We redraw the part of the previous character which got |
|
1634 |
"/ detroyed by the block cursor. |
|
1635 |
"/ (must change the clip, to avoid destroying the prev-prev character) |
|
1636 |
||
1637 |
line := self visibleAt:cursorVisibleLine. |
|
1638 |
(line notNil and:[line isText]) ifTrue:[ |
|
1639 |
cursorCol > 1 ifTrue:[ |
|
1640 |
oldClip := self clippingRectangleOrNil. |
|
1641 |
x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - leftOffset. |
|
1642 |
y := self yOfVisibleLine:cursorVisibleLine. |
|
1643 |
self clippingRectangle:(x@y extent:((font width * 2) @ fontHeight)). |
|
1644 |
super redrawVisibleLine:cursorVisibleLine from:cursorCol-1 to:cursorCol. |
|
1645 |
self clippingRectangle:oldClip. |
|
1646 |
^ self. |
|
1647 |
]. |
|
1648 |
]. |
|
1649 |
super redrawVisibleLine:cursorVisibleLine col:cursorCol |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1650 |
] |
728
3ef81000ee8c
new cursorTypes: #bigCaret and #bigSolidCaret
Claus Gittinger <cg@exept.de>
parents:
698
diff
changeset
|
1651 |
|
1495
3b79070e35e4
fixed drawing of italics under cursor
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
1652 |
"Modified: / 22.4.1998 / 09:13:07 / cg" |
121 | 1653 |
! |
1654 |
||
672 | 1655 |
validateCursorCol:col inLine:line |
674 | 1656 |
"check of col is a valid cursor position; return a new col-nr if not. |
1657 |
Here, no limits are enforced (and col is returned), |
|
1658 |
but it may be redefined in EditFields or views which dont like the |
|
1659 |
cursor to be positioned behind the end of a textLine (vi/st-80 behavior)" |
|
672 | 1660 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1661 |
|l max| |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1662 |
|
1419 | 1663 |
"/ in ST80 mode, |
1664 |
"/ the cursor may not be positioned behond the |
|
1665 |
"/ end of a line or behond the last line of the text |
|
1666 |
"/ |
|
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
1667 |
st80Mode == true ifTrue:[ |
2010 | 1668 |
l := (self listAt:line). |
1669 |
max := l size + 1. |
|
1670 |
col > max ifTrue:[ |
|
1671 |
^ max |
|
1672 |
] |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1673 |
]. |
672 | 1674 |
^ col |
1675 |
||
1419 | 1676 |
"Created: / 22.5.1996 / 14:25:30 / cg" |
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
1677 |
"Modified: / 20.6.1998 / 18:19:24 / cg" |
674 | 1678 |
! |
1679 |
||
1680 |
validateCursorLine:line |
|
1681 |
"check of line is a valid cursor line; return a fixed line-nr if not. |
|
1682 |
Here, no limits are enforced (and line is returned), but it may be |
|
1683 |
redefined in views which dont like the cursor to be positioned |
|
1684 |
behind the end of the text (vi/st-80 behavior), or want to |
|
1685 |
skip reserved regions" |
|
1686 |
||
1419 | 1687 |
"/ |
1688 |
"/ in st80Mode, the cursor may not be positioned |
|
1689 |
"/ behond the last line |
|
1690 |
"/ |
|
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
1691 |
st80Mode == true ifTrue:[ |
2010 | 1692 |
^ (line min:(list size)) max:1 |
1419 | 1693 |
]. |
674 | 1694 |
^ line |
1695 |
||
1419 | 1696 |
"Created: / 22.5.1996 / 18:22:23 / cg" |
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
1697 |
"Modified: / 20.6.1998 / 18:19:26 / cg" |
672 | 1698 |
! |
1699 |
||
121 | 1700 |
withCursorOffDo:aBlock |
1701 |
"evaluate aBlock with cursor off; turn it on afterwards." |
|
1702 |
||
1703 |
(shown not or:[cursorShown not]) ifTrue:[ |
|
1704 |
^ aBlock value |
|
1705 |
]. |
|
1706 |
self hideCursor. |
|
1707 |
aBlock valueNowOrOnUnwindDo:[ |
|
1708 |
self showCursor |
|
1709 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1710 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1711 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1712 |
!EditTextView methodsFor:'editing'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1713 |
|
313
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1714 |
copyAndDeleteSelection |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1715 |
"copy the selection into the pastBuffer and delete it" |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1716 |
|
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1717 |
selectionStartLine notNil ifTrue:[ |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1718 |
self setTextSelection:(self selection). |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1719 |
self deleteSelection. |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1720 |
]. |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1721 |
|
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1722 |
"Created: 27.1.1996 / 16:23:28 / cg" |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1723 |
! |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1724 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1725 |
deleteCharAtCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1726 |
"delete single character under cursor; does not merge lines" |
121 | 1727 |
|
1728 |
|wasOn| |
|
1729 |
||
1730 |
wasOn := self hideCursor. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1731 |
self deleteCharAtLine:cursorLine col:cursorCol. |
121 | 1732 |
wasOn ifTrue:[self showCursor] |
1733 |
! |
|
1734 |
||
827 | 1735 |
deleteCharAtLine:lineNr col:colNr |
1736 |
"delete a single character at colNr in line lineNr" |
|
1737 |
||
1738 |
self deleteCharsAtLine:lineNr fromCol:colNr toCol:colNr |
|
1739 |
! |
|
1740 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1741 |
deleteCharBeforeCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1742 |
"delete single character to the left of cursor and move cursor to left" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1743 |
|
827 | 1744 |
|soCol wasOn lineNrAboveCursor ln| |
121 | 1745 |
|
1746 |
wasOn := self hideCursor. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1747 |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1748 |
(autoIndent |
827 | 1749 |
and:[cursorCol ~~ 1 |
1750 |
and:[cursorLine <= (list size)]]) |
|
1751 |
ifTrue:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1752 |
soCol := (self leftIndentForLine:cursorLine) + 1. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1753 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1754 |
(cursorCol == soCol and:[soCol > 1]) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1755 |
ln := list at:cursorLine. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1756 |
(ln notNil and:[(ln indexOfNonSeparatorStartingAt:1) < soCol]) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1757 |
soCol := 1 |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1758 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1759 |
] |
827 | 1760 |
] ifFalse:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1761 |
soCol := 1 |
827 | 1762 |
]. |
1763 |
||
1419 | 1764 |
(cursorCol ~~ soCol and:[cursorCol ~~ 1]) ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1765 |
" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1766 |
somewhere in the middle of a line |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1767 |
" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1768 |
self cursorLeft. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1769 |
self deleteCharAtLine:cursorLine col:cursorCol. |
1419 | 1770 |
] ifFalse:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1771 |
" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1772 |
at begin of line - merge with previous line; |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1773 |
except for the very first line. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1774 |
" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1775 |
(cursorLine == 1) ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1776 |
lineNrAboveCursor := self validateCursorLine:(cursorLine - 1). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1777 |
lineNrAboveCursor < cursorLine ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1778 |
self mergeLine:lineNrAboveCursor removeBlanks:false. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1779 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1780 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1781 |
]. |
827 | 1782 |
wasOn ifTrue:[ self showCursor ] |
1783 |
||
1419 | 1784 |
"Modified: / 16.1.1998 / 22:33:04 / cg" |
827 | 1785 |
! |
1786 |
||
1787 |
deleteCharsAtLine:lineNr fromCol:colNr |
|
1788 |
"delete characters from colNr up to the end in line lineNr" |
|
1789 |
||
1790 |
|line| |
|
1791 |
||
1792 |
(line := self listAt:lineNr) notNil ifTrue:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1793 |
self deleteCharsAtLine:lineNr fromCol:colNr toCol:(line size) |
827 | 1794 |
] |
1795 |
||
1796 |
! |
|
1797 |
||
1798 |
deleteCharsAtLine:lineNr toCol:colNr |
|
1799 |
"delete characters from start up to colNr in line lineNr" |
|
1800 |
||
1801 |
self deleteCharsAtLine:lineNr fromCol:1 toCol:colNr |
|
1802 |
||
1803 |
||
121 | 1804 |
! |
1805 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1806 |
deleteCursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1807 |
"delete the line where the cursor sits" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1808 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1809 |
self deleteLine:cursorLine |
121 | 1810 |
! |
1811 |
||
827 | 1812 |
deleteLine:lineNr |
1813 |
"delete line" |
|
1814 |
||
1815 |
self deleteFromLine:lineNr toLine:lineNr |
|
1816 |
||
1817 |
||
1818 |
! |
|
1819 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1820 |
deleteLinesWithoutRedrawFrom:startLine to:endLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1821 |
"delete lines - no redraw; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1822 |
return true, if something was really deleted" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1823 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1824 |
|lastLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1825 |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
1826 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
1827 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1828 |
(list isNil or:[startLine > list size]) ifTrue:[^ false]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1829 |
(endLine > list size) ifTrue:[ |
2010 | 1830 |
lastLine := list size |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1831 |
] ifFalse:[ |
2010 | 1832 |
lastLine := endLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1833 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1834 |
list removeFromIndex:startLine toIndex:lastLine. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
1835 |
"/ TODO: remember old maxwidth of linerange, |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
1836 |
"/ only clear widthOfWidestLine, if this max |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
1837 |
"/ length was (one of) the longest. |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
1838 |
"/ avoids slow delete with huge texts. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1839 |
widthOfWidestLine := nil. "/ i.e. unknown |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1840 |
self textChanged. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1841 |
^ true |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
1842 |
|
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
1843 |
"Modified: / 10.11.1998 / 23:55:29 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1844 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1845 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1846 |
deleteSelection |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1847 |
"delete the selection" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1848 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1849 |
|wasOn startLine startCol endLine endCol| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1850 |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
1851 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
1852 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1853 |
selectionStartLine notNil ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1854 |
wasOn := self hideCursor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1855 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1856 |
startLine := selectionStartLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1857 |
startCol := selectionStartCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1858 |
endLine := selectionEndLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1859 |
endCol := selectionEndCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1860 |
self unselectWithoutRedraw. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1861 |
self deleteFromLine:startLine col:startCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1862 |
toLine:endLine col:endCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1863 |
cursorCol := startCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1864 |
cursorLine := startLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1865 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1866 |
self makeCursorVisibleAndShowCursor:wasOn |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1867 |
] |
121 | 1868 |
! |
1869 |
||
1870 |
insertCharAtCursor:aCharacter |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
1871 |
"insert a single character at cursor-position - advance cursor." |
121 | 1872 |
|
1873 |
|wasOn| |
|
1874 |
||
1875 |
wasOn := self hideCursor. |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
1876 |
aCharacter == Character tab ifTrue:[ |
2010 | 1877 |
"/ needs special care to advance cursor correctly |
1878 |
self insertTabAtCursor |
|
121 | 1879 |
] ifFalse:[ |
2010 | 1880 |
self insert:aCharacter atLine:cursorLine col:cursorCol. |
1881 |
aCharacter == (Character cr) ifTrue:[ |
|
1882 |
self cursorReturn |
|
1883 |
] ifFalse:[ |
|
1884 |
self cursorRight. |
|
1885 |
]. |
|
121 | 1886 |
]. |
1887 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
1888 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
1889 |
"Modified: / 12.6.1998 / 21:50:20 / cg" |
121 | 1890 |
! |
1891 |
||
641 | 1892 |
insertLine:aString before:lineNr |
1893 |
"insert the line aString before line lineNr" |
|
1894 |
||
1895 |
^ self insertLines:(Array with:aString) from:1 to:1 before:lineNr. |
|
1896 |
||
1897 |
"Modified: 14.5.1996 / 13:42:54 / cg" |
|
1898 |
! |
|
1899 |
||
155 | 1900 |
insertLines:aStringCollection before:lineNr |
1901 |
"insert a bunch before line lineNr" |
|
1902 |
||
1903 |
self insertLines:aStringCollection from:1 to:aStringCollection size before:lineNr |
|
1904 |
||
1905 |
"Modified: 6.9.1995 / 20:51:03 / claus" |
|
1906 |
! |
|
1907 |
||
654 | 1908 |
insertLines:lines withCR:withCr |
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
1909 |
"insert a bunch of lines at cursor position. |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
1910 |
Cursor is moved behind insertion. |
641 | 1911 |
If withCr is true, append cr after last line" |
1912 |
||
1913 |
|start end nLines wasOn| |
|
1914 |
||
1915 |
lines notNil ifTrue:[ |
|
2010 | 1916 |
nLines := lines size. |
1917 |
(nLines == 1) ifTrue:[ |
|
1918 |
self insertStringAtCursor:(lines at:1). |
|
1919 |
withCr ifTrue:[ |
|
1920 |
self insertCharAtCursor:(Character cr) |
|
1921 |
] |
|
1922 |
] ifFalse:[ |
|
1923 |
(cursorCol ~~ 1) ifTrue:[ |
|
1924 |
self insertStringAtCursor:(lines at:1). |
|
1925 |
self insertCharAtCursor:(Character cr). |
|
1926 |
start := 2 |
|
1927 |
] ifFalse:[ |
|
1928 |
start := 1 |
|
1929 |
]. |
|
1930 |
withCr ifTrue:[ |
|
1931 |
end := nLines |
|
1932 |
] ifFalse:[ |
|
1933 |
end := nLines - 1 |
|
1934 |
]. |
|
1935 |
(start < nLines) ifTrue:[ |
|
1936 |
(end >= start) ifTrue:[ |
|
1937 |
wasOn := self hideCursor. |
|
1938 |
self insertLines:lines from:start to:end before:cursorLine. |
|
1939 |
cursorLine := cursorLine + (end - start + 1). |
|
1940 |
cursorVisibleLine := self absoluteLineToVisibleLine:cursorLine. |
|
1941 |
wasOn ifTrue:[self showCursor]. |
|
1942 |
] |
|
1943 |
]. |
|
1944 |
withCr ifFalse:[ |
|
1945 |
"last line without cr" |
|
1946 |
self insertStringAtCursor:(lines at:nLines) |
|
1947 |
] |
|
1948 |
] |
|
641 | 1949 |
] |
654 | 1950 |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
1951 |
"Created: / 18.5.1996 / 15:32:06 / cg" |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
1952 |
"Modified: / 12.6.1998 / 21:51:16 / cg" |
654 | 1953 |
! |
1954 |
||
1955 |
insertLines:lines withCr:withCr |
|
1956 |
"insert a bunch of lines at cursor position. Cursor |
|
1957 |
is moved behind insertion. |
|
1958 |
If withCr is true, append cr after last line" |
|
1959 |
||
1292 | 1960 |
self obsoleteMethodWarning:'use #insertLines:withCR:'. |
1961 |
self insertLines:lines withCR:withCr. |
|
1962 |
||
1963 |
"Modified: 31.7.1997 / 23:07:22 / cg" |
|
641 | 1964 |
! |
1965 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1966 |
insertSelectedStringAtCursor:aString |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1967 |
"insert the argument, aString at cursor position and select it" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1968 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1969 |
|startLine startCol| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1970 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1971 |
startLine := cursorLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1972 |
startCol := cursorCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1973 |
self insertStringAtCursor:aString. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1974 |
self selectFromLine:startLine col:startCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1975 |
toLine:cursorLine col:(cursorCol - 1) |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1976 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1977 |
|
1935
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
1978 |
insertString:aString atCharacterPosition:charPos |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
1979 |
"insert the argument, aString at a character position" |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
1980 |
|
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
1981 |
|line col| |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
1982 |
|
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
1983 |
line := self lineOfCharacterPosition:charPos. |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
1984 |
col := charPos - (self characterPositionOfLine:line col:1) + 1. |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
1985 |
self insertString:aString atLine:line col:col |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
1986 |
! |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
1987 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1988 |
insertString:aString atLine:lineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1989 |
"insert the string, aString at line/col; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1990 |
handle cr's correctly" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1991 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1992 |
|start "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1993 |
stop "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1994 |
end "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1995 |
subString c |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1996 |
l "{ Class: SmallInteger }" | |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1997 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1998 |
aString isNil ifTrue:[^ self]. |
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
1999 |
(aString includes:(Character cr)) ifFalse:[ |
2010 | 2000 |
^ self insertStringWithoutCRs:aString atLine:lineNr col:colNr |
121 | 2001 |
]. |
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2002 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2003 |
l := lineNr. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2004 |
c := colNr. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2005 |
start := 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2006 |
end := aString size. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2007 |
[start <= end] whileTrue:[ |
2010 | 2008 |
stop := aString indexOf:(Character cr) startingAt:start. |
2009 |
stop == 0 ifTrue:[ |
|
2010 |
stop := end + 1 |
|
2011 |
]. |
|
2012 |
subString := aString copyFrom:start to:(stop - 1). |
|
2013 |
self insertStringWithoutCRs:subString atLine:l col:c. |
|
2014 |
(stop <= end) ifTrue:[ |
|
2015 |
c := c + subString size. |
|
2016 |
self insert:(Character cr) atLine:l col:c. |
|
2017 |
l := l + 1. |
|
2018 |
c := 1 |
|
2019 |
]. |
|
2020 |
start := stop + 1 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2021 |
] |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
2022 |
|
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2023 |
"Modified: / 10.6.1998 / 19:03:59 / cg" |
121 | 2024 |
! |
2025 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2026 |
insertStringAtCursor:aString |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2027 |
"insert the argument, aString at cursor position |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2028 |
handle cr's correctly. A nil argument is interpreted as an empty line." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2029 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2030 |
aString isNil ifTrue:[ |
2010 | 2031 |
"new:" |
2032 |
self insertCharAtCursor:(Character cr). |
|
2033 |
^ self |
|
105 | 2034 |
]. |
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2035 |
(aString includes:(Character cr)) ifFalse:[ |
2010 | 2036 |
^ self insertStringWithoutCRsAtCursor:aString |
105 | 2037 |
]. |
2038 |
||
654 | 2039 |
self insertLines:aString asStringCollection withCR:false. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2040 |
|
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2041 |
"Modified: / 10.6.1998 / 19:03:21 / cg" |
105 | 2042 |
! |
2043 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2044 |
insertStringWithoutCRs:aString atLine:lineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2045 |
"insert aString (which has no crs) at lineNr/colNr" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2046 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2047 |
self withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2048 |
shown ifTrue:[self redrawLine:lineNr from:colNr] |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
2049 |
|
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
2050 |
"Modified: / 5.4.1998 / 16:51:14 / cg" |
105 | 2051 |
! |
2052 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2053 |
insertStringWithoutCRsAtCursor:aString |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2054 |
"insert a string (which has no crs) at cursor position |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2055 |
- advance cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2056 |
|
1563
b4eb49efdfcd
fixed cursor positioning if inserting a string with tabs.
Claus Gittinger <cg@exept.de>
parents:
1561
diff
changeset
|
2057 |
|wasOn oldLen newLen| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2058 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2059 |
aString notNil ifTrue:[ |
2010 | 2060 |
wasOn := self hideCursor. |
2061 |
(aString includes:Character tab) ifTrue:[ |
|
2062 |
self checkForExistingLine:cursorLine. |
|
2063 |
oldLen := (list at:cursorLine) size. |
|
2064 |
self insertString:aString atLine:cursorLine col:cursorCol. |
|
2065 |
newLen := (list at:cursorLine) size. |
|
2066 |
cursorCol := cursorCol + (newLen - oldLen). |
|
2067 |
] ifFalse:[ |
|
2068 |
self insertString:aString atLine:cursorLine col:cursorCol. |
|
2069 |
cursorCol := cursorCol + aString size. |
|
2070 |
]. |
|
2071 |
wasOn ifTrue:[self showCursor] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2072 |
] |
1563
b4eb49efdfcd
fixed cursor positioning if inserting a string with tabs.
Claus Gittinger <cg@exept.de>
parents:
1561
diff
changeset
|
2073 |
|
b4eb49efdfcd
fixed cursor positioning if inserting a string with tabs.
Claus Gittinger <cg@exept.de>
parents:
1561
diff
changeset
|
2074 |
"Modified: / 10.6.1998 / 20:43:52 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2075 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2076 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2077 |
insertTabAtCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2078 |
"insert spaces to next tab" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2079 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2080 |
|wasOn nextTab| |
105 | 2081 |
|
121 | 2082 |
wasOn := self hideCursor. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2083 |
nextTab := self nextTabAfter:cursorCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2084 |
self insertStringAtCursor:(String new:(nextTab - cursorCol)). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2085 |
self makeCursorVisibleAndShowCursor:wasOn. |
105 | 2086 |
! |
2087 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2088 |
removeTrailingBlankLines |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2089 |
"remove all blank lines at end of text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2090 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2091 |
|lastLine "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2092 |
line finished| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2093 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2094 |
lastLine := list size. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2095 |
finished := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2096 |
[finished] whileFalse:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2097 |
(lastLine <= 1) ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2098 |
finished := true |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2099 |
] ifFalse:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2100 |
line := list at:lastLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2101 |
line notNil ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2102 |
line isBlank ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2103 |
list at:lastLine put:nil. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2104 |
line := nil |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2105 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2106 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2107 |
line notNil ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2108 |
finished := true |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2109 |
] ifFalse:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2110 |
lastLine := lastLine - 1 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2111 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2112 |
] |
118 | 2113 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2114 |
(lastLine ~~ list size) ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2115 |
list grow:lastLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2116 |
"/ self textChanged |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2117 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2118 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2119 |
|
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2120 |
replaceCharAtCursor:aCharacter |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2121 |
"replace a single character at cursor-position - advance cursor" |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2122 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2123 |
|wasOn| |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2124 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2125 |
wasOn := self hideCursor. |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2126 |
aCharacter == (Character cr) ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2127 |
self cursorReturn |
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2128 |
] ifFalse:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2129 |
self replace:aCharacter atLine:cursorLine col:cursorCol. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2130 |
self cursorRight. |
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2131 |
]. |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2132 |
self makeCursorVisibleAndShowCursor:wasOn. |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2133 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2134 |
"Created: 6.3.1996 / 12:27:42 / cg" |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2135 |
! |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2136 |
|
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2137 |
replaceLines:lines withCR:withCr |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2138 |
"replace a bunch of lines at cursor position. Cursor |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2139 |
is moved behind replacement. |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2140 |
If withCr is true, move to the beginning of the next line |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2141 |
after the last line" |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2142 |
|
1809 | 2143 |
|line col nLines wasOn| |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2144 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2145 |
lines notNil ifTrue:[ |
2010 | 2146 |
wasOn := self hideCursor. |
2147 |
nLines := lines size. |
|
2148 |
line := cursorLine. |
|
2149 |
col := cursorCol. |
|
2150 |
lines keysAndValuesDo:[:i :l | |
|
2151 |
self replaceString:l atLine:line col:col. |
|
2152 |
(i ~~ nLines or:[withCr]) ifTrue:[ |
|
2153 |
line := line + 1. |
|
2154 |
col := 1. |
|
2155 |
] ifFalse:[ |
|
2156 |
col := col + (l size). |
|
2157 |
] |
|
2158 |
]. |
|
2159 |
self cursorLine:line col:col. |
|
2160 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
2161 |
"/ wasOn ifTrue:[self showCursor]. |
|
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2162 |
] |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2163 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2164 |
"Created: / 18.5.1996 / 15:32:06 / cg" |
1567
0eff7ca88e89
much faster multi-line replace (avoid scroll)
Claus Gittinger <cg@exept.de>
parents:
1566
diff
changeset
|
2165 |
"Modified: / 12.6.1998 / 22:05:51 / cg" |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2166 |
! |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2167 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2168 |
replaceSelectionBy:something |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2169 |
"delete the selection (if any) and insert something, a character or string; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2170 |
leave cursor after insertion" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2171 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2172 |
self replaceSelectionBy:something keepCursor:false |
105 | 2173 |
! |
2174 |
||
2175 |
replaceSelectionBy:something keepCursor:keep |
|
2176 |
"delete the selection (if any) and insert something, a character or string; |
|
2177 |
leave cursor after insertion or leave it, depending on keep" |
|
2178 |
||
2179 |
|sel l c| |
|
2180 |
||
2181 |
l := cursorLine. |
|
2182 |
c := cursorCol. |
|
2183 |
||
2184 |
sel := self selection. |
|
2185 |
sel notNil ifTrue:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2186 |
lastString := sel. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2187 |
self deleteSelection. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2188 |
replacing := true. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2189 |
lastReplacement := '' |
105 | 2190 |
]. |
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
2191 |
|
105 | 2192 |
(something isMemberOf:Character) ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2193 |
lastReplacement notNil ifTrue:[ |
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
2194 |
"/ "XXX - replacing text with spaces ..." |
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
2195 |
"/ (lastReplacement endsWith:Character space) ifTrue:[ |
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
2196 |
"/ lastReplacement := lastReplacement copyWithoutLast:1 "copyTo:(lastReplacement size - 1)". |
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
2197 |
"/ lastReplacement := lastReplacement copyWith:something. |
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
2198 |
"/ lastReplacement := lastReplacement copyWith:Character space |
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
2199 |
"/ ] ifFalse:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2200 |
lastReplacement := lastReplacement copyWith:something. |
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
2201 |
"/ ] |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2202 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2203 |
insertMode ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2204 |
self insertCharAtCursor:something |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2205 |
] ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2206 |
self replaceCharAtCursor:something |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2207 |
] |
105 | 2208 |
] ifFalse:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2209 |
lastReplacement := something. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2210 |
insertMode ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2211 |
self insertStringAtCursor:something |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2212 |
] ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2213 |
self replaceStringAtCursor |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2214 |
] |
105 | 2215 |
]. |
2216 |
keep ifTrue:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2217 |
self cursorLine:l col:c |
105 | 2218 |
] |
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
2219 |
|
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
2220 |
"Modified: 9.10.1996 / 16:14:35 / cg" |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2221 |
! |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2222 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2223 |
replaceStringAtCursor:aString |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2224 |
"replace multiple characters at cursor-position - advance cursor" |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2225 |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2226 |
|wasOn i1 i2| |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2227 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2228 |
wasOn := self hideCursor. |
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2229 |
(aString includes:Character tab) ifTrue:[ |
2010 | 2230 |
"/ need special care for TAB (to move cursor correctly) |
2231 |
i1 := 1. |
|
2232 |
[i1 ~~ 0] whileTrue:[ |
|
2233 |
i2 := aString indexOf:Character tab startingAt:i1. |
|
2234 |
i2 ~~ 0 ifTrue:[ |
|
2235 |
i1 ~~ i2 ifTrue:[ |
|
2236 |
self replaceString:(aString copyFrom:i1 to:i2-1) atLine:cursorLine col:cursorCol. |
|
2237 |
self cursorCol:(cursorCol + (i2 - i1)). |
|
2238 |
]. |
|
2239 |
self replaceTABAtCursor. |
|
2240 |
i2 := i2 + 1. |
|
2241 |
] ifFalse:[ |
|
2242 |
self replaceString:(aString copyFrom:i1) atLine:cursorLine col:cursorCol. |
|
2243 |
self cursorCol:(cursorCol + (aString size - i1 + 1)). |
|
2244 |
]. |
|
2245 |
i1 := i2. |
|
2246 |
] |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2247 |
] ifFalse:[ |
2010 | 2248 |
self replaceString:aString atLine:cursorLine col:cursorCol. |
2249 |
self cursorCol:(cursorCol + aString size). |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2250 |
]. |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2251 |
self makeCursorVisibleAndShowCursor:wasOn. |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2252 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2253 |
"Created: / 9.6.1998 / 20:33:20 / cg" |
1597
5fdcfcedb91c
fixed cursor positioning after replaceStringAtCursor.
Claus Gittinger <cg@exept.de>
parents:
1596
diff
changeset
|
2254 |
"Modified: / 20.6.1998 / 19:41:02 / cg" |
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2255 |
! |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2256 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2257 |
replaceTABAtCursor |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2258 |
"replace a single character at cursor-position by a TAB character" |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2259 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2260 |
|wasOn nextTab| |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2261 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2262 |
wasOn := self hideCursor. |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2263 |
nextTab := self nextTabAfter:cursorCol. |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2264 |
self replaceStringAtCursor:(String new:(nextTab - cursorCol)). |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2265 |
self makeCursorVisibleAndShowCursor:wasOn. |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2266 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2267 |
"Created: / 12.6.1998 / 21:53:23 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2268 |
! ! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2269 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2270 |
!EditTextView methodsFor:'editing - basic'! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2271 |
|
827 | 2272 |
deleteCharsAtLine:lineNr fromCol:startCol toCol:endCol |
2273 |
"delete characters from startCol to endCol in line lineNr |
|
2274 |
" |
|
1803
ac7cc1b99407
scroll left as required, if deleting characters of the longest line,
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
2275 |
|line lineSize newLine start stop prevWidth newWidth| |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2276 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2277 |
line := self listAt:lineNr. |
827 | 2278 |
|
2279 |
(self checkModificationsAllowed and:[line notNil]) ifTrue:[ |
|
2010 | 2280 |
lineSize := line size. |
2281 |
||
2282 |
startCol == 0 ifFalse:[ start := startCol ] |
|
2283 |
ifTrue:[ start := 1 ]. |
|
2284 |
||
2285 |
endCol > lineSize ifFalse:[ stop := endCol ] |
|
2286 |
ifTrue:[ stop := lineSize ]. |
|
2287 |
||
2288 |
stop >= start ifTrue:[ |
|
2289 |
start ~~ 1 ifTrue:[ newLine := line copyFrom:1 to:(start-1) ] |
|
2290 |
ifFalse:[ newLine := '' ]. |
|
2291 |
||
2292 |
stop == lineSize ifFalse:[ |
|
2293 |
line bitsPerCharacter > newLine bitsPerCharacter ifTrue:[ |
|
2294 |
newLine := line string species fromString:newLine. |
|
2295 |
]. |
|
2296 |
newLine := newLine, (line copyFrom:(stop + 1) to:lineSize) |
|
2297 |
]. |
|
2298 |
||
2299 |
(trimBlankLines and:[newLine isBlank]) ifTrue:[ |
|
2300 |
newLine := nil |
|
2301 |
]. |
|
2302 |
||
2303 |
prevWidth := self widthOfLine:lineNr. |
|
2304 |
||
2305 |
list at:lineNr put:newLine. |
|
2306 |
||
2307 |
(prevWidth = widthOfWidestLine) ifTrue:[ |
|
2308 |
"/ remember old width of this line, |
|
2309 |
"/ only clear widthOfWidestLine, if this lines |
|
2310 |
"/ length was (one of) the longest. |
|
2311 |
"/ avoids slow delete with huge texts. |
|
2312 |
widthOfWidestLine := nil. "i.e. unknown" |
|
2313 |
||
2314 |
"/ scroll left if reqiured |
|
2315 |
viewOrigin x > 0 ifTrue:[ |
|
2316 |
newWidth := self widthOfLine:lineNr. |
|
2317 |
newWidth < (viewOrigin x + width) ifTrue:[ |
|
2318 |
self scrollHorizontalTo:(newWidth |
|
2319 |
- width |
|
2320 |
+ margin + margin |
|
2321 |
+ (font widthOf:' ')) |
|
2322 |
] |
|
2323 |
]. |
|
2324 |
]. |
|
2325 |
self textChanged. |
|
2326 |
self redrawLine:lineNr from:start. |
|
2327 |
||
2328 |
] |
|
827 | 2329 |
] |
2330 |
||
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2331 |
"Modified: / 11.11.1998 / 00:01:09 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2332 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2333 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2334 |
deleteFromLine:startLine col:startCol toLine:endLine col:endCol |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2335 |
"delete all text from startLine/startCol to endLine/endCol - |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2336 |
joining lines if nescessary" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2337 |
|
1818
aa16d9b96e40
fixed cut to not compress multiple blanks.
Claus Gittinger <cg@exept.de>
parents:
1817
diff
changeset
|
2338 |
|line newLine lineSize nMore| |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2339 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2340 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2341 |
list isNil ifTrue:[^ self]. |
960
29a592101ad4
care for deleting a selection behond the texts end
Claus Gittinger <cg@exept.de>
parents:
947
diff
changeset
|
2342 |
startLine > list size ifTrue:[ ^ self]. "/ deleted space below text |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2343 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2344 |
(startLine == endLine) ifTrue:[ |
2010 | 2345 |
"/ delete chars within a line |
2346 |
self deleteCharsAtLine:startLine fromCol:startCol toCol:endCol. |
|
2347 |
^ self |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2348 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2349 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2350 |
((startCol == 1) and:[endCol == 0]) ifTrue:[ |
2010 | 2351 |
"/ delete full lines only |
2352 |
endLine > startLine ifTrue:[ |
|
2353 |
self deleteFromLine:startLine toLine:(endLine - 1) |
|
2354 |
]. |
|
2355 |
^ self |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2356 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2357 |
|
641 | 2358 |
"/ delete right rest of 1st line |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2359 |
self deleteCharsAtLine:startLine fromCol:startCol. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2360 |
|
641 | 2361 |
"/ delete the inner lines ... |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2362 |
endLine > (startLine + 1) ifTrue:[ |
2010 | 2363 |
self deleteFromLine:(startLine + 1) toLine:(endLine - 1) |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2364 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2365 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2366 |
(endCol ~~ 0) ifTrue:[ |
2010 | 2367 |
"/ delete the left rest of the last line |
2368 |
||
2369 |
self deleteCharsAtLine:(startLine + 1) toCol:endCol. |
|
2370 |
||
2371 |
"/ must add blanks, if startCol lies behond end of startLine |
|
2372 |
||
2373 |
line := list at:startLine. |
|
2374 |
lineSize := line size. |
|
2375 |
(startCol > lineSize) ifTrue:[ |
|
2376 |
newLine := line. |
|
2377 |
line isNil ifTrue:[ |
|
2378 |
newLine := String new:(startCol - 1) |
|
2379 |
] ifFalse:[ |
|
2380 |
nMore := startCol - 1 - lineSize. |
|
2381 |
nMore > 0 ifTrue:[ |
|
2382 |
newLine := line , (line species new:nMore) |
|
2383 |
] |
|
2384 |
]. |
|
2385 |
newLine ~~ line ifTrue:[ |
|
2386 |
list at:startLine put:newLine. |
|
2387 |
]. |
|
2388 |
"/ TODO: remember old maxwidth of linerange, |
|
2389 |
"/ only clear widthOfWidestLine, if this max |
|
2390 |
"/ length was (one of) the longest. |
|
2391 |
"/ avoids slow delete with huge texts. |
|
2392 |
widthOfWidestLine := nil. "/ i.e. unknown |
|
2393 |
self textChanged. |
|
2394 |
] |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2395 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2396 |
|
641 | 2397 |
"/ merge the left rest of 1st line with right rest of last line into one |
1818
aa16d9b96e40
fixed cut to not compress multiple blanks.
Claus Gittinger <cg@exept.de>
parents:
1817
diff
changeset
|
2398 |
self mergeLine:startLine removeBlanks:false |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2399 |
|
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2400 |
"Modified: / 10.11.1998 / 23:52:59 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2401 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2402 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2403 |
deleteFromLine:startLineNr toLine:endLineNr |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2404 |
"delete some lines" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2405 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2406 |
|wasOn nLines| |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2407 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2408 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2409 |
list isNil ifTrue:[^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2410 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2411 |
wasOn := self hideCursor. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2412 |
|
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2413 |
"/ isnt this the same as: |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2414 |
"/ self deleteLinesWithoutRedrawFrom:startLineNr to:endLineNr. |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2415 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2416 |
list removeFromIndex:startLineNr toIndex:(endLineNr min:list size). |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2417 |
"/ TODO: remember old maxwidth of linerange, |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2418 |
"/ only clear widthOfWidestLine, if this max |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2419 |
"/ length was (one of) the longest. |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2420 |
"/ avoids slow delete with huge texts. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2421 |
widthOfWidestLine := nil. "/ i.e. unknown |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2422 |
self textChanged. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2423 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2424 |
self redrawFromLine:startLineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2425 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2426 |
nLines := list size. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2427 |
(firstLineShown >= nLines) ifTrue:[ |
2010 | 2428 |
self makeLineVisible:nLines |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2429 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2430 |
wasOn ifTrue:[self showCursor]. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2431 |
|
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2432 |
"Modified: / 10.11.1998 / 23:55:05 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2433 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2434 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2435 |
deleteLineWithoutRedraw:lineNr |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2436 |
"delete line - no redraw; |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2437 |
return true, if something was really deleted" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2438 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2439 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2440 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2441 |
(list isNil or:[lineNr > list size]) ifTrue:[^ false]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2442 |
list removeIndex:lineNr. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2443 |
"/ TODO: remember old maxwidth of linerange, |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2444 |
"/ only clear widthOfWidestLine, if this max |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2445 |
"/ length was (one of) the longest. |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2446 |
"/ avoids slow delete with huge texts. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2447 |
widthOfWidestLine := nil. "/ i.e. unknown |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2448 |
self textChanged. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2449 |
^ true |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2450 |
|
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2451 |
"Modified: / 10.11.1998 / 23:53:24 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2452 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2453 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2454 |
insert:aCharacter atLine:lineNr col:colNr |
827 | 2455 |
"insert a single character at lineNr/colNr; |
2456 |
set emphasis to character at current position" |
|
2457 |
||
1929
8e70fb7c9701
fixed handling of italic text when inserting
Claus Gittinger <cg@exept.de>
parents:
1928
diff
changeset
|
2458 |
|line lineSize newLine drawCharacterOnly attribute oldClip x y| |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2459 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2460 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2461 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2462 |
aCharacter == (Character cr) ifTrue:[ |
2029
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2463 |
self splitLine:lineNr before:colNr. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2464 |
^ self |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2465 |
]. |
827 | 2466 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2467 |
drawCharacterOnly := false. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2468 |
self checkForExistingLine:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2469 |
line := list at:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2470 |
lineSize := line size. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
2471 |
|
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
2472 |
st80Mode ~~ true ifTrue:[ |
2029
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2473 |
(trimBlankLines |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2474 |
and:[colNr > lineSize |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2475 |
and:[aCharacter == Character space]]) ifTrue:[ |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2476 |
^ self |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2477 |
] |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2478 |
]. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
2479 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2480 |
(lineSize == 0) ifTrue:[ |
2029
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2481 |
newLine := aCharacter asString species new:colNr. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2482 |
drawCharacterOnly := true |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2483 |
] ifFalse: [ |
2029
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2484 |
(colNr > lineSize) ifTrue: [ |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2485 |
colNr == (lineSize +1) ifTrue:[ |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2486 |
attribute := line emphasisAt:lineSize |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2487 |
]. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2488 |
newLine := line species new:colNr. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2489 |
newLine replaceFrom:1 to:lineSize |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2490 |
with:line startingAt:1. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2491 |
drawCharacterOnly := true |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2492 |
] ifFalse: [ |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2493 |
attribute := line emphasisAt:colNr. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2494 |
newLine := line species new:(lineSize + 1). |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2495 |
|
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2496 |
newLine replaceFrom:1 to:(colNr - 1) |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2497 |
with:line startingAt:1. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2498 |
newLine replaceFrom:(colNr + 1) to:(lineSize + 1) |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2499 |
with:line startingAt:colNr |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2500 |
] |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2501 |
]. |
827 | 2502 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2503 |
newLine at:colNr put:aCharacter. |
827 | 2504 |
|
2505 |
attribute notNil ifTrue:[ |
|
2029
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2506 |
newLine emphasisAt:colNr put:attribute |
827 | 2507 |
]. |
2508 |
||
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2509 |
aCharacter == (Character tab) ifTrue:[ |
2029
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2510 |
newLine := self withTabsExpanded:newLine. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2511 |
drawCharacterOnly := false |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2512 |
]. |
827 | 2513 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2514 |
list at:lineNr put:newLine. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2515 |
widthOfWidestLine notNil ifTrue:[ |
2029
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2516 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2517 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2518 |
self textChanged. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2519 |
shown ifTrue:[ |
2029
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2520 |
"/ care for italic text - in this case, we must also |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2521 |
"/ redraw the character before the insertion in order |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2522 |
"/ to fix the slanted piece of the character. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2523 |
"/ (but we must clip, to avoid destoying the character before) |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2524 |
(newLine notNil and:[newLine isText]) ifTrue:[ |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2525 |
colNr > 1 ifTrue:[ |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2526 |
cursorVisibleLine notNil ifTrue:[ |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2527 |
oldClip := self clippingRectangleOrNil. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2528 |
x := (self xOfCol:colNr inVisibleLine:cursorVisibleLine) - leftOffset. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2529 |
y := self yOfVisibleLine:cursorVisibleLine. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2530 |
drawCharacterOnly ifTrue:[ |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2531 |
self clippingRectangle:(x@y extent:((font width * 2) @ fontHeight)). |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2532 |
self redrawLine:lineNr from:colNr-1 to:colNr |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2533 |
] ifFalse:[ |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2534 |
self clippingRectangle:(x@y extent:((width - x) @ fontHeight)). |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2535 |
self redrawLine:lineNr from:colNr-1 |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2536 |
]. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2537 |
self clippingRectangle:oldClip. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2538 |
]. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2539 |
^ self. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2540 |
]. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2541 |
]. |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2542 |
drawCharacterOnly ifTrue:[ |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2543 |
self redrawLine:lineNr col:colNr |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2544 |
] ifFalse:[ |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2545 |
self redrawLine:lineNr from:colNr |
22629607c6eb
care for invisible cursor when redrawing italic area
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
2546 |
] |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2547 |
] |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2548 |
|
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
2549 |
"Modified: / 20.6.1998 / 18:19:22 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2550 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2551 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2552 |
insertLines:someText from:start to:end before:lineNr |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2553 |
"insert a bunch of lines before line lineNr" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2554 |
|
827 | 2555 |
|text indent visLine w nLines "{ Class: SmallInteger }" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2556 |
srcY "{ Class: SmallInteger }" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2557 |
dstY "{ Class: SmallInteger }" | |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2558 |
|
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
2559 |
self isReadOnly ifTrue:[ |
2010 | 2560 |
^ self |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2561 |
]. |
827 | 2562 |
|
2563 |
autoIndent ifTrue:[ |
|
2010 | 2564 |
indent := self leftIndentForLine:lineNr. |
2565 |
||
2566 |
text := someText collect:[:ln||line| |
|
2567 |
ln notNil ifTrue:[ |
|
2568 |
line := ln withoutLeadingSeparators. |
|
2569 |
(line isEmpty or:[indent == 0]) ifFalse:[ |
|
2570 |
line := (String new:indent), line |
|
2571 |
]. |
|
2572 |
line |
|
2573 |
] ifFalse:[ |
|
2574 |
nil |
|
2575 |
] |
|
2576 |
]. |
|
827 | 2577 |
] ifFalse:[ |
2010 | 2578 |
text := someText |
827 | 2579 |
]. |
2580 |
||
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2581 |
visLine := self listLineToVisibleLine:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2582 |
(shown not or:[visLine isNil]) ifTrue:[ |
2010 | 2583 |
self withoutRedrawInsertLines:text |
2584 |
from:start to:end |
|
2585 |
before:lineNr. |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2586 |
] ifFalse:[ |
2010 | 2587 |
nLines := end - start + 1. |
2588 |
((visLine + nLines) >= nLinesShown) ifTrue:[ |
|
2589 |
self withoutRedrawInsertLines:text |
|
2590 |
from:start to:end |
|
2591 |
before:lineNr. |
|
2592 |
self redrawFromVisibleLine:visLine to:nLinesShown |
|
2593 |
] ifFalse:[ |
|
2594 |
w := self widthForScrollBetween:(lineNr + nLines) |
|
2595 |
and:(firstLineShown + nLines + nLinesShown). |
|
2596 |
srcY := topMargin + ((visLine - 1) * fontHeight). |
|
2597 |
dstY := srcY + (nLines * fontHeight). |
|
2598 |
||
2599 |
"/ |
|
2600 |
"/ scroll ... |
|
2601 |
"/ |
|
2602 |
" |
|
2603 |
stupid: must catchExpose before inserting new |
|
2604 |
stuff - since catchExpose may perform redraws |
|
2605 |
" |
|
2606 |
self catchExpose. |
|
2607 |
self withoutRedrawInsertLines:text |
|
2608 |
from:start to:end |
|
2609 |
before:lineNr. |
|
2610 |
self |
|
2611 |
copyFrom:self |
|
2612 |
x:textStartLeft y:srcY |
|
2613 |
toX:textStartLeft y:dstY |
|
2614 |
width:w |
|
2615 |
height:(height - dstY) |
|
2616 |
async:true. |
|
2617 |
self redrawFromVisibleLine:visLine to:(visLine + nLines - 1). |
|
2618 |
self waitForExpose |
|
2619 |
]. |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2620 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2621 |
widthOfWidestLine notNil ifTrue:[ |
2010 | 2622 |
text do:[:line | |
2623 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
|
2624 |
] |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2625 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2626 |
self textChanged. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2627 |
|
984 | 2628 |
"Modified: 29.1.1997 / 13:02:39 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2629 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2630 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2631 |
mergeLine:lineNr |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2632 |
"merge line lineNr with line lineNr+1" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2633 |
|
1319 | 2634 |
self mergeLine:lineNr removeBlanks:true |
2635 |
||
2636 |
"Modified: 9.9.1997 / 09:28:03 / cg" |
|
2637 |
! |
|
2638 |
||
2639 |
mergeLine:lineNr removeBlanks:removeBlanks |
|
2640 |
"merge line lineNr with line lineNr+1" |
|
2641 |
||
827 | 2642 |
|leftPart rightPart bothParts nextLineNr i| |
2643 |
||
2644 |
(list notNil and:[(list size) > lineNr]) ifFalse:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2645 |
^ self |
827 | 2646 |
]. |
2647 |
leftPart := self listAt:lineNr. |
|
2648 |
||
2649 |
leftPart isNil ifTrue:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2650 |
leftPart := ''. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2651 |
autoIndent ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2652 |
(i := self leftIndentForLine:cursorLine) == 0 ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2653 |
leftPart := String new:i |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2654 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2655 |
] |
827 | 2656 |
]. |
2657 |
self cursorLine:lineNr col:((leftPart size) + 1). |
|
2658 |
nextLineNr := self validateCursorLine:(lineNr + 1). |
|
2659 |
||
2660 |
nextLineNr > (list size) ifFalse:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2661 |
(rightPart := self listAt:nextLineNr) isNil ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2662 |
rightPart := '' |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2663 |
] ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2664 |
removeBlanks ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2665 |
rightPart := rightPart withoutLeadingSeparators. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2666 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2667 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2668 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2669 |
bothParts := leftPart , rightPart. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2670 |
(trimBlankLines and:[bothParts isBlank]) ifTrue:[bothParts := nil]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2671 |
list at:lineNr put:bothParts. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2672 |
self redrawLine:lineNr. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2673 |
self deleteLine:nextLineNr |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2674 |
] |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2675 |
|
1319 | 2676 |
"Created: 9.9.1997 / 09:27:38 / cg" |
2677 |
"Modified: 9.9.1997 / 09:28:27 / cg" |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2678 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2679 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2680 |
replace:aCharacter atLine:lineNr col:colNr |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2681 |
"replace a single character at lineNr/colNr" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2682 |
|
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
2683 |
|line lineSize newLine drawCharacterOnly| |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2684 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2685 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2686 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2687 |
aCharacter == (Character cr) ifTrue:[ |
2010 | 2688 |
^ self |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2689 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2690 |
|
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
2691 |
drawCharacterOnly := true. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2692 |
self checkForExistingLine:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2693 |
line := list at:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2694 |
lineSize := line size. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
2695 |
|
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
2696 |
(trimBlankLines |
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
2697 |
and:[colNr > lineSize |
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
2698 |
and:[aCharacter == Character space]]) ifTrue:[ |
2010 | 2699 |
^ self |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2700 |
]. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
2701 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2702 |
(lineSize == 0) ifTrue:[ |
2010 | 2703 |
newLine := aCharacter asString species new:colNr. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2704 |
] ifFalse: [ |
2010 | 2705 |
(colNr > lineSize) ifTrue: [ |
2706 |
newLine := line species new:colNr. |
|
2707 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
|
2708 |
] ifFalse: [ |
|
2709 |
newLine := line copy. |
|
2710 |
] |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2711 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2712 |
newLine at:colNr put:aCharacter. |
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
2713 |
aCharacter == (Character tab) ifTrue:[ |
2010 | 2714 |
newLine := self withTabsExpanded:newLine. |
2715 |
drawCharacterOnly := false |
|
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
2716 |
]. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2717 |
list at:lineNr put:newLine. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2718 |
widthOfWidestLine notNil ifTrue:[ |
2010 | 2719 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2720 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2721 |
self textChanged. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2722 |
shown ifTrue:[ |
2010 | 2723 |
drawCharacterOnly ifTrue:[ |
2724 |
self redrawLine:lineNr col:colNr |
|
2725 |
] ifFalse:[ |
|
2726 |
self redrawLine:lineNr from:colNr |
|
2727 |
] |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2728 |
] |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
2729 |
|
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
2730 |
"Created: / 6.3.1996 / 12:29:20 / cg" |
1559
cecf77805bff
expand tabs in #replaceAll:...
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2731 |
"Modified: / 10.6.1998 / 18:50:18 / cg" |
105 | 2732 |
! |
2733 |
||
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2734 |
replaceString:aString atLine:lineNr col:colNr |
1557 | 2735 |
"replace multiple characters starting at lineNr/colNr. |
1567
0eff7ca88e89
much faster multi-line replace (avoid scroll)
Claus Gittinger <cg@exept.de>
parents:
1566
diff
changeset
|
2736 |
This is not prepared to encounter special chars (except TAB) |
0eff7ca88e89
much faster multi-line replace (avoid scroll)
Claus Gittinger <cg@exept.de>
parents:
1566
diff
changeset
|
2737 |
in the string." |
1557 | 2738 |
|
2739 |
|line lineSize newLine endCol| |
|
2740 |
||
2741 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
2742 |
||
2743 |
self checkForExistingLine:lineNr. |
|
2744 |
line := list at:lineNr. |
|
2745 |
lineSize := line size. |
|
2746 |
||
2747 |
endCol := colNr + aString size - 1. |
|
2748 |
(lineSize == 0) ifTrue:[ |
|
2010 | 2749 |
newLine := aString species new:endCol. |
1557 | 2750 |
] ifFalse: [ |
2010 | 2751 |
(endCol > lineSize) ifTrue: [ |
2752 |
aString isText ifTrue:[ |
|
2753 |
newLine := aString species new:endCol. |
|
2754 |
] ifFalse:[ |
|
2755 |
newLine := line species new:endCol. |
|
2756 |
]. |
|
2757 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
|
2758 |
] ifFalse: [ |
|
2759 |
aString isText ifTrue:[ |
|
2760 |
newLine := aString species new:line size. |
|
2761 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
|
2762 |
] ifFalse:[ |
|
2763 |
newLine := line copy. |
|
2764 |
] |
|
2765 |
] |
|
1557 | 2766 |
]. |
2767 |
newLine replaceFrom:colNr with:aString. |
|
1559
cecf77805bff
expand tabs in #replaceAll:...
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2768 |
(aString includes:(Character tab)) ifTrue:[ |
2010 | 2769 |
newLine := self withTabsExpanded:newLine. |
1559
cecf77805bff
expand tabs in #replaceAll:...
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2770 |
]. |
1557 | 2771 |
list at:lineNr put:newLine. |
2772 |
widthOfWidestLine notNil ifTrue:[ |
|
2010 | 2773 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
1557 | 2774 |
]. |
2775 |
self textChanged. |
|
2776 |
shown ifTrue:[ |
|
2010 | 2777 |
self redrawLine:lineNr from:colNr |
1557 | 2778 |
] |
2779 |
||
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
2780 |
"Created: / 11.6.1998 / 10:38:32 / cg" |
1599
63636b356b1f
care for emphasis when replacing.
Claus Gittinger <cg@exept.de>
parents:
1597
diff
changeset
|
2781 |
"Modified: / 20.6.1998 / 20:23:50 / cg" |
1557 | 2782 |
! |
2783 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2784 |
splitLine:lineNr before:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2785 |
"split the line linNr before colNr; the right part (from colNr) |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2786 |
is cut off and inserted after lineNr; the view is redrawn" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2787 |
|
981
6e52d3876ea7
dont catchExpose, if copy is empty
Claus Gittinger <cg@exept.de>
parents:
960
diff
changeset
|
2788 |
|line lineSize leftRest rightRest visLine w h mustWait |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2789 |
srcY "{ Class: SmallInteger }" | |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2790 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2791 |
list isNil ifFalse:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2792 |
lineNr > (list size) ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2793 |
(colNr == 1) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2794 |
self insertLine:nil before:lineNr. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2795 |
^ self |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2796 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2797 |
line := list at:lineNr. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2798 |
line isNil ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2799 |
lineSize := line size. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2800 |
(colNr <= lineSize) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2801 |
rightRest := line copyFrom:colNr to:lineSize. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2802 |
(colNr > 1) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2803 |
leftRest := line copyTo:(colNr - 1) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2804 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2805 |
] ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2806 |
leftRest := line |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2807 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2808 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2809 |
leftRest notNil ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2810 |
(trimBlankLines and:[leftRest isBlank]) ifTrue:[leftRest := nil] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2811 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2812 |
list at:lineNr put:leftRest. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2813 |
self withoutRedrawInsertLine:rightRest before:(lineNr + 1). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2814 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2815 |
visLine := self listLineToVisibleLine:(lineNr). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2816 |
visLine notNil ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2817 |
w := self widthForScrollBetween:lineNr |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2818 |
and:(firstLineShown + nLinesShown). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2819 |
srcY := topMargin + (visLine * fontHeight). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2820 |
h := ((nLinesShown - visLine - 1) * fontHeight). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2821 |
(mustWait := (w > 0 and:[h > 0])) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2822 |
self catchExpose. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2823 |
self |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2824 |
copyFrom:self |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2825 |
x:textStartLeft y:srcY |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2826 |
toX:textStartLeft y:(srcY + fontHeight) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2827 |
width:w |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2828 |
height:((nLinesShown - visLine - 1) * fontHeight) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2829 |
async:true. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2830 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2831 |
self redrawLine:lineNr. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2832 |
self redrawLine:(lineNr + 1). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2833 |
mustWait ifTrue:[self waitForExpose] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2834 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2835 |
widthOfWidestLine := nil. "/ unknown |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2836 |
self textChanged. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
2837 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2838 |
] |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
2839 |
|
984 | 2840 |
"Modified: 29.1.1997 / 13:03:22 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2841 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2842 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2843 |
withoutRedrawInsertLine:aString before:lineNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2844 |
"insert the argument, aString before line lineNr; the string |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2845 |
becomes line nileNr; everything else is moved down; the view |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2846 |
is not redrawn" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2847 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2848 |
|line| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2849 |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
2850 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
2851 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2852 |
line := aString. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2853 |
line notNil ifTrue:[ |
2010 | 2854 |
line isString ifTrue:[ |
2855 |
line isBlank ifTrue:[ |
|
2856 |
line := nil |
|
2857 |
] ifFalse:[ |
|
2858 |
(line includes:(Character tab)) ifTrue:[ |
|
2859 |
line := self withTabsExpanded:line |
|
2860 |
] |
|
2861 |
] |
|
2862 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2863 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2864 |
list isNil ifTrue: [ |
2010 | 2865 |
list := StringCollection new:lineNr |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2866 |
] ifFalse: [ |
2010 | 2867 |
list grow:((list size + 1) max:lineNr) |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2868 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2869 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2870 |
"I have changed 'replaceFrom:to:with:startingAt:' to correctly handle |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2871 |
overlapping copy - if it didn't, we had to use:" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2872 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2873 |
index := list size. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2874 |
[index > lineNr] whileTrue: [ |
2010 | 2875 |
pIndex := index - 1. |
2876 |
list at:index put:(list at:pIndex). |
|
2877 |
index := pIndex |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2878 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2879 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2880 |
list replaceFrom:(lineNr + 1) to:(list size) with:list startingAt:lineNr. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2881 |
list at:lineNr put:line. |
991
2d97ed971ce4
need a self>>contentsChanged when inserting lines.
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
2882 |
self contentsChanged |
2d97ed971ce4
need a self>>contentsChanged when inserting lines.
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
2883 |
|
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2884 |
"Modified: / 10.6.1998 / 19:00:56 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2885 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2886 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2887 |
withoutRedrawInsertLines:lines from:start to:end before:lineNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2888 |
"insert a bunch of lines before line lineNr; the view is not redrawn" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2889 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2890 |
|newLine newLines nLines| |
121 | 2891 |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
2892 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2893 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2894 |
nLines := end - start + 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2895 |
newLines := Array new:(lines size). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2896 |
start to:end do:[:index | |
2010 | 2897 |
newLine := lines at:index. |
2898 |
newLine notNil ifTrue:[ |
|
2899 |
newLine isString ifTrue:[ |
|
2900 |
newLine isBlank ifTrue:[ |
|
2901 |
newLine := nil |
|
2902 |
] ifFalse:[ |
|
2903 |
(newLine includes:(Character tab)) ifTrue:[ |
|
2904 |
newLine := self withTabsExpanded:newLine |
|
2905 |
] |
|
2906 |
] |
|
2907 |
] |
|
2908 |
]. |
|
2909 |
newLines at:index put:newLine |
|
121 | 2910 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2911 |
list isNil ifTrue: [ |
2010 | 2912 |
list := StringCollection new:(lineNr + nLines + 1) |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2913 |
] ifFalse: [ |
2010 | 2914 |
list grow:((list size + nLines) max:(lineNr + nLines - 1)) |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2915 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2916 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2917 |
"I have changed 'replaceFrom:to:with:startingAt:' to correctly handle |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2918 |
overlapping copy - if it didn't, we had to use:" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2919 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2920 |
index := list size. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2921 |
[index > lineNr] whileTrue: [ |
2010 | 2922 |
pIndex := index - 1. |
2923 |
list at:index put:(list at:pIndex). |
|
2924 |
index := pIndex |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2925 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2926 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2927 |
list replaceFrom:(lineNr + nLines) to:(list size) with:list startingAt:lineNr. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2928 |
list replaceFrom:lineNr to:(lineNr + nLines - 1) with:newLines startingAt:start. |
991
2d97ed971ce4
need a self>>contentsChanged when inserting lines.
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
2929 |
self contentsChanged |
2d97ed971ce4
need a self>>contentsChanged when inserting lines.
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
2930 |
|
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2931 |
"Modified: / 10.6.1998 / 19:01:16 / cg" |
121 | 2932 |
! |
2933 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2934 |
withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2935 |
"insert aString (which has no crs) at lineNr/colNr" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2936 |
|
827 | 2937 |
|isText strLen line lineSize newLine stringType sz| |
2938 |
||
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
2939 |
(aString notNil) ifFalse:[ ^ self]. |
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
2940 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2941 |
strLen := aString size. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2942 |
self checkForExistingLine:lineNr. |
400
70fb3a81922f
better create a 16bit string when pasting one into an 8bit string
Claus Gittinger <cg@exept.de>
parents:
387
diff
changeset
|
2943 |
|
827 | 2944 |
stringType := aString string species. |
2945 |
isText := aString isText. |
|
2946 |
line := list at:lineNr. |
|
2947 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2948 |
line notNil ifTrue:[ |
2010 | 2949 |
lineSize := line size. |
2950 |
line bitsPerCharacter > aString bitsPerCharacter ifTrue:[ |
|
2951 |
stringType := line string species |
|
2952 |
]. |
|
2953 |
line isText ifTrue:[ isText := true ] |
|
827 | 2954 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2955 |
] ifFalse:[ |
2010 | 2956 |
lineSize := 0 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2957 |
]. |
827 | 2958 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2959 |
((colNr == 1) and:[lineSize == 0]) ifTrue: [ |
2010 | 2960 |
newLine := aString |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2961 |
] ifFalse:[ |
2010 | 2962 |
(lineSize == 0 or:[colNr > lineSize]) ifTrue: [ |
2963 |
sz := colNr + strLen - 1 |
|
2964 |
] ifFalse:[ |
|
2965 |
sz := lineSize + strLen |
|
2966 |
]. |
|
2967 |
||
2968 |
isText ifFalse:[ |
|
2969 |
newLine := stringType new:sz |
|
2970 |
] ifTrue:[ |
|
2971 |
newLine := Text string:(stringType new:sz) |
|
2972 |
]. |
|
2973 |
||
2974 |
(lineSize ~~ 0) ifTrue: [ |
|
2975 |
(colNr > lineSize) ifTrue: [ |
|
2976 |
newLine replaceFrom:1 to:lineSize |
|
2977 |
with:line startingAt:1 |
|
2978 |
] ifFalse: [ |
|
2979 |
newLine replaceFrom:1 to:(colNr - 1) |
|
2980 |
with:line startingAt:1. |
|
2981 |
newLine replaceFrom:(colNr + strLen) to:(lineSize + strLen) |
|
2982 |
with:line startingAt:colNr |
|
2983 |
] |
|
2984 |
]. |
|
2985 |
newLine replaceFrom:colNr to:(colNr + strLen - 1) |
|
2986 |
with:aString startingAt:1 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2987 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2988 |
|
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2989 |
(aString includes:(Character tab)) ifTrue:[ |
2010 | 2990 |
newLine := self withTabsExpanded:newLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2991 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2992 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2993 |
list at:lineNr put:newLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2994 |
widthOfWidestLine notNil ifTrue:[ |
2010 | 2995 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:newLine). |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2996 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2997 |
self textChanged. |
385
a373f2dd9c60
care when editing 16bit text (dont hardcode String into the edit methods)
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
2998 |
|
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2999 |
"Modified: / 10.6.1998 / 19:01:52 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3000 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3001 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3002 |
!EditTextView methodsFor:'event processing'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3003 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3004 |
buttonPress:button x:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3005 |
"hide the cursor when button is activated" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3006 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3007 |
hasKeyboardFocus := true. |
1817
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
3008 |
cursorShown ifTrue: [ |
2010 | 3009 |
self drawCursor |
1817
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
3010 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3011 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3012 |
((button == 1) or:[button == #select]) ifTrue:[ |
2010 | 3013 |
self hideCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3014 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3015 |
(button == #paste) ifTrue:[ |
2010 | 3016 |
self pasteOrReplace. |
3017 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3018 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3019 |
super buttonPress:button x:x y:y |
1817
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
3020 |
|
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
3021 |
"Modified: / 23.3.1999 / 13:51:40 / cg" |
121 | 3022 |
! |
3023 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3024 |
buttonRelease:button x:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3025 |
"move the cursor to the click-position of previous button press" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3026 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3027 |
((button == 1) or:[button == #select]) ifTrue:[ |
2010 | 3028 |
typeOfSelection := nil. |
3029 |
selectionStartLine isNil ifTrue:[ |
|
3030 |
clickCol notNil ifTrue:[ |
|
3031 |
self cursorMovementAllowed ifTrue:[ |
|
3032 |
self cursorLine:clickLine col:clickCol |
|
3033 |
] |
|
3034 |
] |
|
3035 |
] ifFalse:[ |
|
3036 |
lastString := nil. "new selection invalidates remembered string" |
|
3037 |
]. |
|
3038 |
self showCursor |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3039 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3040 |
super buttonRelease:button x:x y:y |
1580
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
3041 |
|
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
3042 |
"Modified: / 18.6.1998 / 14:14:05 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3043 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3044 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3045 |
keyPress:key x:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3046 |
"handle keyboard input" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3047 |
|
922 | 3048 |
<resource: #keyboard (#Paste #Insert #Cut #Again #Replace #Accept |
2017 | 3049 |
#Delete #BasicDelete #BackSpace #BasicBackspace |
3050 |
#SelectWord |
|
3051 |
#SearchMatchingParent #SelectMatchingParents |
|
3052 |
#SelectToEnd #SelectFromBeginning |
|
3053 |
#BeginOfLine #EndOfLine #NextWord #PreviousWord |
|
3054 |
#CursorRight #CursorDown #CursorLeft #CursorUp |
|
3055 |
#Return #Tab #Escape |
|
3056 |
#GotoLine #Delete #BeginOfText #EndOfText |
|
3057 |
#SelectLine #ExpandSelectionByLine #DeleteLine |
|
3058 |
#InsertLine |
|
3059 |
#SelectLineFromBeginning |
|
3060 |
#'F*' #'f*')> |
|
3061 |
||
3062 |
|sensor n fKeyMacros shifted i |
|
3063 |
selStartLine selEndLine selStartCol selEndCol sel| |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3064 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3065 |
sensor := self sensor. |
1803
ac7cc1b99407
scroll left as required, if deleting characters of the longest line,
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
3066 |
shifted := (sensor ? device) shiftDown. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3067 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3068 |
(key isMemberOf:Character) ifTrue:[ |
2017 | 3069 |
self isReadOnly ifTrue:[ |
3070 |
self flash |
|
3071 |
] ifFalse:[ |
|
3072 |
typeOfSelection == #paste ifTrue:[ |
|
3073 |
"pasted selection will NOT be replaced by keystroke" |
|
3074 |
self unselect |
|
3075 |
]. |
|
3076 |
||
3077 |
selStartLine := selectionStartLine. |
|
3078 |
selStartCol := self selectionStartCol. |
|
3079 |
selEndLine := selectionEndLine. |
|
3080 |
selEndCol := self selectionEndCol. |
|
3081 |
sel := self selection. |
|
3082 |
||
3083 |
"replace selection by what is typed in - |
|
3084 |
if word was selected with a space, keep it" |
|
3085 |
||
3086 |
(selectStyle == #wordLeft) ifTrue:[ |
|
3087 |
self replaceSelectionBy:(' ' copyWith:key) |
|
3088 |
] ifFalse:[ |
|
3089 |
(selectStyle == #wordRight) ifTrue:[ |
|
3090 |
self replaceSelectionBy:(key asString , ' '). |
|
3091 |
self cursorLeft |
|
3092 |
] ifFalse:[ |
|
3093 |
self replaceSelectionBy:key |
|
3094 |
] |
|
3095 |
]. |
|
3096 |
selectStyle := nil. |
|
3097 |
||
2018 | 3098 |
sel size > 0 ifTrue:[ |
3099 |
undoAction := [ |
|
3100 |
self cursorLine:selStartLine col:selStartCol. |
|
3101 |
self deleteCharAtCursor. |
|
3102 |
self paste:sel. |
|
3103 |
]. |
|
3104 |
]. |
|
2017 | 3105 |
|
3106 |
showMatchingParenthesis ifTrue:[ |
|
3107 |
"emacs style parenthesis shower" |
|
3108 |
||
3109 |
"claus: only do it for closing parenthesis - |
|
3110 |
otherwise its too anoying. |
|
3111 |
" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3112 |
" |
2017 | 3113 |
(#( $( $) $[ $] ${ $} ) includes:key) ifTrue:[ |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3114 |
" |
2017 | 3115 |
(#( $) $] $} ) includes:key) ifTrue:[ |
3116 |
self searchForMatchingParenthesisFromLine:cursorLine col:(cursorCol - 1) |
|
3117 |
ifFound:[:line :col | |
|
3118 |
|savLine savCol| |
|
3119 |
||
3120 |
self withCursor:Cursor eye do:[ |
|
3121 |
savLine := cursorLine. |
|
3122 |
savCol := cursorCol. |
|
3123 |
self cursorLine:line col:col. |
|
3124 |
device flush. |
|
3125 |
"/ want to wait 200ms, but not if another keyPress |
|
3126 |
"/ arrives in the meantime ... |
|
3127 |
"/ |
|
3128 |
5 timesRepeat:[ |
|
3129 |
(sensor notNil and:[sensor hasKeyPressEventFor:self]) ifFalse:[ |
|
3130 |
Processor activeProcess millisecondDelay:40. |
|
3131 |
] |
|
3132 |
]. |
|
3133 |
self cursorLine:savLine col:savCol |
|
3134 |
] |
|
3135 |
] |
|
3136 |
ifNotFound:[self showNotFound] |
|
3137 |
onError:[self beep] |
|
3138 |
]. |
|
3139 |
]. |
|
3140 |
]. |
|
3141 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3142 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3143 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3144 |
replacing := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3145 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3146 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3147 |
Fn pastes a key-sequence (but only if not overlayed with |
2017 | 3148 |
another function in the keyboard map) |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3149 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3150 |
see TextView>>:x:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3151 |
" |
1177
9d23e1241404
avoid match: if possible (to not clobber the previous matchString)
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
3152 |
(key at:1) asLowercase == $f ifTrue:[ |
2017 | 3153 |
(('[fF][0-9]' match:key) |
3154 |
or:['[fF][0-9][0-9]' match:key]) ifTrue:[ |
|
3155 |
shifted ifFalse:[ |
|
3156 |
fKeyMacros := UserPreferences current functionKeySequences. |
|
3157 |
fKeyMacros notNil ifTrue:[ |
|
3158 |
(fKeyMacros includesKey:key) ifTrue:[ |
|
3159 |
self pasteOrReplace:(fKeyMacros at:key) asStringCollection. |
|
3160 |
^ self |
|
3161 |
] |
|
3162 |
] |
|
3163 |
] |
|
3164 |
]. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3165 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3166 |
|
274
6df4bb990f04
handle accept where acceptAction is define (this was a historic leftover)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
3167 |
(key == #Accept) ifTrue:[^ self accept]. |
6df4bb990f04
handle accept where acceptAction is define (this was a historic leftover)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
3168 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3169 |
((key == #Paste) or:[key == #Insert]) ifTrue:[self pasteOrReplace. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3170 |
(key == #Cut) ifTrue:[self cut. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3171 |
(key == #Again) ifTrue:[self again. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3172 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3173 |
(key == #Replace) ifTrue:[self replace. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3174 |
(key == #SelectWord) ifTrue:[ |
2017 | 3175 |
self makeCursorVisible. |
3176 |
^ self selectWordUnderCursor. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3177 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3178 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3179 |
(key == #SearchMatchingParent) ifTrue:[^ self searchForMatchingParenthesis.]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3180 |
(key == #SelectMatchingParents) ifTrue:[^ self searchForAndSelectMatchingParenthesis.]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3181 |
(key == #SelectToEnd) ifTrue:[^ self selectUpToEnd.]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3182 |
(key == #SelectFromBeginning) ifTrue:[^ self selectFromBeginning.]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3183 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3184 |
" disabled - nobody liked it ... |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3185 |
and if you like it, its better done in the keymap. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3186 |
|
1304
173d00c195f9
flush pending keyboard events in cursor-up/down
Claus Gittinger <cg@exept.de>
parents:
1300
diff
changeset
|
3187 |
(key == #Ctrlb) ifTrue:[self unselect. self cursorLeft. ^ self]. |
173d00c195f9
flush pending keyboard events in cursor-up/down
Claus Gittinger <cg@exept.de>
parents:
1300
diff
changeset
|
3188 |
(key == #Ctrlf) ifTrue:[self unselect. self cursorRight. ^ self]. |
173d00c195f9
flush pending keyboard events in cursor-up/down
Claus Gittinger <cg@exept.de>
parents:
1300
diff
changeset
|
3189 |
(key == #Ctrln) ifTrue:[self unselect. self cursorDown. ^ self]. |
173d00c195f9
flush pending keyboard events in cursor-up/down
Claus Gittinger <cg@exept.de>
parents:
1300
diff
changeset
|
3190 |
(key == #Ctrlp) ifTrue:[self unselect. self cursorUp. ^ self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3191 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3192 |
|
1675
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
3193 |
(key == #BeginOfLine) ifTrue:[ |
2017 | 3194 |
self unselect. |
3195 |
shifted ifTrue:[ |
|
3196 |
self cursorHome |
|
3197 |
] ifFalse:[ |
|
3198 |
self cursorToBeginOfLine. |
|
3199 |
]. |
|
3200 |
^ self |
|
1675
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
3201 |
]. |
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
3202 |
(key == #EndOfLine) ifTrue:[ |
2017 | 3203 |
self unselect. |
3204 |
shifted ifTrue:[ |
|
3205 |
self cursorToBottom |
|
3206 |
] ifFalse:[ |
|
3207 |
self cursorToEndOfLine. |
|
3208 |
]. |
|
3209 |
^ self |
|
1675
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
3210 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3211 |
(key == #NextWord) ifTrue:[self cursorToNextWord. ^self]. |
499 | 3212 |
(key == #PreviousWord) ifTrue:[self cursorToPreviousWord. ^self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3213 |
(key == #GotoLine) ifTrue:[self gotoLine. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3214 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3215 |
(key == #CursorRight) ifTrue:[ |
2017 | 3216 |
(shifted and:[selectionStartLine isNil]) ifTrue:[ |
3217 |
selectionStartLine := selectionEndLine := clickStartLine := cursorLine. |
|
3218 |
selectionStartCol := selectionEndCol := clickStartCol := cursorCol. |
|
3219 |
expandingTop := false. |
|
3220 |
^ self redrawLine:selectionStartLine. |
|
3221 |
]. |
|
3222 |
||
3223 |
selectionStartLine notNil ifTrue:[ |
|
3224 |
self cursorMovementAllowed ifTrue:[ |
|
3225 |
"/ |
|
3226 |
"/ treat the whole selection as cursor |
|
3227 |
"/ |
|
3228 |
cursorLine := selectionEndLine. |
|
3229 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
3230 |
selectionEndCol == 0 ifTrue:[ |
|
3231 |
selectionEndCol := 1. |
|
3232 |
]. |
|
3233 |
cursorCol := selectionEndCol. |
|
3234 |
shifted ifTrue:[ |
|
3235 |
self expandSelectionRight. |
|
3236 |
^ self |
|
3237 |
]. |
|
3238 |
self unselect; makeCursorVisible. |
|
3239 |
cursorCol == 1 ifTrue:[^ self]. |
|
3240 |
]. |
|
3241 |
]. |
|
3242 |
self cursorRight. ^self |
|
121 | 3243 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3244 |
(key == #CursorDown) ifTrue:[ |
2017 | 3245 |
(shifted and:[selectionStartLine isNil]) ifTrue:[ |
3246 |
selectionStartLine := clickStartLine := cursorLine. selectionEndLine := cursorLine + 1. |
|
3247 |
selectionStartCol := clickStartCol := selectionEndCol := cursorCol. |
|
3248 |
self redrawLine:selectionStartLine. |
|
3249 |
expandingTop := false. |
|
3250 |
^ self redrawLine:selectionEndLine. |
|
3251 |
]. |
|
3252 |
||
3253 |
selectionStartLine notNil ifTrue:[ |
|
3254 |
self cursorMovementAllowed ifTrue:[ |
|
3255 |
"/ |
|
3256 |
"/ treat the whole selection as cursor |
|
3257 |
"/ |
|
3258 |
cursorLine := selectionEndLine. |
|
3259 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
3260 |
cursorCol := selectionStartCol. |
|
3261 |
cursorCol == 0 ifTrue:[ |
|
3262 |
cursorCol := 1. |
|
3263 |
cursorLine := cursorLine - 1. |
|
3264 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
3265 |
]. |
|
3266 |
self makeCursorVisible. |
|
3267 |
||
3268 |
shifted ifTrue:[ |
|
3269 |
clickLine := cursorLine. |
|
3270 |
clickCol := cursorCol. |
|
3271 |
self expandSelectionDown. |
|
3272 |
^ self |
|
3273 |
]. |
|
3274 |
self unselect. |
|
3275 |
]. |
|
3276 |
]. |
|
3277 |
||
3278 |
sensor isNil ifTrue:[ |
|
3279 |
n := 1 |
|
3280 |
] ifFalse:[ |
|
3281 |
n := 1 + (sensor compressKeyPressEventsWithKey:#CursorDown). |
|
3282 |
]. |
|
3283 |
self cursorDown:n. |
|
3284 |
"/ |
|
3285 |
"/ flush keyboard to avoid runaway cursor |
|
3286 |
"/ |
|
3287 |
sensor notNil ifTrue:[self sensor flushKeyboardFor:self]. |
|
3288 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3289 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3290 |
(key == #CursorLeft or:[key == #CursorUp]) ifTrue:[ |
2017 | 3291 |
(shifted and:[selectionStartLine isNil]) ifTrue:[ |
3292 |
expandingTop := true. |
|
3293 |
key == #CursorLeft ifTrue:[ |
|
3294 |
cursorCol > 1 ifTrue:[ |
|
3295 |
selectionStartLine := selectionEndLine := clickStartLine := cursorLine. |
|
3296 |
selectionEndCol := clickStartCol := cursorCol-1. |
|
3297 |
selectionStartCol := cursorCol-1. |
|
3298 |
^ self redrawLine:selectionStartLine. |
|
3299 |
] |
|
3300 |
] ifFalse:[ |
|
3301 |
cursorLine > 1 ifTrue:[ |
|
3302 |
selectionEndLine := clickStartLine := cursorLine. |
|
3303 |
selectionEndCol := selectionStartCol := clickStartCol := cursorCol. |
|
3304 |
selectionStartLine := cursorLine - 1. |
|
3305 |
^ self redrawFromLine:selectionStartLine to:cursorLine. |
|
3306 |
] |
|
3307 |
] |
|
3308 |
]. |
|
3309 |
||
3310 |
selectionStartLine notNil ifTrue:[ |
|
3311 |
self cursorMovementAllowed ifTrue:[ |
|
3312 |
"/ |
|
3313 |
"/ treat the whole selection as cursor |
|
3314 |
"/ |
|
3315 |
cursorLine := selectionStartLine. |
|
3316 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
3317 |
cursorCol := selectionStartCol. |
|
3318 |
(key == #CursorLeft) ifTrue:[ |
|
3319 |
cursorCol := cursorCol+1. "/ compensate for followup crsr-left |
|
3320 |
]. |
|
3321 |
self makeCursorVisible. |
|
3322 |
||
3323 |
shifted ifTrue:[ |
|
3324 |
(key == #CursorUp) ifTrue:[ |
|
3325 |
clickLine := cursorLine. |
|
3326 |
^ self expandSelectionUp. |
|
3327 |
]. |
|
3328 |
^ self expandSelectionLeft. |
|
3329 |
]. |
|
3330 |
self unselect. |
|
3331 |
]. |
|
3332 |
]. |
|
3333 |
(key == #CursorLeft) ifTrue:[ |
|
3334 |
self cursorLeft. ^self |
|
3335 |
]. |
|
3336 |
(key == #CursorUp) ifTrue:[ |
|
3337 |
sensor isNil ifTrue:[ |
|
3338 |
n := 1 |
|
3339 |
] ifFalse:[ |
|
3340 |
n := 1 + (sensor compressKeyPressEventsWithKey:#CursorUp). |
|
3341 |
]. |
|
3342 |
self cursorUp:n. |
|
3343 |
"/ |
|
3344 |
"/ flush keyboard to avoid runaway cursor |
|
3345 |
"/ |
|
3346 |
sensor notNil ifTrue:[sensor flushKeyboardFor:self]. |
|
3347 |
^ self |
|
3348 |
]. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3349 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3350 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3351 |
(key == #Return) ifTrue:[ |
2017 | 3352 |
shifted ifTrue:[ |
3353 |
self unselect. self cursorReturn. ^self |
|
3354 |
]. |
|
3355 |
self isReadOnly ifTrue:[ |
|
3356 |
self unselect; makeCursorVisible. |
|
3357 |
self cursorReturn |
|
3358 |
] ifFalse:[ |
|
3359 |
insertMode ifFalse:[ |
|
3360 |
self cursorReturn. |
|
3361 |
autoIndent == true ifTrue:[ |
|
3362 |
i := self leftIndentForLine:(cursorLine + 1). |
|
3363 |
self cursorCol:(i+1 max:1) |
|
3364 |
] |
|
3365 |
] ifTrue:[ |
|
3366 |
"/ old version just unselected ... |
|
3367 |
"/ self unselect; makeCursorVisible. |
|
3368 |
||
3369 |
"/ new version deletes ... |
|
3370 |
typeOfSelection == #paste ifTrue:[ |
|
3371 |
self unselect; makeCursorVisible. |
|
3372 |
] ifFalse:[ |
|
3373 |
self copyAndDeleteSelection. |
|
3374 |
]. |
|
3375 |
self insertCharAtCursor:(Character cr). |
|
3376 |
autoIndent == true ifTrue:[ |
|
3377 |
i := self leftIndentForLine:cursorLine. |
|
3378 |
self indentFromLine:cursorLine toLine:cursorLine. |
|
3379 |
self cursorCol:(i+1 max:1) |
|
3380 |
]. |
|
3381 |
]. |
|
3382 |
]. |
|
3383 |
^self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3384 |
]. |
309
b5c9d68e95e1
new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
3385 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3386 |
(key == #Tab) ifTrue:[ |
2017 | 3387 |
self tabMeansNextField ifTrue:[^ super keyPress:key x:x y:y]. |
3388 |
||
3389 |
shifted ifTrue:[ |
|
3390 |
" |
|
3391 |
the old version used shift-tab as backtab, |
|
3392 |
however, backtab was seldom used. |
|
3393 |
An alternative is to make it a non-inserting tab ... |
|
3394 |
" |
|
3395 |
"/ self unselect. self cursorBacktab. |
|
3396 |
self unselect. self cursorTab. |
|
3397 |
^self |
|
3398 |
]. |
|
3399 |
||
3400 |
" |
|
3401 |
uncomment line below, if you like RAND/INed/MAXed editor behavior |
|
3402 |
(where tab-key is only cursor positioning) |
|
3403 |
this was the original behavior of the TAB key, but many people |
|
3404 |
complained .... |
|
3405 |
" |
|
3406 |
insertMode ifFalse:[ |
|
3407 |
self unselect. self cursorTab. ^self |
|
3408 |
]. |
|
3409 |
self unselect. self insertTabAtCursor. |
|
3410 |
^self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3411 |
]. |
309
b5c9d68e95e1
new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
3412 |
|
870 | 3413 |
(key == #BackSpace |
3414 |
or:[key == #BasicBackspace]) ifTrue:[ |
|
2017 | 3415 |
selectionStartLine notNil ifTrue:[ |
3416 |
(key == #BasicBackspace) ifTrue:[ |
|
3417 |
^ self deleteSelection. |
|
3418 |
] ifFalse:[ |
|
3419 |
^ self copyAndDeleteSelection. |
|
3420 |
]. |
|
3421 |
]. |
|
3422 |
||
3423 |
self makeCursorVisible. |
|
3424 |
self deleteCharBeforeCursor. ^self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3425 |
]. |
309
b5c9d68e95e1
new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
3426 |
|
870 | 3427 |
(key == #Delete |
3428 |
or:[key == #BasicDelete]) ifTrue:[ |
|
2017 | 3429 |
selectionStartLine notNil ifTrue:[ |
3430 |
(key == #BasicDelete) ifTrue:[ |
|
3431 |
^ self deleteSelection. |
|
3432 |
] ifFalse:[ |
|
3433 |
^ self copyAndDeleteSelection. |
|
3434 |
]. |
|
3435 |
]. |
|
3436 |
self makeCursorVisible. |
|
3437 |
self deleteCharAtCursor. ^self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3438 |
]. |
309
b5c9d68e95e1
new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
3439 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3440 |
(key == #BeginOfText) ifTrue:[ "i.e. HOME" |
2017 | 3441 |
self unselect. |
3442 |
cursorVisibleLine == 1 ifTrue:[ |
|
3443 |
self cursorHome. |
|
3444 |
] ifFalse:[ |
|
3445 |
self cursorToFirstVisibleLine |
|
3446 |
]. |
|
3447 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3448 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3449 |
(key == #EndOfText) ifTrue:[ "i.e. END" |
2017 | 3450 |
self unselect. |
3451 |
cursorVisibleLine == nFullLinesShown ifTrue:[ |
|
3452 |
self cursorToBottom. |
|
3453 |
] ifFalse:[ |
|
3454 |
self cursorToLastVisibleLine |
|
3455 |
]. |
|
3456 |
^self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3457 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3458 |
((key == #Escape) |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3459 |
or:[key == #SelectLineFromBeginning]) ifTrue:[ |
2017 | 3460 |
self makeCursorVisible. |
3461 |
self unselect. self selectCursorLineFromBeginning. ^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3462 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3463 |
(key == #SelectLine) ifTrue:[ |
2017 | 3464 |
self makeCursorVisible. |
3465 |
self unselect. self selectCursorLine. ^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3466 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3467 |
(key == #ExpandSelectionByLine) ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3468 |
"/ self makeCursorVisible. |
2017 | 3469 |
self selectExpandCursorLine. ^ self |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3470 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3471 |
(key == #DeleteLine) ifTrue:[ |
2017 | 3472 |
self makeCursorVisible. |
3473 |
self unselect. self deleteCursorLine. ^self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3474 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3475 |
(key == #InsertLine) ifTrue:[ |
2017 | 3476 |
self makeCursorVisible. |
3477 |
self unselect. self insertLine:nil before:cursorLine. ^self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3478 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3479 |
super keyPress:key x:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3480 |
|
1446
609e20a4a234
Fix selections with ShiftCursorKeys.
Stefan Vogel <sv@exept.de>
parents:
1439
diff
changeset
|
3481 |
"Modified: / 6.2.1998 / 11:59:59 / stefan" |
1688 | 3482 |
"Modified: / 20.9.1998 / 17:55:11 / cg" |
121 | 3483 |
! |
3484 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3485 |
mapped |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3486 |
"view was made visible" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3487 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3488 |
super mapped. |
915
5147640d0cf7
do not make cursor visible when mapped, but instead
Claus Gittinger <cg@exept.de>
parents:
905
diff
changeset
|
3489 |
"/ self makeCursorVisible. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3490 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
915
5147640d0cf7
do not make cursor visible when mapped, but instead
Claus Gittinger <cg@exept.de>
parents:
905
diff
changeset
|
3491 |
|
5147640d0cf7
do not make cursor visible when mapped, but instead
Claus Gittinger <cg@exept.de>
parents:
905
diff
changeset
|
3492 |
"Modified: 20.12.1996 / 14:15:56 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3493 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3494 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3495 |
pointerEnter:state x:x y:y |
1824
03630b3be319
honor the focusFollowsMouse userPreference.
Claus Gittinger <cg@exept.de>
parents:
1819
diff
changeset
|
3496 |
"mouse pointer entered - request the keyboard focus (sometimes)" |
03630b3be319
honor the focusFollowsMouse userPreference.
Claus Gittinger <cg@exept.de>
parents:
1819
diff
changeset
|
3497 |
|
1918
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3498 |
self wantsFocusWithPointerEnter ifTrue:[ |
2010 | 3499 |
self requestFocus. |
1796 | 3500 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3501 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3502 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3503 |
sizeChanged:how |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3504 |
"make certain, cursor is visible after the sizechange" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3505 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3506 |
|cv| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3507 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3508 |
cv := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3509 |
super sizeChanged:how. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3510 |
cv notNil ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3511 |
self makeLineVisible:cursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3512 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3513 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3514 |
|
1807 | 3515 |
!EditTextView methodsFor:'focus handling'! |
3516 |
||
3517 |
hasKeyboardFocus:aBoolean |
|
3518 |
"sent by the windowGroup, a delegate or myself to make me show a block cursor |
|
3519 |
(otherwise, I would not know about this)" |
|
3520 |
||
3521 |
hasKeyboardFocus := aBoolean. |
|
1816
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
3522 |
(cursorShown |
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
3523 |
and:[self enabled |
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
3524 |
and:[readOnly not]]) ifTrue:[ |
2010 | 3525 |
self drawCursor |
1816
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
3526 |
]. |
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
3527 |
|
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
3528 |
"Modified: / 23.3.1999 / 13:49:35 / cg" |
1807 | 3529 |
! |
3530 |
||
3531 |
showFocus:explicit |
|
3532 |
"in addition to however my superclass thinks how a focusView is to be |
|
3533 |
displayed, show the cursor when I got the focus" |
|
3534 |
||
3535 |
self showCursor. |
|
3536 |
self hasKeyboardFocus:true. |
|
3537 |
super showFocus:explicit |
|
3538 |
||
3539 |
"Modified: 11.12.1996 / 16:56:54 / cg" |
|
1918
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3540 |
! |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3541 |
|
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3542 |
wantsFocusWithPointerEnter |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3543 |
"return true, if I want the focus when |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3544 |
the mouse pointer enters" |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3545 |
|
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3546 |
|pref| |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3547 |
|
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3548 |
pref := UserPreferences current focusFollowsMouse. |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3549 |
(pref ~~ false |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3550 |
and:[(styleSheet at:#'editText.requestFocusOnPointerEnter' default:true) |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3551 |
and:[self enabled |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3552 |
and:[readOnly not]]]) ifTrue:[ |
2010 | 3553 |
^ true |
1918
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3554 |
]. |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3555 |
|
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3556 |
^ false |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3557 |
|
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3558 |
|
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
3559 |
|
1807 | 3560 |
! ! |
3561 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3562 |
!EditTextView methodsFor:'formatting'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3563 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3564 |
indent |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3565 |
"indent selected line-range" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3566 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3567 |
|start end| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3568 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3569 |
selectionStartLine isNil ifTrue:[^ self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3570 |
start := selectionStartLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3571 |
end := selectionEndLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3572 |
(selectionEndCol == 0) ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3573 |
end := end - 1 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3574 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3575 |
self unselect. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3576 |
self indentFromLine:start toLine:end |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3577 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3578 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3579 |
indentFromLine:start toLine:end |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3580 |
"indent a line-range - this is don by searching for the |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3581 |
last non-empty line before start, and change the indent |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3582 |
of the line based on that indent." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3583 |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3584 |
|leftStart delta d line spaces| |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3585 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3586 |
leftStart := self leftIndentForLine:start. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3587 |
(leftStart == 0) ifTrue:[^ self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3588 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3589 |
delta := leftStart - (self leftIndentOfLine:start). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3590 |
(delta == 0) ifTrue:[^ self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3591 |
(delta > 0) ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3592 |
spaces := String new:delta |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3593 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3594 |
start to:end do:[:lineNr | |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3595 |
line := self listAt:lineNr. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3596 |
line notNil ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3597 |
line isBlank ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3598 |
list at:lineNr put:nil |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3599 |
] ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3600 |
(delta > 0) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3601 |
line := spaces , line. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3602 |
widthOfWidestLine notNil ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3603 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3604 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3605 |
] ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3606 |
"check if deletion is ok" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3607 |
d := delta negated + 1. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3608 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3609 |
line size > d ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3610 |
(line copyTo:(d - 1)) withoutSeparators isEmpty ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3611 |
line := line copyFrom:d |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3612 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3613 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3614 |
widthOfWidestLine := nil |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3615 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3616 |
list at:lineNr put:line. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3617 |
self textChanged. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3618 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3619 |
] |
121 | 3620 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3621 |
self redrawFromLine:start to:end |
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3622 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3623 |
"Modified: 5.3.1996 / 14:59:18 / cg" |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3624 |
! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3625 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3626 |
leftIndentForLine:lineNr |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3627 |
"find an appropriate indent for a line. |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3628 |
this is done by searching for the last non-empty line before it |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3629 |
and returning its indent." |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3630 |
|
827 | 3631 |
"SHOULD GO TO ListView" |
3632 |
||
3633 |
|line lnr indent| |
|
3634 |
||
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3635 |
lnr := lineNr. |
827 | 3636 |
|
3637 |
[lnr ~~ 1] whileTrue:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3638 |
lnr := lnr - 1. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3639 |
line := self listAt:lnr. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3640 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3641 |
line notNil ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3642 |
indent := line indexOfNonSeparatorStartingAt:1. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3643 |
indent ~~ 0 ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3644 |
^ indent - 1 |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3645 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
3646 |
] |
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3647 |
]. |
827 | 3648 |
^ 0 |
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3649 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3650 |
"Created: 5.3.1996 / 14:58:53 / cg" |
105 | 3651 |
! ! |
3652 |
||
0 | 3653 |
!EditTextView methodsFor:'initialization'! |
3654 |
||
941 | 3655 |
fetchDeviceResources |
3656 |
"fetch device colors, to avoid reallocation at redraw time" |
|
3657 |
||
3658 |
super fetchDeviceResources. |
|
3659 |
||
1993 | 3660 |
cursorFgColor notNil ifTrue:[cursorFgColor := cursorFgColor onDevice:device]. |
3661 |
cursorBgColor notNil ifTrue:[cursorBgColor := cursorBgColor onDevice:device]. |
|
3662 |
cursorNoFocusFgColor notNil ifTrue:[cursorNoFocusFgColor := cursorNoFocusFgColor onDevice:device]. |
|
941 | 3663 |
|
3664 |
"Created: 14.1.1997 / 00:15:24 / cg" |
|
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
3665 |
"Modified: 18.2.1997 / 15:02:46 / cg" |
941 | 3666 |
! |
3667 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3668 |
initEvents |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3669 |
"enable enter/leave events in addition" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3670 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3671 |
super initEvents. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3672 |
self enableEnterLeaveEvents |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3673 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3674 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3675 |
initStyle |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3676 |
"initialize style specific stuff" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3677 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3678 |
super initStyle. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3679 |
lockUpdates := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3680 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3681 |
cursorFgColor := DefaultCursorForegroundColor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3682 |
cursorFgColor isNil ifTrue:[cursorFgColor := bgColor]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3683 |
cursorBgColor := DefaultCursorBackgroundColor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3684 |
cursorBgColor isNil ifTrue:[cursorBgColor := fgColor]. |
1334 | 3685 |
cursorType := cursorTypeNoFocus := DefaultCursorType. |
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
3686 |
DefaultCursorTypeNoFocus notNil ifTrue:[ |
2010 | 3687 |
cursorTypeNoFocus := DefaultCursorTypeNoFocus. |
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
3688 |
]. |
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
3689 |
cursorNoFocusFgColor := DefaultCursorNoFocusForegroundColor. |
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
3690 |
cursorNoFocusFgColor isNil ifTrue:[ |
2010 | 3691 |
cursorType ~~ #block ifTrue:[ |
3692 |
cursorNoFocusFgColor := cursorBgColor |
|
3693 |
] ifFalse:[ |
|
3694 |
cursorNoFocusFgColor := cursorFgColor |
|
3695 |
] |
|
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
3696 |
]. |
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
3697 |
|
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
3698 |
"Modified: / 20.5.1998 / 04:26:31 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3699 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3700 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3701 |
initialize |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3702 |
"initialize a new EditTextView; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3703 |
setup some instance variables" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3704 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3705 |
super initialize. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3706 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3707 |
self level:-1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3708 |
readOnly := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3709 |
fixedSize := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3710 |
exceptionBlock := [:errorText | ]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3711 |
cursorShown := prevCursorState := true. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3712 |
cursorLine := 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3713 |
cursorVisibleLine := 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3714 |
cursorCol := 1. |
947 | 3715 |
modifiedChannel := ValueHolder newBoolean. |
1013 | 3716 |
acceptChannel := ValueHolder newBoolean. |
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
3717 |
acceptChannel addDependent:self. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3718 |
showMatchingParenthesis := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3719 |
hasKeyboardFocus := false. "/ true. |
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
3720 |
tabMeansNextField := false. |
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3721 |
autoIndent := false. |
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3722 |
insertMode := true. |
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
3723 |
st80Mode := ST80Mode. |
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
3724 |
trimBlankLines := st80Mode not. "true." |
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
3725 |
|
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
3726 |
"Modified: / 20.6.1998 / 18:19:17 / cg" |
0 | 3727 |
! ! |
3728 |
||
121 | 3729 |
!EditTextView methodsFor:'menu actions'! |
3730 |
||
3731 |
cut |
|
3732 |
"cut selection into copybuffer" |
|
3733 |
||
1818
aa16d9b96e40
fixed cut to not compress multiple blanks.
Claus Gittinger <cg@exept.de>
parents:
1817
diff
changeset
|
3734 |
|line col history sel s| |
121 | 3735 |
|
1548
d4a3d61388dc
flash view in readonly mode, when modification is attempted.
Claus Gittinger <cg@exept.de>
parents:
1546
diff
changeset
|
3736 |
(self checkModificationsAllowed) ifFalse:[ |
2010 | 3737 |
self flash. |
3738 |
^ self |
|
1548
d4a3d61388dc
flash view in readonly mode, when modification is attempted.
Claus Gittinger <cg@exept.de>
parents:
1546
diff
changeset
|
3739 |
]. |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3740 |
|
121 | 3741 |
sel := self selection. |
3742 |
sel notNil ifTrue:[ |
|
2010 | 3743 |
lastString := s := sel asStringWithCRs. |
3744 |
line := selectionStartLine. |
|
3745 |
col := selectionStartCol. |
|
3746 |
undoAction := [ self cursorLine:line col:col. |
|
3747 |
self insertLines:(Array with:s) withCR:false. |
|
3748 |
]. |
|
3749 |
||
3750 |
" |
|
3751 |
remember in CopyBuffer |
|
3752 |
" |
|
3753 |
self setTextSelection:lastString. |
|
3754 |
||
3755 |
" |
|
3756 |
append to DeleteHistory (if there is one) |
|
3757 |
" |
|
3758 |
history := Smalltalk at:#DeleteHistory. |
|
3759 |
history notNil ifTrue:[ |
|
3760 |
history addAll:(lastString asStringCollection). |
|
3761 |
history size > 1000 ifTrue:[ |
|
3762 |
history := history copyFrom:(history size - 1000) |
|
3763 |
]. |
|
3764 |
]. |
|
3765 |
||
3766 |
" |
|
3767 |
now, delete it |
|
3768 |
" |
|
3769 |
self deleteSelection. |
|
3770 |
lastReplacement := nil |
|
121 | 3771 |
] ifFalse:[ |
2010 | 3772 |
" |
3773 |
a cut without selection will search&cut again |
|
3774 |
" |
|
3775 |
self again |
|
121 | 3776 |
] |
1290 | 3777 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3778 |
"Modified: / 5.4.1998 / 16:51:53 / cg" |
121 | 3779 |
! |
3780 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3781 |
defaultForGotoLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3782 |
"return a default value to show in the gotoLine box" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3783 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3784 |
cursorLine notNil ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3785 |
^ cursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3786 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3787 |
^ super defaultForGotoLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3788 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3789 |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3790 |
editMenu |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3791 |
"return the views middleButtonMenu" |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3792 |
|
488 | 3793 |
<resource: #keyboard (#Again #Copy #Cut #Paste #Accept #Find #GotoLine #SaveAs #Print)> |
1261
bdb18f73205c
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1198
diff
changeset
|
3794 |
<resource: #programMenu> |
1054 | 3795 |
|
1809 | 3796 |
|items m sub sensor| |
1515 | 3797 |
|
3798 |
((sensor := self sensor) notNil and:[sensor ctrlDown]) ifTrue:[ |
|
2017 | 3799 |
items := #( |
3800 |
('again (for all)' multipleAgain) |
|
3801 |
). |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3802 |
] ifFalse:[ |
2017 | 3803 |
undoAction notNil ifTrue:[ |
3804 |
]. |
|
3805 |
||
3806 |
items := #( |
|
3807 |
('again' again Again ) |
|
3808 |
('-' ) |
|
3809 |
('copy' copySelection Copy ) |
|
3810 |
('cut' cut Cut ) |
|
3811 |
('paste' pasteOrReplace Paste ) |
|
3812 |
('-' ) |
|
3813 |
('accept' accept Accept ) |
|
3814 |
('=' ) |
|
3815 |
('others' others ) |
|
3816 |
). |
|
3817 |
undoAction notNil ifTrue:[ |
|
3818 |
items := #( |
|
3819 |
('undo' undo ) |
|
3820 |
) , items |
|
3821 |
]. |
|
3822 |
||
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3823 |
]. |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3824 |
|
1546
f17fa0744663
use new menu-creation message
Claus Gittinger <cg@exept.de>
parents:
1534
diff
changeset
|
3825 |
m := PopUpMenu itemList:items resources:resources. |
f17fa0744663
use new menu-creation message
Claus Gittinger <cg@exept.de>
parents:
1534
diff
changeset
|
3826 |
|
f17fa0744663
use new menu-creation message
Claus Gittinger <cg@exept.de>
parents:
1534
diff
changeset
|
3827 |
items := #( |
2017 | 3828 |
('search ...' search Find ) |
3829 |
('goto ...' gotoLine GotoLine ) |
|
3830 |
('-' ) |
|
3831 |
('font ...' changeFont ) |
|
3832 |
('-' ) |
|
3833 |
('indent' indent ) |
|
3834 |
('autoIndent \c' autoIndent: ) |
|
3835 |
('insertMode \c' insertMode: ) |
|
3836 |
('-' ) |
|
3837 |
('save as ...' save SaveAs ) |
|
3838 |
('print' doPrint Print ) |
|
3839 |
). |
|
1546
f17fa0744663
use new menu-creation message
Claus Gittinger <cg@exept.de>
parents:
1534
diff
changeset
|
3840 |
|
f17fa0744663
use new menu-creation message
Claus Gittinger <cg@exept.de>
parents:
1534
diff
changeset
|
3841 |
sub := PopUpMenu itemList:items resources:resources performer:model. |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3842 |
|
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3843 |
m subMenuAt:#others put:sub. |
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
3844 |
sub checkToggleAt:#autoIndent: put:autoIndent. |
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3845 |
sub checkToggleAt:#insertMode: put:insertMode. |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3846 |
|
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
3847 |
self isReadOnly ifTrue:[ |
2017 | 3848 |
m disableAll:#(paste pasteOrReplace cut indent autoIndent: insertMode:) |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3849 |
]. |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3850 |
self hasSelection not ifTrue:[ |
2017 | 3851 |
m disable:#copySelection. |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3852 |
]. |
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
3853 |
(self hasSelection not or:[self isReadOnly]) ifTrue:[ |
2017 | 3854 |
m disable:#cut. |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3855 |
]. |
1818
aa16d9b96e40
fixed cut to not compress multiple blanks.
Claus Gittinger <cg@exept.de>
parents:
1817
diff
changeset
|
3856 |
(undoAction isNil) ifTrue:[ |
2017 | 3857 |
m disable:#undo. |
1818
aa16d9b96e40
fixed cut to not compress multiple blanks.
Claus Gittinger <cg@exept.de>
parents:
1817
diff
changeset
|
3858 |
]. |
1108 | 3859 |
acceptEnabled == false ifTrue:[ |
2017 | 3860 |
m disable:#accept |
1108 | 3861 |
]. |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3862 |
^ m. |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3863 |
|
1546
f17fa0744663
use new menu-creation message
Claus Gittinger <cg@exept.de>
parents:
1534
diff
changeset
|
3864 |
"Modified: / 21.5.1998 / 15:52:38 / cg" |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3865 |
! |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
3866 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3867 |
paste |
1289 | 3868 |
"paste the copybuffer; if there is a selection, unselect first. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3869 |
Then paste at cursor position." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3870 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3871 |
|sel| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3872 |
|
1548
d4a3d61388dc
flash view in readonly mode, when modification is attempted.
Claus Gittinger <cg@exept.de>
parents:
1546
diff
changeset
|
3873 |
self checkModificationsAllowed ifFalse:[ |
2010 | 3874 |
self flash. |
3875 |
^ self |
|
1548
d4a3d61388dc
flash view in readonly mode, when modification is attempted.
Claus Gittinger <cg@exept.de>
parents:
1546
diff
changeset
|
3876 |
]. |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3877 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3878 |
sel := self getTextSelection. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3879 |
self unselect. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3880 |
sel notNil ifTrue:[ |
2010 | 3881 |
self paste:sel. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3882 |
] |
1289 | 3883 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3884 |
"Modified: / 5.4.1998 / 16:55:02 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3885 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3886 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3887 |
paste:someText |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3888 |
"paste someText at cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3889 |
|
1818
aa16d9b96e40
fixed cut to not compress multiple blanks.
Claus Gittinger <cg@exept.de>
parents:
1817
diff
changeset
|
3890 |
|s nLines startLine startCol l1 l2 c1 c2| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3891 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3892 |
self checkModificationsAllowed ifFalse:[^ self]. |
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3893 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3894 |
someText notNil ifTrue:[ |
2017 | 3895 |
s := someText. |
3896 |
s isString ifTrue:[ |
|
3897 |
s := s asStringCollection |
|
3898 |
] ifFalse:[ |
|
3899 |
(s isStringCollection) ifFalse:[ |
|
3900 |
self warn:'selection (' , s class name , ') is not convertable to Text'. |
|
3901 |
^ self |
|
3902 |
] |
|
3903 |
]. |
|
3904 |
(nLines := s size) == 0 ifTrue:[^ self]. |
|
3905 |
(nLines == 1 and:[(s at:1) size == 0]) ifTrue:[^ self]. |
|
3906 |
||
3907 |
startLine := l1 := cursorLine. |
|
3908 |
startCol := c1 := cursorCol. |
|
3909 |
self insertLines:(s withTabsExpanded) withCR:false. |
|
3910 |
l2 := cursorLine. |
|
3911 |
c2 := (cursorCol - 1). |
|
3912 |
self selectFromLine:l1 col:c1 toLine:l2 col:c2. |
|
3913 |
typeOfSelection := #paste. |
|
3914 |
undoAction := [ |
|
3915 |
self unselect. |
|
3916 |
self deleteFromLine:l1 col:c1 toLine:l2 col:c2. |
|
3917 |
self cursorLine:l1 col:c1. |
|
3918 |
]. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3919 |
] |
362
3993ba6c31a0
Expand tabs before pasting a string.
Stefan Vogel <sv@exept.de>
parents:
331
diff
changeset
|
3920 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3921 |
"Modified: / 14.2.1996 / 11:14:14 / stefan" |
1568 | 3922 |
"Modified: / 12.6.1998 / 22:12:00 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3923 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3924 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3925 |
pasteOrReplace |
1289 | 3926 |
"paste the copybuffer; if there is a selection, replace it. |
2010 | 3927 |
otherwise paste at cursor position. |
3928 |
Replace is not done for selections which were created by a paste, |
|
3929 |
to allow multiple paste operations in a row." |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3930 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3931 |
|sel| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3932 |
|
1548
d4a3d61388dc
flash view in readonly mode, when modification is attempted.
Claus Gittinger <cg@exept.de>
parents:
1546
diff
changeset
|
3933 |
self checkModificationsAllowed ifFalse:[ |
2010 | 3934 |
self flash. |
3935 |
^ self |
|
1548
d4a3d61388dc
flash view in readonly mode, when modification is attempted.
Claus Gittinger <cg@exept.de>
parents:
1546
diff
changeset
|
3936 |
]. |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3937 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3938 |
sel := self getTextSelection. |
2010 | 3939 |
sel notNil ifTrue:[ |
3940 |
self pasteOrReplace:sel. |
|
3941 |
]. |
|
1289 | 3942 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3943 |
"Modified: / 5.4.1998 / 16:55:16 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3944 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3945 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3946 |
pasteOrReplace:someText |
1289 | 3947 |
"paste someText; if there is a selection, replace it. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3948 |
otherwise paste at cursor position. Replace is not done |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3949 |
for originating by a paste, to allow multiple |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3950 |
paste." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3951 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3952 |
self checkModificationsAllowed ifFalse:[^ self]. |
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3953 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3954 |
((self hasSelection == true) and:[typeOfSelection ~~ #paste]) ifTrue:[ |
2010 | 3955 |
^ self replace:someText |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3956 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3957 |
self paste:someText. |
1289 | 3958 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3959 |
"Modified: / 5.4.1998 / 16:55:21 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3960 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3961 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3962 |
replace |
1289 | 3963 |
"replace the selection by the contents of the copybuffer" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3964 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3965 |
|sel| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3966 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3967 |
self checkModificationsAllowed ifFalse:[^ self]. |
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3968 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3969 |
sel := self getTextSelection. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3970 |
sel notNil ifTrue:[ |
2010 | 3971 |
self replace:sel |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3972 |
] |
1289 | 3973 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3974 |
"Modified: / 5.4.1998 / 16:55:24 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3975 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3976 |
|
121 | 3977 |
replace:someText |
1289 | 3978 |
"replace the selection by someText" |
121 | 3979 |
|
2017 | 3980 |
|selected selectedString |
3981 |
selStartLine selStartCol selEndLine selEndCol pasteUndoAction| |
|
121 | 3982 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3983 |
self checkModificationsAllowed ifFalse:[^ self]. |
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3984 |
|
121 | 3985 |
selected := self selection. |
3986 |
selected isNil ifTrue:[ |
|
2017 | 3987 |
^ self paste:someText |
121 | 3988 |
]. |
2017 | 3989 |
|
121 | 3990 |
self deleteSelection. |
3991 |
||
3992 |
"take care, if we replace a selection without space by a word selected |
|
3993 |
with one - in this case we usually do not want the space. |
|
3994 |
But, if we replace a word-selected selection by something without a |
|
3995 |
space, we DO want the space added." |
|
3996 |
||
3997 |
selected size == 1 ifTrue:[ |
|
2017 | 3998 |
selectedString := selected at:1. |
7 | 3999 |
]. |
4000 |
||
362
3993ba6c31a0
Expand tabs before pasting a string.
Stefan Vogel <sv@exept.de>
parents:
331
diff
changeset
|
4001 |
someText size == 1 ifTrue:[ |
2017 | 4002 |
|cutOffSpace addSpace replacement replacementString| |
4003 |
||
4004 |
cutOffSpace := false. |
|
4005 |
addSpace := false. |
|
4006 |
replacement := someText copy. |
|
4007 |
||
4008 |
selectedString notNil ifTrue:[ |
|
4009 |
((selectedString startsWith:' ') or:[selectedString endsWith:' ']) ifFalse:[ |
|
4010 |
"selection has no space" |
|
4011 |
||
4012 |
((selectStyle == #wordleft) or:[selectStyle == #wordRight]) ifTrue:[ |
|
4013 |
cutOffSpace := true |
|
4014 |
] |
|
4015 |
] ifTrue:[ |
|
4016 |
addSpace := true |
|
4017 |
] |
|
4018 |
]. |
|
4019 |
replacementString := replacement at:1. |
|
4020 |
cutOffSpace ifTrue:[ |
|
4021 |
(replacementString startsWith:' ') ifTrue:[ |
|
4022 |
replacementString := replacementString withoutSpaces |
|
4023 |
]. |
|
4024 |
] ifFalse:[ |
|
4025 |
selectStyle == #wordLeft ifTrue:[ |
|
4026 |
"want a space at left" |
|
4027 |
(replacementString startsWith:' ') ifFalse:[ |
|
4028 |
replacementString := replacementString withoutSpaces. |
|
4029 |
replacementString := ' ' , replacementString |
|
4030 |
] |
|
4031 |
]. |
|
4032 |
selectStyle == #wordRight ifTrue:[ |
|
4033 |
"want a space at right" |
|
4034 |
||
4035 |
(replacementString endsWith:' ') ifFalse:[ |
|
4036 |
replacementString := replacementString withoutSpaces. |
|
4037 |
replacementString := replacementString , ' ' |
|
4038 |
] |
|
4039 |
]. |
|
4040 |
]. |
|
4041 |
replacement at:1 put: replacementString. |
|
4042 |
self paste:replacement. |
|
121 | 4043 |
] ifFalse:[ |
2017 | 4044 |
self paste:someText |
7 | 4045 |
]. |
121 | 4046 |
lastString := selectedString. |
2017 | 4047 |
lastReplacement := someText. |
4048 |
||
4049 |
selStartLine := selectionStartLine. |
|
4050 |
selStartCol := self selectionStartCol. |
|
4051 |
selEndLine := selectionEndLine. |
|
4052 |
selEndCol := self selectionEndCol. |
|
4053 |
pasteUndoAction := undoAction. |
|
4054 |
||
4055 |
undoAction := [ |
|
4056 |
pasteUndoAction value. |
|
4057 |
self cursorLine:selStartLine col:selEndLine. |
|
4058 |
self paste:selected. |
|
4059 |
]. |
|
362
3993ba6c31a0
Expand tabs before pasting a string.
Stefan Vogel <sv@exept.de>
parents:
331
diff
changeset
|
4060 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
4061 |
"Modified: / 14.2.1996 / 10:37:02 / stefan" |
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
4062 |
"Modified: / 5.4.1998 / 16:55:28 / cg" |
121 | 4063 |
! |
4064 |
||
4065 |
showDeleted |
|
4066 |
"open a readonly editor on all deleted text" |
|
4067 |
||
4068 |
|v| |
|
4069 |
||
4070 |
v := EditTextView openWith:(Smalltalk at:#DeleteHistory). |
|
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
4071 |
v readOnly:true. |
121 | 4072 |
v topView label:'deleted text'. |
105 | 4073 |
! ! |
4074 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4075 |
!EditTextView methodsFor:'private'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4076 |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
4077 |
checkModificationsAllowed |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
4078 |
"check if the text can be modified (i.e. is not readOnly). |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
4079 |
evaluate the exceptionBlock if not. |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
4080 |
This block should be provided by the application or user of the textView, |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
4081 |
and may show a warnBox or whatever." |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
4082 |
|
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
4083 |
self isReadOnly ifTrue: [ |
2010 | 4084 |
exceptionBlock isNil ifTrue:[ |
4085 |
^ false |
|
4086 |
]. |
|
4087 |
||
4088 |
(exceptionBlock value:'Text may not be modified') ~~ true ifTrue:[ |
|
4089 |
^ false |
|
4090 |
] |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
4091 |
]. |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
4092 |
^ true |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
4093 |
|
1577
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
4094 |
"Modified: / 17.6.1998 / 15:51:10 / cg" |
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
4095 |
! |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
4096 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4097 |
textChanged |
522 | 4098 |
"my text was modified (internally). |
4099 |
Sent whenever text has been edited (not to confuse with |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4100 |
contentsChanged, which is triggered when the size has changed, and |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4101 |
is used to notify scrollers, other views etc.)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4102 |
|
641 | 4103 |
self contentsChanged. |
1015 | 4104 |
self modified:true. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4105 |
contentsWasSaved := false |
641 | 4106 |
|
1015 | 4107 |
"Modified: 14.2.1997 / 16:58:38 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4108 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4109 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4110 |
!EditTextView methodsFor:'queries'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4111 |
|
1526
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
4112 |
currentLine |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
4113 |
"the current line (for relative gotos)" |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
4114 |
|
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
4115 |
^ cursorLine |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
4116 |
|
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
4117 |
"Created: / 17.5.1998 / 20:07:52 / cg" |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
4118 |
! |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
4119 |
|
1878 | 4120 |
isKeyboardConsumer |
4121 |
"return true, if the receiver is a keyboard consumer; |
|
4122 |
Return true here, redefined from SimpleView." |
|
4123 |
||
4124 |
^ true |
|
4125 |
||
4126 |
! |
|
4127 |
||
997 | 4128 |
specClass |
1390 | 4129 |
"redefined, since the name of my specClass is nonStandard (i.e. not EditTextSpec)" |
4130 |
||
997 | 4131 |
self class == EditTextView ifTrue:[^ TextEditorSpec]. |
1049 | 4132 |
^ super specClass |
4133 |
||
1390 | 4134 |
"Modified: / 31.10.1997 / 19:48:19 / cg" |
997 | 4135 |
! |
4136 |
||
324 | 4137 |
tabMeansNextField |
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
4138 |
"return true, if a Tab character should shift focus." |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
4139 |
|
313
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
4140 |
"if not readOnly, I want my tab keys ..." |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
4141 |
|
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
4142 |
^ self isReadOnly or:[tabMeansNextField] |
324 | 4143 |
|
4144 |
"Created: 7.2.1996 / 19:15:31 / cg" |
|
313
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
4145 |
! |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
4146 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4147 |
widthOfContents |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4148 |
"return the width of the contents in pixels |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4149 |
Redefined to add the size of a space (for the cursor). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4150 |
this enables us to scroll one position further than the longest |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4151 |
line (and possibly see the cursor behind the line)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4152 |
|
697 | 4153 |
|w dev| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4154 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4155 |
w := super widthOfContents. |
697 | 4156 |
(dev := device) isNil ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4157 |
"/ really dont know ... |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4158 |
dev := Screen current |
606
682579fa3b62
fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents:
597
diff
changeset
|
4159 |
]. |
697 | 4160 |
^ w + (font widthOn:dev) |
4161 |
||
4162 |
"Modified: 28.5.1996 / 19:32:25 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4163 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4164 |
|
1588 | 4165 |
!EditTextView methodsFor:'realization'! |
4166 |
||
4167 |
realize |
|
4168 |
"make the view visible - scroll to make the cursor visible." |
|
4169 |
||
4170 |
super realize. |
|
4171 |
||
4172 |
self makeCursorVisible. |
|
1993 | 4173 |
cursorFgColor := cursorFgColor onDevice:device. |
4174 |
cursorBgColor := cursorBgColor onDevice:device. |
|
1588 | 4175 |
|
4176 |
"Modified: 20.12.1996 / 14:16:05 / cg" |
|
4177 |
"Created: 24.7.1997 / 18:24:12 / cg" |
|
4178 |
! ! |
|
4179 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4180 |
!EditTextView methodsFor:'redrawing'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4181 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4182 |
redrawCursorIfBetweenVisibleLine:startVisLine and:endVisLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4183 |
"redraw the cursor, if it sits in a line range" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4184 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4185 |
cursorShown ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4186 |
cursorVisibleLine notNil ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4187 |
(cursorVisibleLine between:startVisLine and:endVisLine) ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4188 |
self drawCursorCharacter |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4189 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4190 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4191 |
] |
105 | 4192 |
! |
4193 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4194 |
redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4195 |
"redraw the cursor, if it sits in visible line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4196 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4197 |
cursorShown ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4198 |
(visLine == cursorVisibleLine) ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4199 |
self drawCursorCharacter |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4200 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4201 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4202 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4203 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4204 |
redrawFromVisibleLine:startVisLine to:endVisLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4205 |
"redraw a visible line range" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4206 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4207 |
super redrawFromVisibleLine:startVisLine to:endVisLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4208 |
self redrawCursorIfBetweenVisibleLine:startVisLine and:endVisLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4209 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4210 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4211 |
redrawVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4212 |
"redraw a visible line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4213 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4214 |
super redrawVisibleLine:visLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4215 |
self redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4216 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4217 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4218 |
redrawVisibleLine:visLine col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4219 |
"redraw the single character in visibleline at colNr" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4220 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4221 |
cursorShown ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4222 |
(visLine == cursorVisibleLine) ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4223 |
(colNr == cursorCol) ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4224 |
self drawCursorCharacter. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4225 |
^ self |
118 | 4226 |
] |
4227 |
] |
|
0 | 4228 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4229 |
super redrawVisibleLine:visLine col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4230 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4231 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4232 |
redrawVisibleLine:visLine from:startCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4233 |
"redraw a visible line from startCol to the end of line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4234 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4235 |
super redrawVisibleLine:visLine from:startCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4236 |
self redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4237 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4238 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4239 |
redrawVisibleLine:visLine from:startCol to:endCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4240 |
"redraw a visible line from startCol to endCol" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4241 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4242 |
super redrawVisibleLine:visLine from:startCol to:endCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4243 |
self redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4244 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4245 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4246 |
!EditTextView methodsFor:'scrolling'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4247 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4248 |
halfPageDown |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4249 |
"half a page down - to keep cursor on same visible line, it has to be moved |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4250 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4251 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4252 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4253 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4254 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4255 |
super halfPageDown. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4256 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4257 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4258 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4259 |
halfPageUp |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4260 |
"half a page up - to keep cursor on same visible line, it has to be moved |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4261 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4262 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4263 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4264 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4265 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4266 |
super halfPageUp. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4267 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4268 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4269 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4270 |
originChanged:delta |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4271 |
"sent after scrolling - have to show the cursor if it was on before" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4272 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4273 |
super originChanged:delta. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4274 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4275 |
should we move the cursor with the scroll - or leave it ? |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4276 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4277 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4278 |
prevCursorState ifTrue:[ |
2010 | 4279 |
self showCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4280 |
] |
1577
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
4281 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
4282 |
"Modified: / 17.6.1998 / 16:13:24 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4283 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4284 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4285 |
originWillChange |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4286 |
"sent before scrolling - have to hide the cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4287 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4288 |
prevCursorState := cursorShown. |
1601 | 4289 |
"/ cursorShown := false. |
1591 | 4290 |
cursorShown ifTrue:[ |
2010 | 4291 |
self hideCursor |
1591 | 4292 |
] |
4293 |
||
1601 | 4294 |
"Modified: / 6.7.1998 / 13:07:23 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4295 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4296 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4297 |
pageDown |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4298 |
"page down - to keep cursor on same visible line, it has to be moved |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4299 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4300 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4301 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4302 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4303 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4304 |
super pageDown. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4305 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4306 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4307 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4308 |
pageUp |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4309 |
"page up - to keep cursor on same visible line, it has to be moved |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4310 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4311 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4312 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4313 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4314 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4315 |
super pageUp. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4316 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4317 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4318 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4319 |
!EditTextView methodsFor:'searching'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4320 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4321 |
searchBwd:pattern ifAbsent:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4322 |
"do a backward search" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4323 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4324 |
|startLine startCol| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4325 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4326 |
cursorLine isNil ifTrue:[^ self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4327 |
selectionStartLine notNil ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4328 |
startLine := selectionStartLine. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4329 |
startCol := selectionStartCol |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4330 |
] ifFalse:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4331 |
startLine := cursorLine min:list size. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4332 |
startCol := cursorCol |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4333 |
]. |
1339 | 4334 |
self |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4335 |
searchBackwardFor:pattern |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4336 |
startingAtLine:startLine col:startCol |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4337 |
ifFound:[:line :col | |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4338 |
self cursorLine:line col:col. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4339 |
self showMatch:pattern atLine:line col:col. |
1339 | 4340 |
"/ self makeLineVisible:cursorLine |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4341 |
typeOfSelection := #search] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4342 |
ifAbsent:aBlock |
1339 | 4343 |
|
4344 |
"Modified: 9.10.1997 / 13:02:04 / cg" |
|
4345 |
! |
|
4346 |
||
4347 |
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock |
|
4348 |
"do a backward search" |
|
4349 |
||
4350 |
|startLine startCol| |
|
4351 |
||
4352 |
cursorLine isNil ifTrue:[^ self]. |
|
4353 |
selectionStartLine notNil ifTrue:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4354 |
startLine := selectionStartLine. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4355 |
startCol := selectionStartCol |
1339 | 4356 |
] ifFalse:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4357 |
startLine := cursorLine min:list size. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4358 |
startCol := cursorCol |
1339 | 4359 |
]. |
4360 |
self |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4361 |
searchBackwardFor:pattern |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4362 |
ignoreCase:ign |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4363 |
startingAtLine:startLine col:startCol |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4364 |
ifFound:[:line :col | |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4365 |
self cursorLine:line col:col. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4366 |
self showMatch:pattern atLine:line col:col. |
1339 | 4367 |
"/ self makeLineVisible:cursorLine |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4368 |
typeOfSelection := #search] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4369 |
ifAbsent:aBlock |
1339 | 4370 |
|
4371 |
"Modified: 9.10.1997 / 13:02:13 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4372 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4373 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4374 |
searchForAndSelectMatchingParenthesis |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4375 |
"select characters enclosed by matching parenthesis if one is under cusor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4376 |
|
1339 | 4377 |
self |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4378 |
searchForMatchingParenthesisFromLine:cursorLine col:cursorCol |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4379 |
ifFound:[:line :col | |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4380 |
self selectFromLine:cursorLine col:cursorCol |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4381 |
toLine:line col:col] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4382 |
ifNotFound:[self showNotFound] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4383 |
onError:[self beep] |
1339 | 4384 |
|
4385 |
"Modified: 9.10.1997 / 12:57:34 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4386 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4387 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4388 |
searchForMatchingParenthesis |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4389 |
"search for a matching parenthesis starting at cursor position. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4390 |
Search for the corresponding character is done forward if its an opening, |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4391 |
backwards if its a closing parenthesis. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4392 |
Positions the cursor if found, peeps if not" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4393 |
|
1339 | 4394 |
self |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4395 |
searchForMatchingParenthesisFromLine:cursorLine col:cursorCol |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4396 |
ifFound:[:line :col | self cursorLine:line col:col] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4397 |
ifNotFound:[self showNotFound] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4398 |
onError:[self beep] |
1339 | 4399 |
|
4400 |
"Modified: 9.10.1997 / 12:56:30 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4401 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4402 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4403 |
searchFwd:pattern ifAbsent:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4404 |
"do a forward search" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4405 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4406 |
|startCol| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4407 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4408 |
"/ if there is no selection and the cursor is at the origin, |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4409 |
"/ assume its the first search and do not skip the very first match |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4410 |
startCol := cursorCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4411 |
self hasSelection ifFalse:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4412 |
(cursorLine == 1 and:[cursorCol == 1]) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4413 |
startCol := 0 |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4414 |
] |
1339 | 4415 |
]. |
4416 |
||
4417 |
self |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4418 |
searchFwd:pattern |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4419 |
startingAtLine:cursorLine col:startCol |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4420 |
ifAbsent:aBlock |
1339 | 4421 |
|
4422 |
"Modified: 9.10.1997 / 12:58:59 / cg" |
|
4423 |
! |
|
4424 |
||
4425 |
searchFwd:pattern ignoreCase:ign ifAbsent:aBlock |
|
4426 |
"do a forward search" |
|
4427 |
||
4428 |
|startCol| |
|
4429 |
||
4430 |
"/ if there is no selection and the cursor is at the origin, |
|
4431 |
"/ assume its the first search and do not skip the very first match |
|
4432 |
startCol := cursorCol. |
|
4433 |
self hasSelection ifFalse:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4434 |
(cursorLine == 1 and:[cursorCol == 1]) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4435 |
startCol := 0 |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4436 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4437 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4438 |
|
1339 | 4439 |
self |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4440 |
searchFwd:pattern |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4441 |
ignoreCase:ign |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4442 |
startingAtLine:cursorLine col:startCol |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4443 |
ifAbsent:aBlock |
1339 | 4444 |
|
4445 |
"Modified: 9.10.1997 / 12:58:59 / cg" |
|
4446 |
"Created: 9.10.1997 / 13:04:10 / cg" |
|
4447 |
! |
|
4448 |
||
4449 |
searchFwd:pattern ignoreCase:ign startingAtLine:startLine col:startCol ifAbsent:aBlock |
|
4450 |
"do a forward search" |
|
4451 |
||
4452 |
cursorLine isNil ifTrue:[^ self]. |
|
4453 |
self |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4454 |
searchForwardFor:pattern |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4455 |
ignoreCase:ign |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4456 |
startingAtLine:startLine col:startCol |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4457 |
ifFound:[:line :col | |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4458 |
self cursorLine:line col:col. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4459 |
self showMatch:pattern atLine:line col:col. |
1339 | 4460 |
"/ self makeLineVisible:cursorLine |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4461 |
typeOfSelection := #search] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4462 |
ifAbsent:aBlock |
1339 | 4463 |
|
4464 |
"Modified: 9.10.1997 / 12:57:47 / cg" |
|
4465 |
"Created: 9.10.1997 / 13:01:12 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4466 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4467 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4468 |
searchFwd:pattern startingAtLine:startLine col:startCol ifAbsent:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4469 |
"do a forward search" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4470 |
|
1339 | 4471 |
self |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4472 |
searchForwardFor:pattern |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4473 |
startingAtLine:startLine col:startCol |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4474 |
ifFound:[:line :col | |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4475 |
self cursorLine:line col:col. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4476 |
self showMatch:pattern atLine:line col:col. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4477 |
typeOfSelection := #search] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4478 |
ifAbsent:aBlock |
1339 | 4479 |
|
4480 |
"Modified: 9.10.1997 / 13:07:52 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4481 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4482 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4483 |
setSearchPattern |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4484 |
"set the searchpattern from the selection if there is one, and position |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4485 |
cursor to start of pattern" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4486 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4487 |
|sel| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4488 |
|
559
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
4489 |
"/ |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
4490 |
"/ if the last operation was a replcae, set pattern to last |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
4491 |
"/ original string (for search after again) |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
4492 |
"/ |
565 | 4493 |
(lastString notNil |
4494 |
and:[lastReplacement notNil |
|
4495 |
and:[typeOfSelection ~~ #search]]) ifTrue:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4496 |
lastSearchPattern := lastString asString withoutSeparators. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4497 |
^ self |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4498 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4499 |
|
559
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
4500 |
"/ |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
4501 |
"/ if there is a selection: |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
4502 |
"/ if there was no previous search, take it as search pattern. |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
4503 |
"/ if there was a previous search, only take the selection if |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
4504 |
"/ it did not result from a paste. |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
4505 |
"/ (to allow search-paste to be repeated) |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
4506 |
"/ |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4507 |
sel := self selection. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4508 |
sel notNil ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4509 |
(lastSearchPattern isNil |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4510 |
or:[typeOfSelection ~~ #paste]) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4511 |
self cursorLine:selectionStartLine col:selectionStartCol. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4512 |
lastSearchPattern := sel asString withoutSeparators |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4513 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4514 |
] |
559
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
4515 |
|
565 | 4516 |
"Modified: 20.4.1996 / 12:50:13 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4517 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4518 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4519 |
!EditTextView methodsFor:'selections'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4520 |
|
1850 | 4521 |
autoMoveCursorToEndOfSelection |
4522 |
"return true, if the cursor should be automatically moved to the |
|
4523 |
end of a selection. |
|
4524 |
Redefined to return false in terminaViews, where the cursor should |
|
4525 |
not be affected by selecting" |
|
4526 |
||
4527 |
^ true |
|
4528 |
! |
|
4529 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4530 |
selectAll |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4531 |
"select the whole text. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4532 |
redefined to send super selectFrom... since we dont want the |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4533 |
cursor to be moved in this case." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4534 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4535 |
list isNil ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4536 |
self unselect |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4537 |
] ifFalse:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4538 |
super selectFromLine:1 col:1 toLine:(list size + 1) col:0. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4539 |
typeOfSelection := nil |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4540 |
] |
1082 | 4541 |
|
4542 |
"Modified: 28.2.1997 / 19:14:54 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4543 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4544 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4545 |
selectCursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4546 |
"select cursorline" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4547 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4548 |
self selectFromLine:cursorLine col:1 toLine:cursorLine+1 col:0 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4549 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4550 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4551 |
selectCursorLineFromBeginning |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4552 |
"select cursorline up to cursor position" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4553 |
|
823
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
4554 |
cursorCol > 1 ifTrue:[ |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4555 |
self selectFromLine:cursorLine col:1 |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4556 |
toLine:cursorLine col:(cursorCol-1) |
823
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
4557 |
] |
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
4558 |
|
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
4559 |
"Modified: 16.8.1996 / 19:14:14 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4560 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4561 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4562 |
selectExpandCursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4563 |
"expand selection by one line or select cursorline" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4564 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4565 |
selectionStartLine isNil ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4566 |
self selectCursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4567 |
] ifFalse:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4568 |
self selectFromLine:selectionStartLine col:selectionStartCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4569 |
toLine:cursorLine+1 col:0. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4570 |
self makeLineVisible:selectionEndLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4571 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4572 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4573 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4574 |
selectFromBeginning |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4575 |
"select the text from the beginning to the current cursor position." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4576 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4577 |
|col| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4578 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4579 |
list isNil ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4580 |
self unselect |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4581 |
] ifFalse:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4582 |
cursorCol == 0 ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4583 |
col := 0 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4584 |
] ifFalse:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4585 |
col := cursorCol - 1 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4586 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4587 |
super selectFromLine:1 col:1 toLine:cursorLine col:col. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4588 |
typeOfSelection := nil |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4589 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4590 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4591 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4592 |
selectFromLine:startLine col:startCol toLine:endLine col:endCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4593 |
"when a range is selected, position the cursor behind the selection |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4594 |
for easier editing. Also typeOfSelection is nilled here." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4595 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4596 |
super selectFromLine:startLine col:startCol toLine:endLine col:endCol. |
1850 | 4597 |
(selectionEndLine notNil and:[self autoMoveCursorToEndOfSelection]) ifTrue:[ |
2010 | 4598 |
self cursorLine:selectionEndLine col:(selectionEndCol + 1). |
1198 | 4599 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4600 |
typeOfSelection := nil |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4601 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4602 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4603 |
selectUpToEnd |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4604 |
"select the text from the current cursor position to the end." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4605 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4606 |
list isNil ifTrue:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4607 |
self unselect |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4608 |
] ifFalse:[ |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4609 |
super selectFromLine:cursorLine col:cursorCol toLine:(list size + 1) col:0. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4610 |
typeOfSelection := nil |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4611 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4612 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4613 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4614 |
selectWordUnderCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4615 |
"select the word under the cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4616 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4617 |
self selectWordAtLine:cursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4618 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4619 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4620 |
unselect |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4621 |
"forget and unhilight selection - must take care of cursor here" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4622 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4623 |
|wasOn| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4624 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4625 |
wasOn := self hideCursor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4626 |
super unselect. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4627 |
wasOn ifTrue:[self showCursor] |
105 | 4628 |
! ! |
4629 |
||
4630 |
!EditTextView methodsFor:'undo & again'! |
|
4631 |
||
4632 |
again |
|
4633 |
"repeat the last action (which was a cut or replace). |
|
4634 |
If current selection is not last string, search forward to |
|
4635 |
next occurence of it before repeating the last operation." |
|
4636 |
||
501 | 4637 |
|s l c sel savedSelectStyle| |
105 | 4638 |
|
4639 |
lastString notNil ifTrue:[ |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4640 |
s := lastString asString. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4641 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4642 |
"remove final cr" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4643 |
s := s copyWithoutLast:1. |
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
4644 |
"/ s := s withoutSpaces. "XXX - replacing text with spaces ..." |
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4645 |
savedSelectStyle := selectStyle. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4646 |
selectStyle := nil. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4647 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4648 |
sel := self selection. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4649 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4650 |
"if we are already there (after a find), ommit search" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4651 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4652 |
(sel notNil and:[sel asString withoutSeparators = s]) ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4653 |
undoAction := [self insertLines:lastString atLine:cursorLine col:cursorCol]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4654 |
l := selectionStartLine "cursorLine". |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4655 |
c := selectionStartCol "cursorCol". |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4656 |
self deleteSelection. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4657 |
lastReplacement notNil ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4658 |
self insertLines:lastReplacement asStringCollection withCR:false. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4659 |
self selectFromLine:l col:c toLine:cursorLine col:(cursorCol - 1). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4660 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4661 |
selectStyle := savedSelectStyle. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4662 |
^ true |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4663 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4664 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4665 |
self searchForwardFor:s startingAtLine:cursorLine col:cursorCol |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4666 |
ifFound: |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4667 |
[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4668 |
:line :col | |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4669 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4670 |
|repl| |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4671 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4672 |
self selectFromLine:line col:col |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4673 |
toLine:line col:(col + s size - 1). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4674 |
self makeLineVisible:line. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4675 |
undoAction := [self insertLines:lastString atLine:line col:col]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4676 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4677 |
self deleteSelection. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4678 |
lastReplacement notNil ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4679 |
lastReplacement isString ifFalse:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4680 |
repl := lastReplacement asString withoutSpaces |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4681 |
] ifTrue:[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4682 |
repl := lastReplacement withoutSpaces. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4683 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4684 |
self insertLines:repl asStringCollection withCR:false. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4685 |
self selectFromLine:line col:col toLine:cursorLine col:(cursorCol - 1). |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4686 |
]. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4687 |
selectStyle := savedSelectStyle. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4688 |
^ true |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4689 |
] |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4690 |
ifAbsent: |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4691 |
[ |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4692 |
self showNotFound. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4693 |
selectStyle := savedSelectStyle. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4694 |
^ false |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
4695 |
] |
105 | 4696 |
] |
501 | 4697 |
|
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
4698 |
"Modified: 9.10.1996 / 16:14:11 / cg" |
105 | 4699 |
! |
4700 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4701 |
multipleAgain |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4702 |
"repeat the last action (which was a cut or replace) until search fails" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4703 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4704 |
[self again] whileTrue:[] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4705 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4706 |
|
121 | 4707 |
undo |
4708 |
"currently not implemented" |
|
4709 |
||
4710 |
undoAction notNil ifTrue:[ |
|
2010 | 4711 |
undoAction value. |
4712 |
undoAction := nil. |
|
121 | 4713 |
] |
105 | 4714 |
! ! |
4715 |
||
865 | 4716 |
!EditTextView class methodsFor:'documentation'! |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4717 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4718 |
version |
2035
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
4719 |
^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.219 1999-10-11 15:53:55 cg Exp $' |
0 | 4720 |
! ! |