Immediate Mode error highlighting -- everything is now in I.M.
parent
b998317bda
commit
2b28efa3bf
|
@ -387,6 +387,8 @@ default_4coder_initialize(Application_Links *app, char **command_line_files, i32
|
||||||
view_highlight_range = managed_variable_create_or_get_id(app, "DEFAULT.highlight" , 0);
|
view_highlight_range = managed_variable_create_or_get_id(app, "DEFAULT.highlight" , 0);
|
||||||
view_highlight_buffer = managed_variable_create_or_get_id(app, "DEFAULT.highlight_buf" , 0);
|
view_highlight_buffer = managed_variable_create_or_get_id(app, "DEFAULT.highlight_buf" , 0);
|
||||||
|
|
||||||
|
sticky_jump_marker_handle = managed_variable_create_or_get_id(app, "DEFAULT.sticky_jump_marker_handle", 0);
|
||||||
|
|
||||||
// open command line files
|
// open command line files
|
||||||
Arena *scratch = context_get_arena(app);
|
Arena *scratch = context_get_arena(app);
|
||||||
Temp_Memory temp = begin_temp(scratch);
|
Temp_Memory temp = begin_temp(scratch);
|
||||||
|
|
|
@ -43,6 +43,8 @@ static Managed_Variable_ID view_ui_data = 0;
|
||||||
static Managed_Variable_ID view_highlight_range = 0;
|
static Managed_Variable_ID view_highlight_range = 0;
|
||||||
static Managed_Variable_ID view_highlight_buffer = 0;
|
static Managed_Variable_ID view_highlight_buffer = 0;
|
||||||
|
|
||||||
|
static Managed_Variable_ID sticky_jump_marker_handle = 0;
|
||||||
|
|
||||||
static u8 out_buffer_space[1024];
|
static u8 out_buffer_space[1024];
|
||||||
static u8 command_space[1024];
|
static u8 command_space[1024];
|
||||||
static char hot_directory_space[1024];
|
static char hot_directory_space[1024];
|
||||||
|
|
|
@ -567,6 +567,31 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
||||||
colors, 0, color_count);
|
colors, 0, color_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE(allen): Error highlight
|
||||||
|
{
|
||||||
|
String_Const_u8 name = string_u8_litexpr("*compilation*");
|
||||||
|
Buffer_ID compilation_buffer = get_buffer_by_name(app, name, AccessAll);
|
||||||
|
if (compilation_buffer != 0){
|
||||||
|
Managed_Scope scopes[2];
|
||||||
|
scopes[0] = buffer_get_managed_scope(app, compilation_buffer);
|
||||||
|
scopes[1] = buffer_get_managed_scope(app, buffer);
|
||||||
|
Managed_Scope scope = get_managed_scope_with_multiple_dependencies(app, scopes, ArrayCount(scopes));
|
||||||
|
Managed_Object markers_object = 0;
|
||||||
|
if (managed_variable_get(app, scope, sticky_jump_marker_handle, &markers_object)){
|
||||||
|
Temp_Memory temp = begin_temp(scratch);
|
||||||
|
i32 count = managed_object_get_item_count(app, markers_object);
|
||||||
|
Marker *markers = push_array(scratch, Marker, count);
|
||||||
|
managed_object_load_data(app, markers_object, 0, count, markers);
|
||||||
|
for (i32 i = 0; i < count; i += 1){
|
||||||
|
i64 line_number = get_line_number_from_pos(app, buffer, markers[i].pos);
|
||||||
|
draw_line_highlight(app, text_layout_id, line_number,
|
||||||
|
Stag_Highlight_Junk);
|
||||||
|
}
|
||||||
|
end_temp(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE(allen): Color parens
|
// NOTE(allen): Color parens
|
||||||
if (do_matching_paren_highlight){
|
if (do_matching_paren_highlight){
|
||||||
i64 pos = cursor_pos;
|
i64 pos = cursor_pos;
|
||||||
|
|
|
@ -425,16 +425,16 @@ static Command_Metadata fcoder_metacmd_table[237] = {
|
||||||
{ PROC_LINKS(goto_first_jump_direct, 0), "goto_first_jump_direct", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 88 },
|
{ PROC_LINKS(goto_first_jump_direct, 0), "goto_first_jump_direct", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 88 },
|
||||||
{ PROC_LINKS(newline_or_goto_position_direct, 0), "newline_or_goto_position_direct", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 103 },
|
{ PROC_LINKS(newline_or_goto_position_direct, 0), "newline_or_goto_position_direct", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 103 },
|
||||||
{ PROC_LINKS(newline_or_goto_position_same_panel_direct, 0), "newline_or_goto_position_same_panel_direct", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 120 },
|
{ PROC_LINKS(newline_or_goto_position_same_panel_direct, 0), "newline_or_goto_position_same_panel_direct", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 120 },
|
||||||
{ PROC_LINKS(goto_jump_at_cursor_sticky, 0), "goto_jump_at_cursor_sticky", 26, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 368 },
|
{ PROC_LINKS(goto_jump_at_cursor_sticky, 0), "goto_jump_at_cursor_sticky", 26, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 354 },
|
||||||
{ PROC_LINKS(goto_jump_at_cursor_same_panel_sticky, 0), "goto_jump_at_cursor_same_panel_sticky", 37, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 395 },
|
{ PROC_LINKS(goto_jump_at_cursor_same_panel_sticky, 0), "goto_jump_at_cursor_same_panel_sticky", 37, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 381 },
|
||||||
{ PROC_LINKS(goto_next_jump_sticky, 0), "goto_next_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 494 },
|
{ PROC_LINKS(goto_next_jump_sticky, 0), "goto_next_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 480 },
|
||||||
{ PROC_LINKS(goto_prev_jump_sticky, 0), "goto_prev_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 511 },
|
{ PROC_LINKS(goto_prev_jump_sticky, 0), "goto_prev_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 497 },
|
||||||
{ PROC_LINKS(goto_next_jump_no_skips_sticky, 0), "goto_next_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 524 },
|
{ PROC_LINKS(goto_next_jump_no_skips_sticky, 0), "goto_next_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 510 },
|
||||||
{ PROC_LINKS(goto_prev_jump_no_skips_sticky, 0), "goto_prev_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 541 },
|
{ PROC_LINKS(goto_prev_jump_no_skips_sticky, 0), "goto_prev_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 527 },
|
||||||
{ PROC_LINKS(goto_first_jump_sticky, 0), "goto_first_jump_sticky", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 555 },
|
{ PROC_LINKS(goto_first_jump_sticky, 0), "goto_first_jump_sticky", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 541 },
|
||||||
{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 572 },
|
{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 558 },
|
||||||
{ PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 594 },
|
{ PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 580 },
|
||||||
{ PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 611 },
|
{ PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 597 },
|
||||||
{ PROC_LINKS(view_jump_list_with_lister, 0), "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\4coder_jump_lister.cpp", 34, 104 },
|
{ PROC_LINKS(view_jump_list_with_lister, 0), "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\4coder_jump_lister.cpp", 34, 104 },
|
||||||
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 19 },
|
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 19 },
|
||||||
{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 28 },
|
{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 28 },
|
||||||
|
|
|
@ -101,16 +101,12 @@ parse_buffer_to_jump_array(Application_Links *app, Arena *arena, Buffer_ID buffe
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char sticky_jump_marker_handle_var[] = "DEFAULT.sticky_jump_marker_handle";
|
|
||||||
static i32 sticky_jump_marker_handle_loc;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_marker_list(Application_Links *app, Heap *heap, Buffer_ID buffer, Marker_List *list){
|
init_marker_list(Application_Links *app, Heap *heap, Buffer_ID buffer, Marker_List *list){
|
||||||
Arena *scratch = context_get_arena(app);
|
Arena *scratch = context_get_arena(app);
|
||||||
Temp_Memory temp = begin_temp(scratch);
|
Temp_Memory temp = begin_temp(scratch);
|
||||||
|
|
||||||
String_Const_u8 buffer_name = push_buffer_base_name(app, scratch, buffer);
|
String_Const_u8 buffer_name = push_buffer_base_name(app, scratch, buffer);
|
||||||
b32 is_compilation_buffer = string_match(buffer_name, string_u8_litexpr("*compilation*"));
|
|
||||||
|
|
||||||
Sticky_Jump_Array jumps = parse_buffer_to_jump_array(app, scratch, buffer);
|
Sticky_Jump_Array jumps = parse_buffer_to_jump_array(app, scratch, buffer);
|
||||||
Range_Array buffer_ranges = get_ranges_of_duplicate_keys(scratch, &jumps.jumps->jump_buffer_id, sizeof(*jumps.jumps), jumps.count);
|
Range_Array buffer_ranges = get_ranges_of_duplicate_keys(scratch, &jumps.jumps->jump_buffer_id, sizeof(*jumps.jumps), jumps.count);
|
||||||
|
@ -171,22 +167,13 @@ init_marker_list(Application_Links *app, Heap *heap, Buffer_ID buffer, Marker_Li
|
||||||
Managed_Object marker_handle = alloc_buffer_markers_on_buffer(app, target_buffer_id, total_jump_count, &scope);
|
Managed_Object marker_handle = alloc_buffer_markers_on_buffer(app, target_buffer_id, total_jump_count, &scope);
|
||||||
managed_object_store_data(app, marker_handle, 0, total_jump_count, markers);
|
managed_object_store_data(app, marker_handle, 0, total_jump_count, markers);
|
||||||
|
|
||||||
if (is_compilation_buffer){
|
|
||||||
// TODO(allen): replace
|
|
||||||
#if 0
|
|
||||||
Marker_Visual visual = create_marker_visual(app, marker_handle);
|
|
||||||
marker_visual_set_effect(app, visual, VisualType_LineHighlights, Stag_Highlight_Junk, 0, 0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
end_temp(marker_temp);
|
end_temp(marker_temp);
|
||||||
|
|
||||||
Assert(managed_object_get_item_size(app, marker_handle) == sizeof(Marker));
|
Assert(managed_object_get_item_size(app, marker_handle) == sizeof(Marker));
|
||||||
Assert(managed_object_get_item_count(app, marker_handle) == total_jump_count);
|
Assert(managed_object_get_item_count(app, marker_handle) == total_jump_count);
|
||||||
Assert(managed_object_get_type(app, marker_handle) == ManagedObjectType_Markers);
|
Assert(managed_object_get_type(app, marker_handle) == ManagedObjectType_Markers);
|
||||||
|
|
||||||
sticky_jump_marker_handle_loc = managed_variable_create_or_get_id(app, sticky_jump_marker_handle_var, 0);
|
managed_variable_set(app, scope, sticky_jump_marker_handle, marker_handle);
|
||||||
managed_variable_set(app, scope, sticky_jump_marker_handle_loc, marker_handle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Managed_Object stored_jump_array = alloc_managed_memory_in_scope(app, scope_array[0], sizeof(Sticky_Jump_Stored), jumps.count);
|
Managed_Object stored_jump_array = alloc_managed_memory_in_scope(app, scope_array[0], sizeof(Sticky_Jump_Stored), jumps.count);
|
||||||
|
@ -295,9 +282,8 @@ get_jump_from_list(Application_Links *app, Marker_List *list, i32 index, ID_Pos_
|
||||||
scope_array[1] = buffer_get_managed_scope(app, target_buffer_id);
|
scope_array[1] = buffer_get_managed_scope(app, target_buffer_id);
|
||||||
Managed_Scope scope = get_managed_scope_with_multiple_dependencies(app, scope_array, ArrayCount(scope_array));
|
Managed_Scope scope = get_managed_scope_with_multiple_dependencies(app, scope_array, ArrayCount(scope_array));
|
||||||
|
|
||||||
sticky_jump_marker_handle_loc = managed_variable_create_or_get_id(app, sticky_jump_marker_handle_var, 0);
|
|
||||||
Managed_Object marker_array = 0;
|
Managed_Object marker_array = 0;
|
||||||
if (managed_variable_get(app, scope, sticky_jump_marker_handle_loc, &marker_array)){
|
if (managed_variable_get(app, scope, sticky_jump_marker_handle, &marker_array)){
|
||||||
Marker marker = {};
|
Marker marker = {};
|
||||||
managed_object_load_data(app, marker_array, stored.index_into_marker_array, 1, &marker);
|
managed_object_load_data(app, marker_array, stored.index_into_marker_array, 1, &marker);
|
||||||
location->buffer_id = target_buffer_id;
|
location->buffer_id = target_buffer_id;
|
||||||
|
|
Loading…
Reference in New Issue