diff --git a/4coder_api_transition_30_31.cpp b/4coder_api_transition_30_31.cpp index 547edd7a..cd5d4304 100644 --- a/4coder_api_transition_30_31.cpp +++ b/4coder_api_transition_30_31.cpp @@ -665,10 +665,6 @@ get_process_state(Application_Links *app, Buffer_ID buffer_id){ return(state); } -//////////////////////////////// - - - #endif // BOTTOM diff --git a/4coder_api_transition_30_31_helpers.cpp b/4coder_api_transition_30_31_helpers.cpp new file mode 100644 index 00000000..4be22578 --- /dev/null +++ b/4coder_api_transition_30_31_helpers.cpp @@ -0,0 +1,262 @@ +/* + * Helpers for the API transition from 4.0.30 to 4.0.31 + * + * In order to keep your layer on the old API you don't have to do anything, this provides wrappers + * idential to the 4.0.30 API. + * In order to transition your entire layer over to the 4.0.31 API define 'REMOVE_TRANSITION_HELPER_31' and fix errors. + * Or you can do it step by step by removing a few wrappers at a time. + * This transition helper will be removed in a future version so it is recommended to get off sooner or laster. + * + * Tips on transitioning: +* +* Wrather than just try to inline this code everywhere, you can simplify things quite a lot by storing references +* to buffers and views and Buffer_ID and View_ID instead of Buffer_Summary and View_Summary. + * Just get the summaries when you need information in those structures. + * + * You will make your code simpler if you stick to String as much as possible, but whenever you want to you can switch + * to any string type you have to String by calling make_string(char_ptr, length) or make_string_slowly(null_terminated_c_str). + * To pull the char ptr and length out of a String named "string": string.str and str.size. + * If you need a null terminated string from a String use get_null_terminated in 4coder_helper.cpp + * + */ + +// TOP + +#if !defined(REMOVE_TRANSITION_HELPER_31) + +static char +buffer_get_char(Application_Links *app, Buffer_Summary *buffer, i32 pos){ + return(buffer==0?0:buffer_get_char(app, buffer->buffer_id, pos)); +} + +static i32 +buffer_get_line_start(Application_Links *app, Buffer_Summary *buffer, i32 line){ + return(buffer==0?0:buffer_get_line_start(app, buffer->buffer_id, line)); +} + +static i32 +buffer_get_line_end(Application_Links *app, Buffer_Summary *buffer, i32 line){ + return(buffer==0?0:buffer_get_line_end(app, buffer->buffer_id, line)); +} + +static Cpp_Token* +get_first_token_at_line(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Array tokens, i32 line){ + return(buffer==0?0:get_first_token_at_line(app, buffer->buffer_id, tokens, line)); +} + +static b32 +read_line(Application_Links *app, Partition *part, Buffer_Summary *buffer, i32 line, String *str, + Partial_Cursor *start_out, Partial_Cursor *one_past_last_out){ + return(buffer==0?0:read_line(app, part, buffer->buffer_id, line, str, start_out, one_past_last_out)); +} + +static b32 +read_line(Application_Links *app, Partition *part, Buffer_Summary *buffer, i32 line, String *str){ + return(buffer==0?0:read_line(app, part, buffer->buffer_id, line, str)); +} + +static b32 +init_stream_chunk(Stream_Chunk *chunk, Application_Links *app, Buffer_Summary *buffer, i32 pos, char *data, u32 size){ + return(buffer==0?0:init_stream_chunk(chunk, app, buffer->buffer_id, pos, data, size)); +} + +static b32 +init_stream_tokens(Stream_Tokens_DEP *stream, Application_Links *app, Buffer_Summary *buffer, i32 pos, Cpp_Token *data, i32 count){ + return(buffer==0?0:init_stream_tokens(stream, app, buffer->buffer_id, pos, data, count)); +} + +static i32 +seek_line_end(Application_Links *app, Buffer_Summary *buffer, i32 pos){ + return(buffer==0?0:seek_line_end(app, buffer->buffer_id, pos)); +} + +static i32 +seek_line_beginning(Application_Links *app, Buffer_Summary *buffer, i32 pos){ + return(buffer==0?0:seek_line_beginning(app, buffer->buffer_id, pos)); +} + +static void +move_past_lead_whitespace(Application_Links *app, View_Summary *view, Buffer_Summary *buffer){ + if (view != 0 && buffer != 0){ + move_past_lead_whitespace(app, view, buffer->buffer_id); + } +} + +static i32 +buffer_seek_whitespace_up(Application_Links *app, Buffer_Summary *buffer, i32 pos){ + return(buffer==0?0:buffer_seek_whitespace_up(app, buffer->buffer_id, pos)); +} + +static i32 +buffer_seek_whitespace_down(Application_Links *app, Buffer_Summary *buffer, i32 pos){ + return(buffer==0?0:buffer_seek_whitespace_down(app, buffer->buffer_id, pos)); +} + +static i32 +buffer_seek_whitespace_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){ + return(buffer==0?0:buffer_seek_whitespace_right(app, buffer->buffer_id, pos)); +} + +static i32 +buffer_seek_whitespace_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){ + return(buffer==0?0:buffer_seek_whitespace_left(app, buffer->buffer_id, pos)); +} + +static i32 +buffer_seek_alphanumeric_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){ + return(buffer==0?0:buffer_seek_alphanumeric_right(app, buffer->buffer_id, pos)); +} + +static i32 +buffer_seek_alphanumeric_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){ + return(buffer==0?0:buffer_seek_alphanumeric_left(app, buffer->buffer_id, pos)); +} + +static i32 +buffer_seek_alphanumeric_or_underscore_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){ + return(buffer==0?0:buffer_seek_alphanumeric_or_underscore_right(app, buffer->buffer_id, pos)); +} + +static i32 +buffer_seek_alphanumeric_or_underscore_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){ + return(buffer==0?0:buffer_seek_alphanumeric_or_underscore_left(app, buffer->buffer_id, pos)); +} + +static i32 +buffer_seek_range_camel_right(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 an_pos){ + return(buffer==0?0:buffer_seek_range_camel_right(app, buffer->buffer_id, pos, an_pos)); +} + +static i32 +buffer_seek_range_camel_left(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 an_pos){ + return(buffer==0?0:buffer_seek_range_camel_left(app, buffer->buffer_id, pos, an_pos)); +} + +static i32 +buffer_seek_alphanumeric_or_camel_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){ + return(buffer==0?0:buffer_seek_alphanumeric_or_camel_right(app, buffer->buffer_id, pos)); +} + +static i32 +buffer_seek_alphanumeric_or_camel_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){ + return(buffer==0?0:buffer_seek_alphanumeric_or_camel_left(app, buffer->buffer_id, pos)); +} + +static Cpp_Token_Array +buffer_get_all_tokens(Application_Links *app, Partition *part, Buffer_Summary *buffer){ + Cpp_Token_Array result = {}; + if (buffer != 0){ + result = buffer_get_all_tokens(app, part, buffer->buffer_id); + } + return(result); +} + +static i32 +buffer_boundary_seek(Application_Links *app, Buffer_Summary *buffer, Partition *part, i32 start_pos, b32 seek_forward, Seek_Boundary_Flag flags){ + return(buffer==0?0:buffer_boundary_seek(app, buffer->buffer_id, part, start_pos, seek_forward, flags)); +} + +static void +buffer_seek_delimiter_forward(Application_Links *app, Buffer_Summary *buffer, i32 pos, char delim, i32 *result){ + if (buffer != 0){ + buffer_seek_delimiter_forward(app, buffer->buffer_id, pos, delim, result); + } +} + +static void +buffer_seek_delimiter_backward(Application_Links *app, Buffer_Summary *buffer, i32 pos, char delim, i32 *result){ + if (buffer != 0){ + buffer_seek_delimiter_backward(app, buffer->buffer_id, pos, delim, result); + } +} + +static void +buffer_seek_string_forward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, char *str, i32 size, i32 *result){ + if (buffer != 0){ + buffer_seek_string_forward(app, buffer->buffer_id, pos, end, str, size, result); + } +} + +static void +buffer_seek_string_backward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, char *str, i32 size, i32 *result){ + if (buffer != 0){ + buffer_seek_string_backward(app, buffer->buffer_id, pos, end, str, size, result); + } +} + +static void +buffer_seek_string_insensitive_forward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, char *str, i32 size, i32 *result){ + if (buffer != 0){ + buffer_seek_string_insensitive_forward(app, buffer->buffer_id, pos, end, str, size, result); + } +} + +static void +buffer_seek_string_insensitive_backward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, char *str, i32 size, i32 *result){ + if (buffer != 0){ + buffer_seek_string_insensitive_backward(app, buffer->buffer_id, pos, end, str, size, result); + } +} + +static void +buffer_seek_string(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, i32 min, char *str, i32 size, i32 *result, Buffer_Seek_String_Flags flags){ + if (buffer != 0){ + buffer_seek_string(app, buffer->buffer_id, pos, end, min, str, size, result, flags); + } +} + +static b32 +buffer_line_is_blank(Application_Links *app, Buffer_Summary *buffer, i32 line){ + return(buffer==0?0:buffer_line_is_blank(app, buffer->buffer_id, line)); +} + +static String +read_identifier_at_pos(Application_Links *app, Buffer_Summary *buffer, i32 pos, char *space, i32 max, Range *range_out){ + String result = {}; + if (buffer != 0){ + result = read_identifier_at_pos(app, buffer->buffer_id, pos, space, max, range_out); + } + return(result); +} + +static i32 +buffer_boundary_seek(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, i32 dir, Seek_Boundary_Flag flags){ + return(buffer==0?0:buffer_boundary_seek(app, buffer->buffer_id, start_pos, dir, flags)); +} + +static void +view_buffer_boundary_seek_set_pos(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 dir, u32 flags){ + if (buffer != 0){ + view_buffer_boundary_seek_set_pos(app, view, buffer->buffer_id, dir, flags); + } +} + +static Range +view_buffer_boundary_range(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 dir, u32 flags){ + Range result = {}; + if (buffer != 0){ + result = view_buffer_boundary_range(app, view, buffer->buffer_id, dir, flags); + } + return(result); +} + +static Range +view_buffer_snipe_range(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 dir, u32 flags){ + Range result = {}; + if (buffer != 0){ + result = view_buffer_snipe_range(app, view, buffer->buffer_id, dir, flags); + } + return(result); +} + +static void +query_replace_base(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 pos, String r, String w){ + if (buffer != 0){ + query_replace_base(app, view, buffer->buffer_id, pos, r, w); + } +} + +#endif + +// BOTTOM + diff --git a/4coder_auto_indent.cpp b/4coder_auto_indent.cpp index 3b0801af..ebb5618b 100644 --- a/4coder_auto_indent.cpp +++ b/4coder_auto_indent.cpp @@ -16,7 +16,7 @@ buffer_find_hard_start(Application_Links *app, Buffer_Summary *buffer, i32 line_ char data_chunk[1024]; Stream_Chunk stream = {}; stream.add_null = true; - if (init_stream_chunk(&stream, app, buffer, line_start, data_chunk, sizeof(data_chunk))){ + if (init_stream_chunk(&stream, app, buffer->buffer_id, line_start, data_chunk, sizeof(data_chunk))){ b32 still_looping = true; do{ for (; result.char_pos < stream.end; ++result.char_pos){ @@ -64,7 +64,7 @@ make_batch_from_indent_marks(Application_Links *app, Partition *arena, Buffer_Su for (i32 line_number = first_line; line_number < one_past_last_line; ++line_number){ - i32 line_start_pos = buffer_get_line_start(app, buffer, line_number); + i32 line_start_pos = buffer_get_line_start(app, buffer->buffer_id, line_number); Hard_Start_Result hard_start = buffer_find_hard_start(app, buffer, line_start_pos, opts.tab_width); i32 correct_indentation = shifted_indent_marks[line_number]; @@ -165,7 +165,7 @@ find_anchor_token(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Arra Indent_Anchor_Position anchor = {}; if (tokens.count > 0){ - Cpp_Token *first_invalid_token = get_first_token_at_line(app, buffer, tokens, line_start); + Cpp_Token *first_invalid_token = get_first_token_at_line(app, buffer->buffer_id, tokens, line_start); if (first_invalid_token <= tokens.tokens){ anchor.token = tokens.tokens; } @@ -269,7 +269,7 @@ get_indentation_marks(Application_Links *app, Partition *arena, Buffer_Summary * indent.current_indent = 0; } - i32 next_line_start_pos = buffer_get_line_start(app, buffer, line_number); + i32 next_line_start_pos = buffer_get_line_start(app, buffer->buffer_id, line_number); indent.previous_line_indent = indent.current_indent; Cpp_Token prev_token = {}; Cpp_Token token = {}; @@ -300,12 +300,12 @@ get_indentation_marks(Application_Links *app, Partition *arena, Buffer_Summary * } for (;token.start >= next_line_start_pos && line_number < one_past_last_line;){ - next_line_start_pos = buffer_get_line_start(app, buffer, line_number + 1); + next_line_start_pos = buffer_get_line_start(app, buffer->buffer_id, line_number + 1); i32 this_indent = 0; i32 previous_indent = indent.previous_line_indent; - i32 this_line_start = buffer_get_line_start(app, buffer, line_number); + i32 this_line_start = buffer_get_line_start(app, buffer->buffer_id, line_number); i32 next_line_start = next_line_start_pos; b32 did_multi_line_behavior = false; @@ -460,7 +460,7 @@ get_indentation_marks(Application_Links *app, Partition *arena, Buffer_Summary * case CPP_TOKEN_STRING_CONSTANT: { i32 line = buffer_get_line_number(app, buffer, token.start); - i32 start = buffer_get_line_start(app, buffer, line); + i32 start = buffer_get_line_start(app, buffer->buffer_id, line); Hard_Start_Result hard_start = buffer_find_hard_start(app, buffer, start, tab_width); i32 old_dist_to_token = (token.start - start); @@ -477,7 +477,7 @@ get_indentation_marks(Application_Links *app, Partition *arena, Buffer_Summary * if (!(token.flags & CPP_TFLAG_PP_BODY)){ if (indent.paren_nesting < ArrayCount(indent.paren_anchor_indent)){ i32 line = buffer_get_line_number(app, buffer, token.start); - i32 start = buffer_get_line_start(app, buffer, line); + i32 start = buffer_get_line_start(app, buffer->buffer_id, line); i32 char_pos = token.start - start; Hard_Start_Result hard_start = buffer_find_hard_start(app, buffer, start, tab_width); @@ -523,7 +523,7 @@ get_indent_lines_whole_tokens(Application_Links *app, Buffer_Summary *buffer, Cp for (;line_start > 1;){ i32 line_start_pos = 0; - Cpp_Token *token = get_first_token_at_line(app, buffer, tokens, line_start, &line_start_pos); + Cpp_Token *token = get_first_token_at_line(app, buffer->buffer_id, tokens, line_start, &line_start_pos); if (token && token->start < line_start_pos){ line_start = buffer_get_line_number(app, buffer, token->start); } @@ -534,7 +534,7 @@ get_indent_lines_whole_tokens(Application_Links *app, Buffer_Summary *buffer, Cp for (;line_end < buffer->line_count;){ i32 next_line_start_pos = 0; - Cpp_Token *token = get_first_token_at_line(app, buffer, tokens, line_end+1, &next_line_start_pos); + Cpp_Token *token = get_first_token_at_line(app, buffer->buffer_id, tokens, line_end+1, &next_line_start_pos); if (token && token->start < next_line_start_pos){ line_end = buffer_get_line_number(app, buffer, token->start+token->size); } @@ -634,7 +634,7 @@ CUSTOM_DOC("Auto-indents the line on which the cursor sits.") Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); buffer_auto_indent(app, &global_part, &buffer, view.cursor.pos, view.cursor.pos, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens); - move_past_lead_whitespace(app, &view, &buffer); + move_past_lead_whitespace(app, &view, buffer.buffer_id); } CUSTOM_COMMAND_SIG(auto_tab_range) @@ -646,7 +646,7 @@ CUSTOM_DOC("Auto-indents the range between the cursor and the mark.") Range range = get_view_range(&view); buffer_auto_indent(app, &global_part, &buffer, range.min, range.max, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens); - move_past_lead_whitespace(app, &view, &buffer); + move_past_lead_whitespace(app, &view, buffer.buffer_id); } CUSTOM_COMMAND_SIG(write_and_auto_tab) @@ -664,7 +664,7 @@ CUSTOM_DOC("Inserts a character and auto-indents the line on which the cursor si flags |= AutoIndent_ExactAlignBlock; } buffer_auto_indent(app, &global_part, &buffer, view.cursor.pos, view.cursor.pos, DEF_TAB_WIDTH, flags); - move_past_lead_whitespace(app, &view, &buffer); + move_past_lead_whitespace(app, &view, buffer.buffer_id); } // BOTTOM diff --git a/4coder_base_commands.cpp b/4coder_base_commands.cpp index bcf9363c..d71a1c01 100644 --- a/4coder_base_commands.cpp +++ b/4coder_base_commands.cpp @@ -445,9 +445,14 @@ CUSTOM_DOC("Removes trailing whitespace from all lines in the current buffer.") // buffer, so streaming it is actually the wrong call. Rewrite this // to minimize calls to buffer_read_range. View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer_id); + + i32 buffer_size = 0; + i32 line_count = 0; + buffer_get_size(app, buffer_id, &buffer_size); + buffer_get_line_count(app, buffer_id, &line_count); - i32 line_count = buffer.line_count; i32 edit_max = line_count; if (edit_max*(i32)sizeof(Buffer_Edit) < app->memory_size){ @@ -457,10 +462,9 @@ CUSTOM_DOC("Removes trailing whitespace from all lines in the current buffer.") Stream_Chunk chunk = {}; i32 i = 0; - if (init_stream_chunk(&chunk, app, &buffer, i, data, sizeof(data))){ + if (init_stream_chunk(&chunk, app, buffer_id, i, data, sizeof(data))){ Buffer_Edit *edit = edits; - i32 buffer_size = buffer.size; i32 still_looping = true; i32 last_hard = buffer_size; do{ @@ -496,7 +500,7 @@ CUSTOM_DOC("Removes trailing whitespace from all lines in the current buffer.") } i32 edit_count = (i32)(edit - edits); - buffer_batch_edit(app, &buffer, 0, 0, edits, edit_count, BatchEdit_PreserveTokens); + buffer_batch_edit(app, buffer_id, 0, 0, edits, edit_count, BatchEdit_PreserveTokens); } } } @@ -718,8 +722,9 @@ isearch__update_highlight(Application_Links *app, View_Summary *view, Managed_Ob static void isearch(Application_Links *app, b32 start_reversed, String query_init, b32 on_the_query_init_string){ View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - if (!buffer.exists){ + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); + if (!buffer_exists(app, buffer_id)){ return; } @@ -749,7 +754,7 @@ isearch(Application_Links *app, b32 start_reversed, String query_init, b32 on_th b32 first_step = true; Managed_Scope view_scope = view_get_managed_scope(app, view.view_id); - Managed_Object highlight = alloc_buffer_markers_on_buffer(app, buffer.buffer_id, 2, &view_scope); + Managed_Object highlight = alloc_buffer_markers_on_buffer(app, buffer_id, 2, &view_scope); Marker_Visual visual = create_marker_visual(app, highlight); marker_visual_set_effect(app, visual, VisualType_CharacterHighlightRanges, @@ -849,12 +854,12 @@ isearch(Application_Links *app, b32 start_reversed, String query_init, b32 on_th if (!backspace){ if (reverse){ i32 new_pos = 0; - buffer_seek_string_insensitive_backward(app, &buffer, start_pos - 1, 0, bar.string.str, bar.string.size, &new_pos); + buffer_seek_string_insensitive_backward(app, buffer_id, start_pos - 1, 0, bar.string.str, bar.string.size, &new_pos); if (new_pos >= 0){ if (step_backward){ pos = new_pos; start_pos = new_pos; - buffer_seek_string_insensitive_backward(app, &buffer, start_pos - 1, 0, bar.string.str, bar.string.size, &new_pos); + buffer_seek_string_insensitive_backward(app, buffer_id, start_pos - 1, 0, bar.string.str, bar.string.size, &new_pos); if (new_pos < 0){ new_pos = start_pos; } @@ -865,13 +870,15 @@ isearch(Application_Links *app, b32 start_reversed, String query_init, b32 on_th } else{ i32 new_pos = 0; - buffer_seek_string_insensitive_forward(app, &buffer, start_pos + 1, 0, bar.string.str, bar.string.size, &new_pos); - if (new_pos < buffer.size){ + buffer_seek_string_insensitive_forward(app, buffer_id, start_pos + 1, 0, bar.string.str, bar.string.size, &new_pos); + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); + if (new_pos < buffer_size){ if (step_forward){ pos = new_pos; start_pos = new_pos; - buffer_seek_string_insensitive_forward(app, &buffer, start_pos + 1, 0, bar.string.str, bar.string.size, &new_pos); - if (new_pos >= buffer.size){ + buffer_seek_string_insensitive_forward(app, buffer_id, start_pos + 1, 0, bar.string.str, bar.string.size, &new_pos); + if (new_pos >= buffer_size){ new_pos = start_pos; } } @@ -920,10 +927,10 @@ CUSTOM_COMMAND_SIG(search_identifier) CUSTOM_DOC("Begins an incremental search down through the current buffer for the word or token under the cursor.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); char space[256]; - String query = read_identifier_at_pos(app, &buffer, view.cursor.pos, space, sizeof(space), 0); + String query = read_identifier_at_pos(app, buffer_id, view.cursor.pos, space, sizeof(space), 0); isearch(app, false, query, true); } @@ -931,10 +938,10 @@ CUSTOM_COMMAND_SIG(reverse_search_identifier) CUSTOM_DOC("Begins an incremental search up through the current buffer for the word or token under the cursor.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); char space[256]; - String query = read_identifier_at_pos(app, &buffer, view.cursor.pos, space, sizeof(space), 0); + String query = read_identifier_at_pos(app, buffer_id, view.cursor.pos, space, sizeof(space), 0); isearch(app, true, query, true); } @@ -961,32 +968,33 @@ CUSTOM_DOC("Queries the user for two strings, and replaces all occurences of the u32 access = AccessOpen; View_Summary view = get_active_view(app, access); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); Range range = get_view_range(&view); i32 pos = range.min; i32 new_pos; - buffer_seek_string_forward(app, &buffer, pos, 0, r.str, r.size, &new_pos); + buffer_seek_string_forward(app, buffer_id, pos, 0, r.str, r.size, &new_pos); global_history_edit_group_begin(app); for (;new_pos + r.size <= range.end;){ - buffer_replace_range(app, &buffer, new_pos, new_pos + r.size, w.str, w.size); + buffer_replace_range(app, buffer_id, new_pos, new_pos + r.size, w); refresh_view(app, &view); range = get_view_range(&view); pos = new_pos + w.size; - buffer_seek_string_forward(app, &buffer, pos, 0, r.str, r.size, &new_pos); + buffer_seek_string_forward(app, buffer_id, pos, 0, r.str, r.size, &new_pos); } global_history_edit_group_end(app); } static void -query_replace_base(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 pos, String r, String w){ +query_replace_base(Application_Links *app, View_Summary *view, Buffer_ID buffer_id, i32 pos, String r, String w){ i32 new_pos = 0; - buffer_seek_string_forward(app, buffer, pos, 0, r.str, r.size, &new_pos); + buffer_seek_string_forward(app, buffer_id, pos, 0, r.str, r.size, &new_pos); Managed_Scope view_scope = view_get_managed_scope(app, view->view_id); - Managed_Object highlight = alloc_buffer_markers_on_buffer(app, buffer->buffer_id, 2, &view_scope); + Managed_Object highlight = alloc_buffer_markers_on_buffer(app, buffer_id, 2, &view_scope); Marker_Visual visual = create_marker_visual(app, highlight); marker_visual_set_effect(app, visual, VisualType_CharacterHighlightRanges, @@ -995,8 +1003,11 @@ query_replace_base(Application_Links *app, View_Summary *view, Buffer_Summary *b marker_visual_set_view_key(app, visual, view->view_id); cursor_is_hidden = true; + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); + User_Input in = {}; - for (;new_pos < buffer->size;){ + for (;new_pos < buffer_size;){ Range match = make_range(new_pos, new_pos + r.size); isearch__update_highlight(app, view, highlight, match.min, match.max); @@ -1005,14 +1016,14 @@ query_replace_base(Application_Links *app, View_Summary *view, Buffer_Summary *b if (in.key.character == 'y' || in.key.character == 'Y' || in.key.character == '\n' || in.key.character == '\t'){ - buffer_replace_range(app, buffer, match.min, match.max, w.str, w.size); + buffer_replace_range(app, buffer_id, match.min, match.max, w); pos = match.start + w.size; } else{ pos = match.max; } - buffer_seek_string_forward(app, buffer, pos, 0, r.str, r.size, &new_pos); + buffer_seek_string_forward(app, buffer_id, pos, 0, r.str, r.size, &new_pos); } managed_object_free(app, highlight); @@ -1048,7 +1059,8 @@ query_replace_parameter(Application_Links *app, String replace_str, i32 start_po String w = with.string; View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); i32 pos = start_pos; Query_Bar bar; @@ -1056,7 +1068,7 @@ query_replace_parameter(Application_Links *app, String replace_str, i32 start_po bar.string = null_string; start_query_bar(app, &bar, 0); - query_replace_base(app, &view, &buffer, pos, r, w); + query_replace_base(app, &view, buffer_id, pos, r, w); } CUSTOM_COMMAND_SIG(query_replace) @@ -1087,14 +1099,15 @@ CUSTOM_COMMAND_SIG(query_replace_identifier) CUSTOM_DOC("Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.") { View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - if (!buffer.exists){ + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); + if (!buffer_exists(app, buffer_id)){ return; } Range range = {}; char space[256]; - String replace = read_identifier_at_pos(app, &buffer, view.cursor.pos, space, sizeof(space), &range); + String replace = read_identifier_at_pos(app, buffer_id, view.cursor.pos, space, sizeof(space), &range); if (replace.size != 0){ query_replace_parameter(app, replace, range.min, true); @@ -1409,20 +1422,21 @@ CUSTOM_COMMAND_SIG(duplicate_line) CUSTOM_DOC("Create a copy of the line on which the cursor sits.") { View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); Partition *part = &global_part; Temp_Memory temp = begin_temp_memory(part); String line_string = {}; char *before_line = push_array(part, char, 1); - if (read_line(app, part, &buffer, view.cursor.line, &line_string)){ + if (read_line(app, part, buffer_id, view.cursor.line, &line_string)){ *before_line = '\n'; line_string.str = before_line; line_string.size += 1; - i32 pos = buffer_get_line_end(app, &buffer, view.cursor.line); - buffer_replace_range(app, &buffer, pos, pos, line_string.str, line_string.size); + i32 pos = buffer_get_line_end(app, buffer_id, view.cursor.line); + buffer_replace_range(app, buffer_id, pos, pos, line_string); } end_temp_memory(temp); } @@ -1431,24 +1445,28 @@ CUSTOM_COMMAND_SIG(delete_line) CUSTOM_DOC("Delete the line the on which the cursor sits.") { View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); Partition *part = &global_part; Temp_Memory temp = begin_temp_memory(part); - i32 start = buffer_get_line_start(app, &buffer, view.cursor.line); - i32 end = buffer_get_line_end(app, &buffer, view.cursor.line) + 1; - if (end > buffer.size){ - end = buffer.size; + i32 start = buffer_get_line_start(app, buffer_id, view.cursor.line); + i32 end = buffer_get_line_end(app, buffer_id, view.cursor.line) + 1; + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); + if (end > buffer_size){ + end = buffer_size; } - if (start == end || buffer_get_char(app, &buffer, end - 1) != '\n'){ + if (start == end || buffer_get_char(app, buffer_id, end - 1) != '\n'){ start -= 1; if (start < 0){ start = 0; } } - buffer_replace_range(app, &buffer, start, end, 0, 0); + String zero = {}; + buffer_replace_range(app, buffer_id, start, end, zero); end_temp_memory(temp); } @@ -1508,36 +1526,43 @@ CUSTOM_COMMAND_SIG(open_file_in_quotes) CUSTOM_DOC("Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - if (!buffer.exists) return; + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); + if (!buffer_exists(app, buffer_id)){ + return; + } - char file_name_[256]; - String file_name = make_fixed_width_string(file_name_); + Arena *arena = context_get_arena(app); + Temp_Memory_Arena temp = begin_temp_memory(arena); i32 pos = view.cursor.pos; i32 start = 0; i32 end = 0; - buffer_seek_delimiter_forward(app, &buffer, pos, '"', &end); - buffer_seek_delimiter_backward(app, &buffer, pos, '"', &start); + buffer_seek_delimiter_forward(app, buffer_id, pos, '"', &end); + buffer_seek_delimiter_backward(app, buffer_id, pos, '"', &start); ++start; - i32 size = end - start; - - char short_file_name[128]; - if (size < sizeof(short_file_name)){ - if (buffer_read_range(app, &buffer, start, end, short_file_name)){ - copy(&file_name, make_string(buffer.file_name, buffer.file_name_len)); - remove_last_folder(&file_name); - append(&file_name, make_string(short_file_name, size)); - - get_next_view_looped_primary_panels(app, &view, AccessAll); - if (view.exists){ - if (view_open_file(app, &view, file_name.str, file_name.size, true)){ - set_active_view(app, &view); - } + i32 quoted_name_size = end - start; + char *quoted_name = push_array(arena, char, quoted_name_size); + if (buffer_read_range(app, buffer_id, start, end, quoted_name)){ + String file_name = {}; + buffer_get_file_name(app, buffer_id, 0, &file_name.memory_size); + file_name.memory_size += quoted_name_size + 1; + file_name.str = push_array(arena, char, file_name.memory_size); + buffer_get_file_name(app, buffer_id, &file_name, 0); + remove_last_folder(&file_name); + append(&file_name, make_string(quoted_name, quoted_name_size)); + terminate_with_null(&file_name); + + get_next_view_looped_primary_panels(app, &view, AccessAll); + if (view.exists){ + if (view_open_file(app, &view, file_name.str, file_name.size, true)){ + set_active_view(app, &view); } } } + + end_temp_memory(temp); } CUSTOM_COMMAND_SIG(open_matching_file_cpp) diff --git a/4coder_combined_write_commands.cpp b/4coder_combined_write_commands.cpp index fc26f8d5..5ae95410 100644 --- a/4coder_combined_write_commands.cpp +++ b/4coder_combined_write_commands.cpp @@ -49,7 +49,7 @@ long_braces(Application_Links *app, char *text, i32 size){ view_set_cursor(app, &view, seek_pos(pos + 2), true); buffer_auto_indent(app, &global_part, &buffer, pos, pos + size, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens); - move_past_lead_whitespace(app, &view, &buffer); + move_past_lead_whitespace(app, &view, buffer.buffer_id); } CUSTOM_COMMAND_SIG(open_long_braces) diff --git a/4coder_default_hooks.cpp b/4coder_default_hooks.cpp index a3f72342..b757f58a 100644 --- a/4coder_default_hooks.cpp +++ b/4coder_default_hooks.cpp @@ -657,9 +657,9 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View u32 token_flags = BoundaryToken|BoundaryWhitespace; i32 pos0 = view.cursor.pos; - i32 pos1 = buffer_boundary_seek(app, &buffer, pos0, DirLeft , token_flags); + i32 pos1 = buffer_boundary_seek(app, buffer.buffer_id, pos0, DirLeft , token_flags); if (pos1 >= 0){ - i32 pos2 = buffer_boundary_seek(app, &buffer, pos1, DirRight, token_flags); + i32 pos2 = buffer_boundary_seek(app, buffer.buffer_id, pos1, DirRight, token_flags); if (pos2 <= buffer.size){ Managed_Object token_highlight = alloc_buffer_markers_on_buffer(app, buffer.buffer_id, 2, &render_scope); Marker range_markers[2] = {}; @@ -683,11 +683,11 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View } if (do_matching_paren_highlight){ i32 pos = view.cursor.pos; - if (buffer_get_char(app, &buffer, pos) == '('){ + if (buffer_get_char(app, buffer.buffer_id, pos) == '('){ pos += 1; } else if (pos > 0){ - if (buffer_get_char(app, &buffer, pos - 1) == ')'){ + if (buffer_get_char(app, buffer.buffer_id, pos - 1) == ')'){ pos -= 1; } } diff --git a/4coder_default_include.cpp b/4coder_default_include.cpp index 6e2d21c1..9332cc4a 100644 --- a/4coder_default_include.cpp +++ b/4coder_default_include.cpp @@ -75,6 +75,8 @@ #include "4coder_default_hooks.cpp" #include "4coder_remapping_commands.cpp" +#include "4coder_api_transition_30_31_helpers.cpp" + #endif // BOTTOM diff --git a/4coder_fancy.cpp b/4coder_fancy.cpp index 4d92880e..a00a4a97 100644 --- a/4coder_fancy.cpp +++ b/4coder_fancy.cpp @@ -60,7 +60,7 @@ fancy_resolve_to_rgba(Application_Links *app, Fancy_Color source){ } static Fancy_Color -pass_through_fancy_color(void){ +fancy_pass_through(void){ Fancy_Color result = {}; return(result); } @@ -112,22 +112,22 @@ push_fancy_string(Arena *arena, Fancy_Color fore, Fancy_Color back, String value static Fancy_String * push_fancy_string(Arena *arena, Fancy_String_List *list, Fancy_Color fore, String value){ - return(push_fancy_string(arena, list, fore, pass_through_fancy_color(), value)); + return(push_fancy_string(arena, list, fore, fancy_pass_through(), value)); } static Fancy_String * push_fancy_string(Arena *arena, Fancy_Color fore, String value){ - return(push_fancy_string(arena, 0, fore, pass_through_fancy_color(), value)); + return(push_fancy_string(arena, 0, fore, fancy_pass_through(), value)); } static Fancy_String * push_fancy_string(Arena *arena, Fancy_String_List *list, String value){ - return(push_fancy_string(arena, list, pass_through_fancy_color(), pass_through_fancy_color(), value)); + return(push_fancy_string(arena, list, fancy_pass_through(), fancy_pass_through(), value)); } static Fancy_String * push_fancy_string(Arena *arena, String value){ - return(push_fancy_string(arena, 0, pass_through_fancy_color(), pass_through_fancy_color(), value)); + return(push_fancy_string(arena, 0, fancy_pass_through(), fancy_pass_through(), value)); } static Fancy_String* @@ -155,7 +155,7 @@ static Fancy_String* push_fancy_stringf(Arena *arena, Fancy_String_List *list, Fancy_Color fore, char *format, ...){ va_list args; va_start(args, format); - Fancy_String *result = push_fancy_stringfv(arena, list, fore, pass_through_fancy_color(), format, args); + Fancy_String *result = push_fancy_stringfv(arena, list, fore, fancy_pass_through(), format, args); va_end(args); return(result); } @@ -164,7 +164,7 @@ static Fancy_String* push_fancy_stringf(Arena *arena, Fancy_String_List *list, char *format, ...){ va_list args; va_start(args, format); - Fancy_String *result = push_fancy_stringfv(arena, list, pass_through_fancy_color(), pass_through_fancy_color(), format, args); + Fancy_String *result = push_fancy_stringfv(arena, list, fancy_pass_through(), fancy_pass_through(), format, args); va_end(args); return(result); } @@ -182,7 +182,7 @@ static Fancy_String* push_fancy_stringf(Arena *arena, Fancy_Color fore, char *format, ...){ va_list args; va_start(args, format); - Fancy_String *result = push_fancy_stringfv(arena, 0, fore, pass_through_fancy_color(), format, args); + Fancy_String *result = push_fancy_stringfv(arena, 0, fore, fancy_pass_through(), format, args); va_end(args); return(result); } @@ -191,7 +191,7 @@ static Fancy_String* push_fancy_stringf(Arena *arena, char *format, ...){ va_list args; va_start(args, format); - Fancy_String *result = push_fancy_stringfv(arena, 0, pass_through_fancy_color(), pass_through_fancy_color(), format, args); + Fancy_String *result = push_fancy_stringfv(arena, 0, fancy_pass_through(), fancy_pass_through(), format, args); va_end(args); return(result); } diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index 07ab44c0..6640c368 100644 --- a/4coder_generated/command_metadata.h +++ b/4coder_generated/command_metadata.h @@ -260,8 +260,8 @@ static Command_Metadata fcoder_metacmd_table[234] = { { PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 640 }, { PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 619 }, { PROC_LINKS(backspace_char, 0), "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 101 }, -{ PROC_LINKS(backspace_word, 0), "backspace_word", 14, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1257 }, -{ PROC_LINKS(basic_change_active_panel, 0), "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 506 }, +{ PROC_LINKS(backspace_word, 0), "backspace_word", 14, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1212 }, +{ PROC_LINKS(basic_change_active_panel, 0), "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 510 }, { PROC_LINKS(build_in_build_panel, 0), "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 187 }, { PROC_LINKS(build_search, 0), "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 155 }, { PROC_LINKS(center_view, 0), "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 151 }, @@ -275,29 +275,29 @@ static Command_Metadata fcoder_metacmd_table[234] = { { PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 240 }, { PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1060 }, { PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 203 }, -{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 514 }, +{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 518 }, { PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 1000 }, { PROC_LINKS(comment_line, 0), "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 135 }, { PROC_LINKS(comment_line_toggle, 0), "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 159 }, { 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, 26 }, { PROC_LINKS(cursor_mark_swap, 0), "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 129 }, { 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, 35 }, -{ PROC_LINKS(decrease_face_size, 0), "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 609 }, -{ PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 586 }, +{ PROC_LINKS(decrease_face_size, 0), "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 613 }, +{ PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 590 }, { PROC_LINKS(delete_char, 0), "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 83 }, { PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 515 }, -{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1178 }, -{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1430 }, +{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1191 }, +{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1444 }, { PROC_LINKS(delete_range, 0), "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 139 }, -{ PROC_LINKS(delete_word, 0), "delete_word", 11, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1263 }, -{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1408 }, -{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 662 }, -{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 670 }, +{ PROC_LINKS(delete_word, 0), "delete_word", 11, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1218 }, +{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1421 }, +{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 666 }, +{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 674 }, { PROC_LINKS(execute_any_cli, 0), "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "w:\\4ed\\code\\4coder_system_command.cpp", 37, 23 }, { PROC_LINKS(execute_previous_cli, 0), "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "w:\\4ed\\code\\4coder_system_command.cpp", 37, 7 }, -{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 678 }, -{ PROC_LINKS(goto_beginning_of_file, 0), "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1176 }, -{ PROC_LINKS(goto_end_of_file, 0), "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1184 }, +{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 682 }, +{ PROC_LINKS(goto_beginning_of_file, 0), "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1131 }, +{ PROC_LINKS(goto_end_of_file, 0), "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1139 }, { 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, 84 }, { 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, 547 }, { 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, 529 }, @@ -305,7 +305,7 @@ static Command_Metadata fcoder_metacmd_table[234] = { { PROC_LINKS(goto_jump_at_cursor_same_panel_direct, 0), "goto_jump_at_cursor_same_panel_direct", 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..", 168, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 29 }, { 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, 373 }, { 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, 345 }, -{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 686 }, +{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 690 }, { PROC_LINKS(goto_next_jump_direct, 0), "goto_next_jump_direct", 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_direct.cpp", 34, 48 }, { PROC_LINKS(goto_next_jump_no_skips_direct, 0), "goto_next_jump_no_skips_direct", 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_direct.cpp", 34, 66 }, { 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, 498 }, @@ -314,17 +314,17 @@ static Command_Metadata fcoder_metacmd_table[234] = { { PROC_LINKS(goto_prev_jump_no_skips_direct, 0), "goto_prev_jump_no_skips_direct", 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_direct.cpp", 34, 75 }, { 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, 514 }, { 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, 484 }, -{ PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 544 }, -{ PROC_LINKS(hide_scrollbar, 0), "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 530 }, +{ PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 548 }, +{ PROC_LINKS(hide_scrollbar, 0), "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 534 }, { PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 79 }, -{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 597 }, -{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 575 }, +{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 601 }, +{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 579 }, { PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 776 }, { PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 886 }, { PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 918 }, { PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 848 }, { PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 757 }, -{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1600 }, +{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1625 }, { PROC_LINKS(kill_rect, 0), "kill_rect", 9, "Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.", 93, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 26 }, { PROC_LINKS(left_adjust_view, 0), "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 167 }, { PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 332 }, @@ -359,21 +359,21 @@ static Command_Metadata fcoder_metacmd_table[234] = { { PROC_LINKS(lister__write_character__file_path, 0), "lister__write_character__file_path", 34, "A lister mode command that inserts a character into the text field of a file system list.", 89, "w:\\4ed\\code\\4coder_lists.cpp", 28, 192 }, { PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 256 }, { PROC_LINKS(load_project, 0), "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1083 }, -{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1288 }, +{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1301 }, { PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 110 }, { PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 383 }, { PROC_LINKS(miblo_decrement_time_stamp_minute, 0), "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 395 }, { PROC_LINKS(miblo_increment_basic, 0), "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 94 }, { PROC_LINKS(miblo_increment_time_stamp, 0), "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 377 }, { PROC_LINKS(miblo_increment_time_stamp_minute, 0), "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 389 }, -{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 621 }, +{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 625 }, { PROC_LINKS(mouse_wheel_scroll, 0), "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 254 }, { PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 320 }, { PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 332 }, { PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 338 }, { PROC_LINKS(move_left, 0), "move_left", 9, "Moves the cursor one character to the left.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 369 }, -{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1385 }, -{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1321 }, +{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1398 }, +{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1334 }, { PROC_LINKS(move_right, 0), "move_right", 10, "Moves the cursor one character to the right.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 379 }, { PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 314 }, { PROC_LINKS(move_up_10, 0), "move_up_10", 10, "Moves the cursor up ten lines.", 30, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 326 }, @@ -384,12 +384,12 @@ static Command_Metadata fcoder_metacmd_table[234] = { { 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, 570 }, { PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1067 }, { PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1074 }, -{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1507 }, -{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1890 }, +{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1525 }, +{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1915 }, { PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 55 }, { PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 71 }, { PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 63 }, -{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1543 }, +{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1568 }, { PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 263 }, { PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 254 }, { PROC_LINKS(page_down, 0), "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 358 }, @@ -402,43 +402,43 @@ static Command_Metadata fcoder_metacmd_table[234] = { { PROC_LINKS(project_command_lister, 0), "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1527 }, { PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1090 }, { PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1113 }, -{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1062 }, -{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1086 }, -{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1104 }, -{ PROC_LINKS(redo, 0), "redo", 4, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1783 }, -{ PROC_LINKS(redo_this_buffer, 0), "redo_this_buffer", 16, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1691 }, +{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1074 }, +{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1098 }, +{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1117 }, +{ PROC_LINKS(redo, 0), "redo", 4, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1808 }, +{ PROC_LINKS(redo_this_buffer, 0), "redo_this_buffer", 16, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1716 }, { PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 382 }, -{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1244 }, +{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1257 }, { PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 383 }, -{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1615 }, +{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1640 }, { PROC_LINKS(replace_all_occurrences, 0), "replace_all_occurrences", 23, "Queries the user for two strings, and replaces all occurrences of the first string with the second string in all open buffers.", 126, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 780 }, -{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 941 }, -{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 912 }, -{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 930 }, -{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1607 }, -{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1148 }, -{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1204 }, -{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 750 }, -{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 905 }, -{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 919 }, -{ PROC_LINKS(seek_alphanumeric_left, 0), "seek_alphanumeric_left", 22, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1237 }, -{ PROC_LINKS(seek_alphanumeric_or_camel_left, 0), "seek_alphanumeric_or_camel_left", 31, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1249 }, -{ PROC_LINKS(seek_alphanumeric_or_camel_right, 0), "seek_alphanumeric_or_camel_right", 32, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1243 }, -{ PROC_LINKS(seek_alphanumeric_right, 0), "seek_alphanumeric_right", 23, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1231 }, -{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1130 }, -{ PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1110 }, -{ PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1142 }, -{ PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1120 }, -{ PROC_LINKS(seek_token_left, 0), "seek_token_left", 15, "Seek left for the next beginning of a token.", 44, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1213 }, -{ PROC_LINKS(seek_token_right, 0), "seek_token_right", 16, "Seek right for the next end of a token.", 39, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1207 }, -{ PROC_LINKS(seek_white_or_token_left, 0), "seek_white_or_token_left", 24, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1225 }, -{ PROC_LINKS(seek_white_or_token_right, 0), "seek_white_or_token_right", 25, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1219 }, -{ PROC_LINKS(seek_whitespace_down, 0), "seek_whitespace_down", 20, "Seeks the cursor down to the next blank line.", 45, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1100 }, -{ PROC_LINKS(seek_whitespace_down_end_line, 0), "seek_whitespace_down_end_line", 29, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1165 }, -{ PROC_LINKS(seek_whitespace_left, 0), "seek_whitespace_left", 20, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1201 }, -{ PROC_LINKS(seek_whitespace_right, 0), "seek_whitespace_right", 21, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1195 }, -{ PROC_LINKS(seek_whitespace_up, 0), "seek_whitespace_up", 18, "Seeks the cursor up to the next blank line.", 43, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1090 }, -{ PROC_LINKS(seek_whitespace_up_end_line, 0), "seek_whitespace_up_end_line", 27, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1154 }, +{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 948 }, +{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 919 }, +{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 937 }, +{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1632 }, +{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1161 }, +{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1217 }, +{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 751 }, +{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 912 }, +{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 926 }, +{ PROC_LINKS(seek_alphanumeric_left, 0), "seek_alphanumeric_left", 22, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1192 }, +{ PROC_LINKS(seek_alphanumeric_or_camel_left, 0), "seek_alphanumeric_or_camel_left", 31, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1204 }, +{ PROC_LINKS(seek_alphanumeric_or_camel_right, 0), "seek_alphanumeric_or_camel_right", 32, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1198 }, +{ PROC_LINKS(seek_alphanumeric_right, 0), "seek_alphanumeric_right", 23, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1186 }, +{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1083 }, +{ PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1061 }, +{ PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1095 }, +{ PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1072 }, +{ PROC_LINKS(seek_token_left, 0), "seek_token_left", 15, "Seek left for the next beginning of a token.", 44, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1168 }, +{ PROC_LINKS(seek_token_right, 0), "seek_token_right", 16, "Seek right for the next end of a token.", 39, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1162 }, +{ PROC_LINKS(seek_white_or_token_left, 0), "seek_white_or_token_left", 24, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1180 }, +{ PROC_LINKS(seek_white_or_token_right, 0), "seek_white_or_token_right", 25, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1174 }, +{ PROC_LINKS(seek_whitespace_down, 0), "seek_whitespace_down", 20, "Seeks the cursor down to the next blank line.", 45, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1050 }, +{ PROC_LINKS(seek_whitespace_down_end_line, 0), "seek_whitespace_down_end_line", 29, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1119 }, +{ PROC_LINKS(seek_whitespace_left, 0), "seek_whitespace_left", 20, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1156 }, +{ PROC_LINKS(seek_whitespace_right, 0), "seek_whitespace_right", 21, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1150 }, +{ PROC_LINKS(seek_whitespace_up, 0), "seek_whitespace_up", 18, "Seeks the cursor up to the next blank line.", 43, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1039 }, +{ PROC_LINKS(seek_whitespace_up_end_line, 0), "seek_whitespace_up_end_line", 27, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1107 }, { PROC_LINKS(select_all, 0), "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 389 }, { PROC_LINKS(select_next_scope_absolute, 0), "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 390 }, { PROC_LINKS(select_prev_scope_absolute, 0), "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 410 }, @@ -453,31 +453,31 @@ static Command_Metadata fcoder_metacmd_table[234] = { { PROC_LINKS(setup_build_bat_and_sh, 0), "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1510 }, { PROC_LINKS(setup_build_sh, 0), "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1504 }, { PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1491 }, -{ PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 537 }, -{ PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 523 }, -{ PROC_LINKS(snipe_token_or_word, 0), "snipe_token_or_word", 19, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1269 }, -{ PROC_LINKS(snipe_token_or_word_right, 0), "snipe_token_or_word_right", 25, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1275 }, +{ PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 541 }, +{ PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 527 }, +{ PROC_LINKS(snipe_token_or_word, 0), "snipe_token_or_word", 19, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1224 }, +{ PROC_LINKS(snipe_token_or_word_right, 0), "snipe_token_or_word_right", 25, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1230 }, { PROC_LINKS(snippet_lister, 0), "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 248 }, { PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 326 }, -{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1567 }, +{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1592 }, { PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 421 }, { PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 401 }, -{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 551 }, -{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 569 }, +{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 555 }, +{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 573 }, { PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 374 }, { PROC_LINKS(toggle_highlight_enclosing_scopes, 0), "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 362 }, { PROC_LINKS(toggle_highlight_line_at_cursor, 0), "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 356 }, -{ PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 656 }, -{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 560 }, +{ PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 660 }, +{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 564 }, { PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 338 }, { PROC_LINKS(toggle_paren_matching_helper, 0), "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 368 }, -{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 649 }, -{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 638 }, +{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 653 }, +{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 642 }, { PROC_LINKS(uncomment_line, 0), "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 147 }, -{ PROC_LINKS(undo, 0), "undo", 4, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1707 }, -{ PROC_LINKS(undo_this_buffer, 0), "undo_this_buffer", 16, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1677 }, -{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1557 }, -{ 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, 108 }, +{ PROC_LINKS(undo, 0), "undo", 4, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1732 }, +{ PROC_LINKS(undo_this_buffer, 0), "undo_this_buffer", 16, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1702 }, +{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1582 }, +{ 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, 106 }, { PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\4coder_search.cpp", 29, 958 }, { PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 652 }, { PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 103 }, diff --git a/4coder_helper.cpp b/4coder_helper.cpp index be7064a9..5602a7ae 100644 --- a/4coder_helper.cpp +++ b/4coder_helper.cpp @@ -424,11 +424,12 @@ query_user_number(Application_Links *app, Query_Bar *bar){ } static char -buffer_get_char(Application_Links *app, Buffer_Summary *buffer, i32 pos){ +buffer_get_char(Application_Links *app, Buffer_ID buffer_id, i32 pos){ + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); char result = ' '; - *buffer = get_buffer(app, buffer->buffer_id, AccessAll); - if (pos < buffer->size){ - buffer_read_range(app, buffer, pos, pos + 1, &result); + if (pos < buffer_size){ + buffer_read_range(app, buffer_id, pos, pos + 1, &result); } return(result); } @@ -737,30 +738,30 @@ get_view_range(View_Summary *view){ } static b32 -read_line(Application_Links *app, Partition *part, Buffer_Summary *buffer, i32 line, String *str, +read_line(Application_Links *app, Partition *part, Buffer_ID buffer_id, i32 line, String *str, Partial_Cursor *start_out, Partial_Cursor *one_past_last_out){ Partial_Cursor begin = {}; Partial_Cursor end = {}; b32 success = false; - if (buffer_compute_cursor(app, buffer, seek_line_char(line, 1), &begin)){ - if (buffer_compute_cursor(app, buffer, seek_line_char(line, -1), &end)){ - if (begin.line == line){ - if (0 <= begin.pos && begin.pos <= end.pos && end.pos <= buffer->size){ - i32 size = (end.pos - begin.pos); - i32 alloc_size = size + 1; - char *memory = push_array(part, char, alloc_size); - if (memory != 0){ - *str = make_string(memory, 0, alloc_size); - buffer_read_range(app, buffer, begin.pos, end.pos, str->str); - str->size = size; - terminate_with_null(str); - - *start_out = begin; - *one_past_last_out = end; - success = true; - } - } + if (buffer_compute_cursor(app, buffer_id, seek_line_char(line, 1), &begin) && + buffer_compute_cursor(app, buffer_id, seek_line_char(line, -1), &end) && + begin.line == line){ + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); + if (0 <= begin.pos && begin.pos <= end.pos && end.pos <= buffer_size){ + i32 size = (end.pos - begin.pos); + i32 alloc_size = size + 1; + char *memory = push_array(part, char, alloc_size); + if (memory != 0){ + *str = make_string(memory, 0, alloc_size); + buffer_read_range(app, buffer_id, begin.pos, end.pos, str->str); + str->size = size; + terminate_with_null(str); + + *start_out = begin; + *one_past_last_out = end; + success = true; } } } @@ -769,9 +770,9 @@ read_line(Application_Links *app, Partition *part, Buffer_Summary *buffer, i32 l } static b32 -read_line(Application_Links *app, Partition *part, Buffer_Summary *buffer, i32 line, String *str){ +read_line(Application_Links *app, Partition *part, Buffer_ID buffer_id, i32 line, String *str){ Partial_Cursor ignore = {}; - return(read_line(app, part, buffer, line, str, &ignore, &ignore)); + return(read_line(app, part, buffer_id, line, str, &ignore, &ignore)); } static String @@ -794,22 +795,28 @@ scratch_read(Application_Links *app, Partition *scratch, Buffer_ID buffer, Cpp_T } static i32 -buffer_get_line_start(Application_Links *app, Buffer_Summary *buffer, i32 line){ - i32 result = buffer->size; - if (line <= buffer->line_count){ +buffer_get_line_start(Application_Links *app, Buffer_ID buffer_id, i32 line){ + i32 result = 0; + buffer_get_size(app, buffer_id, &result); + i32 line_count = 0; + buffer_get_line_count(app, buffer_id, &line_count); + if (line <= line_count){ Partial_Cursor partial_cursor = {}; - buffer_compute_cursor(app, buffer, seek_line_char(line, 1), &partial_cursor); + buffer_compute_cursor(app, buffer_id, seek_line_char(line, 1), &partial_cursor); result = partial_cursor.pos; } return(result); } static i32 -buffer_get_line_end(Application_Links *app, Buffer_Summary *buffer, i32 line){ - i32 result = buffer->size; - if (line <= buffer->line_count){ +buffer_get_line_end(Application_Links *app, Buffer_ID buffer_id, i32 line){ + i32 result = 0; + buffer_get_size(app, buffer_id, &result); + i32 line_count = 0; + buffer_get_line_count(app, buffer_id, &line_count); + if (line <= line_count){ Partial_Cursor partial_cursor = {}; - buffer_compute_cursor(app, buffer, seek_line_char(line, -1), &partial_cursor); + buffer_compute_cursor(app, buffer_id, seek_line_char(line, -1), &partial_cursor); result = partial_cursor.pos; } return(result); @@ -823,44 +830,41 @@ buffer_get_line_number(Application_Links *app, Buffer_Summary *buffer, i32 pos){ } static Cpp_Token* -get_first_token_at_line(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Array tokens, i32 line, i32 *line_start_out = 0){ - i32 line_start = buffer_get_line_start(app, buffer, line); +get_first_token_at_line(Application_Links *app, Buffer_ID buffer_id, Cpp_Token_Array tokens, i32 line, i32 *line_start_out = 0){ + i32 line_start = buffer_get_line_start(app, buffer_id, line); Cpp_Get_Token_Result get_token = cpp_get_token(tokens, line_start); - if (get_token.in_whitespace_after_token){ get_token.token_index += 1; } - if (line_start_out){ *line_start_out = line_start; } - Cpp_Token *result = 0; if (get_token.token_index < tokens.count){ result = &tokens.tokens[get_token.token_index]; } - return(result); } //////////////////////////////// static b32 -init_stream_chunk(Stream_Chunk *chunk, Application_Links *app, Buffer_Summary *buffer, +init_stream_chunk(Stream_Chunk *chunk, Application_Links *app, Buffer_ID buffer_id, i32 pos, char *data, u32 size){ b32 result = false; - refresh_buffer(app, buffer); - if (0 <= pos && pos < buffer->size && size > 0){ + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); + if (0 <= pos && pos < buffer_size && size > 0){ chunk->app = app; - chunk->buffer = buffer; + chunk->buffer_id = buffer_id; chunk->base_data = data; chunk->data_size = size; chunk->start = round_down(pos, size); chunk->end = round_up(pos, size); - if (chunk->max_end > buffer->size || chunk->max_end == 0){ - chunk->max_end = buffer->size; + if (chunk->max_end > buffer_size || chunk->max_end == 0){ + chunk->max_end = buffer_size; } if (chunk->max_end && chunk->max_end < chunk->end){ @@ -871,7 +875,7 @@ init_stream_chunk(Stream_Chunk *chunk, Application_Links *app, Buffer_Summary *b } if (chunk->start < chunk->end){ - buffer_read_range(app, buffer, chunk->start, chunk->end, chunk->base_data); + buffer_read_range(app, buffer_id, chunk->start, chunk->end, chunk->base_data); chunk->data = chunk->base_data - chunk->start; result = true; } @@ -883,11 +887,12 @@ init_stream_chunk(Stream_Chunk *chunk, Application_Links *app, Buffer_Summary *b static b32 forward_stream_chunk(Stream_Chunk *chunk){ Application_Links *app = chunk->app; - Buffer_Summary *buffer = chunk->buffer; + Buffer_ID buffer_id = chunk->buffer_id; b32 result = 0; - refresh_buffer(app, buffer); - if (chunk->end < buffer->size){ + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); + if (chunk->end < buffer_size){ chunk->start = chunk->end; chunk->end += chunk->data_size; @@ -899,15 +904,15 @@ forward_stream_chunk(Stream_Chunk *chunk){ } if (chunk->start < chunk->end){ - buffer_read_range(app, buffer, chunk->start, chunk->end, chunk->base_data); + buffer_read_range(app, buffer_id, chunk->start, chunk->end, chunk->base_data); chunk->data = chunk->base_data - chunk->start; result = 1; } } - else if (chunk->add_null && chunk->end + 1 < buffer->size){ - chunk->start = buffer->size; - chunk->end = buffer->size + 1; + else if (chunk->add_null && chunk->end + 1 < buffer_size){ + chunk->start = buffer_size; + chunk->end = buffer_size + 1; chunk->base_data[0] = 0; chunk->data = chunk->base_data - chunk->start; result = 1; @@ -919,10 +924,9 @@ forward_stream_chunk(Stream_Chunk *chunk){ static b32 backward_stream_chunk(Stream_Chunk *chunk){ Application_Links *app = chunk->app; - Buffer_Summary *buffer = chunk->buffer; - b32 result = 0; + Buffer_ID buffer_id = chunk->buffer_id; + b32 result = false; - refresh_buffer(app, buffer); if (chunk->start > 0){ chunk->end = chunk->start; chunk->start -= chunk->data_size; @@ -935,9 +939,9 @@ backward_stream_chunk(Stream_Chunk *chunk){ } if (chunk->start < chunk->end){ - buffer_read_range(app, buffer, chunk->start, chunk->end, chunk->base_data); + buffer_read_range(app, buffer_id, chunk->start, chunk->end, chunk->base_data); chunk->data = chunk->base_data - chunk->start; - result = 1; + result = true; } } @@ -946,7 +950,7 @@ backward_stream_chunk(Stream_Chunk *chunk){ chunk->end = 0; chunk->base_data[0] = 0; chunk->data = chunk->base_data - chunk->start; - result = 1; + result = true; } return(result); @@ -955,16 +959,14 @@ backward_stream_chunk(Stream_Chunk *chunk){ //////////////////////////////// static b32 -init_stream_tokens(Stream_Tokens_DEP *stream, Application_Links *app, Buffer_Summary *buffer, - i32 pos, Cpp_Token *data, i32 count){ +init_stream_tokens(Stream_Tokens_DEP *stream, Application_Links *app, Buffer_ID buffer_id, i32 pos, Cpp_Token *data, i32 count){ b32 result = false; - refresh_buffer(app, buffer); - - i32 token_count = buffer_token_count(app, buffer); - if (buffer->tokens_are_ready && pos >= 0 && pos < token_count && count > 0){ + i32 token_count = 0; + buffer_token_count(app, buffer_id, &token_count); + if (buffer_tokens_are_ready(app, buffer_id) && pos >= 0 && pos < token_count && count > 0){ stream->app = app; - stream->buffer = buffer; + stream->buffer_id = buffer_id; stream->base_tokens = data; stream->count = count; stream->start = round_down(pos, count); @@ -978,7 +980,7 @@ init_stream_tokens(Stream_Tokens_DEP *stream, Application_Links *app, Buffer_Sum stream->end = stream->token_count; } - buffer_read_tokens(app, buffer, stream->start, stream->end, stream->base_tokens); + buffer_read_tokens(app, buffer_id, stream->start, stream->end, stream->base_tokens); stream->tokens = stream->base_tokens - stream->start; result = true; } @@ -995,7 +997,7 @@ static void end_temp_stream_token(Stream_Tokens_DEP *stream, Stream_Tokens_DEP temp){ if (stream->start != temp.start || stream->end != temp.end){ Application_Links *app = stream->app; - buffer_read_tokens(app, temp.buffer, temp.start, temp.end, temp.base_tokens); + buffer_read_tokens(app, temp.buffer_id, temp.start, temp.end, temp.base_tokens); stream->tokens = stream->base_tokens - temp.start; stream->start = temp.start; stream->end = temp.end; @@ -1005,50 +1007,40 @@ end_temp_stream_token(Stream_Tokens_DEP *stream, Stream_Tokens_DEP temp){ static b32 forward_stream_tokens(Stream_Tokens_DEP *stream){ Application_Links *app = stream->app; - Buffer_Summary *buffer = stream->buffer; + Buffer_ID buffer_id = stream->buffer_id; b32 result = false; - - refresh_buffer(app, buffer); if (stream->end < stream->token_count){ stream->start = stream->end; stream->end += stream->count; - if (stream->end > stream->token_count){ stream->end = stream->token_count; } - if (stream->start < stream->end){ - buffer_read_tokens(app, buffer, stream->start, stream->end, stream->base_tokens); + buffer_read_tokens(app, buffer_id, stream->start, stream->end, stream->base_tokens); stream->tokens = stream->base_tokens - stream->start; result = true; } } - return(result); } static b32 backward_stream_tokens(Stream_Tokens_DEP *stream){ Application_Links *app = stream->app; - Buffer_Summary *buffer = stream->buffer; + Buffer_ID buffer_id = stream->buffer_id; b32 result = false; - - refresh_buffer(app, buffer); if (stream->start > 0){ stream->end = stream->start; stream->start -= stream->count; - if (0 > stream->start){ stream->start = 0; } - if (stream->start < stream->end){ - buffer_read_tokens(app, buffer, stream->start, stream->end, stream->base_tokens); + buffer_read_tokens(app, buffer_id, stream->start, stream->end, stream->base_tokens); stream->tokens = stream->base_tokens - stream->start; result = true; } } - return(result); } diff --git a/4coder_helper.h b/4coder_helper.h index d1bc24da..29a76690 100644 --- a/4coder_helper.h +++ b/4coder_helper.h @@ -59,7 +59,7 @@ struct Buffer_Rect{ struct Stream_Chunk{ Application_Links *app; - Buffer_Summary *buffer; + Buffer_ID buffer_id; char *base_data; i32 start; @@ -77,7 +77,7 @@ struct Stream_Chunk{ // If you want to keep your code working easily uncomment the typedef for Stream_Tokens. struct Stream_Tokens_DEP{ Application_Links *app; - Buffer_Summary *buffer; + Buffer_ID buffer_id; Cpp_Token *base_tokens; Cpp_Token *tokens; diff --git a/4coder_jump_lister.cpp b/4coder_jump_lister.cpp index 7f1e138f..d8962195 100644 --- a/4coder_jump_lister.cpp +++ b/4coder_jump_lister.cpp @@ -68,8 +68,6 @@ open_jump_lister(Application_Links *app, Partition *scratch, Heap *heap, Marker_List *list = get_or_make_list_for_buffer(app, scratch, heap, list_buffer_id); if (list != 0){ - Buffer_Summary list_buffer = get_buffer(app, list_buffer_id, AccessAll); - i32 estimated_string_space_size = 0; view_end_ui_mode(app, ui_view); Temp_Memory temp = begin_temp_memory(scratch); @@ -80,7 +78,7 @@ open_jump_lister(Application_Links *app, Partition *scratch, Heap *heap, Sticky_Jump_Stored stored = {}; managed_object_load_data(app, stored_jumps, i, 1, &stored); String line = {}; - read_line(app, scratch, &list_buffer, stored.list_line, &line); + read_line(app, scratch, list_buffer_id, stored.list_line, &line); options[i].string = line; memset(&options[i].status, 0, sizeof(options[i].status)); options[i].user_data = IntAsPtr(i); diff --git a/4coder_jump_sticky.cpp b/4coder_jump_sticky.cpp index 19328cef..cf273615 100644 --- a/4coder_jump_sticky.cpp +++ b/4coder_jump_sticky.cpp @@ -52,7 +52,7 @@ parse_buffer_to_jump_array(Application_Links *app, Partition *arena, Buffer_Summ Temp_Memory temp = begin_temp_memory(arena); String line_str = {}; - if (read_line(app, arena, &buffer, line, &line_str)){ + if (read_line(app, arena, buffer.buffer_id, line, &line_str)){ Name_Line_Column_Location location = {}; if (parse_jump_location(line_str, &location, &colon_index, &is_sub_error)){ Buffer_Summary jump_buffer = {}; diff --git a/4coder_jumping.cpp b/4coder_jumping.cpp index 6adbca3d..c4aacc89 100644 --- a/4coder_jumping.cpp +++ b/4coder_jumping.cpp @@ -207,8 +207,7 @@ parse_jump_from_buffer_line(Application_Links *app, Partition *arena, b32 skip_sub_errors, Name_Line_Column_Location *location){ i32 result = false; String line_str = {}; - Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll); - if (read_line(app, arena, &buffer, line, &line_str)){ + if (read_line(app, arena, buffer_id, line, &line_str)){ i32 colon_char = 0; if (parse_jump_location(line_str, skip_sub_errors, location, &colon_char)){ result = true; @@ -278,15 +277,12 @@ seek_next_jump_in_buffer(Application_Links *app, Partition *part, i32 buffer_id, i32 first_line, b32 skip_sub_errors, i32 direction, i32 *line_out, i32 *colon_index_out, Name_Line_Column_Location *location_out){ - Assert(direction == 1 || direction == -1); - b32 result = false; i32 line = first_line; String line_str = {}; - Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll); for (;;){ - if (read_line(app, part, &buffer, line, &line_str)){ + if (read_line(app, part, buffer_id, line, &line_str)){ if (parse_jump_location(line_str, skip_sub_errors, location_out, colon_index_out)){ result = true; break; @@ -297,13 +293,10 @@ seek_next_jump_in_buffer(Application_Links *app, Partition *part, break; } } - if (line < 0){ line = 0; } - *line_out = line; - return(result); } @@ -311,13 +304,11 @@ static ID_Line_Column_Jump_Location convert_name_based_to_id_based(Application_Links *app, Name_Line_Column_Location loc){ ID_Line_Column_Jump_Location result = {}; Buffer_Summary buffer = get_buffer_by_name(app, loc.file.str, loc.file.size, AccessAll); - if (buffer.exists){ result.buffer_id = buffer.buffer_id; result.line = loc.line; result.column = loc.column; } - return(result); } diff --git a/4coder_scope_commands.cpp b/4coder_scope_commands.cpp index 84fcfd42..32358541 100644 --- a/4coder_scope_commands.cpp +++ b/4coder_scope_commands.cpp @@ -435,10 +435,10 @@ place_begin_and_end_on_own_lines(Application_Links *app, Partition *scratch, cha Range range = get_view_range(&view); lines.min = buffer_get_line_number(app, &buffer, range.min); lines.max = buffer_get_line_number(app, &buffer, range.max); - range.min = buffer_get_line_start(app, &buffer, lines.min); - range.max = buffer_get_line_end(app, &buffer, lines.max); + range.min = buffer_get_line_start(app, buffer.buffer_id, lines.min); + range.max = buffer_get_line_end(app, buffer.buffer_id, lines.max); - b32 do_full = (lines.min < lines.max) || (!buffer_line_is_blank(app, &buffer, lines.min)); + b32 do_full = (lines.min < lines.max) || (!buffer_line_is_blank(app, buffer.buffer_id, lines.min)); Temp_Memory temp = begin_temp_memory(scratch); i32 begin_len = str_size(begin); @@ -458,13 +458,13 @@ place_begin_and_end_on_own_lines(Application_Links *app, Partition *scratch, cha i32 min_adjustment = 0; i32 max_adjustment = 4; - if (buffer_line_is_blank(app, &buffer, lines.min)){ + if (buffer_line_is_blank(app, buffer.buffer_id, lines.min)){ memmove(str + 1, str, begin_len); str[0] = '\n'; ++min_adjustment; } - if (buffer_line_is_blank(app, &buffer, lines.max)){ + if (buffer_line_is_blank(app, buffer.buffer_id, lines.max)){ memmove(str + begin_len + 1, str + begin_len + 2, end_len); str[begin_len + end_len + 1] = '\n'; --max_adjustment; @@ -528,26 +528,27 @@ CUSTOM_DOC("Deletes the braces surrounding the currently selected scope. Leaves bottom = x; } - if (buffer_get_char(app, &buffer, top) == '{' && buffer_get_char(app, &buffer, bottom-1) == '}'){ + if (buffer_get_char(app, buffer.buffer_id, top) == '{' && + buffer_get_char(app, buffer.buffer_id, bottom - 1) == '}'){ i32 top_len = 1; i32 bottom_len = 1; - if (buffer_get_char(app, &buffer, top-1) == '\n'){ + if (buffer_get_char(app, buffer.buffer_id, top - 1) == '\n'){ top_len = 2; } - if (buffer_get_char(app, &buffer, bottom+1) == '\n'){ + if (buffer_get_char(app, buffer.buffer_id, bottom + 1) == '\n'){ bottom_len = 2; } Buffer_Edit edits[2]; edits[0].str_start = 0; edits[0].len = 0; - edits[0].start = top+1 - top_len; - edits[0].end = top+1; + edits[0].start = top + 1 - top_len; + edits[0].end = top + 1; edits[1].str_start = 0; edits[1].len = 0; - edits[1].start = bottom-1; - edits[1].end = bottom-1 + bottom_len; + edits[1].start = bottom - 1; + edits[1].end = bottom - 1 + bottom_len; buffer_batch_edit(app, &buffer, 0, 0, edits, 2, BatchEdit_Normal); } @@ -766,7 +767,8 @@ CUSTOM_DOC("If a scope is currently selected, and a statement or block statement Partition *part = &global_part; Temp_Memory temp = begin_temp_memory(part); - if (buffer_get_char(app, &buffer, top) == '{' && buffer_get_char(app, &buffer, bottom-1) == '}'){ + if (buffer_get_char(app, buffer.buffer_id, top) == '{' && + buffer_get_char(app, buffer.buffer_id, bottom-1) == '}'){ Range range = {}; if (find_whole_statement_down(app, &buffer, bottom, &range.start, &range.end)){ char *string_space = push_array(part, char, range.end - range.start); diff --git a/4coder_search.cpp b/4coder_search.cpp index b972b22a..46276b2b 100644 --- a/4coder_search.cpp +++ b/4coder_search.cpp @@ -178,7 +178,7 @@ seek_potential_match(Application_Links *app, Search_Range *range, Search_Key key for (int32_t i = 0; i < key.count; ++i){ String word = key.words[i]; int32_t new_pos = -1; - buffer_seek_string(app, &result->buffer, start_pos, end_pos, range->start, word.str, word.size, &new_pos, flags); + buffer_seek_string(app, result->buffer.buffer_id, start_pos, end_pos, range->start, word.str, word.size, &new_pos, flags); if (new_pos >= 0){ if (forward){ @@ -201,7 +201,7 @@ static int32_t buffer_seek_alpha_numeric_end(Application_Links *app, Buffer_Summary *buffer, int32_t pos){ char space[1024]; Stream_Chunk chunk = {}; - if (init_stream_chunk(&chunk, app, buffer, pos, space, sizeof(space))){ + if (init_stream_chunk(&chunk, app, buffer->buffer_id, pos, space, sizeof(space))){ int32_t still_looping = true; do{ for (; pos < chunk.end; ++pos){ @@ -234,7 +234,7 @@ match_check(Application_Links *app, Search_Range *range, int32_t *pos, Search_Ma { char prev = ' '; if (char_is_alpha_numeric_utf8(word.str[0])){ - prev = buffer_get_char(app, &result.buffer, result.start - 1); + prev = buffer_get_char(app, result.buffer.buffer_id, result.start - 1); } if (!char_is_alpha_numeric_utf8(prev)){ @@ -242,7 +242,7 @@ match_check(Application_Links *app, Search_Range *range, int32_t *pos, Search_Ma if (result.end <= end_pos){ char next = ' '; if (char_is_alpha_numeric_utf8(word.str[word.size-1])){ - next = buffer_get_char(app, &result.buffer, result.end); + next = buffer_get_char(app, result.buffer.buffer_id, result.end); } if (!char_is_alpha_numeric_utf8(next)){ @@ -258,7 +258,7 @@ match_check(Application_Links *app, Search_Range *range, int32_t *pos, Search_Ma case SearchFlag_MatchWordPrefix: { - char prev = buffer_get_char(app, &result.buffer, result.start - 1); + char prev = buffer_get_char(app, result.buffer.buffer_id, result.start - 1); if (!char_is_alpha_numeric_utf8(prev)){ result.end = buffer_seek_alpha_numeric_end(app, &result.buffer, result.start); @@ -697,7 +697,7 @@ list__parameters_buffer(Application_Links *app, Heap *heap, Partition *scratch, Partial_Cursor line_start_cursor = {}; Partial_Cursor line_one_past_last_cursor = {}; String full_line_str = {}; - if (read_line(app, &line_part, &match.buffer, word_pos.line, &full_line_str, &line_start_cursor, &line_one_past_last_cursor)){ + if (read_line(app, &line_part, match.buffer.buffer_id, word_pos.line, &full_line_str, &line_start_cursor, &line_one_past_last_cursor)){ int32_t source_full_line_start = line_start_cursor.pos; String line_str = skip_chop_whitespace(full_line_str); int32_t source_line_start = source_full_line_start + (int32_t)(line_str.str - full_line_str.str); @@ -992,7 +992,7 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with char space[1024]; Stream_Chunk chunk = {}; - if (init_stream_chunk(&chunk, app, &buffer, cursor_pos, space, sizeof(space))){ + if (init_stream_chunk(&chunk, app, buffer.buffer_id, cursor_pos, space, sizeof(space))){ int32_t still_looping = true; do{ for (; cursor_pos >= chunk.start; --cursor_pos){ diff --git a/4coder_seek.cpp b/4coder_seek.cpp index 20b780a2..52c849e0 100644 --- a/4coder_seek.cpp +++ b/4coder_seek.cpp @@ -5,19 +5,18 @@ // TOP static i32 -seek_line_end(Application_Links *app, Buffer_Summary *buffer, i32 pos){ +seek_line_end(Application_Links *app, Buffer_ID buffer_id, i32 pos){ + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); + char chunk[1024]; i32 chunk_size = sizeof(chunk); Stream_Chunk stream = {}; - - i32 still_looping; - char at_pos; - - if (init_stream_chunk(&stream, app, buffer, pos, chunk, chunk_size)){ - still_looping = 1; + if (init_stream_chunk(&stream, app, buffer_id, pos, chunk, chunk_size)){ + b32 still_looping = true; do{ for (; pos < stream.end; ++pos){ - at_pos = stream.data[pos]; + char at_pos = stream.data[pos]; if (at_pos == '\n'){ goto double_break; } @@ -25,30 +24,24 @@ seek_line_end(Application_Links *app, Buffer_Summary *buffer, i32 pos){ still_looping = forward_stream_chunk(&stream); }while(still_looping); double_break:; - - if (pos > buffer->size){ - pos = buffer->size; + if (pos > buffer_size){ + pos = buffer_size; } } - return(pos); } static i32 -seek_line_beginning(Application_Links *app, Buffer_Summary *buffer, i32 pos){ +seek_line_beginning(Application_Links *app, Buffer_ID buffer_id, i32 pos){ char chunk[1024]; i32 chunk_size = sizeof(chunk); Stream_Chunk stream = {}; - - i32 still_looping; - char at_pos; - --pos; - if (init_stream_chunk(&stream, app, buffer, pos, chunk, chunk_size)){ - still_looping = 1; + if (init_stream_chunk(&stream, app, buffer_id, pos, chunk, chunk_size)){ + b32 still_looping = true; do{ for (; pos >= stream.start; --pos){ - at_pos = stream.data[pos]; + char at_pos = stream.data[pos]; if (at_pos == '\n'){ goto double_break; } @@ -56,7 +49,6 @@ seek_line_beginning(Application_Links *app, Buffer_Summary *buffer, i32 pos){ still_looping = backward_stream_chunk(&stream); }while(still_looping); double_break:; - if (pos != 0){ ++pos; } @@ -64,21 +56,20 @@ seek_line_beginning(Application_Links *app, Buffer_Summary *buffer, i32 pos){ pos = 0; } } - return(pos); } static void -move_past_lead_whitespace(Application_Links *app, View_Summary *view, Buffer_Summary *buffer){ +move_past_lead_whitespace(Application_Links *app, View_Summary *view, Buffer_ID buffer_id){ refresh_view(app, view); - i32 new_pos = seek_line_beginning(app, buffer, view->cursor.pos); + i32 new_pos = seek_line_beginning(app, buffer_id, view->cursor.pos); char space[1024]; Stream_Chunk chunk = {}; i32 still_looping = false; i32 i = new_pos; - if (init_stream_chunk(&chunk, app, buffer, i, space, sizeof(space))){ + if (init_stream_chunk(&chunk, app, buffer_id, i, space, sizeof(space))){ do{ for (; i < chunk.end; ++i){ char at_pos = chunk.data[i]; @@ -97,21 +88,20 @@ move_past_lead_whitespace(Application_Links *app, View_Summary *view, Buffer_Sum } static i32 -buffer_seek_whitespace_up(Application_Links *app, Buffer_Summary *buffer, i32 pos){ +buffer_seek_whitespace_up(Application_Links *app, Buffer_ID buffer_id, i32 pos){ char chunk[1024]; i32 chunk_size = sizeof(chunk); Stream_Chunk stream = {}; - char at_pos; --pos; - if (init_stream_chunk(&stream, app, buffer, pos, chunk, chunk_size)){ + if (init_stream_chunk(&stream, app, buffer_id, pos, chunk, chunk_size)){ // Step 1: Find the first non-whitespace character // behind the current position. - i32 still_looping = 1; - while (still_looping){ + b32 still_looping = true; + for (;still_looping;){ for (; pos >= stream.start; --pos){ - at_pos = stream.data[pos]; + char at_pos = stream.data[pos]; if (!char_is_whitespace(at_pos)){ goto double_break_1; } @@ -126,9 +116,9 @@ buffer_seek_whitespace_up(Application_Links *app, Buffer_Summary *buffer, i32 po // non-whitespace character is discovered before // the next '\n' i32 no_hard = false; - while (still_looping){ + for (;still_looping;){ for (; pos >= stream.start; --pos){ - at_pos = stream.data[pos]; + char at_pos = stream.data[pos]; if (at_pos == '\n'){ if (no_hard){ goto double_break_2; @@ -154,12 +144,15 @@ buffer_seek_whitespace_up(Application_Links *app, Buffer_Summary *buffer, i32 po } static i32 -buffer_seek_whitespace_down(Application_Links *app, Buffer_Summary *buffer, i32 pos){ +buffer_seek_whitespace_down(Application_Links *app, Buffer_ID buffer_id, i32 pos){ + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); + char chunk[1024]; i32 chunk_size = sizeof(chunk); Stream_Chunk stream = {}; - if (init_stream_chunk(&stream, app, buffer, pos, chunk, chunk_size)){ + if (init_stream_chunk(&stream, app, buffer_id, pos, chunk, chunk_size)){ // step 1: find the first non-whitespace character // ahead of the current position. b32 still_looping = true; @@ -201,11 +194,11 @@ buffer_seek_whitespace_down(Application_Links *app, Buffer_Summary *buffer, i32 } double_break_2:; - if (prev_endline == -1 || prev_endline+1 >= buffer->size){ - pos = buffer->size; + if (prev_endline == -1 || prev_endline + 1 >= buffer_size){ + pos = buffer_size; } else{ - pos = prev_endline+1; + pos = prev_endline + 1; } } @@ -213,20 +206,21 @@ buffer_seek_whitespace_down(Application_Links *app, Buffer_Summary *buffer, i32 } static i32 -buffer_seek_whitespace_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){ - i32 result = buffer->size + 1; +buffer_seek_whitespace_right(Application_Links *app, Buffer_ID buffer_id, i32 pos){ + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); + i32 result = buffer_size + 1; if (pos < 0){ pos = 0; } pos += 1; - if (pos < buffer->size){ + if (pos < buffer_size){ char data_chunk[1024]; Stream_Chunk stream = {}; stream.add_null = true; - if (init_stream_chunk(&stream, app, buffer, pos, data_chunk, sizeof(data_chunk))){ + if (init_stream_chunk(&stream, app, buffer_id, pos, data_chunk, sizeof(data_chunk))){ b32 still_looping = true; - b32 is_whitespace_1 = true; - is_whitespace_1 = char_is_whitespace(buffer_get_char(app, buffer, pos - 1)); + b32 is_whitespace_1 = char_is_whitespace(buffer_get_char(app, buffer_id, pos - 1)); do{ for (; pos < stream.end; ++pos){ char c2 = stream.data[pos]; @@ -249,18 +243,21 @@ buffer_seek_whitespace_right(Application_Links *app, Buffer_Summary *buffer, i32 } static i32 -buffer_seek_whitespace_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){ +buffer_seek_whitespace_left(Application_Links *app, Buffer_ID buffer_id, i32 pos){ + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); + i32 result = -1; - if (pos > buffer->size){ - pos = buffer->size; + if (pos > buffer_size){ + pos = buffer_size; } pos -= 2; if (pos >= 0){ char data_chunk[1024]; Stream_Chunk stream = {}; - if (init_stream_chunk(&stream, app, buffer, pos, data_chunk, sizeof(data_chunk))){ + if (init_stream_chunk(&stream, app, buffer_id, pos, data_chunk, sizeof(data_chunk))){ b32 still_looping = true; - b32 is_whitespace_2 = char_is_whitespace(buffer_get_char(app, buffer, pos + 1)); + b32 is_whitespace_2 = char_is_whitespace(buffer_get_char(app, buffer_id, pos + 1)); do{ for (; pos >= stream.start; --pos){ char c1 = stream.data[pos]; @@ -277,7 +274,7 @@ buffer_seek_whitespace_left(Application_Links *app, Buffer_Summary *buffer, i32 } } if (pos == -1){ - if (!char_is_whitespace(buffer_get_char(app, buffer, 0))){ + if (!char_is_whitespace(buffer_get_char(app, buffer_id, 0))){ result = 0; } } @@ -285,12 +282,10 @@ buffer_seek_whitespace_left(Application_Links *app, Buffer_Summary *buffer, i32 } static i32 -buffer_seek_alphanumeric_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){ +buffer_seek_alphanumeric_right(Application_Links *app, Buffer_ID buffer_id, i32 pos){ char data_chunk[1024]; Stream_Chunk stream = {}; - - if (init_stream_chunk(&stream, app, buffer, pos, data_chunk, sizeof(data_chunk))){ - + if (init_stream_chunk(&stream, app, buffer_id, pos, data_chunk, sizeof(data_chunk))){ b32 still_looping = true; do{ for (; pos < stream.end; ++pos){ @@ -301,7 +296,6 @@ buffer_seek_alphanumeric_right(Application_Links *app, Buffer_Summary *buffer, i still_looping = forward_stream_chunk(&stream); }while(still_looping); double_break1:; - still_looping = true; do{ for (; pos < stream.end; ++pos){ @@ -313,18 +307,16 @@ buffer_seek_alphanumeric_right(Application_Links *app, Buffer_Summary *buffer, i }while(still_looping); double_break2:; } - return(pos); } static i32 -buffer_seek_alphanumeric_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){ +buffer_seek_alphanumeric_left(Application_Links *app, Buffer_ID buffer_id, i32 pos){ char data_chunk[1024]; Stream_Chunk stream = {}; - --pos; if (pos > 0){ - if (init_stream_chunk(&stream, app, buffer, pos, data_chunk, sizeof(data_chunk))){ + if (init_stream_chunk(&stream, app, buffer_id, pos, data_chunk, sizeof(data_chunk))){ b32 still_looping = true; do{ for (; pos >= stream.start; --pos){ @@ -335,7 +327,6 @@ buffer_seek_alphanumeric_left(Application_Links *app, Buffer_Summary *buffer, i3 still_looping = backward_stream_chunk(&stream); }while(still_looping); double_break1:; - still_looping = true; do{ for (; pos >= stream.start; --pos){ @@ -352,16 +343,14 @@ buffer_seek_alphanumeric_left(Application_Links *app, Buffer_Summary *buffer, i3 else{ pos = 0; } - return(pos); } static i32 -buffer_seek_alphanumeric_or_underscore_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){ +buffer_seek_alphanumeric_or_underscore_right(Application_Links *app, Buffer_ID buffer_id, i32 pos){ char data_chunk[1024]; Stream_Chunk stream = {}; - - if (init_stream_chunk(&stream, app, buffer, pos, data_chunk, sizeof(data_chunk))){ + if (init_stream_chunk(&stream, app, buffer_id, pos, data_chunk, sizeof(data_chunk))){ b32 still_looping = true; do{ for (; pos < stream.end; ++pos){ @@ -372,7 +361,6 @@ buffer_seek_alphanumeric_or_underscore_right(Application_Links *app, Buffer_Summ still_looping = forward_stream_chunk(&stream); }while(still_looping); double_break1:; - still_looping = true; do{ for (; pos < stream.end; ++pos){ @@ -384,19 +372,16 @@ buffer_seek_alphanumeric_or_underscore_right(Application_Links *app, Buffer_Summ }while(still_looping); double_break2:; } - return(pos); } static i32 -buffer_seek_alphanumeric_or_underscore_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){ +buffer_seek_alphanumeric_or_underscore_left(Application_Links *app, Buffer_ID buffer_id, i32 pos){ char data_chunk[1024]; Stream_Chunk stream = {}; - --pos; if (pos > 0){ - if (init_stream_chunk(&stream, app, buffer, pos, data_chunk, sizeof(data_chunk))){ - + if (init_stream_chunk(&stream, app, buffer_id, pos, data_chunk, sizeof(data_chunk))){ b32 still_looping = true; do{ for (; pos >= stream.start; --pos){ @@ -407,7 +392,6 @@ buffer_seek_alphanumeric_or_underscore_left(Application_Links *app, Buffer_Summa still_looping = backward_stream_chunk(&stream); }while(still_looping); double_break1:; - still_looping = true; do{ for (; pos >= stream.start; --pos){ @@ -424,23 +408,19 @@ buffer_seek_alphanumeric_or_underscore_left(Application_Links *app, Buffer_Summa else{ pos = 0; } - return(pos); } static i32 -buffer_seek_range_camel_right(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 an_pos){ +buffer_seek_range_camel_right(Application_Links *app, Buffer_ID buffer_id, i32 pos, i32 an_pos){ char data_chunk[1024]; Stream_Chunk stream = {}; - ++pos; if (pos < an_pos){ stream.max_end = an_pos; - if (init_stream_chunk(&stream, app, buffer, pos, data_chunk, sizeof(data_chunk))){ - + if (init_stream_chunk(&stream, app, buffer_id, pos, data_chunk, sizeof(data_chunk))){ u8 c = 0, pc = stream.data[pos]; ++pos; - b32 still_looping = false; do{ for (; pos < stream.end; ++pos){ @@ -458,22 +438,18 @@ buffer_seek_range_camel_right(Application_Links *app, Buffer_Summary *buffer, i3 else{ pos = an_pos; } - return(pos); } static i32 -buffer_seek_range_camel_left(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 an_pos){ +buffer_seek_range_camel_left(Application_Links *app, Buffer_ID buffer_id, i32 pos, i32 an_pos){ char data_chunk[1024]; Stream_Chunk stream = {}; - --pos; if (pos > 0){ stream.min_start = an_pos+1; - if (init_stream_chunk(&stream, app, buffer, pos, data_chunk, sizeof(data_chunk))){ - + if (init_stream_chunk(&stream, app, buffer_id, pos, data_chunk, sizeof(data_chunk))){ char c = 0, pc = stream.data[pos]; - b32 still_looping = false; do{ for (; pos >= stream.start; --pos){ @@ -491,21 +467,20 @@ buffer_seek_range_camel_left(Application_Links *app, Buffer_Summary *buffer, i32 else{ pos = 0; } - return(pos); } static i32 -buffer_seek_alphanumeric_or_camel_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){ - i32 an_pos = buffer_seek_alphanumeric_right(app, buffer, pos); - i32 result = buffer_seek_range_camel_right(app, buffer, pos, an_pos); +buffer_seek_alphanumeric_or_camel_right(Application_Links *app, Buffer_ID buffer_id, i32 pos){ + i32 an_pos = buffer_seek_alphanumeric_right(app, buffer_id, pos); + i32 result = buffer_seek_range_camel_right(app, buffer_id, pos, an_pos); return(result); } static i32 -buffer_seek_alphanumeric_or_camel_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){ - i32 an_pos = buffer_seek_alphanumeric_left(app, buffer, pos); - i32 result = buffer_seek_range_camel_left(app, buffer, pos, an_pos); +buffer_seek_alphanumeric_or_camel_left(Application_Links *app, Buffer_ID buffer_id, i32 pos){ + i32 an_pos = buffer_seek_alphanumeric_left(app, buffer_id, pos); + i32 result = buffer_seek_range_camel_left(app, buffer_id, pos, an_pos); return(result); } @@ -538,41 +513,32 @@ seek_token_right(Cpp_Token_Array *tokens, i32 pos, i32 buffer_end){ } static Cpp_Token_Array -buffer_get_all_tokens(Application_Links *app, Partition *part, Buffer_Summary *buffer){ +buffer_get_all_tokens(Application_Links *app, Partition *part, Buffer_ID buffer_id){ Cpp_Token_Array array = {}; - - if (buffer->exists && buffer->is_lexed){ - array.count = buffer_token_count(app, buffer); - array.max_count = array.count; - array.tokens = push_array(part, Cpp_Token, array.count); - buffer_read_tokens(app, buffer, 0, array.count, array.tokens); + if (buffer_exists(app, buffer_id)){ + b32 is_lexed = false; + if (buffer_get_setting(app, buffer_id, BufferSetting_Lex, &is_lexed) && + is_lexed){ + buffer_token_count(app, buffer_id, &array.count); + array.max_count = array.count; + array.tokens = push_array(part, Cpp_Token, array.count); + buffer_read_tokens(app, buffer_id, 0, array.count, array.tokens); + } } - return(array); } static i32 -buffer_boundary_seek(Application_Links *app, Buffer_Summary *buffer, Partition *part, i32 start_pos, b32 seek_forward, Seek_Boundary_Flag flags)/* -DOC_PARAM(buffer, The buffer parameter specifies the buffer through which to seek.) -DOC_PARAM(start_pos, The beginning position of the seek is specified by start_pos measured in absolute position.) -DOC_PARAM(seek_forward, If this parameter is non-zero it indicates that the seek should move foward through the buffer.) -DOC_PARAM(flags, This field specifies the types of boundaries at which the seek should stop.) - -DOC_RETURN(This call returns the absolute position where the seek stopped. -If the seek goes below 0 the returned value is -1. -If the seek goes past the end the returned value is the size of the buffer.) - -DOC_SEE(Seek_Boundary_Flag) -DOC_SEE(4coder_Buffer_Positioning_System) -*/{ +buffer_boundary_seek(Application_Links *app, Buffer_ID buffer_id, Partition *part, i32 start_pos, b32 seek_forward, Seek_Boundary_Flag flags){ i32 result = 0; // TODO(allen): reduce duplication? Temp_Memory temp = begin_temp_memory(part); - if (buffer->exists){ + if (buffer_exists(app, buffer_id)){ i32 pos[4]; - i32 size = buffer->size; + i32 size = 0; i32 new_pos = 0; + buffer_get_size(app, buffer_id, &size); if (start_pos < 0){ start_pos = 0; @@ -587,28 +553,28 @@ DOC_SEE(4coder_Buffer_Positioning_System) } if (flags & BoundaryWhitespace){ - pos[0] = buffer_seek_whitespace_right(app, buffer, start_pos); + pos[0] = buffer_seek_whitespace_right(app, buffer_id, start_pos); } if (flags & BoundaryToken){ - if (buffer->tokens_are_ready){ - Cpp_Token_Array array = buffer_get_all_tokens(app, part, buffer); + if (buffer_tokens_are_ready(app, buffer_id)){ + Cpp_Token_Array array = buffer_get_all_tokens(app, part, buffer_id); pos[1] = seek_token_right(&array, start_pos, size); } else{ - pos[1] = buffer_seek_whitespace_right(app, buffer, start_pos); + pos[1] = buffer_seek_whitespace_right(app, buffer_id, start_pos); } } if (flags & BoundaryAlphanumeric){ - pos[2] = buffer_seek_alphanumeric_right(app, buffer, start_pos); + pos[2] = buffer_seek_alphanumeric_right(app, buffer_id, start_pos); if (flags & BoundaryCamelCase){ - pos[3] = buffer_seek_range_camel_right(app, buffer, start_pos, pos[2]); + pos[3] = buffer_seek_range_camel_right(app, buffer_id, start_pos, pos[2]); } } else{ if (flags & BoundaryCamelCase){ - pos[3] = buffer_seek_alphanumeric_or_camel_right(app, buffer, start_pos); + pos[3] = buffer_seek_alphanumeric_or_camel_right(app, buffer_id, start_pos); } } @@ -625,28 +591,28 @@ DOC_SEE(4coder_Buffer_Positioning_System) } if (flags & BoundaryWhitespace){ - pos[0] = buffer_seek_whitespace_left(app, buffer, start_pos); + pos[0] = buffer_seek_whitespace_left(app, buffer_id, start_pos); } if (flags & BoundaryToken){ - if (buffer->tokens_are_ready){ - Cpp_Token_Array array = buffer_get_all_tokens(app, part, buffer); + if (buffer_tokens_are_ready(app, buffer_id)){ + Cpp_Token_Array array = buffer_get_all_tokens(app, part, buffer_id); pos[1] = seek_token_left(&array, start_pos); } else{ - pos[1] = buffer_seek_whitespace_left(app, buffer, start_pos); + pos[1] = buffer_seek_whitespace_left(app, buffer_id, start_pos); } } if (flags & BoundaryAlphanumeric){ - pos[2] = buffer_seek_alphanumeric_left(app, buffer, start_pos); + pos[2] = buffer_seek_alphanumeric_left(app, buffer_id, start_pos); if (flags & BoundaryCamelCase){ - pos[3] = buffer_seek_range_camel_left(app, buffer, start_pos, pos[2]); + pos[3] = buffer_seek_range_camel_left(app, buffer_id, start_pos, pos[2]); } } else{ if (flags & BoundaryCamelCase){ - pos[3] = buffer_seek_alphanumeric_or_camel_left(app, buffer, start_pos); + pos[3] = buffer_seek_alphanumeric_or_camel_left(app, buffer_id, start_pos); } } @@ -667,13 +633,12 @@ DOC_SEE(4coder_Buffer_Positioning_System) //////////////////////////////// void -buffer_seek_delimiter_forward(Application_Links *app, Buffer_Summary *buffer, i32 pos, char delim, i32 *result){ - if (buffer->exists){ +buffer_seek_delimiter_forward(Application_Links *app, Buffer_ID buffer_id, i32 pos, char delim, i32 *result){ + if (buffer_exists(app, buffer_id)){ char chunk[1024]; i32 size = sizeof(chunk); Stream_Chunk stream = {}; - - if (init_stream_chunk(&stream, app, buffer, pos, chunk, size)){ + if (init_stream_chunk(&stream, app, buffer_id, pos, chunk, size)){ i32 still_looping = 1; do{ for(; pos < stream.end; ++pos){ @@ -687,20 +652,17 @@ buffer_seek_delimiter_forward(Application_Links *app, Buffer_Summary *buffer, i3 }while (still_looping); } } - - *result = buffer->size; - + buffer_get_size(app, buffer_id, result); finished:; } static void -buffer_seek_delimiter_backward(Application_Links *app, Buffer_Summary *buffer, i32 pos, char delim, i32 *result){ - if (buffer->exists){ +buffer_seek_delimiter_backward(Application_Links *app, Buffer_ID buffer_id, i32 pos, char delim, i32 *result){ + if (buffer_exists(app, buffer_id)){ char chunk[1024]; i32 size = sizeof(chunk); Stream_Chunk stream = {}; - - if (init_stream_chunk(&stream, app, buffer, pos, chunk, size)){ + if (init_stream_chunk(&stream, app, buffer_id, pos, chunk, size)){ i32 still_looping = 1; do{ for(; pos >= stream.start; --pos){ @@ -714,9 +676,7 @@ buffer_seek_delimiter_backward(Application_Links *app, Buffer_Summary *buffer, i }while (still_looping); } } - *result = 0; - finished:; } @@ -724,18 +684,19 @@ buffer_seek_delimiter_backward(Application_Links *app, Buffer_Summary *buffer, i // You can push it up or do something more clever by just // replacing char read_buffer[512]; with more memory. static void -buffer_seek_string_forward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, char *str, i32 size, i32 *result){ - char read_buffer[512]; - - if (buffer->size > end){ - *result = buffer->size; +buffer_seek_string_forward(Application_Links *app, Buffer_ID buffer_id, i32 pos, i32 end, char *str, i32 size, i32 *result){ + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); + if (buffer_size > end){ + *result = buffer_size; } else{ *result = end; } + char read_buffer[512]; if (size > 0 && size <= sizeof(read_buffer)){ - if (buffer->exists){ + if (buffer_exists(app, buffer_id)){ String read_str = make_fixed_width_string(read_buffer); String needle_str = make_string(str, size); char first_char = str[0]; @@ -746,13 +707,13 @@ buffer_seek_string_forward(Application_Links *app, Buffer_Summary *buffer, i32 p Stream_Chunk stream = {}; stream.max_end = end; - if (init_stream_chunk(&stream, app, buffer, pos, chunk, sizeof(chunk))){ - i32 still_looping = 1; + if (init_stream_chunk(&stream, app, buffer_id, pos, chunk, sizeof(chunk))){ + b32 still_looping = true; do{ for(; pos < stream.end; ++pos){ char at_pos = stream.data[pos]; if (at_pos == first_char){ - buffer_read_range(app, buffer, pos, pos+size, read_buffer); + buffer_read_range(app, buffer_id, pos, pos+size, read_buffer); if (match_ss(needle_str, read_str)){ *result = pos; goto finished; @@ -765,7 +726,7 @@ buffer_seek_string_forward(Application_Links *app, Buffer_Summary *buffer, i32 p } if (end == 0){ - *result = buffer->size; + *result = buffer_size; } else{ *result = end; @@ -779,40 +740,33 @@ buffer_seek_string_forward(Application_Links *app, Buffer_Summary *buffer, i32 p // You can push it up or do something more clever by just // replacing char read_buffer[512]; with more memory. static void -buffer_seek_string_backward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 min, char *str, i32 size, i32 *result){ +buffer_seek_string_backward(Application_Links *app, Buffer_ID buffer_id, i32 pos, i32 min, char *str, i32 size, i32 *result){ char read_buffer[512]; - - *result = min-1; - if (size > 0 && size <= sizeof(read_buffer)){ - if (buffer->exists){ - String read_str = make_fixed_width_string(read_buffer); - String needle_str = make_string(str, size); - char first_char = str[0]; - - read_str.size = size; - - char chunk[1024]; - Stream_Chunk stream = {}; - stream.min_start = min; - - if (init_stream_chunk(&stream, app, buffer, pos, chunk, sizeof(chunk))){ - i32 still_looping = 1; - do{ - for(; pos >= stream.start; --pos){ - char at_pos = stream.data[pos]; - if (at_pos == first_char){ - buffer_read_range(app, buffer, pos, pos+size, read_buffer); - if (match_ss(needle_str, read_str)){ - *result = pos; - goto finished; - } + *result = min - 1; + if (size > 0 && size <= sizeof(read_buffer) && buffer_exists(app, buffer_id)){ + String read_str = make_fixed_width_string(read_buffer); + String needle_str = make_string(str, size); + char first_char = str[0]; + read_str.size = size; + char chunk[1024]; + Stream_Chunk stream = {}; + stream.min_start = min; + if (init_stream_chunk(&stream, app, buffer_id, pos, chunk, sizeof(chunk))){ + i32 still_looping = 1; + do{ + for(; pos >= stream.start; --pos){ + char at_pos = stream.data[pos]; + if (at_pos == first_char){ + buffer_read_range(app, buffer_id, pos, pos+size, read_buffer); + if (match_ss(needle_str, read_str)){ + *result = pos; + goto finished; } } - still_looping = backward_stream_chunk(&stream); - }while (still_looping); - } + } + still_looping = backward_stream_chunk(&stream); + }while (still_looping); } - finished:; } } @@ -821,46 +775,41 @@ buffer_seek_string_backward(Application_Links *app, Buffer_Summary *buffer, i32 // You can push it up or do something more clever by just // replacing char read_buffer[512]; with more memory. static void -buffer_seek_string_insensitive_forward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, char *str, i32 size, i32 *result){ +buffer_seek_string_insensitive_forward(Application_Links *app, Buffer_ID buffer_id, i32 pos, i32 end, char *str, i32 size, i32 *result){ + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); + if (buffer_size > end){ + *result = buffer_size; + } + else{ + *result = end; + } char read_buffer[512]; char chunk[1024]; i32 chunk_size = sizeof(chunk); Stream_Chunk stream = {}; stream.max_end = end; - - if (buffer->size > end){ - *result = buffer->size; - } - else{ - *result = end; - } - - if (size > 0 && size <= sizeof(read_buffer)){ - if (buffer->exists){ - String read_str = make_fixed_width_string(read_buffer); - String needle_str = make_string(str, size); - char first_char = char_to_upper(str[0]); - - read_str.size = size; - - if (init_stream_chunk(&stream, app, buffer, pos, chunk, chunk_size)){ - i32 still_looping = 1; - do{ - for(; pos < stream.end; ++pos){ - char at_pos = char_to_upper(stream.data[pos]); - if (at_pos == first_char){ - buffer_read_range(app, buffer, pos, pos+size, read_buffer); - if (match_insensitive_ss(needle_str, read_str)){ - *result = pos; - goto finished; - } + if (size > 0 && size <= sizeof(read_buffer) && buffer_exists(app, buffer_id)){ + String read_str = make_fixed_width_string(read_buffer); + String needle_str = make_string(str, size); + char first_char = char_to_upper(str[0]); + read_str.size = size; + if (init_stream_chunk(&stream, app, buffer_id, pos, chunk, chunk_size)){ + i32 still_looping = 1; + do{ + for(; pos < stream.end; ++pos){ + char at_pos = char_to_upper(stream.data[pos]); + if (at_pos == first_char){ + buffer_read_range(app, buffer_id, pos, pos+size, read_buffer); + if (match_insensitive_ss(needle_str, read_str)){ + *result = pos; + goto finished; } } - still_looping = forward_stream_chunk(&stream); - }while (still_looping); - } + } + still_looping = forward_stream_chunk(&stream); + }while (still_looping); } - finished:; } } @@ -869,40 +818,35 @@ buffer_seek_string_insensitive_forward(Application_Links *app, Buffer_Summary *b // You can push it up or do something more clever by just // replacing char read_buffer[512]; with more memory. static void -buffer_seek_string_insensitive_backward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 min, char *str, i32 size, i32 *result){ +buffer_seek_string_insensitive_backward(Application_Links *app, Buffer_ID buffer_id, i32 pos, i32 min, char *str, i32 size, i32 *result){ char read_buffer[512]; char chunk[1024]; i32 chunk_size = sizeof(chunk); Stream_Chunk stream = {}; stream.min_start = min; - *result = min-1; - if (size > 0 && size <= sizeof(read_buffer)){ - if (buffer->exists){ - String read_str = make_fixed_width_string(read_buffer); - String needle_str = make_string(str, size); - char first_char = char_to_upper(str[0]); - - read_str.size = size; - - if (init_stream_chunk(&stream, app, buffer, pos, chunk, chunk_size)){ - i32 still_looping = 1; - do{ - for(; pos >= stream.start; --pos){ - char at_pos = char_to_upper(stream.data[pos]); - if (at_pos == first_char){ - buffer_read_range(app, buffer, pos, pos+size, read_buffer); - if (match_insensitive_ss(needle_str, read_str)){ - *result = pos; - goto finished; - } + *result = min - 1; + if (size > 0 && size <= sizeof(read_buffer) && buffer_exists(app, buffer_id)){ + String read_str = make_fixed_width_string(read_buffer); + String needle_str = make_string(str, size); + char first_char = char_to_upper(str[0]); + read_str.size = size; + if (init_stream_chunk(&stream, app, buffer_id, pos, chunk, chunk_size)){ + i32 still_looping = 1; + do{ + for(; pos >= stream.start; --pos){ + char at_pos = char_to_upper(stream.data[pos]); + if (at_pos == first_char){ + buffer_read_range(app, buffer_id, pos, pos+size, read_buffer); + if (match_insensitive_ss(needle_str, read_str)){ + *result = pos; + goto finished; } } - still_looping = backward_stream_chunk(&stream); - }while (still_looping); - } + } + still_looping = backward_stream_chunk(&stream); + }while (still_looping); } - finished:; } } @@ -910,26 +854,26 @@ buffer_seek_string_insensitive_backward(Application_Links *app, Buffer_Summary * //////////////////////////////// static void -buffer_seek_string(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, i32 min, char *str, i32 size, i32 *result, Buffer_Seek_String_Flags flags){ +buffer_seek_string(Application_Links *app, Buffer_ID buffer_id, i32 pos, i32 end, i32 min, char *str, i32 size, i32 *result, Buffer_Seek_String_Flags flags){ switch (flags & 3){ case 0: { - buffer_seek_string_forward(app, buffer, pos, end, str, size, result); + buffer_seek_string_forward(app, buffer_id, pos, end, str, size, result); }break; case BufferSeekString_Backward: { - buffer_seek_string_backward(app, buffer, pos, min, str, size, result); + buffer_seek_string_backward(app, buffer_id, pos, min, str, size, result); }break; case BufferSeekString_CaseInsensitive: { - buffer_seek_string_insensitive_forward(app, buffer, pos, end, str, size, result); + buffer_seek_string_insensitive_forward(app, buffer_id, pos, end, str, size, result); }break; case BufferSeekString_Backward|BufferSeekString_CaseInsensitive: { - buffer_seek_string_insensitive_backward(app, buffer, pos, min, str, size, result); + buffer_seek_string_insensitive_backward(app, buffer_id, pos, min, str, size, result); }break; } } @@ -937,13 +881,15 @@ buffer_seek_string(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 //////////////////////////////// static b32 -buffer_line_is_blank(Application_Links *app, Buffer_Summary *buffer, i32 line){ +buffer_line_is_blank(Application_Links *app, Buffer_ID buffer_id, i32 line){ Partial_Cursor start = {}; Partial_Cursor end = {}; b32 result = false; - if (line <= buffer->line_count){ - buffer_compute_cursor(app, buffer, seek_line_char(line, 1), &start); - buffer_compute_cursor(app, buffer, seek_line_char(line, -1), &end); + i32 line_count = 0; + buffer_get_line_count(app, buffer_id, &line_count); + if (line <= line_count){ + buffer_compute_cursor(app, buffer_id, seek_line_char(line, 1), &start); + buffer_compute_cursor(app, buffer_id, seek_line_char(line, -1), &end); static const i32 chunk_size = 1024; char chunk[chunk_size]; @@ -952,7 +898,7 @@ buffer_line_is_blank(Application_Links *app, Buffer_Summary *buffer, i32 line){ stream.max_end = end.pos; result = true; - if (init_stream_chunk(&stream, app, buffer, i, chunk, chunk_size)){ + if (init_stream_chunk(&stream, app, buffer_id, i, chunk, chunk_size)){ b32 still_looping = false; do{ for (;i < stream.end; ++i){ @@ -971,15 +917,15 @@ buffer_line_is_blank(Application_Links *app, Buffer_Summary *buffer, i32 line){ } static String -read_identifier_at_pos(Application_Links *app, Buffer_Summary *buffer, i32 pos, char *space, i32 max, Range *range_out){ +read_identifier_at_pos(Application_Links *app, Buffer_ID buffer_id, i32 pos, char *space, i32 max, Range *range_out){ String query = {}; - i32 start = buffer_seek_alphanumeric_or_underscore_left(app, buffer, pos); - i32 end = buffer_seek_alphanumeric_or_underscore_right(app, buffer, start); + i32 start = buffer_seek_alphanumeric_or_underscore_left(app, buffer_id, pos); + i32 end = buffer_seek_alphanumeric_or_underscore_right(app, buffer_id, start); if (!(start <= pos && pos < end)){ - end = buffer_seek_alphanumeric_or_underscore_right(app, buffer, pos); - start = buffer_seek_alphanumeric_or_underscore_left(app, buffer, end); + end = buffer_seek_alphanumeric_or_underscore_right(app, buffer_id, pos); + start = buffer_seek_alphanumeric_or_underscore_left(app, buffer_id, end); } if (start <= pos && pos < end){ @@ -988,7 +934,7 @@ read_identifier_at_pos(Application_Links *app, Buffer_Summary *buffer, i32 pos, if (range_out != 0){ *range_out = make_range(start, end); } - buffer_read_range(app, buffer, start, end, space); + buffer_read_range(app, buffer_id, start, end, space); query = make_string_cap(space, size, max); } } @@ -1010,22 +956,23 @@ flip_dir(i32 dir){ } static i32 -buffer_boundary_seek(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, i32 dir, Seek_Boundary_Flag flags){ +buffer_boundary_seek(Application_Links *app, Buffer_ID buffer_id, i32 start_pos, i32 dir, Seek_Boundary_Flag flags){ b32 forward = (dir != DirLeft); - return(buffer_boundary_seek(app, buffer, &global_part, start_pos, forward, flags)); + return(buffer_boundary_seek(app, buffer_id, &global_part, start_pos, forward, flags)); } static void -view_buffer_boundary_seek_set_pos(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 dir, u32 flags){ - i32 pos = buffer_boundary_seek(app, buffer, &global_part, view->cursor.pos, dir, flags); +view_buffer_boundary_seek_set_pos(Application_Links *app, View_Summary *view, Buffer_ID buffer_id, i32 dir, u32 flags){ + i32 pos = buffer_boundary_seek(app, buffer_id, &global_part, view->cursor.pos, dir, flags); view_set_cursor(app, view, seek_pos(pos), true); no_mark_snap_to_cursor_if_shift(app, view->view_id); } static void view_boundary_seek_set_pos(Application_Links *app, View_Summary *view, i32 dir, u32 flags){ - Buffer_Summary buffer = get_buffer(app, view->buffer_id, AccessProtected); - view_buffer_boundary_seek_set_pos(app, view, &buffer, dir, flags); + Buffer_ID buffer_id = 0; + view_get_buffer(app, view->view_id, AccessProtected, &buffer_id); + view_buffer_boundary_seek_set_pos(app, view, buffer_id, dir, flags); } static void @@ -1035,20 +982,22 @@ current_view_boundary_seek_set_pos(Application_Links *app, i32 dir, u32 flags){ } static Range -view_buffer_boundary_range(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 dir, u32 flags){ +view_buffer_boundary_range(Application_Links *app, View_Summary *view, Buffer_ID buffer_id, i32 dir, u32 flags){ i32 pos1 = view->cursor.pos; - i32 pos2 = buffer_boundary_seek(app, buffer, pos1, dir, flags); + i32 pos2 = buffer_boundary_seek(app, buffer_id, pos1, dir, flags); return(make_range(pos1, pos2)); } static Range -view_buffer_snipe_range(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 dir, u32 flags){ +view_buffer_snipe_range(Application_Links *app, View_Summary *view, Buffer_ID buffer_id, i32 dir, u32 flags){ + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); Range result = {}; i32 pos0 = view->cursor.pos; - i32 pos1 = buffer_boundary_seek(app, buffer, pos0, dir, flags); - if (0 <= pos1 && pos1 <= buffer->size){ - i32 pos2 = buffer_boundary_seek(app, buffer, pos1, flip_dir(dir), flags); - if (0 <= pos2 && pos2 <= buffer->size){ + i32 pos1 = buffer_boundary_seek(app, buffer_id, pos0, dir, flags); + if (0 <= pos1 && pos1 <= buffer_size){ + i32 pos2 = buffer_boundary_seek(app, buffer_id, pos1, flip_dir(dir), flags); + if (0 <= pos2 && pos2 <= buffer_size){ if (dir == DirLeft){ if (pos2 < pos0){ pos2 = pos0; @@ -1068,21 +1017,21 @@ view_buffer_snipe_range(Application_Links *app, View_Summary *view, Buffer_Summa static void current_view_boundary_delete(Application_Links *app, i32 dir, u32 flags){ View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - if (buffer.exists){ - Range range = view_buffer_boundary_range(app, &view, &buffer, dir, flags); - buffer_replace_range(app, &buffer, range.min, range.max, 0, 0); - } + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer_id); + Range range = view_buffer_boundary_range(app, &view, buffer_id, dir, flags); + String zero = {}; + buffer_replace_range(app, buffer_id, range.min, range.max, zero); } static void current_view_snipe_delete(Application_Links *app, i32 dir, u32 flags){ View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - if (buffer.exists){ - Range range = view_buffer_snipe_range(app, &view, &buffer, dir, flags); - buffer_replace_range(app, &buffer, range.min, range.max, 0, 0); - } + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer_id); + Range range = view_buffer_snipe_range(app, &view, buffer_id, dir, flags); + String zero = {}; + buffer_replace_range(app, buffer_id, range.min, range.max, zero); } //////////////////////////////// @@ -1091,8 +1040,9 @@ CUSTOM_COMMAND_SIG(seek_whitespace_up) CUSTOM_DOC("Seeks the cursor up to the next blank line.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - i32 new_pos = buffer_seek_whitespace_up(app, &buffer, view.cursor.pos); + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); + i32 new_pos = buffer_seek_whitespace_up(app, buffer_id, view.cursor.pos); view_set_cursor(app, &view, seek_pos(new_pos), true); no_mark_snap_to_cursor_if_shift(app, view.view_id); } @@ -1101,8 +1051,9 @@ CUSTOM_COMMAND_SIG(seek_whitespace_down) CUSTOM_DOC("Seeks the cursor down to the next blank line.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - i32 new_pos = buffer_seek_whitespace_down(app, &buffer, view.cursor.pos); + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); + i32 new_pos = buffer_seek_whitespace_down(app, buffer_id, view.cursor.pos); view_set_cursor(app, &view, seek_pos(new_pos), true); no_mark_snap_to_cursor_if_shift(app, view.view_id); } @@ -1111,8 +1062,9 @@ CUSTOM_COMMAND_SIG(seek_beginning_of_textual_line) CUSTOM_DOC("Seeks the cursor to the beginning of the line across all text.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - i32 new_pos = seek_line_beginning(app, &buffer, view.cursor.pos); + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); + i32 new_pos = seek_line_beginning(app, buffer_id, view.cursor.pos); view_set_cursor(app, &view, seek_pos(new_pos), true); no_mark_snap_to_cursor_if_shift(app, view.view_id); } @@ -1121,8 +1073,9 @@ CUSTOM_COMMAND_SIG(seek_end_of_textual_line) CUSTOM_DOC("Seeks the cursor to the end of the line across all text.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - i32 new_pos = seek_line_end(app, &buffer, view.cursor.pos); + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); + i32 new_pos = seek_line_end(app, buffer_id, view.cursor.pos); view_set_cursor(app, &view, seek_pos(new_pos), true); no_mark_snap_to_cursor_if_shift(app, view.view_id); } @@ -1155,9 +1108,10 @@ CUSTOM_COMMAND_SIG(seek_whitespace_up_end_line) CUSTOM_DOC("Seeks the cursor up to the next blank line and places it at the end of the line.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - i32 new_pos = buffer_seek_whitespace_up(app, &buffer, view.cursor.pos); - new_pos = seek_line_end(app, &buffer, new_pos); + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); + i32 new_pos = buffer_seek_whitespace_up(app, buffer_id, view.cursor.pos); + new_pos = seek_line_end(app, buffer_id, new_pos); view_set_cursor(app, &view, seek_pos(new_pos), true); no_mark_snap_to_cursor_if_shift(app, view.view_id); } @@ -1166,9 +1120,10 @@ CUSTOM_COMMAND_SIG(seek_whitespace_down_end_line) CUSTOM_DOC("Seeks the cursor down to the next blank line and places it at the end of the line.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - i32 new_pos = buffer_seek_whitespace_down(app, &buffer, view.cursor.pos); - new_pos = seek_line_end(app, &buffer, new_pos); + Buffer_ID buffer_id = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); + i32 new_pos = buffer_seek_whitespace_down(app, buffer_id, view.cursor.pos); + new_pos = seek_line_end(app, buffer_id, new_pos); view_set_cursor(app, &view, seek_pos(new_pos), true); no_mark_snap_to_cursor_if_shift(app, view.view_id); }