VDBSimpleConsoleView.st
author Jan Vrany <jan.vrany@labware.com>
Tue, 26 Jul 2022 15:01:33 +0100
changeset 265 f2470f0dd9cd
parent 264 23960fcb9dac
permissions -rw-r--r--
Do not show address for (pseudo) instructions with no code While such instructions do not appear in GDB-produced disassembly, they may appear in some manually-generated instruction lists. One example of such (pseudo) instruction is label.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
     2
jv:libgdbs - GNU Debugger Interface Library
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
Copyright (C) 2015-now Jan Vrany
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
     4
Copyright (C) 2022 LabWare
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
     6
Permission is hereby granted, free of charge, to any person obtaining a copy
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
     7
of this software and associated documentation files (the 'Software'), to deal
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
     8
in the Software without restriction, including without limitation the rights
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
     9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    10
copies of the Software, and to permit persons to whom the Software is
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    11
furnished to do so, subject to the following conditions:
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    13
The above copyright notice and this permission notice shall be included in all
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    14
copies or substantial portions of the Software.
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    15
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    16
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    19
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    21
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    22
SOFTWARE.
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
"
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
"{ Package: 'jv:vdb' }"
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
"{ NameSpace: Smalltalk }"
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    28
TextCollector subclass:#VDBSimpleConsoleView
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    29
	instanceVariableNames:'buffer bufferPosition history historyPosition completeAction
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    30
		lastTabTime lastCompletions'
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    31
	classVariableNames:'TabTabInterval'
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
	poolDictionaries:''
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
    33
	category:'VDB-UI-Console'
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
!
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    36
!VDBSimpleConsoleView class methodsFor:'documentation'!
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
copyright
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
"
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    40
jv:libgdbs - GNU Debugger Interface Library
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
Copyright (C) 2015-now Jan Vrany
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    42
Copyright (C) 2022 LabWare
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    43
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    44
Permission is hereby granted, free of charge, to any person obtaining a copy
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    45
of this software and associated documentation files (the 'Software'), to deal
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    46
in the Software without restriction, including without limitation the rights
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    47
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    48
copies of the Software, and to permit persons to whom the Software is
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    49
furnished to do so, subject to the following conditions:
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    51
The above copyright notice and this permission notice shall be included in all
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    52
copies or substantial portions of the Software.
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    54
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    55
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    56
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    57
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    58
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    59
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 190
diff changeset
    60
SOFTWARE.
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
"
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
! !
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    64
!VDBSimpleConsoleView class methodsFor:'initialization'!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    65
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    66
initialize
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    67
    "Invoked at system start or when the class is dynamically loaded."
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    68
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    69
    "/ please change as required (and remove this comment)
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
    70
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    71
    TabTabInterval := 500"ms"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    72
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    73
    "Modified: / 25-01-2019 / 21:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    74
! !
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    75
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    76
!VDBSimpleConsoleView methodsFor:'accessing'!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    77
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    78
completeAction
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    79
    ^ completeAction
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
    80
!
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
    81
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    82
completeAction:aBlock
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    83
    completeAction := aBlock.
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
    84
! !
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
    85
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    86
!VDBSimpleConsoleView methodsFor:'actions'!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    87
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    88
buffer: aString
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    89
    "Set the line buffer, position the cursor at the end of
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    90
     line"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    91
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    92
    | line |
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
    93
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    94
    line := list at: cursorLine.
190
f37694040277 UX: various little improvements in simple debugger console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 178
diff changeset
    95
    line := (line ? '' copyTo: cursorCol - bufferPosition) , aString.
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
    96
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    97
    list at: cursorLine put: line.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    98
    buffer := aString.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
    99
    bufferPosition := aString size + 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   100
    self cursorCol: line size + 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   101
    self invalidateLine: cursorLine.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   102
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   103
    "Created: / 26-01-2019 / 22:16:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
190
f37694040277 UX: various little improvements in simple debugger console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 178
diff changeset
   104
    "Modified: / 01-12-2019 / 13:16:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   105
