20 lastReplacement lastAction replacing showMatchingParenthesis |
20 lastReplacement lastAction replacing showMatchingParenthesis |
21 hasKeyboardFocus acceptAction lockUpdates tabMeansNextField |
21 hasKeyboardFocus acceptAction lockUpdates tabMeansNextField |
22 autoIndent insertMode trimBlankLines wordWrap |
22 autoIndent insertMode trimBlankLines wordWrap |
23 replacementWordSelectStyle acceptChannel acceptEnabled st80Mode |
23 replacementWordSelectStyle acceptChannel acceptEnabled st80Mode |
24 disableIfInvisible cursorMovementWhenUpdating learnMode |
24 disableIfInvisible cursorMovementWhenUpdating learnMode |
25 learnedMacro' |
25 learnedMacro cursorLineHolder cursorColHolder' |
26 classVariableNames:'DefaultCursorForegroundColor DefaultCursorBackgroundColor |
26 classVariableNames:'DefaultCursorForegroundColor DefaultCursorBackgroundColor |
27 DefaultCursorType DefaultCursorNoFocusForegroundColor ST80Mode |
27 DefaultCursorType DefaultCursorNoFocusForegroundColor ST80Mode |
28 DefaultCursorTypeNoFocus' |
28 DefaultCursorTypeNoFocus' |
29 poolDictionaries:'' |
29 poolDictionaries:'' |
30 category:'Views-Text' |
30 category:'Views-Text' |
722 This is the absolute col; NOT the visible col" |
722 This is the absolute col; NOT the visible col" |
723 |
723 |
724 ^ cursorCol |
724 ^ cursorCol |
725 ! |
725 ! |
726 |
726 |
|
727 cursorColHolder |
|
728 "return a valueHolder for the cursors column (1..)." |
|
729 |
|
730 ^ cursorColHolder |
|
731 ! |
|
732 |
727 cursorLine |
733 cursorLine |
728 "return the cursors line (1..). |
734 "return the cursors line (1..). |
729 This is the absolute line; NOT the visible line" |
735 This is the absolute line; NOT the visible line" |
730 |
736 |
731 ^ cursorLine |
737 ^ cursorLine |
|
738 ! |
|
739 |
|
740 cursorLineHolder |
|
741 "return a valueHolder for the cursors line (1..). |
|
742 This is the absolute line; NOT the visible line" |
|
743 |
|
744 ^ cursorLineHolder |
732 ! |
745 ! |
733 |
746 |
734 fixedSize |
747 fixedSize |
735 "make the texts size fixed (no lines may be added). |
748 "make the texts size fixed (no lines may be added). |
736 OBSOLETE: use readOnly" |
749 OBSOLETE: use readOnly" |
1007 "move cursor to some column in the current line" |
1020 "move cursor to some column in the current line" |
1008 |
1021 |
1009 |wasOn| |
1022 |wasOn| |
1010 |
1023 |
1011 wasOn := self hideCursor. |
1024 wasOn := self hideCursor. |
1012 cursorCol := self validateCursorCol:newCol inLine:cursorLine. |
1025 self setValidatedCursorCol:newCol. |
1013 self makeCursorVisibleAndShowCursor:wasOn. |
1026 self makeCursorVisibleAndShowCursor:wasOn. |
1014 |
1027 |
1015 "Modified: 22.5.1996 / 14:25:53 / cg" |
1028 "Modified: 22.5.1996 / 14:25:53 / cg" |
1016 ! |
1029 ! |
1017 |
1030 |
1024 self cursorDown:1. |
1037 self cursorDown:1. |
1025 |
1038 |
1026 "/ cursor behond text ? |
1039 "/ cursor behond text ? |
1027 cursorLine > list size ifTrue:[ |
1040 cursorLine > list size ifTrue:[ |
1028 wasOn := self hideCursor. |
1041 wasOn := self hideCursor. |
1029 cursorLine := self validateCursorLine:(list size + 1). |
1042 self setValidatedCursorLine:(list size + 1) col:cursorCol. |
1030 cursorCol := self validateCursorCol:cursorCol inLine:cursorLine. |
|
1031 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
1032 "/ wasOn ifTrue:[self showCursor]. |
|
1033 self makeCursorVisibleAndShowCursor:wasOn. |
1043 self makeCursorVisibleAndShowCursor:wasOn. |
1034 self beep. |
1044 self beep. |
1035 ]. |
1045 ]. |
1036 |
1046 |
1037 "Modified: / 10.6.1998 / 17:00:23 / cg" |
1047 "Modified: / 10.6.1998 / 17:00:23 / cg" |
1038 ! |
1048 ! |
1039 |
1049 |
1040 cursorDown:n |
1050 cursorDown:n |
1041 "move cursor down by n lines; scroll if at end of visible text" |
1051 "move cursor down by n lines; scroll if at end of visible text" |
1042 |
1052 |
1043 |wasOn nv| |
1053 |wasOn nv nL| |
1044 |
1054 |
1045 cursorVisibleLine notNil ifTrue:[ |
1055 cursorVisibleLine notNil ifTrue:[ |
1046 wasOn := self hideCursor. |
1056 wasOn := self hideCursor. |
1047 nv := cursorVisibleLine + n - 1. |
1057 nv := cursorVisibleLine + n - 1. |
1048 (nv >= nFullLinesShown) ifTrue:[ |
1058 (nv >= nFullLinesShown) ifTrue:[ |
1049 self scrollDown:(nv - nFullLinesShown + 1) |
1059 self scrollDown:(nv - nFullLinesShown + 1) |
1050 ]. |
1060 ]. |
1051 cursorLine := self validateCursorLine:(cursorLine + n). |
1061 self setValidatedCursorLine:(cursorLine + n) col:cursorCol. |
1052 cursorCol := self validateCursorCol:cursorCol inLine:cursorLine. |
|
1053 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
1054 "/ wasOn ifTrue:[self showCursor]. |
|
1055 self makeCursorVisibleAndShowCursor:wasOn. |
1062 self makeCursorVisibleAndShowCursor:wasOn. |
1056 ] ifFalse:[ |
1063 ] ifFalse:[ |
1057 cursorLine isNil ifTrue:[ |
1064 (nL := cursorLine) isNil ifTrue:[ |
1058 cursorLine := firstLineShown |
1065 nL := firstLineShown |
1059 ]. |
1066 ]. |
1060 cursorLine := self validateCursorLine:(cursorLine + n). |
1067 self setValidatedCursorLine:(nL + n) col:cursorCol. |
1061 cursorCol := self validateCursorCol:cursorCol inLine:cursorLine. |
|
1062 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
1063 self makeCursorVisible. |
1068 self makeCursorVisible. |
1064 ]. |
1069 ]. |
1065 |
1070 |
1066 "Modified: / 10.6.1998 / 16:59:17 / cg" |
1071 "Modified: / 10.6.1998 / 16:59:17 / cg" |
1067 ! |
1072 ! |
1117 (cursorLine == list size |
1122 (cursorLine == list size |
1118 and:[cursorLine ~~ line]) ifTrue:[ |
1123 and:[cursorLine ~~ line]) ifTrue:[ |
1119 newCol := (self listAt:(list size)) size + 1. |
1124 newCol := (self listAt:(list size)) size + 1. |
1120 ] |
1125 ] |
1121 ]. |
1126 ]. |
1122 cursorCol := self validateCursorCol:newCol inLine:cursorLine. |
1127 self setValidatedCursorCol:newCol. |
1123 self makeCursorVisibleAndShowCursor:wasOn. |
1128 self makeCursorVisibleAndShowCursor:wasOn. |
1124 |
1129 |
1125 "Modified: / 20.6.1998 / 18:19:06 / cg" |
1130 "Modified: / 20.6.1998 / 18:19:06 / cg" |
1126 ! |
1131 ! |
1127 |
1132 |
1148 (cursorVisibleLine >= nFullLinesShown) ifTrue:[self scrollDown] |
1153 (cursorVisibleLine >= nFullLinesShown) ifTrue:[self scrollDown] |
1149 ] |
1154 ] |
1150 ]. |
1155 ]. |
1151 |
1156 |
1152 wasOn := self hideCursor. |
1157 wasOn := self hideCursor. |
1153 cursorLine := self validateCursorLine:cursorLine + 1. |
1158 self setValidatedCursorLine:(cursorLine + 1) col:1. |
1154 cursorCol := self validateCursorCol:1 inLine:cursorLine. |
|
1155 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
1156 self makeCursorVisibleAndShowCursor:wasOn. |
1159 self makeCursorVisibleAndShowCursor:wasOn. |
1157 |
1160 |
1158 "Modified: 22.5.1996 / 18:27:34 / cg" |
1161 "Modified: 22.5.1996 / 18:27:34 / cg" |
1159 ! |
1162 ! |
1160 |
1163 |
1223 newTop := list size - nFullLinesShown. |
1226 newTop := list size - nFullLinesShown. |
1224 (newTop < 1) ifTrue:[ |
1227 (newTop < 1) ifTrue:[ |
1225 newTop := 1 |
1228 newTop := 1 |
1226 ]. |
1229 ]. |
1227 self scrollToLine:newTop. |
1230 self scrollToLine:newTop. |
1228 cursorLine := self validateCursorLine:list size. |
1231 |
1229 cursorCol := self validateCursorCol:1 inLine:cursorLine. |
1232 self setValidatedCursorLine:(list size) col:1. |
1230 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
1231 |
1233 |
1232 self makeCursorVisibleAndShowCursor:wasOn. |
1234 self makeCursorVisibleAndShowCursor:wasOn. |
1233 |
1235 |
1234 "Modified: 22.5.1996 / 18:27:45 / cg" |
1236 "Modified: 22.5.1996 / 18:27:45 / cg" |
1235 ! |
1237 ! |
1248 ! |
1250 ! |
1249 |
1251 |
1250 cursorToEnd |
1252 cursorToEnd |
1251 "move cursor down below last line of text" |
1253 "move cursor down below last line of text" |
1252 |
1254 |
1253 |wasOn newTop l line| |
1255 |wasOn newTop lineNr line| |
1254 |
1256 |
1255 l := list size. |
1257 lineNr := list size. |
1256 |
1258 |
1257 cursorLine >= l ifTrue:[ |
1259 cursorLine >= lineNr ifTrue:[ |
1258 line := self listAt:cursorLine. |
1260 line := self listAt:cursorLine. |
1259 (line isNil or:[line isEmpty]) ifTrue:[ |
1261 (line isNil or:[line isEmpty]) ifTrue:[ |
1260 ^ self |
1262 ^ self |
1261 ] |
1263 ] |
1262 ]. |
1264 ]. |
1263 |
1265 |
1264 wasOn := self hideCursor. |
1266 wasOn := self hideCursor. |
1265 |
1267 |
1266 l := l + 1. |
1268 lineNr := lineNr + 1. |
1267 newTop := l - nFullLinesShown. |
1269 newTop := lineNr - nFullLinesShown. |
1268 (newTop < 1) ifTrue:[ |
1270 (newTop < 1) ifTrue:[ |
1269 newTop := 1 |
1271 newTop := 1 |
1270 ]. |
1272 ]. |
1271 self scrollToLine:newTop. |
1273 self scrollToLine:newTop. |
1272 cursorLine := self validateCursorLine:l. |
1274 |
1273 cursorCol := self validateCursorCol:1 inLine:1. |
1275 self setValidatedCursorLine:lineNr col:1. |
1274 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
1275 |
1276 |
1276 self makeCursorVisibleAndShowCursor:wasOn. |
1277 self makeCursorVisibleAndShowCursor:wasOn. |
1277 |
1278 |
1278 "Modified: 22.5.1996 / 18:27:53 / cg" |
1279 "Modified: 22.5.1996 / 18:27:53 / cg" |
1279 ! |
1280 ! |
1299 newTop := list size - nFullLinesShown. |
1300 newTop := list size - nFullLinesShown. |
1300 (newTop < 1) ifTrue:[ |
1301 (newTop < 1) ifTrue:[ |
1301 newTop := 1 |
1302 newTop := 1 |
1302 ]. |
1303 ]. |
1303 self scrollToLine:newTop. |
1304 self scrollToLine:newTop. |
1304 cursorLine := self validateCursorLine:list size. |
1305 |
1305 cursorCol := self validateCursorCol:(self listAt:cursorLine) size inLine:cursorLine. |
1306 self setValidatedCursorLine:list size. |
1306 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
1307 self setCursorCol:(self validateCursorCol:(self listAt:cursorLine) size inLine:cursorLine). |
1307 |
1308 |
1308 self makeCursorVisibleAndShowCursor:wasOn. |
1309 self makeCursorVisibleAndShowCursor:wasOn. |
1309 |
|
1310 ! |
1310 ! |
1311 |
1311 |
1312 cursorToFirstVisibleLine |
1312 cursorToFirstVisibleLine |
1313 "place cursor into the first visible line; do not scroll." |
1313 "place cursor into the first visible line; do not scroll." |
1314 |
1314 |
1325 "move the cursor to the beginning of the next word" |
1325 "move the cursor to the beginning of the next word" |
1326 |
1326 |
1327 |col line searching| |
1327 |col line searching| |
1328 |
1328 |
1329 (cursorLine > list size) ifTrue:[^ self]. |
1329 (cursorLine > list size) ifTrue:[^ self]. |
|
1330 |
1330 self wordAtLine:cursorLine col:cursorCol do:[ |
1331 self wordAtLine:cursorLine col:cursorCol do:[ |
1331 :beginLine :beginCol :endLine :endCol :style | |
1332 :beginLine :beginCol :endLine :endCol :style | |
1332 |
1333 |
1333 line := endLine. |
1334 line := endLine. |
1334 col := endCol + 1. |
1335 col := endCol + 1. |
1354 cursorToPreviousWord |
1355 cursorToPreviousWord |
1355 "move the cursor to the beginning of this or the previous word" |
1356 "move the cursor to the beginning of this or the previous word" |
1356 |
1357 |
1357 |col line searching l| |
1358 |col line searching l| |
1358 |
1359 |
1359 (cursorLine > list size) ifTrue:[^ self]. |
1360 (cursorLine > list size) ifTrue:[^ self]. "/ this is rubbish |
1360 |
1361 |
1361 self wordAtLine:cursorLine col:cursorCol do:[ |
1362 self wordAtLine:cursorLine col:cursorCol do:[ |
1362 :beginLine :beginCol :endLine :endCol :style | |
1363 :beginLine :beginCol :endLine :endCol :style | |
1363 |
1364 |
1364 line := beginLine. |
1365 line := beginLine. |
1425 "move cursor up n lines; scroll if at start of visible text" |
1426 "move cursor up n lines; scroll if at start of visible text" |
1426 |
1427 |
1427 |wasOn nv nl| |
1428 |wasOn nv nl| |
1428 |
1429 |
1429 cursorLine isNil ifTrue:[ |
1430 cursorLine isNil ifTrue:[ |
1430 cursorLine := firstLineShown + nFullLinesShown - 1. |
1431 self setCursorLine:(firstLineShown + nFullLinesShown - 1). |
1431 ]. |
1432 ]. |
1432 nl := cursorLine - n. |
1433 nl := cursorLine - n. |
1433 nl < 1 ifTrue:[nl := 1]. |
1434 nl < 1 ifTrue:[nl := 1]. |
1434 |
1435 |
1435 (nl ~~ cursorLine) ifTrue: [ |
1436 (nl ~~ cursorLine) ifTrue: [ |
1438 nv := cursorVisibleLine - n. |
1439 nv := cursorVisibleLine - n. |
1439 nv < 1 ifTrue:[ |
1440 nv < 1 ifTrue:[ |
1440 self scrollUp:(nv negated + 1) |
1441 self scrollUp:(nv negated + 1) |
1441 ]. |
1442 ]. |
1442 ]. |
1443 ]. |
1443 cursorLine := self validateCursorLine:nl. |
1444 self setValidatedCursorLine:nl col:cursorCol. |
1444 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
1445 cursorCol := self validateCursorCol:cursorCol inLine:cursorLine. |
|
1446 wasOn ifTrue:[self showCursor]. |
1445 wasOn ifTrue:[self showCursor]. |
1447 "/ |
|
1448 "/ to make cursor visible (even if below visible end): |
|
1449 "/ |
|
1450 "/ self makeCursorVisibleAndShowCursor:wasOn. |
|
1451 ] |
1446 ] |
1452 |
1447 |
1453 "Modified: 22.5.1996 / 18:28:11 / cg" |
1448 "Modified: 22.5.1996 / 18:28:11 / cg" |
1454 ! |
1449 ! |
1455 |
1450 |
1456 cursorVisibleLine:visibleLineNr col:colNr |
1451 cursorVisibleLine:visibleLineNr col:colNr |
1457 "put cursor to visibleline/col" |
1452 "put cursor to visibleline/col" |
1458 |
1453 |
1459 |wasOn newCol| |
1454 |wasOn newCol listLine| |
1460 |
1455 |
1461 wasOn := self hideCursor. |
1456 wasOn := self hideCursor. |
1462 cursorLine := self validateCursorLine:(self visibleLineToAbsoluteLine:visibleLineNr). |
1457 |
|
1458 listLine := self visibleLineToAbsoluteLine:visibleLineNr. |
|
1459 self setValidatedCursorLine:listLine. |
1463 cursorVisibleLine := visibleLineNr. |
1460 cursorVisibleLine := visibleLineNr. |
|
1461 |
1464 newCol := colNr. |
1462 newCol := colNr. |
1465 (newCol < 1) ifTrue:[ |
1463 (newCol < 1) ifTrue:[ |
1466 newCol := 1 |
1464 newCol := 1 |
1467 ]. |
1465 ]. |
1468 cursorCol := self validateCursorCol:newCol inLine:cursorLine. |
1466 self setValidatedCursorCol:newCol. |
|
1467 |
1469 self makeCursorVisibleAndShowCursor:wasOn. |
1468 self makeCursorVisibleAndShowCursor:wasOn. |
1470 |
1469 |
1471 "Modified: / 20.6.1998 / 18:40:28 / cg" |
1470 "Modified: / 20.6.1998 / 18:40:28 / cg" |
1472 ! |
1471 ! |
1473 |
1472 |
1688 "scroll to make cursorLine visible; |
1687 "scroll to make cursorLine visible; |
1689 if flag is true, draw the cursor" |
1688 if flag is true, draw the cursor" |
1690 |
1689 |
1691 self makeCursorVisible. |
1690 self makeCursorVisible. |
1692 flag ifTrue:[self showCursor] |
1691 flag ifTrue:[self showCursor] |
|
1692 ! |
|
1693 |
|
1694 setCursorCol:colNr |
|
1695 "strictly private: set the cursorCol" |
|
1696 |
|
1697 cursorCol := colNr. |
|
1698 cursorColHolder value:cursorCol. |
|
1699 ! |
|
1700 |
|
1701 setCursorLine:lineNr |
|
1702 "strictly private: set the cursorLine" |
|
1703 |
|
1704 cursorLine := lineNr. |
|
1705 cursorLineHolder value:cursorLine. |
|
1706 self updateCursorVisibleLine. |
|
1707 ! |
|
1708 |
|
1709 setCursorLine:lineNr col:colNr |
|
1710 "strictly private: set the cursorLine, col and update the visibleLine" |
|
1711 |
|
1712 self setCursorLine:lineNr. |
|
1713 self setCursorCol:colNr. |
|
1714 ! |
|
1715 |
|
1716 setValidatedCursorCol:colNr |
|
1717 "strictly private: set the cursorCol" |
|
1718 |
|
1719 self setCursorCol:(self validateCursorCol:colNr inLine:cursorLine). |
|
1720 ! |
|
1721 |
|
1722 setValidatedCursorLine:lineNr |
|
1723 "strictly private: set the cursorLine and update the visibleLine" |
|
1724 |
|
1725 self setCursorLine:(self validateCursorLine:lineNr). |
|
1726 ! |
|
1727 |
|
1728 setValidatedCursorLine:lineNr col:colNr |
|
1729 "strictly private: set the cursorLine, col and update the visibleLine" |
|
1730 |
|
1731 self setValidatedCursorLine:lineNr. |
|
1732 self setValidatedCursorCol:colNr. |
1693 ! |
1733 ! |
1694 |
1734 |
1695 showCursor |
1735 showCursor |
1696 "make cursor visible if currently invisible" |
1736 "make cursor visible if currently invisible" |
1697 |
1737 |
1779 ]. |
1819 ]. |
1780 super redrawVisibleLine:cursorVisibleLine col:cursorCol |
1820 super redrawVisibleLine:cursorVisibleLine col:cursorCol |
1781 ] |
1821 ] |
1782 |
1822 |
1783 "Modified: / 15.12.1999 / 22:25:59 / cg" |
1823 "Modified: / 15.12.1999 / 22:25:59 / cg" |
|
1824 ! |
|
1825 |
|
1826 updateCursorVisibleLine |
|
1827 "strictly private: set the visibleLine from the cursorLine. |
|
1828 notice: visibleLine will be set to nil if the cursor is not visible" |
|
1829 |
|
1830 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
1784 ! |
1831 ! |
1785 |
1832 |
1786 validateCursorCol:col inLine:line |
1833 validateCursorCol:col inLine:line |
1787 "check of col is a valid cursor position; return a new col-nr if not. |
1834 "check of col is a valid cursor position; return a new col-nr if not. |
1788 Here, no limits are enforced (and col is returned), |
1835 Here, no limits are enforced (and col is returned), |
2007 startLine := selectionStartLine. |
2054 startLine := selectionStartLine. |
2008 startCol := selectionStartCol. |
2055 startCol := selectionStartCol. |
2009 endLine := selectionEndLine. |
2056 endLine := selectionEndLine. |
2010 endCol := selectionEndCol. |
2057 endCol := selectionEndCol. |
2011 self unselectWithoutRedraw. |
2058 self unselectWithoutRedraw. |
2012 self deleteFromLine:startLine col:startCol |
2059 self deleteFromLine:startLine col:startCol toLine:endLine col:endCol. |
2013 toLine:endLine col:endCol. |
2060 self setCursorLine:startLine col:startCol. |
2014 cursorCol := startCol. |
2061 |
2015 cursorLine := startLine. |
|
2016 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
2017 self makeCursorVisibleAndShowCursor:wasOn |
2062 self makeCursorVisibleAndShowCursor:wasOn |
2018 ] |
2063 ] |
2019 ! |
2064 ! |
2020 |
2065 |
2021 deleteWordBeforeCursor |
2066 deleteWordBeforeCursor |
2029 self cursorToPreviousWord. |
2074 self cursorToPreviousWord. |
2030 beginCol := cursorCol. |
2075 beginCol := cursorCol. |
2031 beginLine := cursorLine. |
2076 beginLine := cursorLine. |
2032 deletedText := self textFromLine:beginLine col:beginCol toLine:endLine col:endCol. |
2077 deletedText := self textFromLine:beginLine col:beginCol toLine:endLine col:endCol. |
2033 self deleteFromLine:beginLine col:beginCol toLine:endLine col:endCol. |
2078 self deleteFromLine:beginLine col:beginCol toLine:endLine col:endCol. |
2034 undoAction := [ self cursorLine:beginLine col:beginCol. |
2079 undoAction := [ |
2035 self paste:deletedText]. |
2080 self cursorLine:beginLine col:beginCol. |
|
2081 self paste:deletedText |
|
2082 ]. |
2036 wasOn ifTrue:[ self showCursor ]. |
2083 wasOn ifTrue:[ self showCursor ]. |
2037 |
2084 |
2038 "Modified: / 22.2.2000 / 23:59:04 / cg" |
2085 "Modified: / 22.2.2000 / 23:59:04 / cg" |
2039 ! |
2086 ! |
2040 |
2087 |
2105 ]. |
2152 ]. |
2106 (start < nLines) ifTrue:[ |
2153 (start < nLines) ifTrue:[ |
2107 (end >= start) ifTrue:[ |
2154 (end >= start) ifTrue:[ |
2108 wasOn := self hideCursor. |
2155 wasOn := self hideCursor. |
2109 self insertLines:lines from:start to:end before:cursorLine. |
2156 self insertLines:lines from:start to:end before:cursorLine. |
2110 cursorLine := cursorLine + (end - start + 1). |
2157 self setCursorLine:(cursorLine + (end - start + 1)). |
2111 cursorVisibleLine := self absoluteLineToVisibleLine:cursorLine. |
|
2112 wasOn ifTrue:[self showCursor]. |
2158 wasOn ifTrue:[self showCursor]. |
2113 ] |
2159 ] |
2114 ]. |
2160 ]. |
2115 withCr ifFalse:[ |
2161 withCr ifFalse:[ |
2116 "last line without cr" |
2162 "last line without cr" |
2225 |
2271 |
2226 insertStringWithoutCRsAtCursor:aString |
2272 insertStringWithoutCRsAtCursor:aString |
2227 "insert a string (which has no crs) at cursor position |
2273 "insert a string (which has no crs) at cursor position |
2228 - advance cursor" |
2274 - advance cursor" |
2229 |
2275 |
2230 |wasOn oldLen newLen| |
2276 |wasOn oldLen newLen deltaLen| |
2231 |
2277 |
2232 aString notNil ifTrue:[ |
2278 aString size > 0 ifTrue:[ |
2233 wasOn := self hideCursor. |
2279 wasOn := self hideCursor. |
2234 (aString includes:Character tab) ifTrue:[ |
2280 (aString includes:Character tab) ifTrue:[ |
2235 self checkForExistingLine:cursorLine. |
2281 self checkForExistingLine:cursorLine. |
2236 oldLen := (list at:cursorLine) size. |
2282 oldLen := (list at:cursorLine) size. |
2237 self insertString:aString atLine:cursorLine col:cursorCol. |
2283 self insertString:aString atLine:cursorLine col:cursorCol. |
2238 newLen := (list at:cursorLine) size. |
2284 newLen := (list at:cursorLine) size. |
2239 cursorCol := cursorCol + (newLen - oldLen). |
2285 deltaLen := newLen - oldLen. |
2240 ] ifFalse:[ |
2286 ] ifFalse:[ |
2241 self insertString:aString atLine:cursorLine col:cursorCol. |
2287 self insertString:aString atLine:cursorLine col:cursorCol. |
2242 cursorCol := cursorCol + aString size. |
2288 deltaLen := aString size. |
2243 ]. |
2289 ]. |
|
2290 self setCursorCol:(cursorCol + deltaLen). |
2244 wasOn ifTrue:[self showCursor] |
2291 wasOn ifTrue:[self showCursor] |
2245 ] |
2292 ] |
2246 |
2293 |
2247 "Modified: / 10.6.1998 / 20:43:52 / cg" |
2294 "Modified: / 10.6.1998 / 20:43:52 / cg" |
2248 ! |
2295 ! |
3470 selectionStartLine notNil ifTrue:[ |
3517 selectionStartLine notNil ifTrue:[ |
3471 self cursorMovementAllowed ifTrue:[ |
3518 self cursorMovementAllowed ifTrue:[ |
3472 "/ |
3519 "/ |
3473 "/ treat the whole selection as cursor |
3520 "/ treat the whole selection as cursor |
3474 "/ |
3521 "/ |
3475 cursorLine := selectionEndLine. |
3522 self setCursorLine:selectionEndLine. |
3476 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
3477 selectionEndCol == 0 ifTrue:[ |
3523 selectionEndCol == 0 ifTrue:[ |
3478 selectionEndCol := 1. |
3524 selectionEndCol := 1. |
3479 ]. |
3525 ]. |
3480 cursorCol := selectionEndCol. |
3526 self setCursorCol:selectionEndCol. |
3481 shifted ifTrue:[ |
3527 shifted ifTrue:[ |
3482 self expandSelectionRight. |
3528 self expandSelectionRight. |
3483 ^ self |
3529 ^ self |
3484 ]. |
3530 ]. |
3485 self unselect; makeCursorVisible. |
3531 self unselect; makeCursorVisible. |
3500 selectionStartLine notNil ifTrue:[ |
3546 selectionStartLine notNil ifTrue:[ |
3501 self cursorMovementAllowed ifTrue:[ |
3547 self cursorMovementAllowed ifTrue:[ |
3502 "/ |
3548 "/ |
3503 "/ treat the whole selection as cursor |
3549 "/ treat the whole selection as cursor |
3504 "/ |
3550 "/ |
3505 cursorLine := selectionEndLine. |
3551 self setCursorLine:selectionEndLine. |
3506 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
3552 self setCursorCol:selectionStartCol. |
3507 cursorCol := selectionStartCol. |
|
3508 cursorCol == 0 ifTrue:[ |
3553 cursorCol == 0 ifTrue:[ |
3509 cursorCol := 1. |
3554 self setCursorCol:1. |
3510 cursorLine := cursorLine - 1. |
3555 self setCursorLine:(cursorLine - 1). |
3511 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
|
3512 ]. |
3556 ]. |
3513 self makeCursorVisible. |
3557 self makeCursorVisible. |
3514 |
3558 |
3515 shifted ifTrue:[ |
3559 shifted ifTrue:[ |
3516 clickLine := cursorLine. |
3560 clickLine := cursorLine. |
3557 selectionStartLine notNil ifTrue:[ |
3601 selectionStartLine notNil ifTrue:[ |
3558 self cursorMovementAllowed ifTrue:[ |
3602 self cursorMovementAllowed ifTrue:[ |
3559 "/ |
3603 "/ |
3560 "/ treat the whole selection as cursor |
3604 "/ treat the whole selection as cursor |
3561 "/ |
3605 "/ |
3562 cursorLine := selectionStartLine. |
3606 self setCursorLine:selectionStartLine. |
3563 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
3607 self setCursorCol:selectionStartCol. |
3564 cursorCol := selectionStartCol. |
|
3565 (key == #CursorLeft) ifTrue:[ |
3608 (key == #CursorLeft) ifTrue:[ |
3566 cursorCol := cursorCol+1. "/ compensate for followup crsr-left |
3609 self setCursorCol:(cursorCol+1). "/ compensate for followup crsr-left |
3567 ]. |
3610 ]. |
3568 self makeCursorVisible. |
3611 self makeCursorVisible. |
3569 |
3612 |
3570 shifted ifTrue:[ |
3613 shifted ifTrue:[ |
3571 (key == #CursorUp) ifTrue:[ |
3614 (key == #CursorUp) ifTrue:[ |
3933 self level:-1. |
3973 self level:-1. |
3934 readOnly := false. |
3974 readOnly := false. |
3935 fixedSize := false. |
3975 fixedSize := false. |
3936 exceptionBlock := [:errorText | ]. |
3976 exceptionBlock := [:errorText | ]. |
3937 cursorShown := prevCursorState := true. |
3977 cursorShown := prevCursorState := true. |
|
3978 cursorLineHolder := 1 asValue. |
|
3979 cursorColHolder := 1 asValue. |
3938 cursorLine := 1. |
3980 cursorLine := 1. |
3939 cursorVisibleLine := 1. |
3981 cursorVisibleLine := 1. |
3940 cursorCol := 1. |
3982 cursorCol := 1. |
3941 modifiedChannel := ValueHolder with:false. |
3983 modifiedChannel := ValueHolder with:false. |
3942 acceptChannel := ValueHolder with:false. |
3984 acceptChannel := ValueHolder with:false. |
4522 |
4564 |
4523 super originChanged:delta. |
4565 super originChanged:delta. |
4524 " |
4566 " |
4525 should we move the cursor with the scroll - or leave it ? |
4567 should we move the cursor with the scroll - or leave it ? |
4526 " |
4568 " |
4527 cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
4569 self updateCursorVisibleLine. |
4528 prevCursorState ifTrue:[ |
4570 prevCursorState ifTrue:[ |
4529 self showCursor |
4571 self showCursor |
4530 ] |
4572 ] |
4531 |
4573 |
4532 "Modified: / 17.6.1998 / 16:13:24 / cg" |
4574 "Modified: / 17.6.1998 / 16:13:24 / cg" |