12 |
12 |
13 |
13 |
14 "{ Package: 'stx:libwidg2' }" |
14 "{ Package: 'stx:libwidg2' }" |
15 |
15 |
16 TextCollector subclass:#TerminalView |
16 TextCollector subclass:#TerminalView |
17 instanceVariableNames:'inStream outStream readerProcess shellPid kbdSequences |
17 instanceVariableNames:'inStream outStream readerProcess shellPid kbdSequences |
18 escapeSequenceTree currentSequence kbdMap escapeLeadingChars |
18 escapeSequenceTree currentSequence kbdMap escapeLeadingChars |
19 numberOfColumns numberOfLines shellTerminateAction rangeStartLine |
19 numberOfColumns numberOfLines shellTerminateAction rangeStartLine |
20 rangeEndLine state savedCursor shellCommand shellDirectory |
20 rangeEndLine state savedCursor shellCommand shellDirectory |
21 filterStream localEcho translateNLToCRNL inputTranslateCRToNL' |
21 filterStream localEcho translateNLToCRNL inputTranslateCRToNL |
22 classVariableNames:'Debug' |
22 autoWrapFlag' |
23 poolDictionaries:'' |
23 classVariableNames:'Debug' |
24 category:'Views-TerminalViews' |
24 poolDictionaries:'' |
|
25 category:'Views-TerminalViews' |
25 ! |
26 ! |
26 |
27 |
27 !TerminalView class methodsFor:'documentation'! |
28 !TerminalView class methodsFor:'documentation'! |
28 |
29 |
29 copyright |
30 copyright |
392 "Created: / 28.1.2002 / 20:32:10 / micha" |
393 "Created: / 28.1.2002 / 20:32:10 / micha" |
393 ! ! |
394 ! ! |
394 |
395 |
395 !TerminalView methodsFor:'cursor handling'! |
396 !TerminalView methodsFor:'cursor handling'! |
396 |
397 |
397 cursorCol:col |
|
398 "check of col is a valid cursor position; return a new col-nr if not. |
|
399 Here, the linelength is enforced" |
|
400 |
|
401 ^ super cursorCol:(col min:numberOfColumns) |
|
402 |
|
403 "Modified: / 10.6.1998 / 15:09:34 / cg" |
|
404 ! |
|
405 |
|
406 cursorDown:n |
398 cursorDown:n |
407 cursorLine + n > list size ifTrue:[ |
399 cursorLine + n > list size ifTrue:[ |
408 list := list , (Array new:n). |
400 list := list , (Array new:n). |
409 self textChanged. |
401 self textChanged. |
410 ]. |
402 ]. |
411 super cursorDown:n |
403 super cursorDown:n |
412 |
404 |
413 "Modified: / 10.6.1998 / 17:18:41 / cg" |
405 "Modified: / 10.6.1998 / 17:18:41 / cg" |
414 "Created: / 10.6.1998 / 17:18:50 / cg" |
406 "Created: / 10.6.1998 / 17:18:50 / cg" |
415 ! |
|
416 |
|
417 cursorLine:l col:col |
|
418 "check of col is a valid cursor position; return a new col-nr if not. |
|
419 Here, the linelength is enforced" |
|
420 |
|
421 ^ super cursorLine:l col:(col min:numberOfColumns) |
|
422 |
|
423 "Modified: / 10.6.1998 / 15:09:38 / cg" |
|
424 ! |
407 ! |
425 |
408 |
426 cursorMovementAllowed |
409 cursorMovementAllowed |
427 "return true, if the user may move the cursor around |
410 "return true, if the user may move the cursor around |
428 (via button-click, or cursor-key with selection). |
411 (via button-click, or cursor-key with selection). |
480 |
463 |
481 validateCursorCol:col inLine:line |
464 validateCursorCol:col inLine:line |
482 "check of col is a valid cursor position; return a new col-nr if not. |
465 "check of col is a valid cursor position; return a new col-nr if not. |
483 Here, the linelength is enforced" |
466 Here, the linelength is enforced" |
484 |
467 |
|
468 col > numberOfColumns ifTrue:[ |
|
469 autoWrapFlag ifTrue:[ |
|
470 self endEntry. |
|
471 self cursorLine:(self cursorLine + 1) col:(col-numberOfColumns). |
|
472 ^ 1. |
|
473 ]. |
|
474 ]. |
485 ^ col min:numberOfColumns |
475 ^ col min:numberOfColumns |
486 |
476 |
487 "Modified: / 10.6.1998 / 15:09:41 / cg" |
477 "Modified: / 10.6.1998 / 15:09:41 / cg" |
488 ! ! |
478 ! ! |
489 |
479 |
1236 collectSize := 100. |
1226 collectSize := 100. |
1237 st80Mode := false. |
1227 st80Mode := false. |
1238 trimBlankLines := true. |
1228 trimBlankLines := true. |
1239 localEcho := false. |
1229 localEcho := false. |
1240 inputTranslateCRToNL := false. |
1230 inputTranslateCRToNL := false. |
|
1231 autoWrapFlag := true. |
|
1232 "/ cursorType := #block. |
1241 |
1233 |
1242 numberOfColumns := 80. |
1234 numberOfColumns := 80. |
1243 numberOfLines := 24. |
1235 numberOfLines := 24. |
1244 rangeStartLine := 1. |
1236 rangeStartLine := 1. |
1245 rangeEndLine := numberOfLines. |
1237 rangeEndLine := numberOfLines. |
1621 ] |
1613 ] |
1622 ]. |
1614 ]. |
1623 ]. |
1615 ]. |
1624 |
1616 |
1625 stringWithOutControl notNil ifTrue:[ |
1617 stringWithOutControl notNil ifTrue:[ |
|
1618 "/ characterwise, for correct wrap handling at line end |
|
1619 (cursorCol + stringWithOutControl size) >= numberOfColumns ifTrue:[ |
|
1620 self endEntry. |
|
1621 stringWithOutControl do:[:eachCharacter | |
|
1622 self nextPut:eachCharacter. |
|
1623 self endEntry |
|
1624 ]. |
|
1625 ^ self. |
|
1626 ]. |
|
1627 |
1626 Debug ifTrue:[ |
1628 Debug ifTrue:[ |
1627 Transcript showCR:'String:<', stringWithOutControl, '>'. |
1629 Transcript showCR:'String:<', stringWithOutControl, '>'. |
1628 ]. |
1630 ]. |
1629 currentEmphasis notNil ifTrue:[ |
1631 currentEmphasis notNil ifTrue:[ |
1630 stringWithOutControl := stringWithOutControl emphasizeAllWith:currentEmphasis |
1632 stringWithOutControl := stringWithOutControl emphasizeAllWith:currentEmphasis |
1759 |
1761 |
1760 preferredExtent |
1762 preferredExtent |
1761 "return my preferred extent - this is computed from my numberOfLines, |
1763 "return my preferred extent - this is computed from my numberOfLines, |
1762 numberOfCols and font size" |
1764 numberOfCols and font size" |
1763 |
1765 |
1764 ^ (fontWidth * self class defaultNumberOfColumns + (leftMargin * 2)) |
1766 ^ (fontWidth * self class defaultNumberOfColumns + (leftMargin + margin * 2)) |
1765 @ |
1767 @ |
1766 ((self heightForLines:self class defaultNumberOfLines) + 8) |
1768 ((self heightForLines:self class defaultNumberOfLines) + 8) |
1767 |
1769 |
1768 "Modified: / 20.6.1998 / 20:06:57 / cg" |
1770 "Modified: / 20.6.1998 / 20:06:57 / cg" |
1769 ! |
1771 ! |