Significant progress reorganizing the customization helpers

master
Allen Webster 2019-06-01 20:07:57 -07:00
parent 6130b839ea
commit 749b4349f6
22 changed files with 699 additions and 623 deletions

View File

@ -96,17 +96,17 @@ buffer_get_char(Application_Links *app, Buffer_Summary *buffer, i32 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));
return(buffer==0?0:get_line_start_pos(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));
return(buffer==0?0:get_line_end_pos(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));
return(buffer==0?0:get_first_token_from_line(app, buffer->buffer_id, tokens, line));
}
static b32
@ -117,7 +117,7 @@ read_line(Application_Links *app, Arena *arena, Buffer_Summary *buffer, i32 line
b32 result = (buffer != 0 && is_valid_line(app, buffer->buffer_id, line));
if (result){
out = get_line_range(app, buffer->buffer_id, line);
string = scratch_read(app, arena, buffer->buffer_id, make_range_from_cursors(out));
string = push_buffer_range(app, arena, buffer->buffer_id, make_range_from_cursors(out));
}
*start_out = out.start;
*one_past_last_out = out.one_past_last;
@ -131,7 +131,7 @@ read_line(Application_Links *app, Arena *arena, Buffer_Summary *buffer, i32 line
b32 result = (buffer != 0 && is_valid_line(app, buffer->buffer_id, line));
if (result){
Range_Partial_Cursor range = get_line_range(app, buffer->buffer_id, line);
string = scratch_read(app, arena, buffer->buffer_id, make_range_from_cursors(range));
string = push_buffer_range(app, arena, buffer->buffer_id, make_range_from_cursors(range));
}
*str = string_old_from_new(string);
return(result);
@ -152,7 +152,7 @@ static String
token_get_lexeme(Application_Links *app, Arena *arena, Buffer_Summary *buffer, Cpp_Token *token){
String result = {};
if (buffer != 0 && token != 0){
result = string_old_from_new(token_get_lexeme(app, arena, buffer->buffer_id, *token));
result = string_old_from_new(push_token_lexeme(app, arena, buffer->buffer_id, *token));
}
return(result);
}
@ -463,7 +463,7 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_Summary *buff
static i32
buffer_get_line_number(Application_Links *app, Buffer_Summary *buffer, i32 pos){
return(buffer==0?0:buffer_get_line_number(app, buffer->buffer_id, pos));
return(buffer==0?0:get_line_number_from_pos(app, buffer->buffer_id, pos));
}
static void
@ -691,7 +691,7 @@ view_set_to_region(Application_Links *app, View_Summary *view, i32 major_pos, i3
static i32
character_pos_to_pos(Application_Links *app, View_Summary *view, i32 character_pos){
return(character_pos_to_pos(app, view==0?0:view->view_id, character_pos));
return(character_pos_to_pos_view(app, view==0?0:view->view_id, character_pos));
}
static b32
@ -735,7 +735,7 @@ refresh_view(Application_Links *app, View_Summary *view){
static String
get_string_in_view_range(Application_Links *app, Arena *arena, View_Summary *view){
return(string_old_from_new(get_string_in_view_range(app, arena, view==0?0:view->view_id)));
return(string_old_from_new(push_string_in_view_range(app, arena, view==0?0:view->view_id)));
}
static b32
@ -957,6 +957,67 @@ open_all_files_in_directory_pattern_match(Application_Links *app,
open_all_files_in_directory_pattern_match(app, string_new_u8_from_old(dir), whitelist, blacklist, flags);
}
static String_Const_u8
scratch_read(Application_Links *app, Arena *arena, Buffer_ID buffer, umem start, umem end){
return(push_buffer_range(app, arena, buffer, start, end));
}
static String_Const_u8
scratch_read(Application_Links *app, Arena *arena, Buffer_ID buffer, Range range){
return(push_buffer_range(app, arena, buffer, range));
}
static String_Const_u8
scratch_read(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_umem range){
return(push_buffer_range(app, arena, buffer, range));
}
static String_Const_u8
scratch_read(Application_Links *app, Arena *arena, Buffer_ID buffer, Cpp_Token token){
return(push_token_lexeme(app, arena, buffer, token));
}
static String_Const_u8
scratch_read_line(Application_Links *app, Arena *arena, Buffer_ID buffer, i32 line){
return(push_buffer_line(app, arena, buffer, line));
}
static String_Const_u8
token_get_lexeme(Application_Links *app, Arena *arena, Buffer_ID buffer, Cpp_Token token){
return(push_token_lexeme(app, arena, buffer, token));
}
static String_Const_u8
get_token_lexeme(Application_Links *app, Arena *arena, Buffer_ID buffer, Cpp_Token token){
return(push_token_lexeme(app, arena, buffer, token));
}
static String_Const_u8
read_entire_buffer(Application_Links *app, Buffer_ID buffer_id, Arena *scratch){
return(push_entire_buffer(app, scratch, buffer_id));
}
static String_Const_u8
buffer_read_string(Application_Links *app, Buffer_ID buffer, Range range, void *dest){
Scratch_Block scratch(app);
String_Const_u8 result = push_buffer_range(app, scratch, buffer, range);
block_copy(dest, result.str, result.size);
result.str = (u8*)dest;
return(result);
}
static b32
token_match(Application_Links *app, Buffer_ID buffer, Cpp_Token token, String b){
return(token_lexeme_string_match(app, buffer, token, string_new_u8_from_old(b)));
}
static i32
view_get_line_number(Application_Links *app, View_ID view, i32 pos){
Full_Cursor cursor = {};
view_compute_cursor(app, view, seek_pos(pos), &cursor);
return(cursor.line);
}
#endif
// BOTTOM

View File

@ -64,7 +64,7 @@ make_batch_from_indent_marks(Application_Links *app, Arena *arena, Buffer_ID buf
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 = get_line_start_pos(app, buffer, 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];
@ -155,7 +155,7 @@ static Indent_Anchor_Position
find_anchor_token(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array tokens, i32 line_start, i32 tab_width){
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_from_line(app, buffer, tokens, line_start);
if (first_invalid_token <= tokens.tokens){
anchor.token = tokens.tokens;
}
@ -165,7 +165,7 @@ find_anchor_token(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array toke
Cpp_Token *token_it = tokens.tokens;
i32 highest_checked_line_number = -1;
for (; token_it < first_invalid_token; ++token_it){
i32 line_number = buffer_get_line_number(app, buffer, token_it->start);
i32 line_number = get_line_number_from_pos(app, buffer, token_it->start);
if (highest_checked_line_number < line_number){
highest_checked_line_number = line_number;
if (top == -1){
@ -249,7 +249,7 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
}
}
else{
i32 line_number = buffer_get_line_number(app, buffer, token_ptr->start);
i32 line_number = get_line_number_from_pos(app, buffer, token_ptr->start);
if (line_number > first_line){
line_number = first_line;
}
@ -258,7 +258,7 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
indent.current_indent = 0;
}
i32 next_line_start_pos = buffer_get_line_start(app, buffer, line_number);
i32 next_line_start_pos = get_line_start_pos(app, buffer, line_number);
indent.previous_line_indent = indent.current_indent;
Cpp_Token prev_token = {};
Cpp_Token token = {};
@ -289,12 +289,12 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
}
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 = get_line_start_pos(app, buffer, 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 = get_line_start_pos(app, buffer, line_number);
i32 next_line_start = next_line_start_pos;
b32 did_multi_line_behavior = false;
@ -448,8 +448,8 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
case CPP_TOKEN_COMMENT:
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 line = get_line_number_from_pos(app, buffer, token.start);
i32 start = get_line_start_pos(app, buffer, line);
Hard_Start_Result hard_start = buffer_find_hard_start(app, buffer, start, tab_width);
i32 old_dist_to_token = (token.start - start);
@ -465,8 +465,8 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
{
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 line = get_line_number_from_pos(app, buffer, token.start);
i32 start = get_line_start_pos(app, buffer, line);
i32 char_pos = token.start - start;
Hard_Start_Result hard_start = buffer_find_hard_start(app, buffer, start, tab_width);
@ -498,22 +498,22 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
static void
get_indent_lines_minimum(Application_Links *app, Buffer_ID buffer, i32 start_pos, i32 end_pos, i32 *line_start_out, i32 *line_end_out){
i32 line_start = buffer_get_line_number(app, buffer, start_pos);
i32 line_end = buffer_get_line_number(app, buffer, end_pos) + 1;
i32 line_start = get_line_number_from_pos(app, buffer, start_pos);
i32 line_end = get_line_number_from_pos(app, buffer, end_pos) + 1;
*line_start_out = line_start;
*line_end_out = line_end;
}
static void
get_indent_lines_whole_tokens(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array tokens, i32 start_pos, i32 end_pos, i32 *line_start_out, i32 *line_end_out){
i32 line_start = buffer_get_line_number(app, buffer, start_pos);
i32 line_end = buffer_get_line_number(app, buffer, end_pos);
i32 line_start = get_line_number_from_pos(app, buffer, start_pos);
i32 line_end = get_line_number_from_pos(app, buffer, end_pos);
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);
if (token && token->start < line_start_pos){
line_start = buffer_get_line_number(app, buffer, token->start);
i32 line_start_pos = get_line_start_pos(app, buffer, line_start);
Cpp_Token *token = get_first_token_from_pos(tokens, line_start_pos);
if (token != 0 && token->start < line_start_pos){
line_start = get_line_number_from_pos(app, buffer, token->start);
}
else{
break;
@ -524,22 +524,18 @@ get_indent_lines_whole_tokens(Application_Links *app, Buffer_ID buffer, Cpp_Toke
buffer_get_line_count(app, buffer, &line_count);
for (;line_end < 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);
i32 next_line_start_pos = get_line_start_pos(app, buffer, line_end + 1);
Cpp_Token *token = get_first_token_from_pos(tokens, next_line_start_pos);
if (token != 0 && token->start < next_line_start_pos){
line_end = buffer_get_line_number(app, buffer, token->start + token->size);
line_end = get_line_number_from_pos(app, buffer, token->start + token->size);
}
else{
break;
}
}
if (line_end > line_count){
line_end = line_count + 1;
}
else{
line_end += 1;
}
line_end = clamp_top(line_end, line_count);
line_end += 1;
*line_start_out = line_start;
*line_end_out = line_end;

View File

@ -21,7 +21,8 @@ write_character_parameter(Application_Links *app, u8 *character, u32 length){
// NOTE(allen): setup markers to figure out the new position of cursor after the insert
Marker next_cursor_marker = {};
next_cursor_marker.pos = character_pos_to_pos(app, view, cursor.character_pos);
// TODO(allen): should be using character_pos_to_pos_buffer here!
next_cursor_marker.pos = character_pos_to_pos_view(app, view, cursor.character_pos);
next_cursor_marker.lean_right = true;
Managed_Object handle = alloc_buffer_markers_on_buffer(app, buffer, 1, 0);
managed_object_store_data(app, handle, 0, 1, &next_cursor_marker);
@ -1240,7 +1241,7 @@ save_all_dirty_buffers_with_postfix(Application_Links *app, String_Const_u8 post
buffer_get_dirty_state(app, buffer, &dirty);
if (dirty == DirtyState_UnsavedChanges){
Temp_Memory temp = begin_temp(scratch);
String_Const_u8 file_name = buffer_push_file_name(app, buffer, scratch);
String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer);
if (string_match(string_postfix(file_name, postfix.size), postfix)){
buffer_save(app, buffer, file_name, 0);
}
@ -1282,7 +1283,7 @@ CUSTOM_DOC("Deletes the file of the current buffer if 4coder has the appropriate
Buffer_ID buffer = 0;
view_get_buffer(app, view, AccessAll, &buffer);
Scratch_Block scratch(app);
String_Const_u8 file_name = buffer_push_file_name(app, buffer, scratch);
String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer);
if (file_name.size > 0){
Query_Bar bar = {};
bar.prompt = string_u8_pushf(scratch, "Delete '%.*s' (Y)es, (n)o", string_expand(file_name));
@ -1324,7 +1325,7 @@ CUSTOM_DOC("Queries the user for a file name and saves the contents of the curre
Arena *scratch = context_get_arena(app);
Temp_Memory temp = begin_temp(scratch);
String_Const_u8 buffer_name = buffer_push_unique_buffer_name(app, buffer, scratch);
String_Const_u8 buffer_name = push_buffer_unique_name(app, scratch, buffer);
// Query the user
u8 name_space[4096];
@ -1363,7 +1364,7 @@ CUSTOM_DOC("Queries the user for a new name and renames the file of the current
Arena *scratch = context_get_arena(app);
Temp_Memory temp = begin_temp(scratch);
String_Const_u8 file_name = buffer_push_file_name(app, buffer, scratch);;
String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer);
if (file_name.size > 0){
// Query the user
String_Const_u8 front = string_front_of_path(file_name);
@ -1517,9 +1518,9 @@ CUSTOM_DOC("Create a copy of the line on which the cursor sits.")
Full_Cursor cursor = {};
view_compute_cursor(app, view, seek_pos(cursor_pos), &cursor);
Scratch_Block scratch(app);
String_Const_u8 line_string = scratch_read_line(app, scratch, buffer_id, cursor.line);
String_Const_u8 line_string = push_buffer_line(app, scratch, buffer_id, cursor.line);
String_Const_u8 insertion = string_u8_pushf(scratch, "\n%.*s", string_expand(line_string));
i32 pos = buffer_get_line_end(app, buffer_id, cursor.line);
i32 pos = get_line_end_pos(app, buffer_id, cursor.line);
buffer_replace_range(app, buffer_id, make_range(pos), insertion);
}
@ -1528,29 +1529,25 @@ CUSTOM_DOC("Delete the line the on which the cursor sits.")
{
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer_id = 0;
view_get_buffer(app, view, AccessOpen, &buffer_id);
Buffer_ID buffer = 0;
view_get_buffer(app, view, AccessOpen, &buffer);
i32 cursor_pos = 0;
view_get_cursor_pos(app, view, &cursor_pos);
Full_Cursor cursor = {};
view_compute_cursor(app, view, seek_pos(cursor_pos), &cursor);
i32 start = buffer_get_line_start(app, buffer_id, cursor.line);
i32 end = buffer_get_line_end(app, buffer_id, cursor.line) + 1;
Range range = get_line_pos_range(app, buffer, cursor.line);
range.one_past_last += 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_id, end - 1) != '\n'){
start -= 1;
if (start < 0){
start = 0;
}
buffer_get_size(app, buffer, &buffer_size);
range.one_past_last = clamp_top(range.one_past_last, buffer_size);
if (range_size(range) == 0 || buffer_get_char(app, buffer, range.end - 1) != '\n'){
range.start -= 1;
range.first = clamp_bot(0, range.first);
}
buffer_replace_range(app, buffer_id, make_range(start, end), string_u8_litexpr(""));
buffer_replace_range(app, buffer, range, string_u8_litexpr(""));
}
////////////////////////////////
@ -1559,7 +1556,7 @@ static b32
get_cpp_matching_file(Application_Links *app, Buffer_ID buffer, Buffer_ID *buffer_out){
b32 result = false;
Scratch_Block scratch(app);
String_Const_u8 file_name = buffer_push_file_name(app, buffer, scratch);
String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer);
if (file_name.size > 0){
String_Const_u8 extension = string_file_extension(file_name);
String_Const_u8 new_extensions[2] = {};
@ -1637,9 +1634,9 @@ CUSTOM_DOC("Reads a filename from surrounding '\"' characters and attempts to op
buffer_seek_delimiter_backward(app, buffer_id, pos, '"', &range.start);
range.start += 1;
String_Const_u8 quoted_name = scratch_read(app, scratch, buffer_id, range);
String_Const_u8 quoted_name = push_buffer_range(app, scratch, buffer_id, range);
String_Const_u8 file_name = buffer_push_file_name(app, buffer_id, scratch);
String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer_id);
String_Const_u8 path = string_remove_last_folder(file_name);
if (character_is_slash(string_get_character(path, path.size - 1))){
@ -1751,7 +1748,7 @@ CUSTOM_DOC("Saves the current buffer.")
view_get_buffer(app, view, AccessProtected, &buffer);
Arena *scratch = context_get_arena(app);
Temp_Memory temp = begin_temp(scratch);
String_Const_u8 file_name = buffer_push_file_name(app, buffer, scratch);
String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer);
buffer_save(app, buffer, file_name, 0);
end_temp(temp);
}

View File

@ -7,9 +7,9 @@
static String_Const_u8
push_build_directory_at_file(Application_Links *app, Arena *arena, Buffer_ID buffer){
String_Const_u8 result = {};
String_Const_u8 file_name = buffer_push_file_name(app, buffer, arena);
String_Const_u8 file_name = push_buffer_file_name(app, arena, buffer);
Temp_Memory restore_point = begin_temp(arena);
String_Const_u8 base_name = buffer_push_base_buffer_name(app, buffer, arena);
String_Const_u8 base_name = push_buffer_base_name(app, arena, buffer);
b32 is_match = string_match(file_name, base_name);
end_temp(restore_point);
if (!is_match){

View File

@ -12,7 +12,7 @@ post_buffer_range_to_clipboard(Application_Links *app, i32 clipboard_index, Buff
if (buffer != 0 && 0 <= first && first < one_past_last && one_past_last <= buffer_size){
Scratch_Block scratch(app);
Range range = make_range(first, one_past_last);
String_Const_u8 string = scratch_read(app, scratch, buffer, range);
String_Const_u8 string = push_buffer_range(app, scratch, buffer, range);
if (string.size > 0){
clipboard_post(app, clipboard_index, string);
success = true;

View File

@ -27,7 +27,7 @@ static void
lock_jump_buffer(Application_Links *app, Buffer_ID buffer_id){
Arena *scratch = context_get_arena(app);
Temp_Memory temp = begin_temp(scratch);
String_Const_u8 buffer_name = buffer_push_unique_buffer_name(app, buffer_id, scratch);
String_Const_u8 buffer_name = push_buffer_unique_name(app, scratch, buffer_id);
lock_jump_buffer(buffer_name);
end_temp(temp);
}

View File

@ -419,7 +419,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
view_compute_cursor(app, view_id, seek_pos(cursor_position), &cursor);
Fancy_String_List list = {};
String_Const_u8 unique_name = buffer_push_unique_buffer_name(app, buffer_id, scratch);
String_Const_u8 unique_name = push_buffer_unique_name(app, scratch, buffer_id);
push_fancy_string(scratch, &list, base_color, unique_name);
push_fancy_stringf(scratch, &list, base_color, " - Row: %3.d Col: %3.d -", cursor.line, cursor.character);
@ -535,7 +535,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
// NOTE(allen): Scan for TODOs and NOTEs
{
Temp_Memory temp = begin_temp(scratch);
String_Const_u8 tail = scratch_read(app, scratch, buffer_id, on_screen_range);
String_Const_u8 tail = push_buffer_range(app, scratch, buffer_id, on_screen_range);
Highlight_Record *record_first = 0;
Highlight_Record *record_last = 0;
@ -1116,7 +1116,7 @@ OPEN_FILE_HOOK_SIG(default_file_settings){
Arena *scratch = context_get_arena(app);
Temp_Memory temp = begin_temp(scratch);
String_Const_u8 file_name = buffer_push_file_name(app, buffer_id, scratch);
String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer_id);
i32 buffer_size = 0;
buffer_get_size(app, buffer_id, &buffer_size);
@ -1215,7 +1215,7 @@ OPEN_FILE_HOOK_SIG(default_file_settings){
use_lexer = true;
}
String_Const_u8 buffer_name = buffer_push_base_buffer_name(app, buffer_id, scratch);
String_Const_u8 buffer_name = push_buffer_base_name(app, scratch, buffer_id);
if (string_match(buffer_name, string_u8_litexpr("*compilation*"))){
wrap_lines = false;
}
@ -1280,7 +1280,7 @@ FILE_EDIT_FINISHED_SIG(default_file_edit_finished){
OPEN_FILE_HOOK_SIG(default_end_file){
Scratch_Block scratch(app);
String_Const_u8 buffer_name = buffer_push_unique_buffer_name(app, buffer_id, scratch);
String_Const_u8 buffer_name = push_buffer_unique_name(app, scratch, buffer_id);
String_Const_u8 str = string_u8_pushf(scratch, "Ending file: %.*s\n",
string_expand(buffer_name));
print_message(app, str);

View File

@ -11,7 +11,7 @@
// USE_OLD_STYLE_JUMPS -> use "old style" direct jumps instead of sticky jumps
// REMOVE_TRANSITION_HELPER_31 -> does not include the transition helpers for the API changes in 4.0.31
// REMOVE_OLD_STRING -> does not include the old 4coder_string.h library.
// NOTE: You may only remove "old string" if you first remove the transition helper.
// NOTE: You can only remove "old string" if you first remove the transition helper.
#define REMOVE_TRANSITION_HELPER_31
#define REMOVE_OLD_STRING
@ -60,13 +60,13 @@
#include "4coder_default_framework_variables.cpp"
#include "4coder_helper.cpp"
#include "4coder_seek.cpp"
#include "4coder_fancy.cpp"
#include "4coder_ui_helper.cpp"
#include "4coder_font_helper.cpp"
#include "4coder_config.cpp"
#include "4coder_default_framework.cpp"
#include "4coder_insertion.cpp"
#include "4coder_seek.cpp"
#include "4coder_base_commands.cpp"
#include "4coder_lists.cpp"
#include "4coder_auto_indent.cpp"

View File

@ -447,7 +447,7 @@ CUSTOM_DOC("If the cursor is found to be on the name of a function parameter in
if (token.type == CPP_TOKEN_IDENTIFIER){
Cpp_Token original_token = token;
String_Const_u8 old_lexeme = scratch_read(app, scratch, buffer, token);
String_Const_u8 old_lexeme = push_token_lexeme(app, scratch, buffer, token);
i32 proc_body_found = 0;
b32 still_looping = 0;
@ -512,7 +512,7 @@ CUSTOM_DOC("If the cursor is found to be on the name of a function parameter in
case CPP_TOKEN_IDENTIFIER:
{
if (token_ptr->size == old_lexeme.size){
String_Const_u8 other_lexeme = scratch_read(app, scratch, buffer, *token_ptr);
String_Const_u8 other_lexeme = push_token_lexeme(app, scratch, buffer, *token_ptr);
if (string_match(old_lexeme, other_lexeme)){
Buffer_Edit edit = {};
edit.str_start = 0;

View File

@ -147,7 +147,7 @@ print_positions_buffered(Application_Links *app, Buffer_Insertion *out, Function
Buffer_ID buffer = out->buffer;
String_Const_u8 buffer_name = buffer_push_unique_buffer_name(app, buffer, scratch);
String_Const_u8 buffer_name = push_buffer_unique_name(app, scratch, buffer);
for (i32 i = 0; i < positions_count; ++i){
Function_Positions *positions = &positions_array[i];
@ -155,7 +155,7 @@ print_positions_buffered(Application_Links *app, Buffer_Insertion *out, Function
i32 start_index = positions->sig_start_index;
i32 end_index = positions->sig_end_index;
i32 open_paren_pos = positions->open_paren_pos;
i32 line_number = buffer_get_line_number(app, buffer, open_paren_pos);
i32 line_number = get_line_number_from_pos(app, buffer, open_paren_pos);
Assert(end_index > start_index);
@ -183,7 +183,7 @@ print_positions_buffered(Application_Links *app, Buffer_Insertion *out, Function
}
Temp_Memory token_temp = begin_temp(scratch);
String_Const_u8 lexeme = get_token_lexeme(app, scratch, buffer, *token);
String_Const_u8 lexeme = push_token_lexeme(app, scratch, buffer, *token);
insert_string(out, lexeme);
end_temp(token_temp);

View File

@ -10,20 +10,6 @@
#endif
#if defined(CUSTOM_COMMAND_SIG)
CUSTOM_COMMAND_SIG(replace_all_occurrences);
CUSTOM_COMMAND_SIG(change_active_panel);
CUSTOM_COMMAND_SIG(change_active_panel_backwards);
CUSTOM_COMMAND_SIG(open_panel_vsplit);
CUSTOM_COMMAND_SIG(open_panel_hsplit);
CUSTOM_COMMAND_SIG(suppress_mouse);
CUSTOM_COMMAND_SIG(allow_mouse);
CUSTOM_COMMAND_SIG(toggle_mouse);
CUSTOM_COMMAND_SIG(set_mode_to_original);
CUSTOM_COMMAND_SIG(set_mode_to_notepad_like);
CUSTOM_COMMAND_SIG(toggle_highlight_line_at_cursor);
CUSTOM_COMMAND_SIG(toggle_highlight_enclosing_scopes);
CUSTOM_COMMAND_SIG(toggle_paren_matching_helper);
CUSTOM_COMMAND_SIG(toggle_fullscreen);
CUSTOM_COMMAND_SIG(remap_interactive);
CUSTOM_COMMAND_SIG(seek_whitespace_up);
CUSTOM_COMMAND_SIG(seek_whitespace_down);
CUSTOM_COMMAND_SIG(seek_beginning_of_textual_line);
@ -48,6 +34,20 @@ CUSTOM_COMMAND_SIG(backspace_word);
CUSTOM_COMMAND_SIG(delete_word);
CUSTOM_COMMAND_SIG(snipe_token_or_word);
CUSTOM_COMMAND_SIG(snipe_token_or_word_right);
CUSTOM_COMMAND_SIG(change_active_panel);
CUSTOM_COMMAND_SIG(change_active_panel_backwards);
CUSTOM_COMMAND_SIG(open_panel_vsplit);
CUSTOM_COMMAND_SIG(open_panel_hsplit);
CUSTOM_COMMAND_SIG(suppress_mouse);
CUSTOM_COMMAND_SIG(allow_mouse);
CUSTOM_COMMAND_SIG(toggle_mouse);
CUSTOM_COMMAND_SIG(set_mode_to_original);
CUSTOM_COMMAND_SIG(set_mode_to_notepad_like);
CUSTOM_COMMAND_SIG(toggle_highlight_line_at_cursor);
CUSTOM_COMMAND_SIG(toggle_highlight_enclosing_scopes);
CUSTOM_COMMAND_SIG(toggle_paren_matching_helper);
CUSTOM_COMMAND_SIG(toggle_fullscreen);
CUSTOM_COMMAND_SIG(remap_interactive);
CUSTOM_COMMAND_SIG(write_character);
CUSTOM_COMMAND_SIG(write_underscore);
CUSTOM_COMMAND_SIG(delete_char);
@ -256,20 +256,6 @@ int32_t line_number;
};
static Command_Metadata fcoder_metacmd_table[234] = {
{ 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, 806 },
{ PROC_LINKS(change_active_panel, 0), "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 206 },
{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 217 },
{ 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, 228 },
{ 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, 240 },
{ 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, 307 },
{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 313 },
{ 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, 319 },
{ PROC_LINKS(set_mode_to_original, 0), "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 325 },
{ PROC_LINKS(set_mode_to_notepad_like, 0), "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 331 },
{ 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, 337 },
{ 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, 343 },
{ 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, 349 },
{ 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, 355 },
{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 363 },
{ 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, 1041 },
{ 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, 1055 },
{ 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, 1069 },
@ -294,83 +280,97 @@ static Command_Metadata fcoder_metacmd_table[234] = {
{ 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, 1247 },
{ 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, 1253 },
{ 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, 1259 },
{ PROC_LINKS(write_character, 0), "write_character", 15, "Inserts whatever character was used to trigger this command.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 71 },
{ PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 80 },
{ 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, 87 },
{ 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, 109 },
{ PROC_LINKS(set_mark, 0), "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 133 },
{ 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, 144 },
{ 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, 157 },
{ 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, 170 },
{ 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, 188 },
{ PROC_LINKS(click_set_cursor_and_mark, 0), "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 213 },
{ PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 232 },
{ PROC_LINKS(click_set_cursor_if_lbutton, 0), "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 249 },
{ 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, 268 },
{ 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, 285 },
{ PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 361 },
{ PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 367 },
{ 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, 373 },
{ 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, 379 },
{ 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, 385 },
{ PROC_LINKS(page_up, 0), "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 399 },
{ 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, 408 },
{ 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, 419 },
{ 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, 433 },
{ 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, 447 },
{ 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, 463 },
{ 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, 483 },
{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 503 },
{ 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, 573 },
{ 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, 582 },
{ 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, 592 },
{ 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, 600 },
{ 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, 608 },
{ 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, 616 },
{ 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, 624 },
{ 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, 634 },
{ 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, 646 },
{ 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, 652 },
{ 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, 664 },
{ 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, 676 },
{ 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, 690 },
{ 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, 704 },
{ 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, 721 },
{ 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, 733 },
{ 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, 743 },
{ 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, 749 },
{ 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, 759 },
{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 769 },
{ 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, 777 },
{ 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, 1005 },
{ 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, 1011 },
{ 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, 1017 },
{ 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, 1031 },
{ 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, 1045 },
{ 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, 1166 },
{ 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, 1189 },
{ 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, 1208 },
{ 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, 1252 },
{ 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, 1277 },
{ 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, 1317 },
{ 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, 1355 },
{ 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, 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, 1421 },
{ 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, 1486 },
{ 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, 1508 },
{ 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, 1526 },
{ 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, 1622 },
{ 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, 1660 },
{ 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, 1675 },
{ 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, 1690 },
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1735 },
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1745 },
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1759 },
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1823 },
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1839 },
{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1857 },
{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1936 },
{ 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, 2046 },
{ PROC_LINKS(change_active_panel, 0), "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 206 },
{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 217 },
{ 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, 228 },
{ 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, 240 },
{ 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, 307 },
{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 313 },
{ 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, 319 },
{ PROC_LINKS(set_mode_to_original, 0), "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 325 },
{ PROC_LINKS(set_mode_to_notepad_like, 0), "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 331 },
{ 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, 337 },
{ 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, 343 },
{ 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, 349 },
{ 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, 355 },
{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 363 },
{ PROC_LINKS(write_character, 0), "write_character", 15, "Inserts whatever character was used to trigger this command.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 72 },
{ PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 81 },
{ 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, 88 },
{ 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, 110 },
{ PROC_LINKS(set_mark, 0), "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 134 },
{ 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, 145 },
{ 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, 158 },
{ 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, 171 },
{ 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, 189 },
{ PROC_LINKS(click_set_cursor_and_mark, 0), "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 214 },
{ PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 233 },
{ PROC_LINKS(click_set_cursor_if_lbutton, 0), "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 250 },
{ 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, 269 },
{ 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, 286 },
{ PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 362 },
{ PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 368 },
{ 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, 374 },
{ 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, 380 },
{ 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, 386 },
{ PROC_LINKS(page_up, 0), "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 400 },
{ 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, 409 },
{ 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, 420 },
{ 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, 434 },
{ 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, 448 },
{ 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, 464 },
{ 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, 484 },
{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 504 },
{ 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, 574 },
{ 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, 583 },
{ 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, 593 },
{ 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, 601 },
{ 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, 609 },
{ 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, 617 },
{ 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, 625 },
{ 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, 635 },
{ 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, 647 },
{ 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, 653 },
{ 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, 665 },
{ 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, 677 },
{ 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, 691 },
{ 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, 705 },
{ 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, 722 },
{ 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, 734 },
{ 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, 744 },
{ 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, 750 },
{ 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, 760 },
{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 770 },
{ 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, 778 },
{ 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, 1006 },
{ 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, 1012 },
{ 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, 1018 },
{ 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, 1032 },
{ 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, 1046 },
{ 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, 1167 },
{ 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, 1190 },
{ 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, 1209 },
{ 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, 1253 },
{ 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, 1278 },
{ 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, 1318 },
{ 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, 1356 },
{ 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, 1399 },
{ 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, 1422 },
{ 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, 1487 },
{ 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, 1509 },
{ 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, 1527 },
{ 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, 1619 },
{ 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, 1657 },
{ 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, 1672 },
{ 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, 1687 },
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1732 },
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1742 },
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1756 },
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1820 },
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1836 },
{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1854 },
{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1933 },
{ 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, 2043 },
{ PROC_LINKS(lister__quit, 0), "lister__quit", 12, "A lister mode command that quits the list without executing any actions.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 8 },
{ PROC_LINKS(lister__activate, 0), "lister__activate", 16, "A lister mode command that activates the list's action on the highlighted item.", 79, "w:\\4ed\\code\\4coder_lists.cpp", 28, 16 },
{ PROC_LINKS(lister__write_character, 0), "lister__write_character", 23, "A lister mode command that dispatches to the lister's write character handler.", 78, "w:\\4ed\\code\\4coder_lists.cpp", 28, 32 },
@ -394,21 +394,21 @@ static Command_Metadata fcoder_metacmd_table[234] = {
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 885 },
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 919 },
{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 1004 },
{ 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, 610 },
{ PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 623 },
{ 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, 637 },
{ 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, 650 },
{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\4coder_search.cpp", 29, 724 },
{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\4coder_search.cpp", 29, 731 },
{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "w:\\4ed\\code\\4coder_search.cpp", 29, 738 },
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "w:\\4ed\\code\\4coder_search.cpp", 29, 745 },
{ PROC_LINKS(list_all_locations_of_identifier, 0), "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\4coder_search.cpp", 29, 752 },
{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\4coder_search.cpp", 29, 759 },
{ PROC_LINKS(list_all_locations_of_selection, 0), "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\4coder_search.cpp", 29, 766 },
{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\4coder_search.cpp", 29, 773 },
{ PROC_LINKS(list_all_locations_of_type_definition, 0), "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "w:\\4ed\\code\\4coder_search.cpp", 29, 780 },
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "w:\\4ed\\code\\4coder_search.cpp", 29, 791 },
{ 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, 815 },
{ 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, 606 },
{ PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 619 },
{ 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, 633 },
{ 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, 646 },
{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\4coder_search.cpp", 29, 723 },
{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\4coder_search.cpp", 29, 730 },
{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "w:\\4ed\\code\\4coder_search.cpp", 29, 737 },
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "w:\\4ed\\code\\4coder_search.cpp", 29, 744 },
{ PROC_LINKS(list_all_locations_of_identifier, 0), "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\4coder_search.cpp", 29, 751 },
{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\4coder_search.cpp", 29, 758 },
{ PROC_LINKS(list_all_locations_of_selection, 0), "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\4coder_search.cpp", 29, 765 },
{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\4coder_search.cpp", 29, 772 },
{ PROC_LINKS(list_all_locations_of_type_definition, 0), "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "w:\\4ed\\code\\4coder_search.cpp", 29, 779 },
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "w:\\4ed\\code\\4coder_search.cpp", 29, 790 },
{ 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, 814 },
{ PROC_LINKS(goto_jump_at_cursor_direct, 0), "goto_jump_at_cursor_direct", 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_direct.cpp", 34, 8 },
{ 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, 36 },
{ 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, 61 },
@ -459,9 +459,9 @@ static Command_Metadata fcoder_metacmd_table[234] = {
{ PROC_LINKS(select_surrounding_scope, 0), "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 339 },
{ 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, 357 },
{ 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, 379 },
{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 478 },
{ 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, 484 },
{ 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, 718 },
{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 475 },
{ 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, 481 },
{ 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, 715 },
{ 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, 52 },
{ 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, 60 },
{ 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, 68 },
@ -491,44 +491,44 @@ static Command_Metadata fcoder_metacmd_table[234] = {
{ PROC_LINKS(write_explicit_enum_flags, 0), "write_explicit_enum_flags", 25, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.", 194, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 739 },
};
static int32_t fcoder_metacmd_ID_replace_all_occurrences = 0;
static int32_t fcoder_metacmd_ID_change_active_panel = 1;
static int32_t fcoder_metacmd_ID_change_active_panel_backwards = 2;
static int32_t fcoder_metacmd_ID_open_panel_vsplit = 3;
static int32_t fcoder_metacmd_ID_open_panel_hsplit = 4;
static int32_t fcoder_metacmd_ID_suppress_mouse = 5;
static int32_t fcoder_metacmd_ID_allow_mouse = 6;
static int32_t fcoder_metacmd_ID_toggle_mouse = 7;
static int32_t fcoder_metacmd_ID_set_mode_to_original = 8;
static int32_t fcoder_metacmd_ID_set_mode_to_notepad_like = 9;
static int32_t fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 10;
static int32_t fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 11;
static int32_t fcoder_metacmd_ID_toggle_paren_matching_helper = 12;
static int32_t fcoder_metacmd_ID_toggle_fullscreen = 13;
static int32_t fcoder_metacmd_ID_remap_interactive = 14;
static int32_t fcoder_metacmd_ID_seek_whitespace_up = 15;
static int32_t fcoder_metacmd_ID_seek_whitespace_down = 16;
static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 17;
static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 18;
static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 19;
static int32_t fcoder_metacmd_ID_seek_end_of_line = 20;
static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 21;
static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 22;
static int32_t fcoder_metacmd_ID_goto_beginning_of_file = 23;
static int32_t fcoder_metacmd_ID_goto_end_of_file = 24;
static int32_t fcoder_metacmd_ID_seek_whitespace_right = 25;
static int32_t fcoder_metacmd_ID_seek_whitespace_left = 26;
static int32_t fcoder_metacmd_ID_seek_token_right = 27;
static int32_t fcoder_metacmd_ID_seek_token_left = 28;
static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 29;
static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 30;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 31;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 32;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 33;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 34;
static int32_t fcoder_metacmd_ID_backspace_word = 35;
static int32_t fcoder_metacmd_ID_delete_word = 36;
static int32_t fcoder_metacmd_ID_snipe_token_or_word = 37;
static int32_t fcoder_metacmd_ID_snipe_token_or_word_right = 38;
static int32_t fcoder_metacmd_ID_seek_whitespace_up = 1;
static int32_t fcoder_metacmd_ID_seek_whitespace_down = 2;
static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 3;
static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 4;
static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 5;
static int32_t fcoder_metacmd_ID_seek_end_of_line = 6;
static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 7;
static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 8;
static int32_t fcoder_metacmd_ID_goto_beginning_of_file = 9;
static int32_t fcoder_metacmd_ID_goto_end_of_file = 10;
static int32_t fcoder_metacmd_ID_seek_whitespace_right = 11;
static int32_t fcoder_metacmd_ID_seek_whitespace_left = 12;
static int32_t fcoder_metacmd_ID_seek_token_right = 13;
static int32_t fcoder_metacmd_ID_seek_token_left = 14;
static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 15;
static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 16;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 17;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 18;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 19;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 20;
static int32_t fcoder_metacmd_ID_backspace_word = 21;
static int32_t fcoder_metacmd_ID_delete_word = 22;
static int32_t fcoder_metacmd_ID_snipe_token_or_word = 23;
static int32_t fcoder_metacmd_ID_snipe_token_or_word_right = 24;
static int32_t fcoder_metacmd_ID_change_active_panel = 25;
static int32_t fcoder_metacmd_ID_change_active_panel_backwards = 26;
static int32_t fcoder_metacmd_ID_open_panel_vsplit = 27;
static int32_t fcoder_metacmd_ID_open_panel_hsplit = 28;
static int32_t fcoder_metacmd_ID_suppress_mouse = 29;
static int32_t fcoder_metacmd_ID_allow_mouse = 30;
static int32_t fcoder_metacmd_ID_toggle_mouse = 31;
static int32_t fcoder_metacmd_ID_set_mode_to_original = 32;
static int32_t fcoder_metacmd_ID_set_mode_to_notepad_like = 33;
static int32_t fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 34;
static int32_t fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 35;
static int32_t fcoder_metacmd_ID_toggle_paren_matching_helper = 36;
static int32_t fcoder_metacmd_ID_toggle_fullscreen = 37;
static int32_t fcoder_metacmd_ID_remap_interactive = 38;
static int32_t fcoder_metacmd_ID_write_character = 39;
static int32_t fcoder_metacmd_ID_write_underscore = 40;
static int32_t fcoder_metacmd_ID_delete_char = 41;

View File

@ -4,22 +4,6 @@
// TOP
static String_Const_u8
push_hot_directory(Application_Links *app, Arena *arena){
String_Const_u8 result = {};
get_hot_directory(app, arena, &result);
return(result);
}
static String_Const_u8
push_4ed_path(Application_Links *app, Arena *arena){
String_Const_u8 result = {};
get_4ed_path(app, arena, &result);
return(result);
}
////////////////////////////////
static Binding_Unit*
write_unit(Bind_Helper *helper, Binding_Unit unit){
Binding_Unit *p = 0;
@ -295,6 +279,342 @@ get_key_code(char *buffer){
////////////////////////////////
static String_Const_u8
push_hot_directory(Application_Links *app, Arena *arena){
String_Const_u8 result = {};
get_hot_directory(app, arena, &result);
return(result);
}
static String_Const_u8
push_4ed_path(Application_Links *app, Arena *arena){
String_Const_u8 result = {};
get_4ed_path(app, arena, &result);
return(result);
}
static String_Const_u8
push_buffer_base_name(Application_Links *app, Arena *arena, Buffer_ID buffer){
String_Const_u8 result = {};
buffer_get_base_buffer_name(app, buffer, arena, &result);
return(result);
}
static String_Const_u8
push_buffer_unique_name(Application_Links *app, Arena *arena, Buffer_ID buffer){
String_Const_u8 result = {};
buffer_get_unique_buffer_name(app, buffer, arena, &result);
return(result);
}
static String_Const_u8
push_buffer_file_name(Application_Links *app, Arena *arena, Buffer_ID buffer){
String_Const_u8 result = {};
buffer_get_file_name(app, buffer, arena, &result);
return(result);
}
////////////////////////////////
static Range
get_view_range(Application_Links *app, View_ID view){
Range range = {};
view_get_cursor_pos(app, view, &range.first);
view_get_mark_pos(app, view, &range.one_past_last);
return(rectify(range));
}
static f32
get_view_y(Application_Links *app, View_ID view){
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
Full_Cursor cursor = {};
view_compute_cursor(app, view, seek_pos(pos), &cursor);
return(cursor.wrapped_y);
}
static f32
get_view_x(Application_Links *app, View_ID view){
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
Full_Cursor cursor = {};
view_compute_cursor(app, view, seek_pos(pos), &cursor);
return(cursor.wrapped_x);
}
static b32
is_valid_line(Application_Links *app, Buffer_ID buffer_id, i32 line){
i32 max_line = 0;
buffer_get_line_count(app, buffer_id, &max_line);
return(1 <= line && line <= max_line);
}
static b32
is_valid_line_range(Application_Links *app, Buffer_ID buffer_id, Range range){
i32 max_line = 0;
buffer_get_line_count(app, buffer_id, &max_line);
return(1 <= range.first && range.first <= range.end && range.end <= max_line);
}
static i32
get_line_number_from_pos(Application_Links *app, Buffer_ID buffer, i32 pos){
Partial_Cursor partial_cursor = {};
buffer_compute_cursor(app, buffer, seek_pos(pos), &partial_cursor);
return(partial_cursor.line);
}
static i32
character_pos_to_pos_view(Application_Links *app, View_ID view, i32 character_pos){
i32 result = 0;
Full_Cursor cursor = {};
if (view_compute_cursor(app, view, seek_character_pos(character_pos), &cursor)){
result = cursor.pos;
}
return(result);
}
static i32
character_pos_to_pos_buffer(Application_Links *app, Buffer_ID buffer, i32 character_pos){
i32 result = 0;
Partial_Cursor cursor = {};
if (buffer_compute_cursor(app, buffer, seek_character_pos(character_pos), &cursor)){
result = cursor.pos;
}
return(result);
}
static Partial_Cursor
get_line__book_end(Application_Links *app, Buffer_ID buffer, i32 line_number, i32 side){
Partial_Cursor result = {};
if (!buffer_compute_cursor(app, buffer, seek_line_char(line_number, side), &result)){
block_zero_struct(&result);
}
return(result);
}
static i32
get_line__book_end_pos(Application_Links *app, Buffer_ID buffer, i32 line_number, i32 side){
i32 pos = -1;
Partial_Cursor partial_cursor = get_line__book_end(app, buffer, line_number, side);
if (partial_cursor.line != 0){
pos = partial_cursor.pos;
}
return(pos);
}
static Partial_Cursor
get_line_start(Application_Links *app, Buffer_ID buffer, i32 line_number){
return(get_line__book_end(app, buffer, line_number, 1));
}
// NOTE(allen): The position returned has the index of the terminating newline character,
// not one past the newline character.
static Partial_Cursor
get_line_end(Application_Links *app, Buffer_ID buffer, i32 line_number){
return(get_line__book_end(app, buffer, line_number, -1));
}
static i32
get_line_start_pos(Application_Links *app, Buffer_ID buffer, i32 line_number){
return(get_line__book_end_pos(app, buffer, line_number, 1));
}
// NOTE(allen): The position returned has the index of the terminating newline character,
// not one past the newline character.
static i32
get_line_end_pos(Application_Links *app, Buffer_ID buffer, i32 line_number){
return(get_line__book_end_pos(app, buffer, line_number, -1));
}
// NOTE(allen): The range returned does not include the terminating newline character
static Range_Partial_Cursor
get_line_range(Application_Links *app, Buffer_ID buffer, i32 line_number){
b32 success = false;
Range_Partial_Cursor result = {};
result.begin = get_line_start(app, buffer, line_number);
if (result.begin.line != 0){
result.end = get_line_end(app, buffer, line_number);
if (result.end.line != 0){
success = true;
}
}
if (!success){
block_zero_struct(&result);
}
return(result);
}
// NOTE(allen): The range returned does not include the terminating newline character
static Range
get_line_pos_range(Application_Links *app, Buffer_ID buffer, i32 line_number){
Range_Partial_Cursor range = get_line_range(app, buffer, line_number);
Range result = {};
if (range.begin.line != 0 && range.end.line != 0){
result = make_range(range.begin.pos, range.end.pos);
}
return(result);
}
static Range
make_range_from_cursors(Range_Partial_Cursor range){
return(make_range(range.begin.pos, range.end.pos));
}
static Cpp_Token*
get_first_token_from_pos(Cpp_Token_Array tokens, i32 pos){
Cpp_Get_Token_Result get_token = cpp_get_token(tokens, pos);
if (get_token.in_whitespace_after_token){
get_token.token_index += 1;
}
Cpp_Token *result = 0;
if (get_token.token_index < tokens.count){
result = tokens.tokens + get_token.token_index;
}
return(result);
}
static Cpp_Token*
get_first_token_from_line(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array tokens, i32 line){
i32 line_start = get_line_start_pos(app, buffer, line);
return(get_first_token_from_pos(tokens, line_start));
}
////////////////////////////////
static Range
get_line_range_from_pos_range(Application_Links *app, Buffer_ID buffer, Range pos_range){
Range line_range = {};
line_range.first = get_line_number_from_pos(app, buffer, pos_range.first);
if (line_range.first != 0){
line_range.end = get_line_number_from_pos(app, buffer, pos_range.one_past_last);
if (line_range.end == 0){
line_range.first = 0;
}
}
return(line_range);
}
// NOTE(allen): The end of the returned range does not include the terminating newline character of
// the last line.
static Range
get_pos_range_from_line_range(Application_Links *app, Buffer_ID buffer, Range line_range){
Range pos_range = {};
if (is_valid_line_range(app, buffer, line_range)){
pos_range.first = get_line_start_pos(app, buffer, line_range.first);
pos_range.one_past_last = get_line_end_pos(app, buffer, line_range.end);
}
return(pos_range);
}
static Range
pos_range_enclose_whole_lines(Application_Links *app, Buffer_ID buffer, Range range){
Range line_range = get_line_range_from_pos_range(app, buffer, range);
return(get_pos_range_from_line_range(app, buffer, line_range));
}
static Range
pos_range_enclose_whole_tokens(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array tokens, Range range){
if (range_size(range) > 0){
if (tokens.count > 0){
Cpp_Token *first_token = get_first_token_from_pos(tokens, range.first);
if (first_token != 0 && first_token->start < range.first){
range.first = first_token->start;
}
Cpp_Token *last_token = get_first_token_from_pos(tokens, range.one_past_last - 1);
if (last_token != 0 && last_token->start < range.one_past_last){
range.one_past_last = last_token->start + last_token->size;
}
}
}
return(range);
}
// NOTE(allen): range enclose operators:
// enclose whole *** ?
////////////////////////////////
static String_Const_u8
push_buffer_range(Application_Links *app, Arena *arena, Buffer_ID buffer, umem first, umem one_past_last){
String_Const_u8 result = {};
if (first <= one_past_last){
umem length = one_past_last - first;
Temp_Memory restore_point = begin_temp(arena);
u8 *memory = push_array(arena, u8, length);
if (buffer_read_range(app, buffer, (i32)first, (i32)one_past_last, (char*)memory)){
result = SCu8(memory, length);
}
else{
end_temp(restore_point);
}
}
return(result);
}
static String_Const_u8
push_buffer_range(Application_Links *app, Arena *arena, Buffer_ID buffer, Range range){
return(push_buffer_range(app, arena, buffer, range.first, range.one_past_last));
}
static String_Const_u8
push_buffer_range(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_umem range){
return(push_buffer_range(app, arena, buffer, range.first, range.one_past_last));
}
static String_Const_u8
push_token_lexeme(Application_Links *app, Arena *arena, Buffer_ID buffer, Cpp_Token token){
return(push_buffer_range(app, arena, buffer, token.start, token.start + token.size));
}
static String_Const_u8
push_buffer_line(Application_Links *app, Arena *arena, Buffer_ID buffer, i32 line_number){
return(push_buffer_range(app, arena, buffer, get_line_pos_range(app, buffer, line_number)));
}
static String_Const_u8
push_entire_buffer(Application_Links *app, Arena *arena, Buffer_ID buffer){
i32 size = 0;
buffer_get_size(app, buffer, &size);
return(push_buffer_range(app, arena, buffer, 0, size));
}
static String_Const_u8
push_string_in_view_range(Application_Links *app, Arena *arena, View_ID view){
Buffer_ID buffer = 0;
view_get_buffer(app, view, AccessProtected, &buffer);
return(push_buffer_range(app, arena, buffer, get_view_range(app, view)));
}
////////////////////////////////
static b32
buffer_has_name_with_star(Application_Links *app, Buffer_ID buffer){
Scratch_Block scratch(app);
String_Const_u8 str = push_buffer_unique_name(app, scratch, buffer);
return(str.size > 0 && str.str[0] == '*');
}
static char
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 = ' ';
if (0 <= pos && pos < buffer_size){
buffer_read_range(app, buffer_id, pos, pos + 1, &result);
}
return(result);
}
static b32
token_lexeme_string_match(Application_Links *app, Buffer_ID buffer, Cpp_Token token, String_Const_u8 b){
Scratch_Block scratch(app);
return(string_match(push_token_lexeme(app, scratch, buffer, token), b));
}
////////////////////////////////
static i32
round_down(i32 x, i32 b){
i32 r = 0;
@ -436,16 +756,7 @@ query_user_number(Application_Links *app, Query_Bar *bar){
return(query_user_general(app, bar, true));
}
static char
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 = ' ';
if (pos < buffer_size){
buffer_read_range(app, buffer_id, pos, pos + 1, &result);
}
return(result);
}
////////////////////////////////
static Buffer_Identifier
buffer_identifier(char *str, i32 len){
@ -470,6 +781,47 @@ buffer_identifier(Buffer_ID id){
return(identifier);
}
static Buffer_ID
buffer_identifier_to_id(Application_Links *app, Buffer_Identifier identifier){
Buffer_ID id = 0;
if (identifier.id != 0){
id = identifier.id;
}
else{
String_Const_u8 name = SCu8(identifier.name, identifier.name_len);
get_buffer_by_name(app, name, AccessAll, &id);
if (id == 0){
get_buffer_by_file_name(app, name, AccessAll, &id);
}
}
return(id);
}
static Buffer_ID
buffer_identifier_to_id_create_out_buffer(Application_Links *app, Buffer_Identifier buffer_id){
Buffer_ID result = 0;
if (buffer_id.name != 0 && buffer_id.name_len > 0){
String_Const_u8 buffer_name = SCu8(buffer_id.name, buffer_id.name_len);
Buffer_ID buffer_attach_id = 0;
if (get_buffer_by_name(app, buffer_name, AccessAll, &buffer_attach_id)){
result = buffer_attach_id;
}
else{
if (create_buffer(app, buffer_name, BufferCreate_AlwaysNew|BufferCreate_NeverAttachToFile, &buffer_attach_id)){
buffer_set_setting(app, buffer_attach_id, BufferSetting_ReadOnly, true);
buffer_set_setting(app, buffer_attach_id, BufferSetting_Unimportant, true);
result = buffer_attach_id;
}
}
}
else{
result = buffer_id.id;
}
return(result);
}
////////////////////////////////
static void
adjust_all_buffer_wrap_widths(Application_Links *app, i32 wrap_width, i32 min_base_width){
Buffer_ID buffer = 0;
@ -548,45 +900,6 @@ open_file(Application_Links *app, Buffer_ID *buffer_out, String_Const_u8 file_na
return(result);
}
static Buffer_ID
buffer_identifier_to_id(Application_Links *app, Buffer_Identifier identifier){
Buffer_ID id = 0;
if (identifier.id != 0){
id = identifier.id;
}
else{
String_Const_u8 name = SCu8(identifier.name, identifier.name_len);
get_buffer_by_name(app, name, AccessAll, &id);
if (id == 0){
get_buffer_by_file_name(app, name, AccessAll, &id);
}
}
return(id);
}
static Buffer_ID
buffer_identifier_to_id_create_out_buffer(Application_Links *app, Buffer_Identifier buffer_id){
Buffer_ID result = 0;
if (buffer_id.name != 0 && buffer_id.name_len > 0){
String_Const_u8 buffer_name = SCu8(buffer_id.name, buffer_id.name_len);
Buffer_ID buffer_attach_id = 0;
if (get_buffer_by_name(app, buffer_name, AccessAll, &buffer_attach_id)){
result = buffer_attach_id;
}
else{
if (create_buffer(app, buffer_name, BufferCreate_AlwaysNew|BufferCreate_NeverAttachToFile, &buffer_attach_id)){
buffer_set_setting(app, buffer_attach_id, BufferSetting_ReadOnly, true);
buffer_set_setting(app, buffer_attach_id, BufferSetting_Unimportant, true);
result = buffer_attach_id;
}
}
}
else{
result = buffer_id.id;
}
return(result);
}
static b32
view_open_file(Application_Links *app, View_ID view, String_Const_u8 file_name, b32 never_new){
b32 result = false;
@ -635,195 +948,6 @@ kill_buffer(Application_Links *app, Buffer_Identifier identifier, View_ID gui_vi
return(result);
}
static i32
character_pos_to_pos(Application_Links *app, View_ID view, i32 character_pos){
i32 result = 0;
Full_Cursor cursor = {};
if (view_compute_cursor(app, view, seek_character_pos(character_pos), &cursor)){
result = cursor.pos;
}
return(result);
}
static f32
get_view_y(Application_Links *app, View_ID view){
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
Full_Cursor cursor = {};
view_compute_cursor(app, view, seek_pos(pos), &cursor);
return(cursor.wrapped_y);
}
static f32
get_view_x(Application_Links *app, View_ID view){
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
Full_Cursor cursor = {};
view_compute_cursor(app, view, seek_pos(pos), &cursor);
return(cursor.wrapped_x);
}
static Range
get_view_range(Application_Links *app, View_ID view){
Range range = {};
view_get_cursor_pos(app, view, &range.first);
view_get_mark_pos(app, view, &range.one_past_last);
return(rectify(range));
}
static String_Const_u8
buffer_read_string(Application_Links *app, Buffer_ID buffer, Range range, void *dest){
String_Const_u8 result = {};
if (dest != 0 && buffer_read_range(app, buffer, range.start, range.end, (char*)dest)){
result = SCu8((u8*)dest, get_width(range));
}
return(result);
}
static b32
is_valid_line(Application_Links *app, Buffer_ID buffer_id, i32 line){
i32 max_line = 0;
buffer_get_line_count(app, buffer_id, &max_line);
return(1 <= line && line <= max_line);
}
static Range_Partial_Cursor
get_line_range(Application_Links *app, Buffer_ID buffer_id, i32 line){
Range_Partial_Cursor result = {};
b32 success = (buffer_compute_cursor(app, buffer_id, seek_line_char(line, 1), &result.begin) &&
buffer_compute_cursor(app, buffer_id, seek_line_char(line, -1), &result.end) &&
result.begin.line == line);
if (!success){
block_zero_struct(&result);
}
return(result);
}
static Range_umem
make_range_from_cursors(Range_Partial_Cursor range){
return(make_range_umem(range.begin.pos, range.end.pos));
}
static String_Const_u8
scratch_read(Application_Links *app, Arena *arena, Buffer_ID buffer, umem start, umem end){
String_Const_u8 result = {};
if (start <= end){
umem length = end - start;
u8 *memory = push_array(arena, u8, length);
if (buffer_read_range(app, buffer, (i32)start, (i32)end, (char*)memory)){
result = SCu8(memory, length);
}
}
return(result);
}
static String_Const_u8
scratch_read(Application_Links *app, Arena *arena, Buffer_ID buffer, Range range){
return(scratch_read(app, arena, buffer, range.first, range.one_past_last));
}
static String_Const_u8
scratch_read(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_umem range){
return(scratch_read(app, arena, buffer, range.first, range.one_past_last));
}
static String_Const_u8
scratch_read(Application_Links *app, Arena *arena, Buffer_ID buffer, Cpp_Token token){
return(scratch_read(app, arena, buffer, token.start, token.start + token.size));
}
static String_Const_u8
scratch_read_line(Application_Links *app, Arena *arena, Buffer_ID buffer, i32 line){
Range_umem range = make_range_from_cursors(get_line_range(app, buffer, line));
return(scratch_read(app, arena, buffer, range));
}
static String_Const_u8
token_get_lexeme(Application_Links *app, Arena *arena, Buffer_ID buffer, Cpp_Token token){
return(scratch_read(app, arena, buffer, token.start, token.start + token.size));
}
static String_Const_u8
get_token_lexeme(Application_Links *app, Arena *arena, Buffer_ID buffer, Cpp_Token token){
return(scratch_read(app, arena, buffer, token.start, token.start + token.size));
}
static b32
token_match(Application_Links *app, Buffer_ID buffer, Cpp_Token token, String_Const_u8 b){
Arena *scratch = context_get_arena(app);
Temp_Memory temp = begin_temp(scratch);
String_Const_u8 a = scratch_read(app, scratch, buffer, token.start, token.start + token.size);
b32 result = string_match(a, b);
end_temp(temp);
return(result);
}
static String_Const_u8
read_entire_buffer(Application_Links *app, Buffer_ID buffer_id, Arena *scratch){
i32 size = 0;
buffer_get_size(app, buffer_id, &size);
return(scratch_read(app, scratch, buffer_id, 0, size));
}
static i32
buffer_get_line_number(Application_Links *app, Buffer_ID buffer, i32 pos){
Partial_Cursor partial_cursor = {};
buffer_compute_cursor(app, buffer, seek_pos(pos), &partial_cursor);
return(partial_cursor.line);
}
static i32
view_get_line_number(Application_Links *app, View_ID view, i32 pos){
Full_Cursor cursor = {};
view_compute_cursor(app, view, seek_pos(pos), &cursor);
return(cursor.line);
}
static i32
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_id, seek_line_char(line, 1), &partial_cursor);
result = partial_cursor.pos;
}
return(result);
}
static i32
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_id, seek_line_char(line, -1), &partial_cursor);
result = partial_cursor.pos;
}
return(result);
}
static Cpp_Token*
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 void
@ -1145,21 +1269,6 @@ get_query_string(Application_Links *app, char *query_str, char *string_space, i3
return(bar.string);
}
static String_Const_u8
get_string_in_view_range(Application_Links *app, Arena *arena, View_ID view){
String_Const_u8 result = {};
Buffer_ID buffer = 0;
view_get_buffer(app, view, AccessProtected, &buffer);
if (buffer_exists(app, buffer)){
Range range = get_view_range(app, view);
umem query_length = range.max - range.min;
if (query_length > 0){
result = scratch_read(app, arena, buffer, range.first, range.one_past_last);
}
}
return(result);
}
static String_Const_u8
get_token_or_word_under_pos(Application_Links *app, Arena *arena, Buffer_ID buffer, umem pos){
String_Const_u8 result = {};
@ -1168,7 +1277,7 @@ get_token_or_word_under_pos(Application_Links *app, Arena *arena, Buffer_ID buff
if (success && !get_result.in_whitespace_after_token){
umem size = get_result.token_one_past_last - get_result.token_start;
if (0 < size){
result = scratch_read(app, arena, buffer, get_result.token_start, get_result.token_one_past_last);
result = push_buffer_range(app, arena, buffer, get_result.token_start, get_result.token_one_past_last);
}
}
return(result);
@ -1517,69 +1626,6 @@ split_rect(f32_Rect rect, View_Split_Kind kind, Coordinate coord, Side from_side
return(result);
}
////////////////////////////////
static String_Const_u8
buffer_push_base_buffer_name(Application_Links *app, Buffer_ID buffer, Arena *arena){
String_Const_u8 result = {};
buffer_get_base_buffer_name(app, buffer, arena, &result);
return(result);
}
static String_Const_u8
buffer_push_unique_buffer_name(Application_Links *app, Buffer_ID buffer, Arena *arena){
String_Const_u8 result = {};
buffer_get_unique_buffer_name(app, buffer, arena, &result);
return(result);
}
static String_Const_u8
buffer_push_file_name(Application_Links *app, Buffer_ID buffer, Arena *arena){
String_Const_u8 result = {};
buffer_get_file_name(app, buffer, arena, &result);
return(result);
}
static String_Const_u8
buffer_limited_base_buffer_name(Application_Links *app, Buffer_ID buffer, char *memory, i32 max){
Scratch_Block scratch(app);
String_Const_u8 full = {};
buffer_get_base_buffer_name(app, buffer, scratch, &full);
i32 length = clamp_top((i32)full.size, max);
block_copy(memory, full.str, length);
return(SCu8(memory, length));
}
static String_Const_u8
buffer_limited_unique_buffer_name(Application_Links *app, Buffer_ID buffer, char *memory, i32 max){
Scratch_Block scratch(app);
String_Const_u8 full = {};
buffer_get_unique_buffer_name(app, buffer, scratch, &full);
i32 length = clamp_top((i32)full.size, max);
block_copy(memory, full.str, length);
return(SCu8(memory, length));
}
static String_Const_u8
buffer_limited_file_name(Application_Links *app, Buffer_ID buffer, char *memory, i32 max){
Scratch_Block scratch(app);
String_Const_u8 full = {};
buffer_get_file_name(app, buffer, scratch, &full);
i32 length = clamp_top((i32)full.size, max);
block_copy(memory, full.str, length);
return(SCu8(memory, length));
}
////////////////////////////////
static b32
buffer_has_name_with_star(Application_Links *app, Buffer_ID buffer){
char first = 0;
String_Const_u8 str = buffer_limited_unique_buffer_name(app, buffer, &first, 1);
return(str.size == 0 || first == '*');
}
////////////////////////////////
static f32

View File

@ -102,31 +102,11 @@ insertc(Buffer_Insertion *insertion, char C){
static b32
insert_line_from_buffer(Buffer_Insertion *insertion, Buffer_ID buffer_id, i32 line, i32 truncate_at){
Scratch_Block scratch(insertion->app);
Partial_Cursor begin = {};
Partial_Cursor end = {};
b32 success = false;
if (buffer_compute_cursor(insertion->app, buffer_id, seek_line_char(line, 1), &begin)){
if (buffer_compute_cursor(insertion->app, buffer_id, seek_line_char(line, -1), &end)){
if (begin.line == line){
i32 buffer_size = 0;
buffer_get_size(insertion->app, buffer_id, &buffer_size);
if (0 <= begin.pos && begin.pos <= end.pos && end.pos <= buffer_size){
i32 size = (end.pos - begin.pos);
if (truncate_at && (size > truncate_at)){
size = truncate_at;
}
String_Const_u8 string = scratch_read(insertion->app, scratch, buffer_id, begin.pos, end.pos);
insert_string(insertion, string);
success = true;
}
}
}
b32 success = is_valid_line(insertion->app, buffer_id, line);
if (success){
Scratch_Block scratch(insertion->app);
insert_string(insertion, push_buffer_line(insertion->app, scratch, buffer_id, line));
}
return(success);
}

View File

@ -76,7 +76,7 @@ open_jump_lister(Application_Links *app, Heap *heap, View_ID ui_view, Buffer_ID
for (i32 i = 0; i < option_count; i += 1){
Sticky_Jump_Stored stored = {};
managed_object_load_data(app, stored_jumps, i, 1, &stored);
String_Const_u8 line = scratch_read_line(app, scratch, list_buffer_id, stored.list_line);
String_Const_u8 line = push_buffer_line(app, scratch, list_buffer_id, stored.list_line);
options[i].string = line;
memset(&options[i].status, 0, sizeof(options[i].status));
options[i].user_data = IntAsPtr(i);

View File

@ -54,7 +54,7 @@ parse_buffer_to_jump_array(Application_Links *app, Arena *arena, Buffer_ID buffe
{
Scratch_Block line_auto_closer(arena);
if (is_valid_line(app, buffer, line)){
String_Const_u8 line_str = scratch_read_line(app, arena, buffer, line);
String_Const_u8 line_str = push_buffer_line(app, arena, buffer, line);
Parsed_Jump parsed_jump = parse_jump_location(line_str);
if (parsed_jump.success){
Buffer_ID jump_buffer = {};
@ -109,7 +109,7 @@ init_marker_list(Application_Links *app, Heap *heap, Buffer_ID buffer, Marker_Li
Arena *scratch = context_get_arena(app);
Temp_Memory temp = begin_temp(scratch);
String_Const_u8 buffer_name = buffer_push_base_buffer_name(app, buffer, scratch);
String_Const_u8 buffer_name = push_buffer_base_name(app, scratch, buffer);
b32 is_compilation_buffer = string_match(buffer_name, string_u8_litexpr("*compilation*"));
Sticky_Jump_Array jumps = parse_buffer_to_jump_array(app, scratch, buffer);

View File

@ -197,7 +197,7 @@ parse_jump_location(String_Const_u8 line, Jump_Flag flags){
static Parsed_Jump
parse_jump_from_buffer_line(Application_Links *app, Arena *arena, Buffer_ID buffer_id, i32 line, Jump_Flag flags){
Parsed_Jump jump = {};
String_Const_u8 line_str = scratch_read_line(app, arena, buffer_id, line);
String_Const_u8 line_str = push_buffer_line(app, arena, buffer_id, line);
if (line_str.size > 0){
jump = parse_jump_location(line_str, flags);
}
@ -274,7 +274,7 @@ seek_next_jump_in_buffer(Application_Links *app, Arena *arena,
i32 line = first_line;
for (;;){
if (is_valid_line(app, buffer_id, line)){
String_Const_u8 line_str = scratch_read_line(app, arena, buffer_id, line);
String_Const_u8 line_str = push_buffer_line(app, arena, buffer_id, line);
jump = parse_jump_location(line_str, flags);
if (jump.success){
break;

View File

@ -477,7 +477,7 @@ generate_all_buffers_list__output_buffer(Application_Links *app, Lister *lister,
}
Arena *scratch = context_get_arena(app);
Temp_Memory temp = begin_temp(scratch);
String_Const_u8 buffer_name = buffer_push_unique_buffer_name(app, buffer, scratch);
String_Const_u8 buffer_name = push_buffer_unique_name(app, scratch, buffer);
lister_add_item(lister, buffer_name, status, IntAsPtr(buffer), 0);
end_temp(temp);
}
@ -665,7 +665,7 @@ activate_confirm_kill(Application_Links *app, Heap *heap, View_ID view, Lister_S
{
Arena *scratch = context_get_arena(app);
Temp_Memory temp = begin_temp(scratch);
String_Const_u8 file_name = buffer_push_file_name(app, buffer_id, scratch);
String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer_id);
if (buffer_save(app, buffer_id, file_name, BufferSave_IgnoreDirtyFlag)){
buffer_kill(app, buffer_id, BufferKill_AlwaysKill, 0);
}

View File

@ -81,7 +81,7 @@ get_numeric_at_cursor(Application_Links *app, Buffer_ID buffer, i32 pos, Miblo_N
Range range = get_numeric_string_at_cursor(app, buffer, pos);
if (range_size(range) > 0){
Scratch_Block scratch(app);
String_Const_u8 str = scratch_read(app, scratch, buffer, range);
String_Const_u8 str = push_buffer_range(app, scratch, buffer, range);
if (str.size > 0){
i32 x = (i32)string_to_integer(str, 10);
info->range = range;
@ -286,7 +286,7 @@ get_timestamp_at_cursor(Application_Links *app, Buffer_ID buffer, i32 pos, Miblo
Range time_stamp_range = get_timestamp_string_at_cursor(app, buffer, pos);
if (range_size(time_stamp_range) > 0){
String_Const_u8 string = scratch_read(app, scratch, buffer, time_stamp_range);
String_Const_u8 string = push_buffer_range(app, scratch, buffer, time_stamp_range);
if (string.size > 0){
i32 count_colons = 0;
for (umem i = 0; i < string.size; ++i){

View File

@ -43,7 +43,7 @@ close_all_files_with_extension(Application_Links *app, String_Const_u8_Array ext
if (extension_array.count > 0){
Temp_Memory name_temp = begin_temp(scratch);
String_Const_u8 file_name = buffer_push_file_name(app, buffer, scratch);
String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer);
is_match = false;
if (file_name.size > 0){
String_Const_u8 extension = string_file_extension(file_name);

View File

@ -407,13 +407,12 @@ place_begin_and_end_on_own_lines(Application_Links *app, char *begin, char *end)
Range lines = {};
Range range = get_view_range(app, 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);
lines.min = get_line_number_from_pos(app, buffer, range.min);
lines.max = get_line_number_from_pos(app, buffer, range.max);
range.min = get_line_start_pos(app, buffer, lines.min);
range.max = get_line_end_pos(app, buffer, lines.max);
Arena *scratch = context_get_arena(app);
Temp_Memory temp = begin_temp(scratch);
Scratch_Block scratch(app);
b32 min_line_blank = buffer_line_is_blank(app, buffer, lines.min);
b32 max_line_blank = buffer_line_is_blank(app, buffer, lines.max);
@ -471,8 +470,6 @@ place_begin_and_end_on_own_lines(Application_Links *app, char *begin, char *end)
view_set_cursor(app, view, seek_pos(center_pos), true);
view_set_mark(app, view, seek_pos(center_pos));
}
end_temp(temp);
}
CUSTOM_COMMAND_SIG(place_in_scope)
@ -741,7 +738,7 @@ CUSTOM_DOC("If a scope is currently selected, and a statement or block statement
Scratch_Block scratch(app);
Range range = {};
if (find_whole_statement_down(app, buffer, bottom, &range.start, &range.end)){
String_Const_u8 base_string = scratch_read(app, scratch, buffer, range);
String_Const_u8 base_string = push_buffer_range(app, scratch, buffer, range);
String_Const_u8 string = string_skip_chop_whitespace(base_string);
i32 newline_count = 0;

View File

@ -610,10 +610,9 @@ list__parameters_buffer(Application_Links *app, Heap *heap,
prev_match_id = match.buffer;
}
Temp_Memory line_temp = begin_temp(scratch);
String_Const_u8 file_name = buffer_push_file_name(app, match.buffer, scratch);
String_Const_u8 full_line_str = scratch_read_line(app, scratch, match.buffer, word_pos.line);
String_Const_u8 file_name = push_buffer_file_name(app, scratch, match.buffer);
String_Const_u8 full_line_str = push_buffer_line(app, scratch, match.buffer, word_pos.line);
if (full_line_str.size > 0){
String_Const_u8 line_str = string_skip_chop_whitespace(full_line_str);
insertf(&out, "%.*s:%d:%d: %.*s\n", string_expand(file_name), word_pos.line, word_pos.character, string_expand(line_str));
@ -690,7 +689,7 @@ list_selected_range__parameters(Application_Links *app, Heap *heap, b32 substrin
get_active_view(app, AccessProtected, &view);
Arena *scratch = context_get_arena(app);
Temp_Memory temp = begin_temp(scratch);
String_Const_u8 str = get_string_in_view_range(app, scratch, view);
String_Const_u8 str = push_string_in_view_range(app, scratch, view);
if (str.size > 0){
list_single__parameters(app, heap, str, substrings, case_insensitive, default_target_view);
}

View File

@ -4,6 +4,7 @@
// TOP
// TODO(allen): This seems suspiciously, overkilling, redundant.
static i32
seek_line_end(Application_Links *app, Buffer_ID buffer_id, i32 pos){
i32 buffer_size = 0;
@ -31,6 +32,7 @@ seek_line_end(Application_Links *app, Buffer_ID buffer_id, i32 pos){
return(pos);
}
// TODO(allen): This seems suspiciously, overkilling, redundant.
static i32
seek_line_beginning(Application_Links *app, Buffer_ID buffer_id, i32 pos){
char chunk[1024];
@ -921,21 +923,19 @@ buffer_line_is_blank(Application_Links *app, Buffer_ID buffer_id, i32 line){
static String_Const_u8
read_identifier_at_pos(Application_Links *app, Arena *arena, Buffer_ID buffer_id, i32 pos, Range *range_out){
String_Const_u8 result = {};
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_id, pos);
start = buffer_seek_alphanumeric_or_underscore_left(app, buffer_id, end);
}
String_Const_u8 result = {};
if (start <= pos && pos < end){
if (range_out != 0){
*range_out = make_range(start, end);
}
result = scratch_read(app, arena, buffer_id, start, end);
result = push_buffer_range(app, arena, buffer_id, start, end);
}
return(result);