diff --git a/src/core/core.odin b/src/core/core.odin index 10b936c..e88c68f 100644 --- a/src/core/core.odin +++ b/src/core/core.odin @@ -1,5 +1,7 @@ package core +import "vendor:raylib" + Mode :: enum { Normal, Insert, @@ -8,6 +10,13 @@ Mode :: enum { State :: struct { mode: Mode, should_close: bool, - buffers: [dynamic]FileBuffer, + screen_height: i32, + screen_width: i32, + font: raylib.Font, + current_buffer: int, + buffers: [dynamic]FileBuffer, + + buffer_list_window_is_visible: bool, + buffer_list_window_selected_buffer: int, } diff --git a/src/core/file_buffer.odin b/src/core/file_buffer.odin index ca43cf4..181247a 100644 --- a/src/core/file_buffer.odin +++ b/src/core/file_buffer.odin @@ -732,12 +732,17 @@ update_glyph_buffer :: proc(buffer: ^FileBuffer) { } } -draw_file_buffer :: proc(state: ^State, buffer: ^FileBuffer, x: int, y: int, font: raylib.Font) { +draw_file_buffer :: proc(state: ^State, buffer: ^FileBuffer, x: int, y: int, font: raylib.Font, show_line_numbers: bool = true) { update_glyph_buffer(buffer); color_buffer(buffer); + padding := 0; + if show_line_numbers { + padding = line_number_padding; + } + begin := buffer.top_line; - cursor_x := x + line_number_padding + buffer.cursor.col * source_font_width; + cursor_x := x + padding + buffer.cursor.col * source_font_width; cursor_y := y + buffer.cursor.line * source_font_height; cursor_y -= begin * source_font_height; @@ -760,7 +765,7 @@ draw_file_buffer :: proc(state: ^State, buffer: ^FileBuffer, x: int, y: int, fon } if num_line_break > 0 { - cursor_x = x + line_number_padding + line_length * source_font_width; + cursor_x = x + padding + line_length * source_font_width; cursor_y = cursor_y + num_line_break * source_font_height; } else { cursor_x += line_length * source_font_width; @@ -772,11 +777,12 @@ draw_file_buffer :: proc(state: ^State, buffer: ^FileBuffer, x: int, y: int, fon for j in 0..