From be632574e660343f7496ea1a615c2bd436265b87 Mon Sep 17 00:00:00 2001 From: PS Date: Mon, 13 May 2024 19:29:16 -0700 Subject: [PATCH] Added yeet sheet implementation --- code/custom/4coder_default_bindings.cpp | 56 +- code/custom/4coder_default_hooks.cpp | 6 + code/custom/4coder_default_include.cpp | 1 + code/custom/4coder_yeet.cpp | 1048 +++++++++++++++++ code/custom/generated/command_metadata.h | 367 +++--- code/custom/generated/managed_id_metadata.cpp | 2 + 6 files changed, 1289 insertions(+), 191 deletions(-) create mode 100644 code/custom/4coder_yeet.cpp diff --git a/code/custom/4coder_default_bindings.cpp b/code/custom/4coder_default_bindings.cpp index b77e3fc8..83cc6530 100644 --- a/code/custom/4coder_default_bindings.cpp +++ b/code/custom/4coder_default_bindings.cpp @@ -34,12 +34,11 @@ get_lexeme_under_cursor(Application_Links* app, View_ID view, Buffer_ID buffer, return lexeme; } - function void go_to_definition(Application_Links* app, String_Const_u8 lexeme, View_ID view) { Code_Index_Note* note = 0; - + // if we're trying to go to the definition of the same lexeme as last time // then there are probably a typedef + declaration in different locations so // we want to advance to the next code index note that matches this lexeme @@ -58,7 +57,7 @@ go_to_definition(Application_Links* app, String_Const_u8 lexeme, View_ID view) } } } - + if (!note) { note = code_index_note_from_string(lexeme); @@ -66,10 +65,10 @@ go_to_definition(Application_Links* app, String_Const_u8 lexeme, View_ID view) go_to_definition_last_lexeme_index = 0; } if (note == 0) return; - + Buffer_ID buffer = note->file->buffer; view_set_buffer(app, view, buffer, 0); - + switch (note->note_kind) { case CodeIndexNote_Type: @@ -78,7 +77,7 @@ go_to_definition(Application_Links* app, String_Const_u8 lexeme, View_ID view) { jump_to_location(app, view, note->file->buffer, note->pos.start); } break; - + default: {} break; } } @@ -151,7 +150,7 @@ bindings_cmd_search(Mapping* m, Command_Map* map) Bind(list_all_substring_locations_case_insensitive, KeyCode_D, key_alt); Bind(goto_next_jump, KeyCode_T); Bind(goto_prev_jump, KeyCode_R); - + // Listers Bind(lister_search_all, KeyCode_1); } @@ -163,16 +162,16 @@ bindings_cmd_nav(Mapping* m, Command_Map* map) Bind(seek_end_of_line, KeyCode_P); Bind(move_left_token_boundary, KeyCode_U); Bind(move_right_token_boundary, KeyCode_O); - + Bind(move_up, KeyCode_I); Bind(move_left, KeyCode_J); Bind(move_down, KeyCode_K); Bind(move_right, KeyCode_L); - - + + Bind(move_up_to_blank_line_end, KeyCode_H); Bind(move_down_to_blank_line_end, KeyCode_N); - + Bind(cmd_enter_behavior, KeyCode_Return); Bind(cmd_alt_enter_behavior, KeyCode_Return, key_alt); Bind(jump_to_last_point, KeyCode_Semicolon, KeyCode_Control); @@ -184,14 +183,14 @@ custom_keyboard_bindings() modal_set_cursor_color_u32(modal_mode_input, 0xFF00FF00); modal_set_cursor_color_u32(modal_mode_cmd, 0xFFFF0000); modal_set_cursor_color_u32(modal_mode_debug, 0xFF00F0FF); - + MappingScope(); - + // Global commands modal_bind_all(modal_map_id_global, modal_set_mode_toggle, KeyCode_F, key_alt, 0); modal_bind_all(modal_map_id_global, modal_set_mode_next, KeyCode_F, KeyCode_Control, 0); modal_bind_all(modal_map_id_global, exit_4coder, KeyCode_F4, key_alt, 0); - + modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F1, 0, 0); modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F2, 0, 0); modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F3, 0, 0); @@ -208,7 +207,7 @@ custom_keyboard_bindings() modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F14, 0, 0); modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F15, 0, 0); modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F16, 0, 0); - + SelectMapping(&modal_get_mode(modal_mode_cmd)->map); SelectMap(modal_map_id_global); { @@ -216,7 +215,7 @@ custom_keyboard_bindings() bindings_cmd_misc(m, map); bindings_cmd_search(m, map); bindings_cmd_nav(m, map); - + // Text Editing Bind(delete_to_end_of_line, KeyCode_A); Bind(undo, KeyCode_Z); @@ -229,13 +228,16 @@ custom_keyboard_bindings() Bind(backspace_token_boundary, KeyCode_Backspace, KeyCode_Control); Bind(unindent_range, KeyCode_Tab, KeyCode_Shift); Bind(indent_range, KeyCode_Tab); - + // Macros Bind(keyboard_macro_start_recording, KeyCode_1, key_alt); Bind(keyboard_macro_finish_recording, KeyCode_2, key_alt); Bind(keyboard_macro_replay, KeyCode_3, key_alt); + + // Yeet Sheet + Bind(loco_yeet_selected_range_or_jump, KeyCode_G); } - + SelectMapping(&modal_get_mode(modal_mode_input)->map); SelectMap(modal_map_id_global); { @@ -243,25 +245,25 @@ custom_keyboard_bindings() BindMouseRelease(click_set_cursor, MouseCode_Left); BindCore(click_set_cursor_and_mark, CoreCode_ClickActivateView); BindMouseMove(click_set_cursor_if_lbutton); - + Bind(delete_char, KeyCode_Delete); Bind(backspace_char, KeyCode_Backspace); Bind(backspace_alpha_numeric_or_camel_boundary, KeyCode_Backspace, key_alt); Bind(backspace_token_boundary, KeyCode_Backspace, KeyCode_Control); - + Bind(move_up, KeyCode_I, key_alt); Bind(move_down, KeyCode_K, key_alt); - + BindTextInput(write_text_and_auto_indent); Bind(indent_or_autocomplete, KeyCode_Tab); Bind(unindent_line, KeyCode_Tab, KeyCode_Shift); Bind(write_todo, KeyCode_T, key_alt); Bind(write_note, KeyCode_G, key_alt); - + Bind(input_enter_behavior, KeyCode_Return); Bind(input_alt_enter_behavior, KeyCode_Return, key_alt); } - + SelectMapping(&modal_get_mode(modal_mode_debug)->map); SelectMap(modal_map_id_global); { @@ -276,12 +278,12 @@ void custom_layer_init(Application_Links *app){ Thread_Context *tctx = get_thread_context(app); default_framework_init(app); - + set_all_default_hooks(app); modal_init(3, tctx); - + custom_keyboard_bindings(); - + #if 0 mapping_init(tctx, &framework_mapping); String_ID global_map_id = vars_save_string_lit("keys_global"); @@ -294,7 +296,7 @@ custom_layer_init(Application_Links *app){ #endif setup_essential_mapping(&framework_mapping, global_map_id, file_map_id, code_map_id); #endif - + } #endif //FCODER_DEFAULT_BINDINGS diff --git a/code/custom/4coder_default_hooks.cpp b/code/custom/4coder_default_hooks.cpp index ba0ba387..ac4b20af 100644 --- a/code/custom/4coder_default_hooks.cpp +++ b/code/custom/4coder_default_hooks.cpp @@ -555,6 +555,7 @@ default_render_caller(Application_Links *app, Frame_Info frame_info, View_ID vie // NOTE(allen): draw the buffer default_render_buffer(app, view_id, face_id, buffer, text_layout_id, region); + loco_render_buffer(app, view_id, face_id, buffer, text_layout_id, region, frame_info); text_layout_free(app, text_layout_id); draw_set_clip(app, prev_clip); @@ -1107,12 +1108,17 @@ BUFFER_EDIT_RANGE_SIG(default_buffer_edit_range){ make_data_struct(&buffer_id)); } + loco_on_buffer_edit(app, buffer_id, old_range, new_range); + // no meaning for return return(0); } BUFFER_HOOK_SIG(default_end_buffer){ Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); + + loco_on_buffer_end(app, buffer_id); + Async_Task *lex_task_ptr = scope_attachment(app, scope, buffer_lex_task, Async_Task); if (lex_task_ptr != 0){ async_task_cancel(app, &global_async_system, *lex_task_ptr); diff --git a/code/custom/4coder_default_include.cpp b/code/custom/4coder_default_include.cpp index d4a9c289..c0f7fe75 100644 --- a/code/custom/4coder_default_include.cpp +++ b/code/custom/4coder_default_include.cpp @@ -141,6 +141,7 @@ #include "4coder_variables.cpp" #include "4coder_search_list.cpp" #include "4coder_modal.cpp" +#include "4coder_yeet.cpp" #include "4coder_examples.cpp" diff --git a/code/custom/4coder_yeet.cpp b/code/custom/4coder_yeet.cpp new file mode 100644 index 00000000..da49bc31 --- /dev/null +++ b/code/custom/4coder_yeet.cpp @@ -0,0 +1,1048 @@ +/* +// YEET SHEET. By Luke Perkin. luke@locogame.co.uk +// Header comment last edited 21st 03/2021 +// +// "yeet" regions of text into a seperate buffer called a "yeet sheet". +// The yeet sheet will be kept in sync with any text changes. +// This allows you to have multiple portals into various files in your codebase. +// +// == IMPLEMENTATION == +// @include "4coder_loco_yeets.cpp" in your custom layer. +// +// > loco_render_buffer(Application_Links *app, View_ID view_id, Face_ID face_id, Buffer_ID buffer, Text_Layout_ID text_layout_id, Rect_f32 rect, Frame_Info frame_info) +// Call this is your custom layer's "render" hook. +// +// > loco_on_buffer_edit(Application_Links *app, Buffer_ID buffer_id, Range_i64 old_range, Range_i64 new_range) +// Call this in your custom layer's "on buffer edit" hook. +// +// > loco_yeet_on_buffer_end(Application_Links *app, Buffer_ID buffer_id) +// Call this in your custom layer's "on buffer end" hook. +// +// == COMMANDS == +// The main command you will want to bind to a key is the yeet range command: +// > loco_yeet_selected_range_or_jump +// That will yeet the selected range, or if the cursor is already inside a yeet range, jump to the location +// in the yeet buffer, or vice versa. +// +// > loco_yeet_surrounding_function +// Selects the surrounding function then yeets it. +// +// > loco_yeet_tag +// Queries user for a string then searches all open buffers for that string +// as a comment tag (i.e. "// @tag") and yeets the scope it precedes. +// +// > loco_yeet_clear +// Clears all current yeets. +// +// > loco_yeet_reset_all +// Clears all yeets in all slots, also remove the markers from the original buffers. +// +// > loco_yeet_remove_marker_pair +// Removes a single 'yeet', whatever one the cursor is currently inside. +// +// > loco_save_snapshot_1 +// > loco_save_snapshot_2 +// > loco_save_snapshot_3 +// Saves the current collection of yeets to a slot. + // Note that these do not persist if you close the editor. +// +// > loco_load_yeet_snapshot_1 +// > loco_load_yeet_snapshot_2 +// > loco_load_yeet_snapshot_3 +// Loads a yeet snapshot into the yeet buffer. +// +// > loco_jump_between_yeet +// Will attempt to jump to the corresponding location in the linked buffer. +// +// == CONFIG == +// There are currently a few global variables below, their variable names are self-explanatory. +// +*/ +CUSTOM_ID(attachment, loco_marker_handle); +CUSTOM_ID(attachment, loco_marker_pair_handle); + +//--TYPES + +// @yeettype +struct Loco_Marker_Pair +{ + i32 start_marker_idx; + i32 end_marker_idx; + i32 yeet_start_marker_idx; + i32 yeet_end_marker_idx; + Buffer_ID buffer; +}; + +// @yeettype +struct Loco_Yeets +{ + Loco_Marker_Pair pairs[1024]; + i32 pairs_count; +}; + +// @yeettype +struct Loco_Yeets_Snapshots +{ + Loco_Yeets snapshots[3]; + i32 snapshots_count; +}; + +//--GLOBALS + +global bool loco_yeet_make_yeet_buffer_active_on_yeet = false; +global bool loco_yeet_show_highlight_ranges = true; +global bool loco_yeet_show_source_comment = true; +global FColor loco_yeet_source_comment_color = fcolor_change_alpha(f_green, 0.35f); +global FColor loco_yeet_highlight_start_color = fcolor_argb(0.f, 1.f, 0.f, 0.06f); +global FColor loco_yeet_highlight_end_color = fcolor_argb(0.f, 0.f, 1.f, 0.05f); + +global Loco_Yeets_Snapshots yeets_snapshots = {}; + +// This is set to true when editing either buffer so you don't get +// infinite echoes of syncronization. +global bool lock_yeet_buffer = false; + +// Set this to true to also delete the markers in the original buffer. +// I've left this at false because we might want to store different +// 'collections' of yeeted functions, switch between them would +// be as simple as saving a snapshot of the Loco_Yeets structure. +global bool loco_yeets_delete_og_markers = false; + +//--IMPLEMENTATIONS + +//~ +static Buffer_ID +loco_get_yeet_buffer(Application_Links *app) +{ + String_Const_u8 yeet_name = string_u8_litexpr("*yeet*"); + Buffer_ID yeet_buffer = get_buffer_by_name(app, yeet_name, Access_Always); + if (!buffer_exists(app, yeet_buffer)) + { + yeet_buffer = create_buffer(app, yeet_name, BufferCreate_AlwaysNew); + buffer_set_setting(app, yeet_buffer, BufferSetting_Unimportant, true); + } + return yeet_buffer; +} + +//~ @marker @buffer +static Marker* +loco_get_buffer_markers(Application_Links *app, Arena *arena, Buffer_ID buffer_id, i32* count) +{ + // Adds a certain thing. + Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); + Managed_Object* markers_obj = scope_attachment(app, scope, loco_marker_handle, Managed_Object); + *count = managed_object_get_item_count(app, *markers_obj); + Marker* markers = push_array(arena, Marker, *count); + managed_object_load_data(app, *markers_obj, 0, *count, markers); + return markers; +} + +//~ @marker @buffer @overwrite +static void +loco_overwrite_buffer_markers(Application_Links *app, Arena *arena, Buffer_ID buffer_id, Marker* markers, i32 count) +{ + Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); + Managed_Object* markers_obj = scope_attachment(app, scope, loco_marker_handle, Managed_Object); + managed_object_free(app, *markers_obj); + *markers_obj = alloc_buffer_markers_on_buffer( + app, + buffer_id, + count, + &scope + ); + managed_object_store_data(app, *markers_obj, 0, count, markers); +} + +//~ @overwrite +static void +loco_overwrite_yeets(Application_Links *app, Buffer_ID yeet_buffer, Loco_Yeets* yeets) +{ + Managed_Scope yeet_scope = buffer_get_managed_scope(app, yeet_buffer); + Managed_Object* pair_obj = scope_attachment(app, yeet_scope, loco_marker_pair_handle, Managed_Object); + + i32 count = managed_object_get_item_count(app, *pair_obj); + if (count == 0) + { + *pair_obj = alloc_managed_memory_in_scope( + app, yeet_scope, sizeof(Loco_Yeets), 1); + } + + managed_object_store_data(app, *pair_obj, 0, 1, yeets); +} + +//~ @buffer +static Loco_Yeets +loco_get_buffer_yeets(Application_Links *app, Buffer_ID buffer_id) +{ + Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); + Managed_Object* man_obj = scope_attachment(app, scope, loco_marker_pair_handle, Managed_Object); + Loco_Yeets yeets = {}; + managed_object_load_data(app, *man_obj, 0, 1, &yeets); + return yeets; +} + +//~ @marker @append +// Append an array of markers to the buffer's managed objects. +static i32 +loco_append_markers(Application_Links *app, Buffer_ID buffer_id, Marker* new_markers, i32 count) +{ + Managed_Scope scope; + scope = buffer_get_managed_scope(app, buffer_id); + Scratch_Block scratch(app); + + Temp_Memory marker_temp = begin_temp(scratch); + Managed_Object* markers_obj = scope_attachment(app, scope, loco_marker_handle, Managed_Object); + i32 marker_count = managed_object_get_item_count(app, *markers_obj); + Marker* old_markers = push_array(scratch, Marker, marker_count); + + managed_object_load_data(app, *markers_obj, 0, marker_count, old_markers); + managed_object_free(app, *markers_obj); + + *markers_obj = alloc_buffer_markers_on_buffer( + app, + buffer_id, + marker_count + count, + &scope + ); + managed_object_store_data(app, *markers_obj, 0, marker_count, old_markers); + managed_object_store_data(app, *markers_obj, marker_count, count, new_markers); + end_temp(marker_temp); + + return marker_count; +} + +//~ @marker @range +// Pass in a buffer and a range of indices into a Marker array, this will retrieve the Markers +// array from its scope. Use loco_make_range_from_markers if you already have the Markers. +static Range_i64 +loco_get_marker_range(Application_Links *app, Buffer_ID buffer_id, i32 start_idx, i32 end_idx) +{ + Scratch_Block scratch(app); + i32 count = 0; + Marker* markers = loco_get_buffer_markers(app, scratch, buffer_id, &count); + if (markers != 0) + { + i64 start = markers[start_idx].pos; + i64 end = markers[end_idx].pos; + return Ii64(start, end); + } + return Ii64(0, 0); +} + +//~ @marker @range +// Pass in an array of Markers and a range of indices to that array and this outputs +// a Range of character positions. +static Range_i64 +loco_make_range_from_markers(Marker* markers, i32 start_idx, i32 end_idx) +{ + i64 start = markers[start_idx].pos; + i64 end = markers[end_idx].pos; + return Ii64(start, end); +} + +//~ +static void +loco_delete_marker_pair(Application_Links *app, Buffer_ID yeet_buffer, Loco_Yeets *yeets, i32 i) +{ + Scratch_Block scratch(app); + + // Swap delete pairs. + Loco_Marker_Pair pair = yeets->pairs[i]; + yeets->pairs[i] = yeets->pairs[yeets->pairs_count-1]; + yeets->pairs_count -= 1; + Loco_Marker_Pair &new_pair = yeets->pairs[i]; + + // Need to swap out the indices too + // becuase we've swapped deleted the markers so their index has changed. + if (loco_yeets_delete_og_markers && new_pair.buffer == pair.buffer) + { + new_pair.start_marker_idx = pair.start_marker_idx; + new_pair.end_marker_idx = pair.end_marker_idx; + } + // Always need to set the yeet_marker indices. + new_pair.yeet_start_marker_idx = pair.yeet_start_marker_idx; + new_pair.yeet_end_marker_idx = pair.yeet_end_marker_idx; + + // Swap delete yeet markers. + i32 yeet_marker_count = 0; + Marker* yeet_markers = loco_get_buffer_markers(app, scratch, yeet_buffer, &yeet_marker_count); + yeet_markers[pair.yeet_start_marker_idx] = yeet_markers[yeet_marker_count - 2]; + yeet_markers[pair.yeet_end_marker_idx] = yeet_markers[yeet_marker_count - 1]; + yeet_marker_count -= 2; + + // Swap delete og markers. + if (loco_yeets_delete_og_markers) + { + i32 og_marker_count = 0; + Marker* og_markers = loco_get_buffer_markers(app, scratch, pair.buffer, &og_marker_count); + og_markers[pair.start_marker_idx] = og_markers[og_marker_count - 2]; + og_markers[pair.end_marker_idx] = og_markers[og_marker_count - 1]; + og_marker_count -= 2; + loco_overwrite_buffer_markers(app, scratch, pair.buffer, og_markers, og_marker_count); + } + + // Store markers in memory. + loco_overwrite_buffer_markers(app, scratch, yeet_buffer, yeet_markers, yeet_marker_count); + loco_overwrite_yeets(app, yeet_buffer, yeets); + + Range_i64 yeet_range = loco_make_range_from_markers(yeet_markers, pair.yeet_start_marker_idx, pair.yeet_end_marker_idx); + + String_Const_u8 empty_str = string_u8_litexpr(""); + buffer_replace_range(app, yeet_buffer, yeet_range, empty_str); +} + +//~ @buffer @edit +static void +loco_on_yeet_buffer_edit(Application_Links *app, Buffer_ID buffer_id, Range_i64 old_range, Range_i64 new_range) +{ + + Scratch_Block scratch(app); + Loco_Yeets yeets = loco_get_buffer_yeets(app, buffer_id); + i32 yeet_markers_count = 0; + Marker* yeet_markers = loco_get_buffer_markers(app, scratch, buffer_id, &yeet_markers_count); + for (size_t i = 0; i < yeets.pairs_count; i++) + { + Loco_Marker_Pair& pair = yeets.pairs[i]; + if (!buffer_exists(app, pair.buffer)) continue; + + Range_i64 yeet_range = loco_make_range_from_markers(yeet_markers, pair.yeet_start_marker_idx, pair.yeet_end_marker_idx); + if (old_range.min > yeet_range.min && new_range.max < yeet_range.max) + { + // User edited inside a yeet block. + Scratch_Block og_scratch(app); + i32 og_markers_count = 0; + Marker* og_markers = loco_get_buffer_markers(app, og_scratch, pair.buffer, &og_markers_count); + Range_i64 og_range = loco_make_range_from_markers(og_markers, pair.start_marker_idx, pair.end_marker_idx); + String_Const_u8 string = push_buffer_range(app, og_scratch, buffer_id, yeet_range); + buffer_replace_range( + app, + pair.buffer, + og_range, + string + ); + } + } +} + +//~ @buffer @edit +static void +loco_on_original_buffer_edit(Application_Links *app, Buffer_ID buffer_id, Range_i64 old_range, Range_i64 new_range) +{ + + // Get the yeet buffer. + Buffer_ID yeet_buffer = loco_get_yeet_buffer(app); + if (!buffer_exists(app, yeet_buffer) || buffer_id == yeet_buffer) return; + + // Check if this buffer exists in the yeet list. + Loco_Yeets yeets = loco_get_buffer_yeets(app, yeet_buffer); + bool exists_in_yeets = false; + for (i32 i = 0; i < yeets.pairs_count; i++) + { + if (yeets.pairs[i].buffer == buffer_id) + { + exists_in_yeets = true; + break; + } + } + if (!exists_in_yeets) return; + + // Get yeet list and markers for both buffers. + Scratch_Block scratch(app); + i32 yeet_markers_count = 0; + Marker* yeet_markers = loco_get_buffer_markers(app, scratch, yeet_buffer, &yeet_markers_count); + i32 og_markers_count = 0; + Marker* og_markers = loco_get_buffer_markers(app, scratch, buffer_id, &og_markers_count); + for (i32 i = 0; i < yeets.pairs_count; i++) + { + Loco_Marker_Pair pair = yeets.pairs[i]; + if (pair.buffer != buffer_id) continue; + Range_i64 og_range = loco_make_range_from_markers( + og_markers, pair.start_marker_idx, pair.end_marker_idx); + if (old_range.min > og_range.min && new_range.max < og_range.max) + { + // User edited inside an original buffer block. + Range_i64 yeet_range = loco_make_range_from_markers( + yeet_markers, pair.yeet_start_marker_idx, pair.yeet_end_marker_idx); + String_Const_u8 string = push_buffer_range(app, scratch, buffer_id, og_range); + buffer_replace_range( + app, + yeet_buffer, + yeet_range, + string + ); + } + } +} + +//~ @api @buffer @edit +api(LOCO) void +loco_on_buffer_edit(Application_Links *app, Buffer_ID buffer_id, Range_i64 old_range, Range_i64 new_range) +{ + Buffer_ID yeet_buffer = get_buffer_by_name(app, string_u8_litexpr("*yeet*"), Access_Always); + if (buffer_id == yeet_buffer) + { + if (!lock_yeet_buffer) + { + lock_yeet_buffer = true; + loco_on_yeet_buffer_edit(app, buffer_id, old_range, new_range); + lock_yeet_buffer = false; + } + } + else if (!lock_yeet_buffer) + { + lock_yeet_buffer = true; + loco_on_original_buffer_edit(app, buffer_id, old_range, new_range); + lock_yeet_buffer = false; + } +} + +//~ @api @buffer @render +api(LOCO) void +loco_render_buffer(Application_Links *app, View_ID view_id, Face_ID face_id, + Buffer_ID buffer, Text_Layout_ID text_layout_id, + Rect_f32 rect, Frame_Info frame_info) +{ + String_Const_u8 name = string_u8_litexpr("*yeet*"); + Buffer_ID yeet_buffer = get_buffer_by_name(app, name, Access_Always); + if (!buffer_exists(app, yeet_buffer)) return; + Loco_Yeets yeets = loco_get_buffer_yeets(app, yeet_buffer); + + if (buffer == yeet_buffer && loco_yeet_show_source_comment) + { + Scratch_Block scratch(app); + i32 markers_count = 0; + Marker* markers = loco_get_buffer_markers(app, scratch, yeet_buffer, &markers_count); + f32 line_height = get_view_line_height(app, view_id); + FColor comment_color = loco_yeet_source_comment_color; + for (i32 i = 0; i < yeets.pairs_count; i++) + { + Loco_Marker_Pair pair = yeets.pairs[i]; + if (!buffer_exists(app, pair.buffer)) continue; + + Range_i64 og_range = loco_get_marker_range( + app, pair.buffer, pair.start_marker_idx, pair.end_marker_idx); + i64 start_line = get_line_number_from_pos(app, pair.buffer, og_range.min); + i64 end_line = get_line_number_from_pos(app, pair.buffer, og_range.max); + Fancy_Line line = {}; + String_Const_u8 unique_name = push_buffer_unique_name(app, scratch, pair.buffer); + push_fancy_string(scratch, &line, fcolor_zero(), unique_name); + push_fancy_stringf(scratch, &line, fcolor_zero(), " - Lines: %3.lld - %3.lld", start_line, end_line); + i64 start_pos = markers[pair.yeet_start_marker_idx].pos; + Rect_f32 start_rect = text_layout_character_on_screen(app, text_layout_id, start_pos); + Vec2_f32 comment_pos = { start_rect.x0 + 0, start_rect.y0 - line_height }; + draw_fancy_line(app, face_id, comment_color, &line, comment_pos); + } + } + + if (loco_yeet_show_highlight_ranges) + { + FColor start_color = loco_yeet_highlight_start_color; + FColor end_color = loco_yeet_highlight_end_color; + for (i32 i = 0; i < yeets.pairs_count; i++) + { + Loco_Marker_Pair pair = yeets.pairs[i]; + Range_i64 range = {}; + if (pair.buffer == buffer || buffer == yeet_buffer) + { + if (buffer == yeet_buffer) + { + range = loco_get_marker_range(app, buffer, pair.yeet_start_marker_idx, pair.yeet_end_marker_idx); + } + else + { + range = loco_get_marker_range(app, buffer, pair.start_marker_idx, pair.end_marker_idx); + } + i64 start_line_number = get_line_number_from_pos(app, buffer, range.min); + draw_line_highlight( + app, + text_layout_id, + start_line_number, + start_color); + i64 end_line_number = get_line_number_from_pos(app, buffer, range.max); + draw_line_highlight( + app, + text_layout_id, + end_line_number, + end_color); + } + } + } +} + +//~ @api @buffer +api(LOCO) void +loco_on_buffer_end(Application_Links *app, Buffer_ID buffer_id) +{ + Buffer_ID yeet_buffer = loco_get_yeet_buffer(app); + Loco_Yeets yeets = loco_get_buffer_yeets(app, yeet_buffer); + for (i32 i = yeets.pairs_count - 1; i >= 0; i--) + { + if (yeets.pairs[i].buffer == buffer_id) + { + loco_delete_marker_pair(app, yeet_buffer, &yeets, i); + } + } +} + +//~ +static bool +loco_is_cursor_inside_yeet(Application_Links *app, i64 cursor_pos, i64 *out_dst_cursor_pos, Buffer_ID *out_dst_buffer) +{ + View_ID view = get_active_view(app, Access_Always); + Buffer_ID buffer = view_get_buffer(app, view, Access_Always); + Buffer_ID yeet_buffer = loco_get_yeet_buffer(app); + bool is_yeet_buffer = (buffer == yeet_buffer); + Loco_Yeets yeets = loco_get_buffer_yeets(app, yeet_buffer); + + for (i32 i = 0; i < yeets.pairs_count; i++) + { + Loco_Marker_Pair pair = yeets.pairs[i]; + Buffer_ID src_buf = is_yeet_buffer ? yeet_buffer : pair.buffer; + i32 src_start = is_yeet_buffer ? pair.yeet_start_marker_idx : pair.start_marker_idx; + i32 src_end = is_yeet_buffer ? pair.yeet_end_marker_idx : pair.end_marker_idx; + Range_i64 src_range = loco_get_marker_range(app, src_buf, src_start, src_end); + bool is_cursor_inside = (cursor_pos >= src_range.min && cursor_pos <= src_range.max); + if (is_cursor_inside) + { + Buffer_ID dst_buf = !is_yeet_buffer ? yeet_buffer : pair.buffer; + i32 dst_start = !is_yeet_buffer ? pair.yeet_start_marker_idx : pair.start_marker_idx; + i32 dst_end = !is_yeet_buffer ? pair.yeet_end_marker_idx : pair.end_marker_idx; + Range_i64 dst_range = loco_get_marker_range(app, dst_buf, dst_start, dst_end); + if (out_dst_cursor_pos != 0) + { + *out_dst_cursor_pos = dst_range.min + (cursor_pos - src_range.min); + } + if (out_dst_buffer != 0) + { + *out_dst_buffer = dst_buf; + } + return true; + } + } + + return false; +} + +//~ @jump @buffer +static void +loco_jump_to_buffer(Application_Links *app, Buffer_ID dst_buffer, i64 dst_cursor) +{ + View_ID view = get_next_view_after_active(app, Access_Always); + view_set_buffer(app, view, dst_buffer, 0); + view_set_active(app, view); + view_set_cursor_and_preferred_x(app, view, seek_pos(dst_cursor)); + if (auto_center_after_jumps) + { + center_view(app); + } +} + +//~ @jump +static bool +loco_try_jump_between_yeet_pair(Application_Links *app) +{ + View_ID view = get_active_view(app, Access_Always); + i64 cursor_pos = view_get_cursor_pos(app, view); + i64 dst_cursor_pos = 0; + Buffer_ID dst_buffer = 0; + bool success = loco_is_cursor_inside_yeet(app, cursor_pos, &dst_cursor_pos, &dst_buffer); + if (success) + { + loco_jump_to_buffer(app, dst_buffer, dst_cursor_pos); + } + return success; +} + +//~ @buffer +// Copies text region from one buffer to another buffer (appends to end) +// Returns the insertion region in the dest buffer. +static Range_i64 +loco_copy_buffer_text_to_buffer(Application_Links *app, + Arena * arena, + Buffer_ID src_buffer, + Buffer_ID dst_buffer, + Range_i64 src_range) +{ + // Copy range string from original buffer. + String_Const_u8 copy_string = push_buffer_range(app, arena, src_buffer, src_range); + + // Find dest buffer pos to start insertion. + i64 dst_insert_start = (i64)buffer_get_size(app, dst_buffer); + + // Insert range to yeet buffer. + lock_yeet_buffer = true; + Buffer_Insertion insert = begin_buffer_insertion_at_buffered(app, dst_buffer, dst_insert_start, arena, KB(16)); + insertc(&insert, '\n'); + insert_string(&insert, copy_string); + insertc(&insert, '\n'); + insertc(&insert, '\n'); + end_buffer_insertion(&insert); + lock_yeet_buffer = false; + + // Find dest end buffer pos. + i64 dst_insert_end = (i64)buffer_get_size(app, dst_buffer); + + // +1 to ignore start newline. + // -2 to ignore the two end newlines. + return Ii64(dst_insert_start + 1, dst_insert_end - 2); +} + +//~ @marker @append +// Append two markers that sit and the start and end of a range. +static i32 +loco_append_marker_range(Application_Links *app, Buffer_ID buffer, Range_i64 range) +{ + Marker markers[2]; + markers[0].pos = range.min; + markers[0].lean_right = false; + markers[1].pos = range.max; + markers[1].lean_right = true; + return loco_append_markers(app, buffer, markers, 2); +} + +//~ @snapshot +static void +loco_save_yeet_snapshot_to_slot(Application_Links *app, i32 slot) +{ + Buffer_ID yeet_buffer = loco_get_yeet_buffer(app); + Loco_Yeets yeets = loco_get_buffer_yeets(app, yeet_buffer); + yeets_snapshots.snapshots[slot] = yeets; +} + +//~ @snapshot +static void +loco_load_yeet_snapshot_from_slot(Application_Links *app, i32 slot) +{ + Buffer_ID yeet_buffer = loco_get_yeet_buffer(app); + loco_yeet_clear(app); + Loco_Yeets unsorted_yeets = yeets_snapshots.snapshots[slot]; + + Scratch_Block scratch(app); + + // Sort the pairs by the yeet_buffer marker index. + Sort_Pair_i32* yeet_sorter = push_array(scratch, Sort_Pair_i32, unsorted_yeets.pairs_count); + for (i32 i = 0; i < unsorted_yeets.pairs_count; i += 1){ + yeet_sorter[i].index = i; + yeet_sorter[i].key = unsorted_yeets.pairs[i].yeet_start_marker_idx; + } + sort_pairs_by_key(yeet_sorter, unsorted_yeets.pairs_count); + + Loco_Yeets yeets = {}; + yeets.pairs_count = unsorted_yeets.pairs_count; + for (i32 i = 0; i < unsorted_yeets.pairs_count; i += 1) { + yeets.pairs[i] = unsorted_yeets.pairs[yeet_sorter[i].index]; + } + + // Delete all mentions of buffers that no longer exist. + for (i32 i = yeets.pairs_count - 1; i >= 0; i--) + { + if (!buffer_exists(app, yeets.pairs[i].buffer)) + { + // Swap delete. + yeets.pairs[i] = yeets.pairs[yeets.pairs_count-1]; + yeets.pairs_count -= 1; + } + } + + // Insert the text into the yeet_buffer. + for (i32 i = 0; i < yeets.pairs_count; i++) + { + Loco_Marker_Pair pair = yeets.pairs[i]; + Range_i64 og_range = loco_get_marker_range(app, pair.buffer, pair.start_marker_idx, pair.end_marker_idx); + Range_i64 insertion_range = loco_copy_buffer_text_to_buffer(app, scratch, pair.buffer, yeet_buffer, og_range); + loco_append_marker_range(app, yeet_buffer, insertion_range); + } + + loco_overwrite_yeets(app, yeet_buffer, &yeets); + + // Show the yeet buffer in opposite view if not in yeet view already. + View_ID view = get_active_view(app, Access_Always); + Buffer_ID buffer = view_get_buffer(app, view, Access_Always); + if (buffer != yeet_buffer) + { + View_ID yeet_view = get_next_view_after_active(app, Access_Always); + view_set_buffer(app, yeet_view, yeet_buffer, 0); + view_set_cursor_and_preferred_x(app, yeet_view, seek_pos(0)); + } +} + +//~ @buffer +static void +loco_yeet_buffer_range(Application_Links *app, Buffer_ID buffer, Range_i64 range) +{ + Buffer_ID yeet_buffer = loco_get_yeet_buffer(app); + if (buffer == yeet_buffer || loco_is_cursor_inside_yeet(app, range.min, 0, 0)) + { + return; + } + + i32 old_marker_idx = loco_append_marker_range(app, buffer, range); + + // Copy range string from original buffer. + Scratch_Block scratch(app); + + Range_i64 insertion_range = loco_copy_buffer_text_to_buffer(app, scratch, buffer, yeet_buffer, range); + + i32 old_yeet_marker_idx = loco_append_marker_range(app, yeet_buffer, insertion_range); + + // Show the yeet buffer in opposite view. + View_ID yeet_view = get_next_view_after_active(app, Access_Always); + view_set_buffer(app, yeet_view, yeet_buffer, 0); + view_set_cursor_and_preferred_x(app, yeet_view, seek_pos(insertion_range.min)); + if (loco_yeet_make_yeet_buffer_active_on_yeet) + { + view_set_active(app, yeet_view); + } + + // add marker pair to yeet table. + Managed_Scope yeet_scope = buffer_get_managed_scope(app, yeet_buffer); + Managed_Object* pair_obj = scope_attachment(app, yeet_scope, loco_marker_pair_handle, Managed_Object); + Loco_Yeets yeets = {}; + if (!managed_object_load_data(app, *pair_obj, 0, 1, &yeets)) + { + yeets.pairs_count = 0; + *pair_obj = alloc_managed_memory_in_scope(app, yeet_scope, sizeof(Loco_Yeets), 1); + } + Loco_Marker_Pair& pair = yeets.pairs[yeets.pairs_count++]; + pair.buffer = buffer; + pair.start_marker_idx = old_marker_idx; + pair.end_marker_idx = old_marker_idx + 1; + pair.yeet_start_marker_idx = old_yeet_marker_idx; + pair.yeet_end_marker_idx = old_yeet_marker_idx + 1; + managed_object_store_data(app, *pair_obj, 0, 1, &yeets); +} + +//~ @command +CUSTOM_COMMAND_SIG(loco_jump_between_yeet) +CUSTOM_DOC("Jumps from the yeet sheet to the original buffer or vice versa.") +{ + loco_try_jump_between_yeet_pair(app); +} + +//~ @command +CUSTOM_COMMAND_SIG(loco_yeet_selected_range_or_jump) +CUSTOM_DOC("Yeets some code into a yeet buffer.") +{ + View_ID view = get_active_view(app, Access_Always); + Buffer_ID buffer = view_get_buffer(app, view, Access_Always); + Range_i64 range = get_view_range(app, view); + + // The "or jump" part. + if (loco_try_jump_between_yeet_pair(app)) + return; + + loco_yeet_buffer_range(app, buffer, range); +} + +//~ @command +CUSTOM_COMMAND_SIG(loco_yeet_surrounding_function) +CUSTOM_DOC("Selects the surrounding function scope and yeets it.") +{ + View_ID view = get_active_view(app, Access_ReadVisible); + Buffer_ID buffer = view_get_buffer(app, view, Access_ReadVisible); + // Select the surrounding {} braces. + i64 pos = view_get_cursor_pos(app, view); + Range_i64 range = {}; + if (find_surrounding_nest(app, buffer, pos, FindNest_Scope, &range)){ + for (;;){ + pos = range.min; + if (!find_surrounding_nest(app, buffer, pos, FindNest_Scope, &range)){ + break; + } + } + i64 start_line = get_line_number_from_pos(app, buffer, range.min); + start_line -= 2; + if (start_line < 1) start_line = 1; + range = Ii64(get_line_start_pos(app, buffer, start_line), range.max); + select_scope(app, view, range); + } + // yeet it. + loco_yeet_selected_range_or_jump(app); +} + +//~ @command +CUSTOM_COMMAND_SIG(loco_yeet_clear) +CUSTOM_DOC("Clears all yeets.") +{ + Buffer_ID yeet_buffer = loco_get_yeet_buffer(app); + + Loco_Yeets yeets = loco_get_buffer_yeets(app, yeet_buffer); + if (loco_yeets_delete_og_markers) + { + for (i32 i = 0; i < yeets.pairs_count; i++) + { + Managed_Scope scope = buffer_get_managed_scope(app, yeets.pairs[i].buffer); + Managed_Object* markers_obj = scope_attachment( + app, scope, loco_marker_handle, Managed_Object); + managed_object_free(app, *markers_obj); + } + } + + { + Managed_Scope scope = buffer_get_managed_scope(app, yeet_buffer); + Managed_Object* markers_obj = scope_attachment(app, scope, loco_marker_handle, Managed_Object); + managed_object_free(app, *markers_obj); + Managed_Object* pair_obj = scope_attachment(app, scope, loco_marker_pair_handle, Managed_Object); + managed_object_free(app, *pair_obj); + } + + clear_buffer(app, yeet_buffer); +} + +//~ @command +CUSTOM_COMMAND_SIG(loco_yeet_reset_all) +CUSTOM_DOC("Clears all yeets in all snapshots, also clears all the markers.") +{ + bool cache_delete_og_markers = loco_yeets_delete_og_markers; + loco_yeets_delete_og_markers = true; + loco_load_yeet_snapshot_from_slot(app, 0); + loco_yeet_clear(app); + loco_load_yeet_snapshot_from_slot(app, 1); + loco_yeet_clear(app); + loco_load_yeet_snapshot_from_slot(app, 2); + loco_yeet_clear(app); + loco_yeets_delete_og_markers = cache_delete_og_markers; + loco_load_yeet_snapshot_from_slot(app, 0); + yeets_snapshots = {}; +} + +//~ @command +CUSTOM_COMMAND_SIG(loco_yeet_remove_marker_pair) +CUSTOM_DOC("Removes the marker pair the cursor is currently inside.") +{ + + Buffer_ID yeet_buffer = loco_get_yeet_buffer(app); + View_ID view = get_active_view(app, Access_Always); + Buffer_ID buffer = view_get_buffer(app, view, Access_Always); + i64 cursor_pos = view_get_cursor_pos(app, view); + if (!loco_is_cursor_inside_yeet(app, cursor_pos, 0, 0)) return; + + // If we're in the original buffer, + // try to jump to the relative location in the yeet before. + // That way I just keep the one branch of logic for deleting + // from the yeet buffer only. + View_ID cached_view = view; + if (buffer != yeet_buffer) + { + loco_try_jump_between_yeet_pair(app); + view = get_active_view(app, Access_Always); + buffer = view_get_buffer(app, view, Access_Always); + } + + if (buffer == yeet_buffer) + { + Scratch_Block scratch(app); + Range_i64 range = get_view_range(app, view); + Loco_Yeets yeets = loco_get_buffer_yeets(app, yeet_buffer); + i32 yeet_marker_count = 0; + Marker* yeet_markers = loco_get_buffer_markers(app, scratch, yeet_buffer, &yeet_marker_count); + for (i32 i = yeets.pairs_count - 1; i >= 0; i--) + { + Loco_Marker_Pair pair = yeets.pairs[i]; + Range_i64 yeet_range = loco_make_range_from_markers( + yeet_markers, pair.yeet_start_marker_idx, pair.yeet_end_marker_idx); + if (range.max > yeet_range.min && range.max < yeet_range.max) + { + loco_delete_marker_pair(app, yeet_buffer, &yeets, i); + break; + } + } + + view_set_active(app, cached_view); + } +} + +//--SNAPSHOTS + +//~ @command @snapshot +CUSTOM_COMMAND_SIG(loco_save_yeet_snapshot_1) +CUSTOM_DOC("Save yeets snapshot to slot 1.") +{ + loco_save_yeet_snapshot_to_slot(app, 0); +} + +//~ @command @snapshot +CUSTOM_COMMAND_SIG(loco_save_yeet_snapshot_2) +CUSTOM_DOC("Save yeets snapshot to slot 2.") +{ + loco_save_yeet_snapshot_to_slot(app, 1); +} + +//~ @command @snapshot +CUSTOM_COMMAND_SIG(loco_save_yeet_snapshot_3) +CUSTOM_DOC("Save yeets snapshot to slot 3.") +{ + loco_save_yeet_snapshot_to_slot(app, 2); +} + +//~ @command @snapshot +CUSTOM_COMMAND_SIG(loco_load_yeet_snapshot_1) +CUSTOM_DOC("Load yeets snapshot from slot 1.") +{ + loco_load_yeet_snapshot_from_slot(app, 0); +} + +//~ @command @snapshot +CUSTOM_COMMAND_SIG(loco_load_yeet_snapshot_2) +CUSTOM_DOC("Load yeets snapshot from slot 2.") +{ + loco_load_yeet_snapshot_from_slot(app, 1); +} + +//~ @command @snapshot +CUSTOM_COMMAND_SIG(loco_load_yeet_snapshot_3) +CUSTOM_DOC("Load yeets snapshot from slot 3.") +{ + loco_load_yeet_snapshot_from_slot(app, 2); +} + +//--CATEGORIES + +// @yeettags @yeettype +enum Loco_Yeet_Tags_Parse_State +{ + Loco_Tag_PState_Looking_For_Tag, + Loco_Tag_PState_Reading_Word, + Loco_Tag_PState_End_Of_Word, + Loco_Tag_PState_Looking_For_Comment, + Loco_Tag_PState_Looking_For_Scope_Start, + Loco_Tag_PState_Looking_For_Scope_End +}; + +// @yeettags @yeettype +struct Loco_Yeet_Tag_Range +{ + Range_i64 range; +}; + +//~ @yeettags +static void +loco_yeet_all_scopes_with_tag(Application_Links *app, Buffer_ID buffer, String_Const_u8 tag_name) +{ + Token_Array token_arr = get_token_array_from_buffer(app, buffer); + if (token_arr.tokens == 0) return; + + Scratch_Block scratch(app); + Token_Iterator_Array it = token_iterator_index(buffer, &token_arr, 0); + Loco_Yeet_Tag_Range tag_ranges[1024]; + u64 tag_ranges_count = 0; + Loco_Yeet_Tags_Parse_State root_parse_state = Loco_Tag_PState_Looking_For_Comment; + u64 scope_enter_count = 0; + + for(Token* tok = token_it_read(&it); + tok != 0; + tok = token_it_read(&it)) + { + if (HasFlag(tok->flags, TokenBaseFlag_PreprocessorBody)) + { + if (!token_it_inc_non_whitespace(&it)) break; + continue; + } + + if (tok->sub_kind == TokenCppKind_LineComment && root_parse_state == Loco_Tag_PState_Looking_For_Comment) + { + String_Const_u8 tok_str = push_buffer_range(app, scratch, buffer, Ii64(tok)); + Loco_Yeet_Tags_Parse_State parse_state = Loco_Tag_PState_Looking_For_Tag; + i64 tag_start = 0; + i64 tag_end = 0; + bool found_tag = false; + + for (u64 i = 0; i <= tok_str.size; i++) + { + u8 c = (i < tok_str.size) ? tok_str.str[i] : 0; + switch(parse_state) + { + case Loco_Tag_PState_Looking_For_Tag: { + if (c == '@') + { + parse_state = Loco_Tag_PState_Reading_Word; + tag_start = i+1; + } + break; + } + case Loco_Tag_PState_Reading_Word: { + bool is_lower_alpha = (c >= 'a' && c <= 'z'); + bool is_upper_alpha = (c >= 'A' && c <= 'Z'); + bool is_numeric = (c >= '0' && c <= '9'); + bool is_alphanumeric = (is_lower_alpha || is_upper_alpha || is_numeric); + if (!is_alphanumeric) + { + parse_state = Loco_Tag_PState_End_Of_Word; + tag_end = i; + } + break; + } + } + + if (parse_state == Loco_Tag_PState_End_Of_Word) + { + parse_state = Loco_Tag_PState_Looking_For_Tag; + String_Const_u8 sub = string_substring(tok_str, Ii64(tag_start, tag_end)); + if (string_match(sub, tag_name)) + { + found_tag = true; + break; + } + } + } + + if (found_tag) + { + root_parse_state = Loco_Tag_PState_Looking_For_Scope_Start; + tag_ranges[tag_ranges_count].range.min = tok->pos; + } + } + + if (tok->sub_kind == TokenCppKind_BraceOp) + { + if (root_parse_state == Loco_Tag_PState_Looking_For_Scope_Start) + { + scope_enter_count = 1; + root_parse_state = Loco_Tag_PState_Looking_For_Scope_End; + } + else if (root_parse_state == Loco_Tag_PState_Looking_For_Scope_End) + { + scope_enter_count += 1; + } + } + + if (tok->sub_kind == TokenCppKind_BraceCl && root_parse_state == Loco_Tag_PState_Looking_For_Scope_End) + { + scope_enter_count -= 1; + if (scope_enter_count == 0) + { + root_parse_state = Loco_Tag_PState_Looking_For_Comment; + tag_ranges[tag_ranges_count].range.max = tok->pos+1; + tag_ranges_count += 1; + } + } + + if (!token_it_inc_non_whitespace(&it)) break; + } + + for (u64 i = 0; i < tag_ranges_count; i++) + { + loco_yeet_buffer_range(app, buffer, tag_ranges[i].range); + } +} + +//--TAG-COMMANDS + +// @command @yeettags +CUSTOM_COMMAND_SIG(loco_yeet_tag) +CUSTOM_DOC("Find all locations of a comment tag (//@tag) in all buffers and yeet the scope they precede.") +{ + Scratch_Block scratch(app); + u8 *space = push_array(scratch, u8, KB(1)); + String_Const_u8 tag_name = get_query_string(app, "Yeet Tag: ", space, KB(1)); + Buffer_ID yeet_buffer = loco_get_yeet_buffer(app); + for (Buffer_ID buffer = get_buffer_next(app, 0, Access_ReadWriteVisible); + buffer != 0; + buffer = get_buffer_next(app, buffer, Access_ReadWriteVisible)) + { + if (buffer == yeet_buffer) continue; + + loco_yeet_all_scopes_with_tag(app, buffer, tag_name); + } +} + diff --git a/code/custom/generated/command_metadata.h b/code/custom/generated/command_metadata.h index a00bf392..1c469bc5 100644 --- a/code/custom/generated/command_metadata.h +++ b/code/custom/generated/command_metadata.h @@ -2,7 +2,7 @@ #define command_id(c) (fcoder_metacmd_ID_##c) #define command_metadata(c) (&fcoder_metacmd_table[command_id(c)]) #define command_metadata_by_id(id) (&fcoder_metacmd_table[id]) -#define command_one_past_last_id 269 +#define command_one_past_last_id 282 #if defined(CUSTOM_COMMAND_SIG) #define PROC_LINKS(x,y) x #else @@ -116,6 +116,19 @@ CUSTOM_COMMAND_SIG(load_project); CUSTOM_COMMAND_SIG(load_theme_current_buffer); CUSTOM_COMMAND_SIG(load_themes_default_folder); CUSTOM_COMMAND_SIG(load_themes_hot_directory); +CUSTOM_COMMAND_SIG(loco_jump_between_yeet); +CUSTOM_COMMAND_SIG(loco_load_yeet_snapshot_1); +CUSTOM_COMMAND_SIG(loco_load_yeet_snapshot_2); +CUSTOM_COMMAND_SIG(loco_load_yeet_snapshot_3); +CUSTOM_COMMAND_SIG(loco_save_yeet_snapshot_1); +CUSTOM_COMMAND_SIG(loco_save_yeet_snapshot_2); +CUSTOM_COMMAND_SIG(loco_save_yeet_snapshot_3); +CUSTOM_COMMAND_SIG(loco_yeet_clear); +CUSTOM_COMMAND_SIG(loco_yeet_remove_marker_pair); +CUSTOM_COMMAND_SIG(loco_yeet_reset_all); +CUSTOM_COMMAND_SIG(loco_yeet_selected_range_or_jump); +CUSTOM_COMMAND_SIG(loco_yeet_surrounding_function); +CUSTOM_COMMAND_SIG(loco_yeet_tag); CUSTOM_COMMAND_SIG(make_directory_query); CUSTOM_COMMAND_SIG(miblo_decrement_basic); CUSTOM_COMMAND_SIG(miblo_decrement_time_stamp); @@ -290,7 +303,7 @@ char *source_name; i32 source_name_len; i32 line_number; }; -static Command_Metadata fcoder_metacmd_table[269] = { +static Command_Metadata fcoder_metacmd_table[282] = { { PROC_LINKS(allow_mouse, 0), false, "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "C:\\projects\\4coder_gs\\code\\custom\\4coder_default_framework.cpp", 62, 481 }, { PROC_LINKS(auto_indent_line_at_cursor, 0), false, "auto_indent_line_at_cursor", 26, "Auto-indents the line on which the cursor sits.", 47, "C:\\projects\\4coder_gs\\code\\custom\\4coder_auto_indent.cpp", 56, 420 }, { PROC_LINKS(auto_indent_range, 0), false, "auto_indent_range", 17, "Auto-indents the range between the cursor and the mark.", 55, "C:\\projects\\4coder_gs\\code\\custom\\4coder_auto_indent.cpp", 56, 430 }, @@ -398,6 +411,19 @@ static Command_Metadata fcoder_metacmd_table[269] = { { PROC_LINKS(load_theme_current_buffer, 0), false, "load_theme_current_buffer", 25, "Parse the current buffer as a theme file and add the theme to the theme list. If the buffer has a .4coder postfix in it's name, it is removed when the name is saved.", 165, "C:\\projects\\4coder_gs\\code\\custom\\4coder_config.cpp", 51, 1617 }, { PROC_LINKS(load_themes_default_folder, 0), false, "load_themes_default_folder", 26, "Loads all the theme files in the default theme folder.", 54, "C:\\projects\\4coder_gs\\code\\custom\\4coder_default_framework.cpp", 62, 535 }, { PROC_LINKS(load_themes_hot_directory, 0), false, "load_themes_hot_directory", 25, "Loads all the theme files in the current hot directory.", 55, "C:\\projects\\4coder_gs\\code\\custom\\4coder_default_framework.cpp", 62, 554 }, +{ PROC_LINKS(loco_jump_between_yeet, 0), false, "loco_jump_between_yeet", 22, "Jumps from the yeet sheet to the original buffer or vice versa.", 63, "C:\\projects\\4coder_gs\\code\\custom\\4coder_yeet.cpp", 49, 716 }, +{ PROC_LINKS(loco_load_yeet_snapshot_1, 0), false, "loco_load_yeet_snapshot_1", 25, "Load yeets snapshot from slot 1.", 32, "C:\\projects\\4coder_gs\\code\\custom\\4coder_yeet.cpp", 49, 879 }, +{ PROC_LINKS(loco_load_yeet_snapshot_2, 0), false, "loco_load_yeet_snapshot_2", 25, "Load yeets snapshot from slot 2.", 32, "C:\\projects\\4coder_gs\\code\\custom\\4coder_yeet.cpp", 49, 886 }, +{ PROC_LINKS(loco_load_yeet_snapshot_3, 0), false, "loco_load_yeet_snapshot_3", 25, "Load yeets snapshot from slot 3.", 32, "C:\\projects\\4coder_gs\\code\\custom\\4coder_yeet.cpp", 49, 893 }, +{ PROC_LINKS(loco_save_yeet_snapshot_1, 0), false, "loco_save_yeet_snapshot_1", 25, "Save yeets snapshot to slot 1.", 30, "C:\\projects\\4coder_gs\\code\\custom\\4coder_yeet.cpp", 49, 858 }, +{ PROC_LINKS(loco_save_yeet_snapshot_2, 0), false, "loco_save_yeet_snapshot_2", 25, "Save yeets snapshot to slot 2.", 30, "C:\\projects\\4coder_gs\\code\\custom\\4coder_yeet.cpp", 49, 865 }, +{ PROC_LINKS(loco_save_yeet_snapshot_3, 0), false, "loco_save_yeet_snapshot_3", 25, "Save yeets snapshot to slot 3.", 30, "C:\\projects\\4coder_gs\\code\\custom\\4coder_yeet.cpp", 49, 872 }, +{ PROC_LINKS(loco_yeet_clear, 0), false, "loco_yeet_clear", 15, "Clears all yeets.", 17, "C:\\projects\\4coder_gs\\code\\custom\\4coder_yeet.cpp", 49, 764 }, +{ PROC_LINKS(loco_yeet_remove_marker_pair, 0), false, "loco_yeet_remove_marker_pair", 28, "Removes the marker pair the cursor is currently inside.", 55, "C:\\projects\\4coder_gs\\code\\custom\\4coder_yeet.cpp", 49, 810 }, +{ PROC_LINKS(loco_yeet_reset_all, 0), false, "loco_yeet_reset_all", 19, "Clears all yeets in all snapshots, also clears all the markers.", 63, "C:\\projects\\4coder_gs\\code\\custom\\4coder_yeet.cpp", 49, 793 }, +{ PROC_LINKS(loco_yeet_selected_range_or_jump, 0), false, "loco_yeet_selected_range_or_jump", 32, "Yeets some code into a yeet buffer.", 35, "C:\\projects\\4coder_gs\\code\\custom\\4coder_yeet.cpp", 49, 723 }, +{ PROC_LINKS(loco_yeet_surrounding_function, 0), false, "loco_yeet_surrounding_function", 30, "Selects the surrounding function scope and yeets it.", 52, "C:\\projects\\4coder_gs\\code\\custom\\4coder_yeet.cpp", 49, 738 }, +{ PROC_LINKS(loco_yeet_tag, 0), false, "loco_yeet_tag", 13, "Find all locations of a comment tag (//@tag) in all buffers and yeet the scope they precede.", 92, "C:\\projects\\4coder_gs\\code\\custom\\4coder_yeet.cpp", 49, 1032 }, { PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 1630 }, { PROC_LINKS(miblo_decrement_basic, 0), false, "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "C:\\projects\\4coder_gs\\code\\custom\\4coder_miblo_numbers.cpp", 58, 44 }, { PROC_LINKS(miblo_decrement_time_stamp, 0), false, "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "C:\\projects\\4coder_gs\\code\\custom\\4coder_miblo_numbers.cpp", 58, 237 }, @@ -668,166 +694,179 @@ static i32 fcoder_metacmd_ID_load_project = 103; static i32 fcoder_metacmd_ID_load_theme_current_buffer = 104; static i32 fcoder_metacmd_ID_load_themes_default_folder = 105; static i32 fcoder_metacmd_ID_load_themes_hot_directory = 106; -static i32 fcoder_metacmd_ID_make_directory_query = 107; -static i32 fcoder_metacmd_ID_miblo_decrement_basic = 108; -static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp = 109; -static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 110; -static i32 fcoder_metacmd_ID_miblo_increment_basic = 111; -static i32 fcoder_metacmd_ID_miblo_increment_time_stamp = 112; -static i32 fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 113; -static i32 fcoder_metacmd_ID_mouse_wheel_change_face_size = 114; -static i32 fcoder_metacmd_ID_mouse_wheel_scroll = 115; -static i32 fcoder_metacmd_ID_move_down = 116; -static i32 fcoder_metacmd_ID_move_down_10 = 117; -static i32 fcoder_metacmd_ID_move_down_textual = 118; -static i32 fcoder_metacmd_ID_move_down_to_blank_line = 119; -static i32 fcoder_metacmd_ID_move_down_to_blank_line_end = 120; -static i32 fcoder_metacmd_ID_move_down_to_blank_line_skip_whitespace = 121; -static i32 fcoder_metacmd_ID_move_left = 122; -static i32 fcoder_metacmd_ID_move_left_alpha_numeric_boundary = 123; -static i32 fcoder_metacmd_ID_move_left_alpha_numeric_or_camel_boundary = 124; -static i32 fcoder_metacmd_ID_move_left_token_boundary = 125; -static i32 fcoder_metacmd_ID_move_left_whitespace_boundary = 126; -static i32 fcoder_metacmd_ID_move_left_whitespace_or_token_boundary = 127; -static i32 fcoder_metacmd_ID_move_line_down = 128; -static i32 fcoder_metacmd_ID_move_line_up = 129; -static i32 fcoder_metacmd_ID_move_right = 130; -static i32 fcoder_metacmd_ID_move_right_alpha_numeric_boundary = 131; -static i32 fcoder_metacmd_ID_move_right_alpha_numeric_or_camel_boundary = 132; -static i32 fcoder_metacmd_ID_move_right_token_boundary = 133; -static i32 fcoder_metacmd_ID_move_right_whitespace_boundary = 134; -static i32 fcoder_metacmd_ID_move_right_whitespace_or_token_boundary = 135; -static i32 fcoder_metacmd_ID_move_up = 136; -static i32 fcoder_metacmd_ID_move_up_10 = 137; -static i32 fcoder_metacmd_ID_move_up_to_blank_line = 138; -static i32 fcoder_metacmd_ID_move_up_to_blank_line_end = 139; -static i32 fcoder_metacmd_ID_move_up_to_blank_line_skip_whitespace = 140; -static i32 fcoder_metacmd_ID_multi_paste = 141; -static i32 fcoder_metacmd_ID_multi_paste_interactive = 142; -static i32 fcoder_metacmd_ID_multi_paste_interactive_quick = 143; -static i32 fcoder_metacmd_ID_open_all_code = 144; -static i32 fcoder_metacmd_ID_open_all_code_recursive = 145; -static i32 fcoder_metacmd_ID_open_file_in_quotes = 146; -static i32 fcoder_metacmd_ID_open_in_other = 147; -static i32 fcoder_metacmd_ID_open_long_braces = 148; -static i32 fcoder_metacmd_ID_open_long_braces_break = 149; -static i32 fcoder_metacmd_ID_open_long_braces_semicolon = 150; -static i32 fcoder_metacmd_ID_open_matching_file_cpp = 151; -static i32 fcoder_metacmd_ID_open_panel_hsplit = 152; -static i32 fcoder_metacmd_ID_open_panel_vsplit = 153; -static i32 fcoder_metacmd_ID_page_down = 154; -static i32 fcoder_metacmd_ID_page_up = 155; -static i32 fcoder_metacmd_ID_paste = 156; -static i32 fcoder_metacmd_ID_paste_and_indent = 157; -static i32 fcoder_metacmd_ID_paste_next = 158; -static i32 fcoder_metacmd_ID_paste_next_and_indent = 159; -static i32 fcoder_metacmd_ID_place_in_scope = 160; -static i32 fcoder_metacmd_ID_play_with_a_counter = 161; -static i32 fcoder_metacmd_ID_profile_clear = 162; -static i32 fcoder_metacmd_ID_profile_disable = 163; -static i32 fcoder_metacmd_ID_profile_enable = 164; -static i32 fcoder_metacmd_ID_profile_inspect = 165; -static i32 fcoder_metacmd_ID_project_command_F1 = 166; -static i32 fcoder_metacmd_ID_project_command_F10 = 167; -static i32 fcoder_metacmd_ID_project_command_F11 = 168; -static i32 fcoder_metacmd_ID_project_command_F12 = 169; -static i32 fcoder_metacmd_ID_project_command_F13 = 170; -static i32 fcoder_metacmd_ID_project_command_F14 = 171; -static i32 fcoder_metacmd_ID_project_command_F15 = 172; -static i32 fcoder_metacmd_ID_project_command_F16 = 173; -static i32 fcoder_metacmd_ID_project_command_F2 = 174; -static i32 fcoder_metacmd_ID_project_command_F3 = 175; -static i32 fcoder_metacmd_ID_project_command_F4 = 176; -static i32 fcoder_metacmd_ID_project_command_F5 = 177; -static i32 fcoder_metacmd_ID_project_command_F6 = 178; -static i32 fcoder_metacmd_ID_project_command_F7 = 179; -static i32 fcoder_metacmd_ID_project_command_F8 = 180; -static i32 fcoder_metacmd_ID_project_command_F9 = 181; -static i32 fcoder_metacmd_ID_project_command_lister = 182; -static i32 fcoder_metacmd_ID_project_fkey_command = 183; -static i32 fcoder_metacmd_ID_project_go_to_root_directory = 184; -static i32 fcoder_metacmd_ID_project_reprint = 185; -static i32 fcoder_metacmd_ID_query_replace = 186; -static i32 fcoder_metacmd_ID_query_replace_identifier = 187; -static i32 fcoder_metacmd_ID_query_replace_selection = 188; -static i32 fcoder_metacmd_ID_quick_swap_buffer = 189; -static i32 fcoder_metacmd_ID_redo = 190; -static i32 fcoder_metacmd_ID_redo_all_buffers = 191; -static i32 fcoder_metacmd_ID_rename_file_query = 192; -static i32 fcoder_metacmd_ID_reopen = 193; -static i32 fcoder_metacmd_ID_replace_in_all_buffers = 194; -static i32 fcoder_metacmd_ID_replace_in_buffer = 195; -static i32 fcoder_metacmd_ID_replace_in_range = 196; -static i32 fcoder_metacmd_ID_reverse_search = 197; -static i32 fcoder_metacmd_ID_reverse_search_identifier = 198; -static i32 fcoder_metacmd_ID_save = 199; -static i32 fcoder_metacmd_ID_save_all_dirty_buffers = 200; -static i32 fcoder_metacmd_ID_save_to_query = 201; -static i32 fcoder_metacmd_ID_search = 202; -static i32 fcoder_metacmd_ID_search_identifier = 203; -static i32 fcoder_metacmd_ID_seek_beginning_of_line = 204; -static i32 fcoder_metacmd_ID_seek_beginning_of_textual_line = 205; -static i32 fcoder_metacmd_ID_seek_end_of_line = 206; -static i32 fcoder_metacmd_ID_seek_end_of_textual_line = 207; -static i32 fcoder_metacmd_ID_select_all = 208; -static i32 fcoder_metacmd_ID_select_next_scope_absolute = 209; -static i32 fcoder_metacmd_ID_select_next_scope_after_current = 210; -static i32 fcoder_metacmd_ID_select_prev_scope_absolute = 211; -static i32 fcoder_metacmd_ID_select_prev_top_most_scope = 212; -static i32 fcoder_metacmd_ID_select_surrounding_scope = 213; -static i32 fcoder_metacmd_ID_select_surrounding_scope_maximal = 214; -static i32 fcoder_metacmd_ID_set_eol_mode_from_contents = 215; -static i32 fcoder_metacmd_ID_set_eol_mode_to_binary = 216; -static i32 fcoder_metacmd_ID_set_eol_mode_to_crlf = 217; -static i32 fcoder_metacmd_ID_set_eol_mode_to_lf = 218; -static i32 fcoder_metacmd_ID_set_face_size = 219; -static i32 fcoder_metacmd_ID_set_face_size_this_buffer = 220; -static i32 fcoder_metacmd_ID_set_mark = 221; -static i32 fcoder_metacmd_ID_set_mode_to_notepad_like = 222; -static i32 fcoder_metacmd_ID_set_mode_to_original = 223; -static i32 fcoder_metacmd_ID_setup_build_bat = 224; -static i32 fcoder_metacmd_ID_setup_build_bat_and_sh = 225; -static i32 fcoder_metacmd_ID_setup_build_sh = 226; -static i32 fcoder_metacmd_ID_setup_new_project = 227; -static i32 fcoder_metacmd_ID_show_filebar = 228; -static i32 fcoder_metacmd_ID_show_scrollbar = 229; -static i32 fcoder_metacmd_ID_show_the_log_graph = 230; -static i32 fcoder_metacmd_ID_snipe_backward_whitespace_or_token_boundary = 231; -static i32 fcoder_metacmd_ID_snipe_forward_whitespace_or_token_boundary = 232; -static i32 fcoder_metacmd_ID_snippet_lister = 233; -static i32 fcoder_metacmd_ID_string_repeat = 234; -static i32 fcoder_metacmd_ID_suppress_mouse = 235; -static i32 fcoder_metacmd_ID_swap_panels = 236; -static i32 fcoder_metacmd_ID_theme_lister = 237; -static i32 fcoder_metacmd_ID_to_lowercase = 238; -static i32 fcoder_metacmd_ID_to_uppercase = 239; -static i32 fcoder_metacmd_ID_toggle_filebar = 240; -static i32 fcoder_metacmd_ID_toggle_fps_meter = 241; -static i32 fcoder_metacmd_ID_toggle_fullscreen = 242; -static i32 fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 243; -static i32 fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 244; -static i32 fcoder_metacmd_ID_toggle_line_numbers = 245; -static i32 fcoder_metacmd_ID_toggle_line_wrap = 246; -static i32 fcoder_metacmd_ID_toggle_mouse = 247; -static i32 fcoder_metacmd_ID_toggle_paren_matching_helper = 248; -static i32 fcoder_metacmd_ID_toggle_show_whitespace = 249; -static i32 fcoder_metacmd_ID_toggle_virtual_whitespace = 250; -static i32 fcoder_metacmd_ID_tutorial_maximize = 251; -static i32 fcoder_metacmd_ID_tutorial_minimize = 252; -static i32 fcoder_metacmd_ID_uncomment_line = 253; -static i32 fcoder_metacmd_ID_undo = 254; -static i32 fcoder_metacmd_ID_undo_all_buffers = 255; -static i32 fcoder_metacmd_ID_view_buffer_other_panel = 256; -static i32 fcoder_metacmd_ID_view_jump_list_with_lister = 257; -static i32 fcoder_metacmd_ID_word_complete = 258; -static i32 fcoder_metacmd_ID_word_complete_drop_down = 259; -static i32 fcoder_metacmd_ID_write_block = 260; -static i32 fcoder_metacmd_ID_write_hack = 261; -static i32 fcoder_metacmd_ID_write_note = 262; -static i32 fcoder_metacmd_ID_write_space = 263; -static i32 fcoder_metacmd_ID_write_text_and_auto_indent = 264; -static i32 fcoder_metacmd_ID_write_text_input = 265; -static i32 fcoder_metacmd_ID_write_todo = 266; -static i32 fcoder_metacmd_ID_write_underscore = 267; -static i32 fcoder_metacmd_ID_write_zero_struct = 268; +static i32 fcoder_metacmd_ID_loco_jump_between_yeet = 107; +static i32 fcoder_metacmd_ID_loco_load_yeet_snapshot_1 = 108; +static i32 fcoder_metacmd_ID_loco_load_yeet_snapshot_2 = 109; +static i32 fcoder_metacmd_ID_loco_load_yeet_snapshot_3 = 110; +static i32 fcoder_metacmd_ID_loco_save_yeet_snapshot_1 = 111; +static i32 fcoder_metacmd_ID_loco_save_yeet_snapshot_2 = 112; +static i32 fcoder_metacmd_ID_loco_save_yeet_snapshot_3 = 113; +static i32 fcoder_metacmd_ID_loco_yeet_clear = 114; +static i32 fcoder_metacmd_ID_loco_yeet_remove_marker_pair = 115; +static i32 fcoder_metacmd_ID_loco_yeet_reset_all = 116; +static i32 fcoder_metacmd_ID_loco_yeet_selected_range_or_jump = 117; +static i32 fcoder_metacmd_ID_loco_yeet_surrounding_function = 118; +static i32 fcoder_metacmd_ID_loco_yeet_tag = 119; +static i32 fcoder_metacmd_ID_make_directory_query = 120; +static i32 fcoder_metacmd_ID_miblo_decrement_basic = 121; +static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp = 122; +static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 123; +static i32 fcoder_metacmd_ID_miblo_increment_basic = 124; +static i32 fcoder_metacmd_ID_miblo_increment_time_stamp = 125; +static i32 fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 126; +static i32 fcoder_metacmd_ID_mouse_wheel_change_face_size = 127; +static i32 fcoder_metacmd_ID_mouse_wheel_scroll = 128; +static i32 fcoder_metacmd_ID_move_down = 129; +static i32 fcoder_metacmd_ID_move_down_10 = 130; +static i32 fcoder_metacmd_ID_move_down_textual = 131; +static i32 fcoder_metacmd_ID_move_down_to_blank_line = 132; +static i32 fcoder_metacmd_ID_move_down_to_blank_line_end = 133; +static i32 fcoder_metacmd_ID_move_down_to_blank_line_skip_whitespace = 134; +static i32 fcoder_metacmd_ID_move_left = 135; +static i32 fcoder_metacmd_ID_move_left_alpha_numeric_boundary = 136; +static i32 fcoder_metacmd_ID_move_left_alpha_numeric_or_camel_boundary = 137; +static i32 fcoder_metacmd_ID_move_left_token_boundary = 138; +static i32 fcoder_metacmd_ID_move_left_whitespace_boundary = 139; +static i32 fcoder_metacmd_ID_move_left_whitespace_or_token_boundary = 140; +static i32 fcoder_metacmd_ID_move_line_down = 141; +static i32 fcoder_metacmd_ID_move_line_up = 142; +static i32 fcoder_metacmd_ID_move_right = 143; +static i32 fcoder_metacmd_ID_move_right_alpha_numeric_boundary = 144; +static i32 fcoder_metacmd_ID_move_right_alpha_numeric_or_camel_boundary = 145; +static i32 fcoder_metacmd_ID_move_right_token_boundary = 146; +static i32 fcoder_metacmd_ID_move_right_whitespace_boundary = 147; +static i32 fcoder_metacmd_ID_move_right_whitespace_or_token_boundary = 148; +static i32 fcoder_metacmd_ID_move_up = 149; +static i32 fcoder_metacmd_ID_move_up_10 = 150; +static i32 fcoder_metacmd_ID_move_up_to_blank_line = 151; +static i32 fcoder_metacmd_ID_move_up_to_blank_line_end = 152; +static i32 fcoder_metacmd_ID_move_up_to_blank_line_skip_whitespace = 153; +static i32 fcoder_metacmd_ID_multi_paste = 154; +static i32 fcoder_metacmd_ID_multi_paste_interactive = 155; +static i32 fcoder_metacmd_ID_multi_paste_interactive_quick = 156; +static i32 fcoder_metacmd_ID_open_all_code = 157; +static i32 fcoder_metacmd_ID_open_all_code_recursive = 158; +static i32 fcoder_metacmd_ID_open_file_in_quotes = 159; +static i32 fcoder_metacmd_ID_open_in_other = 160; +static i32 fcoder_metacmd_ID_open_long_braces = 161; +static i32 fcoder_metacmd_ID_open_long_braces_break = 162; +static i32 fcoder_metacmd_ID_open_long_braces_semicolon = 163; +static i32 fcoder_metacmd_ID_open_matching_file_cpp = 164; +static i32 fcoder_metacmd_ID_open_panel_hsplit = 165; +static i32 fcoder_metacmd_ID_open_panel_vsplit = 166; +static i32 fcoder_metacmd_ID_page_down = 167; +static i32 fcoder_metacmd_ID_page_up = 168; +static i32 fcoder_metacmd_ID_paste = 169; +static i32 fcoder_metacmd_ID_paste_and_indent = 170; +static i32 fcoder_metacmd_ID_paste_next = 171; +static i32 fcoder_metacmd_ID_paste_next_and_indent = 172; +static i32 fcoder_metacmd_ID_place_in_scope = 173; +static i32 fcoder_metacmd_ID_play_with_a_counter = 174; +static i32 fcoder_metacmd_ID_profile_clear = 175; +static i32 fcoder_metacmd_ID_profile_disable = 176; +static i32 fcoder_metacmd_ID_profile_enable = 177; +static i32 fcoder_metacmd_ID_profile_inspect = 178; +static i32 fcoder_metacmd_ID_project_command_F1 = 179; +static i32 fcoder_metacmd_ID_project_command_F10 = 180; +static i32 fcoder_metacmd_ID_project_command_F11 = 181; +static i32 fcoder_metacmd_ID_project_command_F12 = 182; +static i32 fcoder_metacmd_ID_project_command_F13 = 183; +static i32 fcoder_metacmd_ID_project_command_F14 = 184; +static i32 fcoder_metacmd_ID_project_command_F15 = 185; +static i32 fcoder_metacmd_ID_project_command_F16 = 186; +static i32 fcoder_metacmd_ID_project_command_F2 = 187; +static i32 fcoder_metacmd_ID_project_command_F3 = 188; +static i32 fcoder_metacmd_ID_project_command_F4 = 189; +static i32 fcoder_metacmd_ID_project_command_F5 = 190; +static i32 fcoder_metacmd_ID_project_command_F6 = 191; +static i32 fcoder_metacmd_ID_project_command_F7 = 192; +static i32 fcoder_metacmd_ID_project_command_F8 = 193; +static i32 fcoder_metacmd_ID_project_command_F9 = 194; +static i32 fcoder_metacmd_ID_project_command_lister = 195; +static i32 fcoder_metacmd_ID_project_fkey_command = 196; +static i32 fcoder_metacmd_ID_project_go_to_root_directory = 197; +static i32 fcoder_metacmd_ID_project_reprint = 198; +static i32 fcoder_metacmd_ID_query_replace = 199; +static i32 fcoder_metacmd_ID_query_replace_identifier = 200; +static i32 fcoder_metacmd_ID_query_replace_selection = 201; +static i32 fcoder_metacmd_ID_quick_swap_buffer = 202; +static i32 fcoder_metacmd_ID_redo = 203; +static i32 fcoder_metacmd_ID_redo_all_buffers = 204; +static i32 fcoder_metacmd_ID_rename_file_query = 205; +static i32 fcoder_metacmd_ID_reopen = 206; +static i32 fcoder_metacmd_ID_replace_in_all_buffers = 207; +static i32 fcoder_metacmd_ID_replace_in_buffer = 208; +static i32 fcoder_metacmd_ID_replace_in_range = 209; +static i32 fcoder_metacmd_ID_reverse_search = 210; +static i32 fcoder_metacmd_ID_reverse_search_identifier = 211; +static i32 fcoder_metacmd_ID_save = 212; +static i32 fcoder_metacmd_ID_save_all_dirty_buffers = 213; +static i32 fcoder_metacmd_ID_save_to_query = 214; +static i32 fcoder_metacmd_ID_search = 215; +static i32 fcoder_metacmd_ID_search_identifier = 216; +static i32 fcoder_metacmd_ID_seek_beginning_of_line = 217; +static i32 fcoder_metacmd_ID_seek_beginning_of_textual_line = 218; +static i32 fcoder_metacmd_ID_seek_end_of_line = 219; +static i32 fcoder_metacmd_ID_seek_end_of_textual_line = 220; +static i32 fcoder_metacmd_ID_select_all = 221; +static i32 fcoder_metacmd_ID_select_next_scope_absolute = 222; +static i32 fcoder_metacmd_ID_select_next_scope_after_current = 223; +static i32 fcoder_metacmd_ID_select_prev_scope_absolute = 224; +static i32 fcoder_metacmd_ID_select_prev_top_most_scope = 225; +static i32 fcoder_metacmd_ID_select_surrounding_scope = 226; +static i32 fcoder_metacmd_ID_select_surrounding_scope_maximal = 227; +static i32 fcoder_metacmd_ID_set_eol_mode_from_contents = 228; +static i32 fcoder_metacmd_ID_set_eol_mode_to_binary = 229; +static i32 fcoder_metacmd_ID_set_eol_mode_to_crlf = 230; +static i32 fcoder_metacmd_ID_set_eol_mode_to_lf = 231; +static i32 fcoder_metacmd_ID_set_face_size = 232; +static i32 fcoder_metacmd_ID_set_face_size_this_buffer = 233; +static i32 fcoder_metacmd_ID_set_mark = 234; +static i32 fcoder_metacmd_ID_set_mode_to_notepad_like = 235; +static i32 fcoder_metacmd_ID_set_mode_to_original = 236; +static i32 fcoder_metacmd_ID_setup_build_bat = 237; +static i32 fcoder_metacmd_ID_setup_build_bat_and_sh = 238; +static i32 fcoder_metacmd_ID_setup_build_sh = 239; +static i32 fcoder_metacmd_ID_setup_new_project = 240; +static i32 fcoder_metacmd_ID_show_filebar = 241; +static i32 fcoder_metacmd_ID_show_scrollbar = 242; +static i32 fcoder_metacmd_ID_show_the_log_graph = 243; +static i32 fcoder_metacmd_ID_snipe_backward_whitespace_or_token_boundary = 244; +static i32 fcoder_metacmd_ID_snipe_forward_whitespace_or_token_boundary = 245; +static i32 fcoder_metacmd_ID_snippet_lister = 246; +static i32 fcoder_metacmd_ID_string_repeat = 247; +static i32 fcoder_metacmd_ID_suppress_mouse = 248; +static i32 fcoder_metacmd_ID_swap_panels = 249; +static i32 fcoder_metacmd_ID_theme_lister = 250; +static i32 fcoder_metacmd_ID_to_lowercase = 251; +static i32 fcoder_metacmd_ID_to_uppercase = 252; +static i32 fcoder_metacmd_ID_toggle_filebar = 253; +static i32 fcoder_metacmd_ID_toggle_fps_meter = 254; +static i32 fcoder_metacmd_ID_toggle_fullscreen = 255; +static i32 fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 256; +static i32 fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 257; +static i32 fcoder_metacmd_ID_toggle_line_numbers = 258; +static i32 fcoder_metacmd_ID_toggle_line_wrap = 259; +static i32 fcoder_metacmd_ID_toggle_mouse = 260; +static i32 fcoder_metacmd_ID_toggle_paren_matching_helper = 261; +static i32 fcoder_metacmd_ID_toggle_show_whitespace = 262; +static i32 fcoder_metacmd_ID_toggle_virtual_whitespace = 263; +static i32 fcoder_metacmd_ID_tutorial_maximize = 264; +static i32 fcoder_metacmd_ID_tutorial_minimize = 265; +static i32 fcoder_metacmd_ID_uncomment_line = 266; +static i32 fcoder_metacmd_ID_undo = 267; +static i32 fcoder_metacmd_ID_undo_all_buffers = 268; +static i32 fcoder_metacmd_ID_view_buffer_other_panel = 269; +static i32 fcoder_metacmd_ID_view_jump_list_with_lister = 270; +static i32 fcoder_metacmd_ID_word_complete = 271; +static i32 fcoder_metacmd_ID_word_complete_drop_down = 272; +static i32 fcoder_metacmd_ID_write_block = 273; +static i32 fcoder_metacmd_ID_write_hack = 274; +static i32 fcoder_metacmd_ID_write_note = 275; +static i32 fcoder_metacmd_ID_write_space = 276; +static i32 fcoder_metacmd_ID_write_text_and_auto_indent = 277; +static i32 fcoder_metacmd_ID_write_text_input = 278; +static i32 fcoder_metacmd_ID_write_todo = 279; +static i32 fcoder_metacmd_ID_write_underscore = 280; +static i32 fcoder_metacmd_ID_write_zero_struct = 281; #endif diff --git a/code/custom/generated/managed_id_metadata.cpp b/code/custom/generated/managed_id_metadata.cpp index 7f141b52..99cfdce4 100644 --- a/code/custom/generated/managed_id_metadata.cpp +++ b/code/custom/generated/managed_id_metadata.cpp @@ -60,4 +60,6 @@ buffer_lex_task = managed_id_declare(app, string_u8_litexpr("attachment"), strin buffer_wrap_lines = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("buffer_wrap_lines")); sticky_jump_marker_handle = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("sticky_jump_marker_handle")); attachment_tokens = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("attachment_tokens")); +loco_marker_handle = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("loco_marker_handle")); +loco_marker_pair_handle = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("loco_marker_pair_handle")); }