Selaa lähdekoodia

svim version 0.1.0 - Saves correct when cusor is mid text, when use tab, it converts to two sapces

jorn_dev
Jørn Guldberg 5 vuotta sitten
vanhempi
commit
5cf71bbaa5
2 muutettua tiedostoa jossa 31 lisäystä ja 25 poistoa
  1. +1
    -1
      kernel.nasm
  2. +30
    -24
      lib/svim.nasm

+ 1
- 1
kernel.nasm Näytä tiedosto

@ -287,7 +287,7 @@ global_vars:
; this is the bios ID
data:
welcome db "###############################################################################", 13, 10, "# Welcome to SingOS VERSION 0.0.5.0 #", 13, 10, "# #", 13, 10, "###############################################################################", 13, 10, 'Press ESC to halt.', 13, 10, 13, 10, 0
welcome db "###############################################################################", 13, 10, "# Welcome to SingOS VERSION 0.0.5.1 #", 13, 10, "# #", 13, 10, "###############################################################################", 13, 10, 'Press ESC to halt.', 13, 10, 13, 10, 0
exit_message db 13, 10, 'Goodbye from SingOS',13,10,'The system has halted.', 0
command_line db 13, 10, 'groot@SingOS $ ', 0
number_one_zstring db '71', 0

+ 30
- 24
lib/svim.nasm Näytä tiedosto

@ -189,10 +189,25 @@ svim:
jmp .svim_loop
.check_down_key:
cmp ax, 0x50e0 ; down key
jne .no_arrow_key_pressed
jne .check_tab_key
call handle_down_key_pressed
jmp .svim_loop
.no_arrow_key_pressed:
jmp .svim_loop
.check_tab_key:
cmp ax, 0x0f09 ; tab key
jne .no_special_key_pressed
mov bx, [buffer_for_svim_base_left_of_cursor]
add bx, [svim_counter_char_in_left_buffer]
mov BYTE [bx], 0x20 ; put space char in the buffer
mov BYTE [bx + 1], 0x20 ; put space char in the buffer
mov bx, [svim_counter_char_in_left_buffer]
add bx, 0x02
mov [svim_counter_char_in_left_buffer], bx
call svim_redraw_window
jmp .svim_loop
jmp .svim_loop
.no_special_key_pressed:
cmp ax, 0x11b ; ESC key
je .end_svim
;cmp ax, 0x3c00 ; f2 key
@ -216,6 +231,17 @@ svim:
;add bx, svim_magic_buffer_size - 2
;mov [bx], ax
; When saving the file, we need to have all the data in the left buffer.
; So we loop through the right buffer and palce the data in the left.
mov ax, [svim_counter_char_in_right_buffer]
.copy_data_to_left_buffer:
cmp ax, 0
je .stop_copy
call handle_right_key_pressed
dec ax
jmp .copy_data_to_left_buffer
.stop_copy:
mov ax, [fileindex_for_open_file]
mov bx, [buffer_for_svim_base_left_of_cursor]
mov cx, [svim_counter_char_in_left_buffer]
@ -253,29 +279,9 @@ svim:
.delete_char:
mov BYTE [bx], 0
mov [svim_counter_char_in_left_buffer], cx
;print_format .debug_buffer_counter, cx
; Go back one space
;mov ax, 0x0e08 ; ah=0x0e means teletype output. al=0x08 means backspace character.
;int 0x10
; Place a NULL
;mov al, 0x0 ; NULL
;int 0x10
; Go back one space again as the above print of NULL pushes the cursor forward again.
;mov ax, 0x0e08
;int 0x10
call svim_redraw_window
jmp .svim_loop
;.f_key_pushed:
;mov al, 0x01 ;arg: index 1
;call os_change_screen
;jmp .svim_loop
;.load_buffer_svim:
handle_left_key_pressed:
pusha
mov ax, [svim_counter_char_in_left_buffer]
@ -500,7 +506,7 @@ svim_counter_char_in_left_buffer dw 0
svim_counter_char_in_right_buffer dw 0
seperate_line db '________________________________________________________________________________', 0
welcome_svim db 'Vim like text editor for SingOS, ESC to exit', 0
welcome_svim_select_file db 'svim v0.0.32 - Open file: ', 0
welcome_svim_select_file db 'svim v0.1.0 - Open file: ', 0
welcome_svim_enter_fileindex db 'Enter fileindex: ', 0
fileindex_for_open_file dw 0
svim_total_file_size_counter dw 0

Ladataan…
Peruuta
Tallenna