Console: Bell character support, escape code '<esc>]K' (erase in line) support

git-svn-id: svn://kolibrios.org@9096 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2021-07-28 07:36:54 +00:00
parent 32a304e64b
commit 7f933eb487

View File

@ -755,6 +755,8 @@ con.write_special_char:
jz .write_esc
cmp al, 8
jz .write_bs
cmp al, 7
jz .bell
cmp al, 9
jnz con.write_char
.write_tab:
@ -790,6 +792,15 @@ con.write_special_char:
@@:
pop eax
ret
.bell:
pusha
push 55
pop eax
mov ebx, eax
mov esi, con.beep2
int 0x40
popa
ret
.write_esc:
mov [con_esc], 1
mov [con_esc_attr_n], 1
@ -868,6 +879,8 @@ con.write_special_char:
je .dec_rst
cmp al, 'h'
je .dec_set
cmp al, 'K'
je .erase_in_line
ret ; simply skip unknown sequences
.dec_rst:
@ -896,6 +909,58 @@ con.write_special_char:
.show_cursor:
mov [con.cursor_height], (15*font_height+50)/100 ; default height
ret
.erase_in_line:
mov eax, [con_esc_attrs]
test eax, eax
jz .erase_till_end_of_line ; <esc>[0K (or <esc>[K)
dec eax
jz .erase_till_start_of_line ; <esc>[1K
dec eax
je .erase_current_line ; <esc>[2K
ret ; unknown sequence
.erase_till_end_of_line:
push edi ecx
mov edi, [con.cur_y]
imul edi, [con.scr_width]
add edi, [con.cur_x]
shl edi, 1
add edi, [con.data]
mov ecx, [con.scr_width]
sub ecx, [con.cur_x]
mov ah, byte[con_flags]
mov al, ' '
rep stosw
pop ecx edi
ret
.erase_till_start_of_line:
push edi ecx
mov edi, [con.cur_y]
imul edi, [con.scr_width]
shl edi, 1
add edi, [con.data]
mov ecx, [con.cur_y]
mov ah, byte[con_flags]
mov al, ' '
rep stosw
pop ecx edi
ret
.erase_current_line:
push edi ecx
mov edi, [con.cur_y]
imul edi, [con.scr_width]
shl edi, 1
add edi, [con.data]
mov ecx, [con.scr_width]
mov ah, byte[con_flags]
mov al, ' '
rep stosw
pop ecx edi
ret
.clear:
mov eax, [con_esc_attrs]
test eax, eax
@ -2648,6 +2713,7 @@ con.nomem_err db 'Not enough memory!',13,10,0
con.aFinished db ' [Finished]',0
con.aNull db '(null)',0
con.beep db 0x90, 0x3C, 0x00
con.beep2 db 0x85, 0x25, 0x85, 0x40, 0x00
con.ipc_buf dd 0,8,0,0
db 0