!
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   106
170
cd9615ebe6a9 Update simple console implementation to use updated -complete command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   107
completion: completion matches: matches
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   108
170
cd9615ebe6a9 Update simple console implementation to use updated -complete command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   109
    lastCompletions := matches.
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   110
    lastCompletions isEmptyOrNil ifTrue:[
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   111
        lastCompletions := nil.
137
418e6ddd8733 UX: simple console: do not show prompt while inferior is running and console read only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 132
diff changeset
   112
        self flash: (resources string:'Nothing to complete').
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   113
        ^self.
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   114
    ].
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   115
170
cd9615ebe6a9 Update simple console implementation to use updated -complete command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   116
    completion isEmptyOrNil ifTrue:[ 
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   117
        self flash: (resources string:'Ambiguous')
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   118
    ] ifFalse:[
170
cd9615ebe6a9 Update simple console implementation to use updated -complete command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   119
        (completion startsWith: (buffer copyTo: bufferPosition - 1)) ifTrue:[
cd9615ebe6a9 Update simple console implementation to use updated -complete command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   120
            | insertion |
cd9615ebe6a9 Update simple console implementation to use updated -complete command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   121
cd9615ebe6a9 Update simple console implementation to use updated -complete command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   122
            insertion := completion copyFrom: bufferPosition.
cd9615ebe6a9 Update simple console implementation to use updated -complete command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   123
            buffer := (buffer copyTo: bufferPosition - 1) , insertion , (buffer copyFrom: bufferPosition).
cd9615ebe6a9 Update simple console implementation to use updated -complete command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   124
            self insertStringAtCursor: insertion.
cd9615ebe6a9 Update simple console implementation to use updated -complete command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   125
            bufferPosition := bufferPosition + insertion size.
cd9615ebe6a9 Update simple console implementation to use updated -complete command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   126
        ] ifFalse:[
190
f37694040277 UX: various little improvements in simple debugger console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 178
diff changeset
   127
            self breakPoint: #jv
178
5d1c3e5fab6b Initial support for VDB python-based variable objects
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   128
        ]
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   129
    ]
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   130
170
cd9615ebe6a9 Update simple console implementation to use updated -complete command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   131
    "Created: / 12-06-2019 / 18:28:09 / jv"
178
5d1c3e5fab6b Initial support for VDB python-based variable objects
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   132
    "Modified: / 12-06-2019 / 19:54:15 / jv"
190
f37694040277 UX: various little improvements in simple debugger console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 178
diff changeset
   133
    "Modified: / 24-11-2019 / 22:10:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   134
