Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3675 GerdtR 1
; TODO: add both visual and command modes
2
 
3
; scan and build command line
4
scan_cmdline:
5
	pusha
6
	cmp	[cmdline_len], cmdline_width
7
	jae	waitevent
8
	push	eax
9
	call	clear_cmdline_end
10
	pop	eax
11
	mov	edi, cmdline
12
	mov	ecx, [cmdline_len]
13
	add	edi, ecx
14
	lea	esi, [edi-1]
15
	sub	ecx, [cmdline_pos]
16
	std
17
	rep	movsb
18
	cld
19
	stosb
20
	inc	[cmdline_len]
21
	call	draw_cmdline_end
22
	inc	[cmdline_pos]
23
	call	draw_cursor
24
	jmp	waitevent
25
.backspace:
26
	cmp	[cmdline_pos], 0
27
	jz	waitevent
28
	dec	[cmdline_pos]
29
.delchar:
30
	call	clear_cmdline_end
31
	mov	edi, [cmdline_pos]
32
	dec	[cmdline_len]
33
	mov	ecx, [cmdline_len]
34
	sub	ecx, edi
35
	add	edi, cmdline
36
	lea	esi, [edi+1]
37
	rep	movsb
38
	call	draw_cmdline_end
39
	call	draw_cursor
40
	jmp	waitevent
41
.del:
42
	mov	eax, [cmdline_pos]
43
	cmp	eax, [cmdline_len]
44
	jae	waitevent
45
	jmp	.delchar
46
.left:
47
	cmp	[cmdline_pos], 0
48
	jz	waitevent
49
	call	hide_cursor
50
	dec	[cmdline_pos]
51
	call	draw_cursor
52
	jmp	waitevent
53
.right:
54
	mov	eax, [cmdline_pos]
55
	cmp	eax, [cmdline_len]
56
	jae	waitevent
57
	call	hide_cursor
58
	inc	[cmdline_pos]
59
	call	draw_cursor
60
	jmp	waitevent
61
.home:
62
	call	hide_cursor
63
	and	[cmdline_pos], 0
64
	call	draw_cursor
65
	jmp	waitevent
66
.end:
67
	call	hide_cursor
68
	mov	eax, [cmdline_len]
69
	mov	[cmdline_pos], eax
70
	call	draw_cursor
71
.up:
72
.down:
73
	jmp	waitevent
74
;; We also trying to execute previous command, if empty command_line
75
.enter:
76
	mov	ecx, [cmdline_len]
77
	cmp ecx, 0
78
	jg	.exec_cur
79
	mov cl, byte [cmdline_prev]
80
	cmp cl, 0
81
	jz waitevent
82
.exec_prev:
83
	mov	esi, cmdline_prev
84
	jmp .exec
85
.exec_cur:
86
	mov	esi, cmdline
87
.exec:
88
	mov	byte [esi+ecx], 0
89
	and	[cmdline_pos], 0
90
	push	esi
91
	call	clear_cmdline_end
92
	call	draw_cursor
93
	pop	esi
94
	and	[cmdline_len], 0
95
; skip leading spaces
96
	call	skip_spaces
97
	cmp	al, 0
98
	jz	waitevent
99
 
100
; vim: ft= fasm
101