remove cursor_index

This commit is contained in:
2026-05-12 10:29:12 -04:00
parent 7c645a43ac
commit dcdaf078ce

View File

@@ -292,14 +292,14 @@ handle_arrow :: (using state: *State, using event: Input.Event) {
}
get_visible_lines :: (using state: State) -> [][..]u8 {
#import "Print_vars";
#import "Print_Vars";
if line_height <= 1 || window_height == 0 return .[];
num_lines_in_screen := window_height / line_height - 1;
result := array_view(lines, first_line, num_lines_in_screen);
return result;
}
string_to_line :: (str: string, cursor_char_index := -1) -> string, string {
string_to_line :: (str: string, cursor_x := -1) -> string, string {
prefix_builder: String_Builder;
prefix_builder.allocator = temporary_allocator;
@@ -311,7 +311,6 @@ string_to_line :: (str: string, cursor_char_index := -1) -> string, string {
start := 0;
char_index := 0;
cursor_index := 0;
current_builder := *prefix_builder;
@@ -327,15 +326,12 @@ string_to_line :: (str: string, cursor_char_index := -1) -> string, string {
// start = char_index + 1;
// cursor_index += 4;
} else {
cursor_index += 1;
}
if cursor_index == cursor_char_index {
s := string.{data=str.data + start, count=(char_index + 1) - start};
if char_index == cursor_x {
s := string.{data=str.data + start, count=char_index - start};
append(current_builder, s);
current_builder = *suffix_builder;
start = char_index + 1;
start = char_index;
}
}