!
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   135
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   136
completionsShow
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   137
    "Shows completion candidates"
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   138
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   139
    | currentColNr currentLineNr currentLine  |
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   140
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   141
    lastCompletions isEmptyOrNil ifTrue:[ ^ self ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   142
    currentColNr := cursorCol.
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   143
    currentLineNr := cursorLine.
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   144
    currentLine := self list at: currentLineNr.
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   145
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   146
    self cr.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   147
    lastCompletions do:[:each |
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   148
        self showCR: each.
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   149
    ].
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   150
    self nextPutAll: currentLine.
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   151
    self cursorCol: currentColNr.
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   152
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   153
    "Created: / 25-01-2019 / 21:56:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   154
!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   155
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   156
historyDown
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   157
    ((historyPosition + 1) between: 1 and: history size) ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   158
        historyPosition := historyPosition + 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   159
        self buffer: (history at: historyPosition)
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   160
    ] ifFalse:[
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   161
        historyPosition := history size + 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   162
        self buffer: ''.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   163
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   164
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   165
    "Created: / 26-01-2019 / 22:21:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   166
!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   167
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   168
historyUp
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   169
    ((historyPosition - 1) between: 1 and: history size) ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   170
        historyPosition := historyPosition - 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   171
        self buffer: (history at: historyPosition)
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   172
    ] ifFalse:[
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   173
        self beep.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   174
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   175
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   176
    "Created: / 26-01-2019 / 22:21:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   177
! !
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   178
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   179
!VDBSimpleConsoleView methodsFor:'cursor handling'!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   180
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   181
cursorMovementAllowed
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   182
    ^ false
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   183
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   184
    "Created: / 25-01-2019 / 09:40:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   185
! !
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   186
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   187
!VDBSimpleConsoleView methodsFor:'event handling'!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   188
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   189
extendSelectionToX:x y:y setPrimarySelection:aBoolean
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   190
    | savCursorLine savCursorCol |
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   191
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   192
    savCursorLine := cursorLine.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   193
    savCursorCol := cursorCol.        
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   194
    super extendSelectionToX:x y:y setPrimarySelection:aBoolean.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   195
    self cursorLine:savCursorLine col:savCursorCol.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   196
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   197
    "Created: / 26-01-2019 / 23:00:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   198
!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   199
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   200
keyPress: key x: x y: y
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   201
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   202
    key == #Tab ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   203
        self keyPressTab.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   204
        ^ self
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   205
    ] ifFalse:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   206
        lastTabTime := lastCompletions := nil.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   207
    ].
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   208
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   209
    key isCharacter ifTrue:[
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   210
        buffer := (buffer copyTo:bufferPosition-1)
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   211
                      , key
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   212
                      , (buffer copyFrom:bufferPosition).
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   213
        self insertCharAtCursor:key.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   214
        bufferPosition := bufferPosition + 1. 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   215
        ^ self
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   216
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   217
    key == #Return ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   218
        self keyPressReturn.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   219
        ^ self.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   220
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   221
    key == #BackSpace ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   222
        self keyPressBackSpace.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   223
        ^ self.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   224
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   225
    key == #Delete ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   226
        self keyPressDelete.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   227
        ^ self.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   228
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   229
    key == #CursorLeft ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   230
        self keyPressCursorLeft.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   231
        ^ self.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   232
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   233
    key == #CursorRight ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   234
        self keyPressCursorRight.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   235
        ^ self.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   236
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   237
    key == #CursorUp ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   238
        self keyPressCursorUp.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   239
        ^ self.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   240
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   241
    key == #CursorDown ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   242
        self keyPressCursorDown.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   243
        ^ self.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   244
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   245
    ((key == #BeginOfLine) or:[key == #Ctrla]) ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   246
        self keyPressBeginOfLine.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   247
        ^ self
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   248
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   249
    ((key == #EndOfLine) or:[key == #Ctrle]) ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   250
        self keyPressEndOfLine.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   251
        ^ self
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   252
    ].
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   253
150
2bd269c89e8c Fix annoying flashing in simple console on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 143
diff changeset
   254
    (#(Shift Shift_L Shift_R 
2bd269c89e8c Fix annoying flashing in simple console on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 143
diff changeset
   255
      Ctrl Control Control_L Control_R 
2bd269c89e8c Fix annoying flashing in simple console on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 143
diff changeset
   256
      Cmd Alt Alt_L Alt_R 
2bd269c89e8c Fix annoying flashing in simple console on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 143
diff changeset
   257
      Win_L Menu
2bd269c89e8c Fix annoying flashing in simple console on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 143
diff changeset
   258
      Caps_Lock Escape
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   259
      PreviousPage NextPage
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   260
      Copy Paste Insert
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   261
    ) includes: key) ifTrue:[
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   262
         ^ super keyPress: key x:x y:y
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   263
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   264
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   265
    "/ Unhandled key
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   266
    self beep; flash
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   267
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   268
    "Created: / 24-01-2019 / 22:02:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   269
    "Modified: / 26-01-2019 / 22:36:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
150
2bd269c89e8c Fix annoying flashing in simple console on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 143
diff changeset
   270
    "Modified: / 13-03-2019 / 14:11:13 / jv"
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   271
!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   272
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   273
keyPressBackSpace
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   274
    bufferPosition == 1 ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   275
        self beep.
137
418e6ddd8733 UX: simple console: do not show prompt while inferior is running and console read only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 132
diff changeset
   276
        ^ self.
418e6ddd8733 UX: simple console: do not show prompt while inferior is running and console read only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 132
diff changeset
   277
    ].
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   278
    buffer := (buffer copyTo: bufferPosition - 2) , (buffer copyFrom: bufferPosition).
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   279
    self deleteCharBeforeCursor.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   280
    bufferPosition := bufferPosition - 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   281
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   282
    "Created: / 24-01-2019 / 22:09:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   283
!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   284
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   285
keyPressBeginOfLine
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   286
    self cursorCol: self cursorCol - bufferPosition + 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   287
    bufferPosition := 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   288
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   289
    "Created: / 25-01-2019 / 10:43:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   290
!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   291
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   292
keyPressCursorDown
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   293
    self historyDown.
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   294
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   295
    "Created: / 24-01-2019 / 22:18:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   296
    "Modified: / 26-01-2019 / 22:19:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   297
!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   298
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   299
keyPressCursorLeft
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   300
    (bufferPosition < 2) ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   301
        self beep.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   302
        ^ self.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   303
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   304
    bufferPosition := bufferPosition - 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   305
    self cursorLeft.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   306
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   307
    "Created: / 24-01-2019 / 22:18:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   308
    "Modified: / 25-01-2019 / 10:29:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   309
!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   310
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   311
keyPressCursorRight
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   312
    (bufferPosition > buffer size) ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   313
        self beep.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   314
        ^ self.
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   315
    ].
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   316
    bufferPosition := bufferPosition + 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   317
    self cursorRight.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   318
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   319
    "Created: / 24-01-2019 / 22:19:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   320
    "Modified: / 25-01-2019 / 10:30:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   321
!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   322
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   323
keyPressCursorUp
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   324
    self historyUp.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   325
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   326
    "Created: / 24-01-2019 / 22:19:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   327
    "Modified: / 26-01-2019 / 22:19:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   328
!
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   329
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   330
keyPressDelete
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   331
    bufferPosition == (buffer size + 1) ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   332
        self beep.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   333
        ^ self.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   334
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   335
    buffer := (buffer copyTo: bufferPosition - 1) , (buffer copyFrom: bufferPosition + 1).
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   336
    self deleteCharAtCursor.
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   337
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   338
    "Created: / 25-01-2019 / 10:33:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   339
!
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   340
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   341
keyPressEndOfLine
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   342
    self cursorCol: self cursorCol - bufferPosition + buffer size + 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   343
    bufferPosition := buffer size + 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   344
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   345
    "Created: / 25-01-2019 / 11:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   346
!
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   347
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   348
keyPressReturn
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   349
    acceptAction value: buffer.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   350
    history add: buffer.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   351
    historyPosition := history size + 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   352
    buffer := ''.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   353
    bufferPosition := 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   354
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   355
    "Created: / 24-01-2019 / 22:09:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
190
f37694040277 UX: various little improvements in simple debugger console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 178
diff changeset
   356
    "Modified: / 01-12-2019 / 11:58:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   357
!
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   358
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   359
keyPressTab 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   360
    | now |
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   361
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   362
    "/ No completion installed, do nothing
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   363
    completeAction isNil ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   364
        self flash: (resources string: 'Command completion not supported').
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   365
        ^ self 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   366
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   367
    now := OperatingSystem getMillisecondTime.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   368
    (lastTabTime notNil and:[(now - lastTabTime) < TabTabInterval]) ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   369
        "/ Tab Tab has been pressed, show completion history.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   370
        lastTabTime := nil.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   371
        self completionsShow.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   372
    ] ifFalse:[
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   373
        "/ A single Tab has been pressed, trigger completion.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   374
        lastTabTime := now.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   375
        completeAction value: (buffer copyTo: bufferPosition - 1)  
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   376
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   377
    ].
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   378
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   379
    "Created: / 25-01-2019 / 21:35:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   380
    "Modified: / 25-01-2019 / 22:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   381
! !
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   382
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   383
!VDBSimpleConsoleView methodsFor:'initialization & release'!
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   384
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   385
initialize
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   386
    super initialize.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   387
    buffer := ''.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   388
    bufferPosition := 1.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   389
    history := OrderedCollection new.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   390
    historyPosition := 1.
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   391
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   392
    "Created: / 24-01-2019 / 22:12:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   393
    "Modified: / 26-01-2019 / 22:22:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   394
! !
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   395
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   396
!VDBSimpleConsoleView methodsFor:'menu & menu actions'!
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   397
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   398
copySelection
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   399
    | savCursorLine savCursorCol |
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   400
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   401
    savCursorLine := cursorLine.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   402
    savCursorCol := cursorCol.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   403
    super copySelection.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   404
    self cursorLine:savCursorLine col:savCursorCol.
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   405
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   406
    "Created: / 26-01-2019 / 22:59:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   407
!
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   408
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   409
paste:someText withCR:withCR
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   410
    "/ (For now) disallow pasting text with newlines...
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   411
    (someText includes: Character cr) ifTrue:[ 
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   412
        self beep.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   413
        ^ self.
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   414
    ].
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   415
    buffer := (buffer copyTo: bufferPosition - 1) , someText , (buffer copyFrom: bufferPosition).
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   416
    self insertStringAtCursor: someText.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   417
    bufferPosition := bufferPosition + someText size.
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   418
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   419
    "Created: / 26-01-2019 / 22:40:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   420
! !
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   421
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   422
!VDBSimpleConsoleView methodsFor:'selections'!
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   423
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   424
selectWordAtLine:line col:col
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   425
    | savCursorLine savCursorCol |
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   426
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   427
    savCursorLine := cursorLine.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   428
    savCursorCol := cursorCol.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   429
    super selectWordAtLine:line col:col.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   430
    self cursorLine:savCursorLine col:savCursorCol.
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   431
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   432
    "Created: / 26-01-2019 / 22:55:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   433
! !
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   434
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   435
!VDBSimpleConsoleView methodsFor:'stream messages'!
130
15335a3523c4 Fix: bug in simple console causing output being lost
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 127
diff changeset
   436
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   437
show:anObject
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   438
    super show: anObject.
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   439
    self endEntry.
132
a1dededebc0b UX: add initial support for command completion in simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 130
diff changeset
   440
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   441
    "Created: / 25-01-2019 / 09:55:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
130
15335a3523c4 Fix: bug in simple console causing output being lost
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 127
diff changeset
   442
! !
15335a3523c4 Fix: bug in simple console causing output being lost
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 127
diff changeset
   443
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   444
!VDBSimpleConsoleView class methodsFor:'documentation'!
71
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   445
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   446
version_HG
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   447
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   448
    ^ '$Changeset: <not expanded> $'
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   449
! !
7329192efb9d Win32: ressurected console implementation from 0db4a162853f
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   450
143
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   451
df7f89efd39d A complete rewrite of simple console
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 138
diff changeset
   452
VDBSimpleConsoleView initialize!