More progress shifting off of View_Summary

This commit is contained in:
Allen Webster 2019-04-06 14:13:49 -07:00
parent 88df8a4fb2
commit bcec902ce2
15 changed files with 620 additions and 540 deletions

View File

@ -105,9 +105,7 @@ seek_line_beginning(Application_Links *app, Buffer_Summary *buffer, i32 pos){
static void
move_past_lead_whitespace(Application_Links *app, View_Summary *view, Buffer_Summary *buffer){
if (view != 0 && buffer != 0){
move_past_lead_whitespace(app, view, buffer->buffer_id);
}
move_past_lead_whitespace(app, view!=0?0:view->view_id, buffer!=0?0:buffer->buffer_id);
}
static i32
@ -259,27 +257,22 @@ buffer_boundary_seek(Application_Links *app, Buffer_Summary *buffer, i32 start_p
static void
view_buffer_boundary_seek_set_pos(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 dir, u32 flags){
if (buffer != 0){
view_buffer_boundary_seek_set_pos(app, view, buffer->buffer_id, dir, flags);
}
view_buffer_boundary_seek_set_pos(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id, dir, flags);
}
static void
view_boundary_seek_set_pos(Application_Links *app, View_Summary *view, i32 dir, u32 flags){
view_boundary_seek_set_pos(app, view==0?0:view->view_id, dir, flags);
}
static Range
view_buffer_boundary_range(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 dir, u32 flags){
Range result = {};
if (buffer != 0){
result = view_buffer_boundary_range(app, view, buffer->buffer_id, dir, flags);
}
return(result);
return(view_buffer_boundary_range(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id, dir, flags));
}
static Range
view_buffer_snipe_range(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 dir, u32 flags){
Range result = {};
if (buffer != 0){
result = view_buffer_snipe_range(app, view, buffer->buffer_id, dir, flags);
}
return(result);
return(view_buffer_snipe_range(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id, dir, flags));
}
static void
@ -439,7 +432,7 @@ list_all_functions(Application_Links *app, Partition *part, Buffer_Summary *opti
static i32
get_start_of_line_at_cursor(Application_Links *app, View_Summary *view, Buffer_Summary *buffer){
return(buffer==0?0:get_start_of_line_at_cursor(app, view, buffer->buffer_id));
return(get_start_of_line_at_cursor(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id));
}
static b32
@ -449,9 +442,7 @@ c_line_comment_starts_at_position(Application_Links *app, Buffer_Summary *buffer
static void
write_string(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, String string){
if (buffer != 0){
write_string(app, view, buffer->buffer_id, string);
}
write_string(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id, string);
}
static b32
@ -642,6 +633,11 @@ activate_snippet(Application_Links *app, Partition *scratch, Heap *heap, View_Su
activate_snippet(app, scratch, heap, view==0?0:view->view_id, state, text_field, user_data, activated_by_mouse);
}
static void
view_set_to_region(Application_Links *app, View_Summary *view, i32 major_pos, i32 minor_pos, f32 normalized_threshold){
view_set_to_region(app, view==0?0:view->view_id, major_pos, minor_pos, normalized_threshold);
}
#endif
// BOTTOM

View File

@ -612,9 +612,10 @@ buffer_auto_indent(Application_Links *app, Buffer_ID buffer, i32 start, i32 end,
CUSTOM_COMMAND_SIG(auto_tab_whole_file)
CUSTOM_DOC("Audo-indents the entire current buffer.")
{
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
i32 buffer_size = 0;
buffer_get_size(app, buffer, &buffer_size);
buffer_auto_indent(app, &global_part, buffer, 0, buffer_size, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens);
@ -623,38 +624,45 @@ CUSTOM_DOC("Audo-indents the entire current buffer.")
CUSTOM_COMMAND_SIG(auto_tab_line_at_cursor)
CUSTOM_DOC("Auto-indents the line on which the cursor sits.")
{
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
buffer_auto_indent(app, &global_part, buffer, view.cursor.pos, view.cursor.pos, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens);
move_past_lead_whitespace(app, &view, buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
buffer_auto_indent(app, &global_part, buffer, pos, pos, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens);
move_past_lead_whitespace(app, view, buffer);
}
CUSTOM_COMMAND_SIG(auto_tab_range)
CUSTOM_DOC("Auto-indents the range between the cursor and the mark.")
{
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
Range range = get_view_range(&view);
view_get_buffer(app, view, AccessOpen, &buffer);
Range range = get_view_range(app, view);
buffer_auto_indent(app, &global_part, buffer, range.min, range.max, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens);
move_past_lead_whitespace(app, &view, buffer);
move_past_lead_whitespace(app, view, buffer);
}
CUSTOM_COMMAND_SIG(write_and_auto_tab)
CUSTOM_DOC("Inserts a character and auto-indents the line on which the cursor sits.")
{
exec_command(app, write_character);
View_Summary view = get_active_view(app, AccessOpen);
write_character(app);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
u32 flags = DEFAULT_INDENT_FLAGS;
User_Input in = get_command_input(app);
if (in.key.character == '\n'){
flags |= AutoIndent_ExactAlignBlock;
}
buffer_auto_indent(app, &global_part, buffer, view.cursor.pos, view.cursor.pos, DEF_TAB_WIDTH, flags);
move_past_lead_whitespace(app, &view, buffer);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
buffer_auto_indent(app, &global_part, buffer, pos, pos, DEF_TAB_WIDTH, flags);
move_past_lead_whitespace(app, view, buffer);
}
// BOTTOM

View File

@ -147,7 +147,7 @@ CUSTOM_DOC("Deletes the text in the range between the cursor and the mark.")
View_Summary view = get_active_view(app, AccessOpen);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
Range range = get_view_range(&view);
Range range = get_view_range(app, view.view_id);
buffer_replace_range(app, buffer, range, make_lit_string(""));
}
@ -412,7 +412,7 @@ CUSTOM_DOC("Converts all ascii text in the range between the cursor and the mark
View_Summary view = get_active_view(app, AccessOpen);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
Range range = get_view_range(&view);
Range range = get_view_range(app, view.view_id);
i32 size = range.max - range.min;
if (size <= app->memory_size){
char *mem = (char*)app->memory;
@ -431,7 +431,7 @@ CUSTOM_DOC("Converts all ascii text in the range between the cursor and the mark
View_Summary view = get_active_view(app, AccessOpen);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
Range range = get_view_range(&view);
Range range = get_view_range(app, view.view_id);
i32 size = range.max - range.min;
if (size <= app->memory_size){
char *mem = (char*)app->memory;
@ -982,7 +982,7 @@ CUSTOM_DOC("Queries the user for two strings, and replaces all occurences of the
Buffer_ID buffer_id = 0;
view_get_buffer(app, view.view_id, AccessProtected, &buffer_id);
Range range = get_view_range(&view);
Range range = get_view_range(app, view.view_id);
i32 pos = range.min;
i32 new_pos;
@ -992,7 +992,7 @@ CUSTOM_DOC("Queries the user for two strings, and replaces all occurences of the
for (;new_pos + r.size <= range.end;){
buffer_replace_range(app, buffer_id, make_range(new_pos, new_pos + r.size), w);
refresh_view(app, &view);
range = get_view_range(&view);
range = get_view_range(app, view.view_id);
pos = new_pos + w.size;
buffer_seek_string_forward(app, buffer_id, pos, 0, r.str, r.size, &new_pos);
}
@ -1129,7 +1129,7 @@ CUSTOM_DOC("Queries the user for a string, and incrementally replace every occur
Partition *part = &global_part;
Temp_Memory temp = begin_temp_memory(part);
Range range = get_view_range(&view);
Range range = get_view_range(app, view.view_id);
i32 replace_length = range.max - range.min;
if (replace_length != 0){
char *replace_space = push_array(part, char, replace_length);

View File

@ -26,20 +26,22 @@ post_buffer_range_to_clipboard(Application_Links *app, Partition *scratch, i32 c
CUSTOM_COMMAND_SIG(copy)
CUSTOM_DOC("Copy the text in the range from the cursor to the mark onto the clipboard.")
{
View_Summary view = get_active_view(app, AccessProtected);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessProtected, &buffer);
Range range = get_view_range(&view);
view_get_buffer(app, view, AccessProtected, &buffer);
Range range = get_view_range(app, view);
post_buffer_range_to_clipboard(app, &global_part, 0, buffer, range.min, range.max);
}
CUSTOM_COMMAND_SIG(cut)
CUSTOM_DOC("Cut the text in the range from the cursor to the mark onto the clipboard.")
{
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
Range range = get_view_range(&view);
view_get_buffer(app, view, AccessOpen, &buffer);
Range range = get_view_range(app, view);
if (post_buffer_range_to_clipboard(app, &global_part, 0, buffer, range.min, range.max)){
buffer_replace_range(app, buffer, range, make_lit_string(""));
}
@ -50,11 +52,11 @@ CUSTOM_DOC("At the cursor, insert the text at the top of the clipboard.")
{
i32 count = clipboard_count(app, 0);
if (count > 0){
View_Summary view = get_active_view(app, AccessOpen);
if_view_has_highlighted_range_delete_range(app, view.view_id);
view = get_view(app, view.view_id, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
if_view_has_highlighted_range_delete_range(app, view);
Managed_Scope scope = view_get_managed_scope(app, view.view_id);
Managed_Scope scope = view_get_managed_scope(app, view);
managed_variable_set(app, scope, view_next_rewrite_loc, RewritePaste);
i32 paste_index = 0;
managed_variable_set(app, scope, view_paste_index_loc, paste_index);
@ -69,18 +71,19 @@ CUSTOM_DOC("At the cursor, insert the text at the top of the clipboard.")
clipboard_index(app, 0, paste_index, str, len);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
i32 pos = view.cursor.pos;
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
buffer_replace_range(app, buffer, make_range(pos), make_string(str, len));
view_set_mark(app, &view, seek_pos(pos));
view_set_cursor(app, &view, seek_pos(pos + len), true);
view_set_mark(app, view, seek_pos(pos));
view_set_cursor(app, view, seek_pos(pos + len), true);
// TODO(allen): Send this to all views.
Theme_Color paste = {};
paste.tag = Stag_Paste;
get_theme_colors(app, &paste, 1);
view_post_fade(app, &view, 0.667f, pos, pos + len, paste.color);
view_post_fade(app, view, 0.667f, pos, pos + len, paste.color);
}
}
}
@ -90,8 +93,9 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste
{
i32 count = clipboard_count(app, 0);
if (count > 0){
View_Summary view = get_active_view(app, AccessOpen);
Managed_Scope scope = view_get_managed_scope(app, view.view_id);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Managed_Scope scope = view_get_managed_scope(app, view);
no_mark_snap_to_cursor(app, scope);
u64 rewrite = 0;
@ -114,19 +118,19 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste
clipboard_index(app, 0, paste_index, str, len);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
Range range = get_view_range(&view);
Range range = get_view_range(app, view);
i32 pos = range.min;
buffer_replace_range(app, buffer, range, make_string(str, len));
view_set_cursor(app, &view, seek_pos(pos + len), true);
view_set_cursor(app, view, seek_pos(pos + len), true);
// TODO(allen): Send this to all views.
Theme_Color paste = {};
paste.tag = Stag_Paste;
get_theme_colors(app, &paste, 1);
view_post_fade(app, &view, 0.667f, pos, pos + len, paste.color);
view_post_fade(app, view, 0.667f, pos, pos + len, paste.color);
}
}
else{

View File

@ -5,17 +5,20 @@
// TOP
static void
write_string(Application_Links *app, View_Summary *view, Buffer_ID buffer, String string){
buffer_replace_range(app, buffer, make_range(view->cursor.pos), string);
view_set_cursor(app, view, seek_pos(view->cursor.pos + string.size), 1);
write_string(Application_Links *app, View_ID view, Buffer_ID buffer, String string){
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
buffer_replace_range(app, buffer, make_range(pos), string);
view_set_cursor(app, view, seek_pos(pos + string.size), 1);
}
static void
write_string(Application_Links *app, String string){
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
write_string(app, &view, buffer, string);
view_get_buffer(app, view, AccessOpen, &buffer);
write_string(app, view, buffer, string);
}
static void
@ -42,14 +45,16 @@ write_named_comment_string(Application_Links *app, char *type_string){
static void
long_braces(Application_Links *app, char *text, i32 size){
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
i32 pos = view.cursor.pos;
view_get_buffer(app, view, AccessOpen, &buffer);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
buffer_replace_range(app, buffer, make_range(pos), make_string(text, size));
view_set_cursor(app, &view, seek_pos(pos + 2), true);
view_set_cursor(app, view, seek_pos(pos + 2), true);
buffer_auto_indent(app, &global_part, buffer, pos, pos + size, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens);
move_past_lead_whitespace(app, &view, buffer);
move_past_lead_whitespace(app, view, buffer);
}
CUSTOM_COMMAND_SIG(open_long_braces)
@ -113,9 +118,12 @@ CUSTOM_DOC("At the cursor, insert a ' = {};'.")
}
static i32
get_start_of_line_at_cursor(Application_Links *app, View_Summary *view, Buffer_ID buffer){
get_start_of_line_at_cursor(Application_Links *app, View_ID view, Buffer_ID buffer){
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
Full_Cursor cursor = {};
view_compute_cursor(app, view, seek_line_char(view->cursor.line, 1), &cursor);
view_compute_cursor(app, view, seek_pos(pos), &cursor);
view_compute_cursor(app, view, seek_line_char(cursor.line, 1), &cursor);
Hard_Start_Result hard_start = buffer_find_hard_start(app, buffer, cursor.pos, DEF_TAB_WIDTH);
return(hard_start.char_pos);
}
@ -135,10 +143,11 @@ c_line_comment_starts_at_position(Application_Links *app, Buffer_ID buffer, i32
CUSTOM_COMMAND_SIG(comment_line)
CUSTOM_DOC("Insert '//' at the beginning of the line after leading whitespace.")
{
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
i32 pos = get_start_of_line_at_cursor(app, &view, buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
i32 pos = get_start_of_line_at_cursor(app, view, buffer);
b32 alread_has_comment = c_line_comment_starts_at_position(app, buffer, pos);
if (!alread_has_comment){
buffer_replace_range(app, buffer, make_range(pos), make_lit_string("//"));
@ -148,10 +157,11 @@ CUSTOM_DOC("Insert '//' at the beginning of the line after leading whitespace.")
CUSTOM_COMMAND_SIG(uncomment_line)
CUSTOM_DOC("If present, delete '//' at the beginning of the line after leading whitespace.")
{
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
i32 pos = get_start_of_line_at_cursor(app, &view, buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
i32 pos = get_start_of_line_at_cursor(app, view, buffer);
b32 alread_has_comment = c_line_comment_starts_at_position(app, buffer, pos);
if (alread_has_comment){
buffer_replace_range(app, buffer, make_range(pos, pos + 2), make_lit_string(""));
@ -161,10 +171,11 @@ CUSTOM_DOC("If present, delete '//' at the beginning of the line after leading w
CUSTOM_COMMAND_SIG(comment_line_toggle)
CUSTOM_DOC("Turns uncommented lines into commented lines and vice versa for comments starting with '//'.")
{
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
i32 pos = get_start_of_line_at_cursor(app, &view, buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
i32 pos = get_start_of_line_at_cursor(app, view, buffer);
b32 alread_has_comment = c_line_comment_starts_at_position(app, buffer, pos);
if (alread_has_comment){
buffer_replace_range(app, buffer, make_range(pos, pos + 2), make_lit_string(""));

View File

@ -27,7 +27,6 @@ START_HOOK_SIG(default_start){
default_4coder_side_by_side_panels(app, files, file_count);
#if 0
default_4coder_one_panel(app, files, file_count);
View_ID left_view = 0;
@ -56,11 +55,14 @@ START_HOOK_SIG(default_start){
i32 header_vertical_pixels = header_margin.y0 + header_margin.y1;
i32 margin_vertical_pixels = header_vertical_pixels + bottom_margin.y0 + bottom_margin.y1;
View_Summary view = {};
get_view_summary(app, left_view, AccessAll, &view);
float line = view.line_height;
panel_set_split(app, h_split_main , PanelSplitKind_FixedPixels_BR, line*6.f + margin_vertical_pixels);
panel_set_split(app, h_split_minor, PanelSplitKind_FixedPixels_TL, line + header_vertical_pixels);
Face_ID face_id = 0;
get_face_id(app, 0, &face_id);
Face_Metrics metrics = {};
get_face_metrics(app, face_id, &metrics);
f32 line_height = metrics.line_height;
panel_set_split(app, h_split_main , PanelSplitKind_FixedPixels_BR, line_height*6.f + margin_vertical_pixels);
panel_set_split(app, h_split_minor, PanelSplitKind_FixedPixels_TL, line_height + header_vertical_pixels);
#endif
if (global_config.automatically_load_project){
@ -78,14 +80,16 @@ START_HOOK_SIG(default_start){
// NOTE(allen|a4.0.10): As of this version the word_complete command
// also relies on this particular command caller hook.
COMMAND_CALLER_HOOK(default_command_caller){
View_Summary view = get_active_view(app, AccessAll);
Managed_Scope scope = view_get_managed_scope(app, view.view_id);
View_ID view = 0;
get_active_view(app, AccessAll, &view);
Managed_Scope scope = view_get_managed_scope(app, view);
managed_variable_set(app, scope, view_next_rewrite_loc, 0);
if (fcoder_mode == FCoderMode_NotepadLike){
for (View_Summary view_it = get_view_first(app, AccessAll);
view_it.exists;
get_view_next(app, &view_it, AccessAll)){
Managed_Scope scope_it = view_get_managed_scope(app, view_it.view_id);
View_ID view_it = 0;
for (get_view_next(app, 0, AccessAll, &view_it);
view_it != 0;
get_view_next(app, view_it, AccessAll, &view_it)){
Managed_Scope scope_it = view_get_managed_scope(app, view_it);
managed_variable_set(app, scope_it, view_snap_mark_to_cursor, true);
}
}
@ -96,14 +100,17 @@ COMMAND_CALLER_HOOK(default_command_caller){
managed_variable_get(app, scope, view_next_rewrite_loc, &next_rewrite);
managed_variable_set(app, scope, view_rewrite_loc, next_rewrite);
if (fcoder_mode == FCoderMode_NotepadLike){
for (View_Summary view_it = get_view_first(app, AccessAll);
view_it.exists;
get_view_next(app, &view_it, AccessAll)){
Managed_Scope scope_it = view_get_managed_scope(app, view_it.view_id);
View_ID view_it = 0;
for (get_view_next(app, 0, AccessAll, &view_it);
view_it != 0;
get_view_next(app, view_it, AccessAll, &view_it)){
Managed_Scope scope_it = view_get_managed_scope(app, view_it);
u64 val = 0;
if (managed_variable_get(app, scope_it, view_snap_mark_to_cursor, &val)){
if (val != 0){
view_set_mark(app, &view_it, seek_pos(view_it.cursor.pos));
i32 pos = 0;
view_get_cursor_pos(app, view_it, &pos);
view_set_mark(app, view_it, seek_pos(pos));
}
}
}
@ -271,9 +278,13 @@ MODIFY_COLOR_TABLE_SIG(default_modify_color_table){
}
GET_VIEW_BUFFER_REGION_SIG(default_view_buffer_region){
View_Summary view = {};
get_view_summary(app, view_id, AccessAll, &view);
i32 line_height = ceil32(view.line_height);
Buffer_ID buffer = 0;
view_get_buffer(app, view_id, AccessAll, &buffer);
Face_ID face_id = 0;
get_face_id(app, buffer, &face_id);
Face_Metrics metrics = {};
get_face_metrics(app, face_id, &metrics);
i32 line_height = ceil32(metrics.line_height);
// file bar
{
@ -298,8 +309,6 @@ GET_VIEW_BUFFER_REGION_SIG(default_view_buffer_region){
// line number margins
if (global_config.show_line_number_margins){
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessAll, &buffer);
i32 line_count = 0;
buffer_get_line_count(app, buffer, &line_count);
i32 line_count_digit_count = int_to_str_size(line_count);
@ -341,6 +350,13 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
Buffer_ID buffer_id = 0;
view_get_buffer(app, view_id, AccessAll, &buffer_id);
Face_ID face_id = 0;
get_face_id(app, buffer_id, &face_id);
Face_Metrics face_metrics = {};
get_face_metrics(app, face_id, &face_metrics);
f32 line_height = face_metrics.line_height;
Rect_i32 sub_region = i32R(0, 0, rect_width(view_inner_rect), rect_height(view_inner_rect));
sub_region = default_view_buffer_region(app, view_id, sub_region);
Rect_f32 buffer_rect = {};
@ -360,13 +376,9 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
text_layout_get_on_screen_range(app, text_layout_id, &on_screen_range);
text_layout_free(app, text_layout_id);
View_Summary view = get_view(app, view_id, AccessAll);
View_Summary active_view = get_active_view(app, AccessAll);
Buffer_ID buffer = 0;
view_get_buffer(app, view_id, AccessAll, &buffer);
b32 is_active_view = (active_view.view_id == view_id);
f32 line_height = view.line_height;
View_ID active_view = 0;
get_active_view(app, AccessAll, &active_view);
b32 is_active_view = (active_view == view_id);
Arena *arena = context_get_arena(app);
Temp_Memory_Arena major_temp = begin_temp_memory(arena);
@ -377,7 +389,10 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
}
{
Rect_f32 r_cursor = view.render_region;
Rect_f32 r_cursor = {};
view_get_screen_rect(app, view_id, &r_cursor);
r_cursor.p1 -= r_cursor.p0;
r_cursor.p0 = V2(0.f,0.f);
// NOTE(allen): Filebar
{
@ -385,7 +400,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
if (view_get_setting(app, view_id, ViewSetting_ShowFileBar, &showing_file_bar)){
if (showing_file_bar){
Face_ID face_id = 0;
get_face_id(app, buffer, &face_id);
get_face_id(app, buffer_id, &face_id);
Rect_f32 bar = r_cursor;
bar.y1 = bar.y0 + line_height + 2.f;
@ -398,17 +413,17 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
Temp_Memory_Arena temp = begin_temp_memory(arena);
Fancy_String_List list = {};
push_fancy_string(arena, &list, base_color, buffer_push_unique_buffer_name(app, buffer, arena));
push_fancy_stringf(arena, &list, base_color, " - L#%d C#%d -", view.cursor.line, view.cursor.character);
i32 cursor_position = 0;
view_get_cursor_pos(app, view_id, &cursor_position);
Full_Cursor cursor = {};
view_compute_cursor(app, view_id, seek_pos(cursor_position), &cursor);
Face_Metrics face_metrics = {};
get_face_metrics(app, face_id, &face_metrics);
push_fancy_stringf(arena, &list, base_color, " LH: %f; TCW: %f-",
face_metrics.line_height, face_metrics.typical_character_width);
Fancy_String_List list = {};
push_fancy_string(arena, &list, base_color, buffer_push_unique_buffer_name(app, buffer_id, arena));
push_fancy_stringf(arena, &list, base_color, " - Row: %3.d Col: %3.d -", cursor.line, cursor.character);
b32 is_dos_mode = false;
if (buffer_get_setting(app, buffer, BufferSetting_Eol, &is_dos_mode)){
if (buffer_get_setting(app, buffer_id, BufferSetting_Eol, &is_dos_mode)){
if (is_dos_mode){
push_fancy_string(arena, &list, base_color, make_lit_string(" dos"));
}
@ -422,7 +437,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
{
Dirty_State dirty = 0;
buffer_get_dirty_state(app, buffer, &dirty);
buffer_get_dirty_state(app, buffer_id, &dirty);
char space[3];
String str = make_fixed_width_string(space);
if (dirty != 0){
@ -467,10 +482,8 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
push_fancy_string(arena, &list, pop1_color , query_bar->prompt);
push_fancy_string(arena, &list, default_color, query_bar->string);
Face_ID font_id = 0;
get_face_id(app, view.buffer_id, &font_id);
Vec2 p = bar.p0 + V2(0.f, 2.f);
draw_fancy_string(app, font_id, list.first, p, Stag_Default, 0);
draw_fancy_string(app, face_id, list.first, p, Stag_Default, 0);
end_temp_memory(temp);
}
@ -480,12 +493,10 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
// NOTE(allen): Line Numbers
if (global_config.show_line_number_margins){
i32 line_count = 0;
buffer_get_line_count(app, buffer, &line_count);
buffer_get_line_count(app, buffer_id, &line_count);
i32 line_count_digit_count = int_to_str_size(line_count);
Face_ID font_id = 0;
get_face_id(app, view.buffer_id, &font_id);
// TODO(allen): I need a "digit width"
f32 zero = get_string_advance(app, font_id, make_lit_string("0"));
f32 zero = get_string_advance(app, face_id, make_lit_string("0"));
f32 margin_width = (f32)line_count_digit_count*zero;
Rect_f32 left_margin = r_cursor;
@ -499,13 +510,15 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
Full_Cursor cursor = {};
view_compute_cursor(app, view_id, seek_pos(on_screen_range.first), &cursor);
GUI_Scroll_Vars scroll_vars = {};
view_get_scroll_vars(app, view_id, &scroll_vars);
for (;cursor.pos <= on_screen_range.one_past_last;){
Vec2 p = panel_space_from_view_space(cursor.wrapped_p, view.scroll_vars.scroll_p);
Vec2 p = panel_space_from_view_space(cursor.wrapped_p, scroll_vars.scroll_p);
p += V2(buffer_rect.p0);
p.x = left_margin.x0;
Temp_Memory_Arena temp = begin_temp_memory(arena);
Fancy_String *line_string = push_fancy_stringf(arena, line_color, "%*d", line_count_digit_count, cursor.line);
draw_fancy_string(app, font_id, line_string, p, Stag_Margin_Active, 0);
draw_fancy_string(app, face_id, line_string, p, Stag_Margin_Active, 0);
end_temp_memory(temp);
i32 next_line = cursor.line + 1;
view_compute_cursor(app, view_id, seek_line_char(next_line, 1), &cursor);
@ -525,7 +538,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
Temp_Memory temp = begin_temp_memory(scratch);
i32 text_size = on_screen_range.one_past_last - on_screen_range.first;
char *text = push_array(scratch, char, text_size);
buffer_read_range(app, buffer, on_screen_range.first, on_screen_range.one_past_last, text);
buffer_read_range(app, buffer_id, on_screen_range.first, on_screen_range.one_past_last, text);
Highlight_Record *records = push_array(scratch, Highlight_Record, 0);
String tail = make_string(text, text_size);
@ -566,7 +579,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
b32 do_emit = i == record_count || (records[i].color != current_color);
if (do_emit){
i32 marker_count = (i32)(push_array(scratch, Marker, 0) - markers);
Managed_Object o = alloc_buffer_markers_on_buffer(app, buffer, marker_count, &render_scope);
Managed_Object o = alloc_buffer_markers_on_buffer(app, buffer_id, marker_count, &render_scope);
managed_object_store_data(app, o, 0, marker_count, markers);
Marker_Visual v = create_marker_visual(app, o);
marker_visual_set_effect(app, v, VisualType_CharacterHighlightRanges, SymbolicColor_Default, current_color, 0);
@ -585,10 +598,15 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
}
// NOTE(allen): Cursor and mark
Managed_Object cursor_and_mark = alloc_buffer_markers_on_buffer(app, buffer, 2, &render_scope);
i32 cursor_pos = 0;
i32 mark_pos = 0;
view_get_cursor_pos(app, view_id, &cursor_pos);
view_get_mark_pos(app, view_id, &mark_pos);
Managed_Object cursor_and_mark = alloc_buffer_markers_on_buffer(app, buffer_id, 2, &render_scope);
Marker cm_markers[2] = {};
cm_markers[0].pos = view.cursor.pos;
cm_markers[1].pos = view.mark.pos;
cm_markers[0].pos = cursor_pos;
cm_markers[1].pos = mark_pos;
managed_object_store_data(app, cursor_and_mark, 0, 2, cm_markers);
b32 cursor_is_hidden_in_this_view = (cursor_is_hidden && is_active_view);
@ -633,7 +651,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
marker_visual_set_take_rule(app, visual, take_rule);
marker_visual_set_priority(app, visual, VisualPriority_Highest);
if (view.cursor.pos != view.mark.pos){
if (cursor_pos != mark_pos){
visual = create_marker_visual(app, cursor_and_mark);
marker_visual_set_effect(app, visual, VisualType_CharacterHighlightRanges, highlight_color, Stag_At_Highlight, 0);
take_rule.maximum_number_of_markers = 2;
@ -664,14 +682,14 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
int_color token_color = 0x5000EE00;
u32 token_flags = BoundaryToken|BoundaryWhitespace;
i32 pos0 = view.cursor.pos;
i32 pos1 = buffer_boundary_seek(app, buffer, pos0, DirLeft , token_flags);
i32 pos0 = cursor_pos;
i32 pos1 = buffer_boundary_seek(app, buffer_id, pos0, DirLeft , token_flags);
if (pos1 >= 0){
i32 pos2 = buffer_boundary_seek(app, buffer, pos1, DirRight, token_flags);
i32 pos2 = buffer_boundary_seek(app, buffer_id, pos1, DirRight, token_flags);
i32 buffer_size = 0;
buffer_get_size(app, buffer, &buffer_size);
buffer_get_size(app, buffer_id, &buffer_size);
if (pos2 <= buffer_size){
Managed_Object token_highlight = alloc_buffer_markers_on_buffer(app, buffer, 2, &render_scope);
Managed_Object token_highlight = alloc_buffer_markers_on_buffer(app, buffer_id, 2, &render_scope);
Marker range_markers[2] = {};
range_markers[0].pos = pos1;
range_markers[1].pos = pos2;
@ -689,15 +707,15 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
for (u16 i = 0; i < color_count; i += 1){
colors[i] = Stag_Back_Cycle_1 + i;
}
mark_enclosures(app, scratch, render_scope, buffer, view.cursor.pos, FindScope_Brace, VisualType_LineHighlightRanges, colors, 0, color_count);
mark_enclosures(app, scratch, render_scope, buffer_id, cursor_pos, FindScope_Brace, VisualType_LineHighlightRanges, colors, 0, color_count);
}
if (do_matching_paren_highlight){
i32 pos = view.cursor.pos;
if (buffer_get_char(app, buffer, pos) == '('){
i32 pos = cursor_pos;
if (buffer_get_char(app, buffer_id, pos) == '('){
pos += 1;
}
else if (pos > 0){
if (buffer_get_char(app, buffer, pos - 1) == ')'){
if (buffer_get_char(app, buffer_id, pos - 1) == ')'){
pos -= 1;
}
}
@ -705,7 +723,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
for (u16 i = 0; i < color_count; i += 1){
colors[i] = Stag_Text_Cycle_1 + i;
}
mark_enclosures(app, scratch, render_scope, buffer, pos, FindScope_Paren, VisualType_CharacterBlocks, 0, colors, color_count);
mark_enclosures(app, scratch, render_scope, buffer_id, pos, FindScope_Paren, VisualType_CharacterBlocks, 0, colors, color_count);
}
draw_clip_push(app, buffer_rect);
@ -724,14 +742,14 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
history_animation_dt[wrapped_index] = frame_info.animation_dt;
history_frame_index[wrapped_index] = frame_info.index;
Rect_f32 hud_rect = view.render_region;
hud_rect.y0 = hud_rect.y1 - view.line_height*(f32)(history_depth);
Rect_f32 hud_rect = {};
view_get_screen_rect(app, view_id, &hud_rect);
hud_rect.p1 -= hud_rect.p0;
hud_rect.p0 = V2(0.f, 0.f);
hud_rect.y0 = hud_rect.y1 - line_height*(f32)(history_depth);
draw_rectangle(app, hud_rect, 0xFF000000);
draw_rectangle_outline(app, hud_rect, 0xFFFFFFFF);
Face_ID font_id = 0;
get_face_id(app, view.buffer_id, &font_id);
Vec2 p = hud_rect.p0;
Range ranges[2];
@ -741,7 +759,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
ranges[1].one_past_last = wrapped_index;
for (i32 i = 0; i < 2; i += 1){
Range r = ranges[i];
for (i32 j = r.first; j > r.one_past_last; j -= 1, p.y += view.line_height){
for (i32 j = r.first; j > r.one_past_last; j -= 1, p.y += line_height){
f32 dts[2];
dts[0] = history_literal_dt[j];
dts[1] = history_animation_dt[j];
@ -771,7 +789,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
push_fancy_stringf(arena, &list, green, " | ");
}
draw_fancy_string(app, font_id, list.first, p, Stag_Default, 0, 0, V2(1.f, 0.f));
draw_fancy_string(app, face_id, list.first, p, Stag_Default, 0, 0, V2(1.f, 0.f));
}
}
@ -858,23 +876,23 @@ default_ui_render_caller(Application_Links *app, View_ID view_id, Rect_f32 rect_
}
static void
default_ui_render_caller(Application_Links *app, View_ID view_id, Face_ID face_id){
View_Summary view = {};
if (get_view_summary(app, view_id, AccessAll, &view)){
Rect_f32 rect_f32 = view.render_region;
default_ui_render_caller(app, view_id, rect_f32, face_id);
}
Rect_f32 rect = {};
view_get_screen_rect(app, view_id, &rect);
rect.p1 -= rect.p0;
rect.p0 = V2(0.f,0.f);
default_ui_render_caller(app, view_id, rect, face_id);
}
static void
default_ui_render_caller(Application_Links *app, View_ID view_id){
View_Summary view = {};
if (get_view_summary(app, view_id, AccessAll, &view)){
Rect_f32 rect_f32 = view.render_region;
Buffer_ID buffer_id = 0;
view_get_buffer(app, view_id, AccessAll, &buffer_id);
Face_ID face_id = 0;
get_face_id(app, buffer_id, &face_id);
default_ui_render_caller(app, view_id, rect_f32, face_id);
}
Rect_f32 rect = {};
view_get_screen_rect(app, view_id, &rect);
rect.p1 -= rect.p0;
rect.p0 = V2(0.f,0.f);
Buffer_ID buffer_id = 0;
view_get_buffer(app, view_id, AccessAll, &buffer_id);
Face_ID face_id = 0;
get_face_id(app, buffer_id, &face_id);
default_ui_render_caller(app, view_id, rect, face_id);
}
static void
@ -938,13 +956,19 @@ HOOK_SIG(default_exit){
// TODO(allen): how to deal with multiple sizes on a single view
// TODO(allen): expected character advance.
HOOK_SIG(default_view_adjust){
for (View_Summary view = get_view_first(app, AccessAll);
view.exists;
get_view_next(app, &view, AccessAll)){
View_ID view = 0;
for (get_view_next(app, 0, AccessAll, &view);
view != 0;
get_view_next(app, view, AccessAll, &view)){
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessAll, &buffer);
f32 view_width = view.render_region.x1 - view.render_region.x0;
Face_ID face_id = get_default_font_for_view(app, view.view_id);
view_get_buffer(app, view, AccessAll, &buffer);
Rect_f32 screen_rect = {};
view_get_screen_rect(app, view, &screen_rect);
f32 view_width = rect_width(screen_rect);
Face_ID face_id = 0;
get_face_id(app, buffer, &face_id);
f32 em = get_string_advance(app, face_id, make_lit_string("m"));
f32 wrap_width = view_width - 2.0f*em;
@ -1278,6 +1302,7 @@ INPUT_FILTER_SIG(default_suppress_mouse_filter){
}
}
// TODO(allen): FIX FIX FIX FIX
// NOTE(allen|a4): scroll rule information
//
// The parameters:
@ -1292,7 +1317,7 @@ INPUT_FILTER_SIG(default_suppress_mouse_filter){
//
// view_id
// This corresponds to which view is computing it's new scrolling position.
// This id DOES correspond to the views that View_Summary contains.
// This id DOES correspond to the views that View_ _Summary contains.
// This will always be between 1 and 16 (0 is a null id).
// See below for an example of having state that carries across scroll udpates.
//

View File

@ -13,48 +13,59 @@
#include <string.h>
static float
get_line_y(Application_Links *app, View_Summary *view, i32 line){
get_line_y(Application_Links *app, View_ID view, i32 line){
Full_Cursor cursor = {};
view_compute_cursor(app, view, seek_line_char(line, 1), &cursor);
float y = cursor.wrapped_y;
if (view->unwrapped_lines){
y = cursor.unwrapped_y;
return(cursor.wrapped_y);
}
static Rect_i32
get_line_x_rect(Application_Links *app, View_ID view){
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 mark_pos = 0;
view_get_mark_pos(app, view, &mark_pos);
Full_Cursor mark = {};
view_compute_cursor(app, view, seek_pos(mark_pos), &mark);
Rect_i32 rect = {};
rect.x0 = (i32)mark.wrapped_x;
rect.x1 = (i32)cursor.wrapped_x;
rect.y0 = mark.line;
rect.y1 = cursor.line;
if (rect.y0 > rect.y1){
Swap(i32, rect.y0, rect.y1);
}
return(y);
if (rect.x0 > rect.x1){
Swap(i32, rect.x0, rect.x1);
}
return(rect);
}
CUSTOM_COMMAND_SIG(kill_rect)
CUSTOM_DOC("Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.")
{
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
i32_Rect rect = get_line_x_rect(&view);
b32 unwrapped = view.unwrapped_lines;
i32_Rect rect = get_line_x_rect(app, view);
for (i32 line = rect.y1; line >= rect.y0; --line){
i32 start = 0;
i32 end = 0;
b32 success = true;
Full_Cursor cursor = {};
float y = get_line_y(app, &view, line);
if (success){
success = view_compute_cursor(app, &view, seek_xy((float)rect.x0, y, 0, unwrapped), &cursor);
}
start = cursor.pos;
if (success){
success = view_compute_cursor(app, &view, seek_xy((float)rect.x1, y, 0, unwrapped), &cursor);
}
end = cursor.pos;
if (success){
buffer_replace_range(app, buffer, make_range(start, end), make_lit_string(""));
f32 y = get_line_y(app, view, line);
if (view_compute_cursor(app, view, seek_wrapped_xy((float)rect.x0, y, 0), &cursor)){
i32 start = cursor.pos;
if (view_compute_cursor(app, view, seek_wrapped_xy((float)rect.x1, y, 0), &cursor)){
i32 end = cursor.pos;
buffer_replace_range(app, buffer, make_range(start, end), make_lit_string(""));
}
}
}
}
@ -115,19 +126,45 @@ it just seems like the wrong way to do it, so I'll stop without
doing multi-cursor for now.
*/
struct Buffer_Rect{
i32 char0;
i32 line0;
i32 char1;
i32 line1;
};
CUSTOM_COMMAND_SIG(multi_line_edit)
CUSTOM_DOC("Begin multi-line mode. In multi-line mode characters are inserted at every line between the mark and cursor. All characters are inserted at the same character offset into the line. This mode uses line_char coordinates.")
{
Partition *part = &global_part;
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
Buffer_Rect rect = get_rect(&view);
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 mark_pos = 0;
view_get_mark_pos(app, view, &mark_pos);
Full_Cursor mark = {};
view_compute_cursor(app, view, seek_pos(mark_pos), &mark);
Buffer_Rect rect = {};
rect.char0 = mark.character;
rect.line0 = mark.line;
rect.char1 = cursor.character;
rect.line1 = cursor.line;
if (rect.line0 > rect.line1){
Swap(i32, rect.line0, rect.line1);
}
if (rect.char0 > rect.char1){
Swap(i32, rect.char0, rect.char1);
}
i32 start_line = view.cursor.line;
i32 pos = view.cursor.character-1;
i32 start_line = cursor.line;
i32 pos = cursor.character - 1;
for (i32 i = rect.line0; i <= rect.line1; ++i){
pad_buffer_line(app, &global_part, buffer, i, ' ', pos);
@ -165,11 +202,10 @@ CUSTOM_DOC("Begin multi-line mode. In multi-line mode characters are inserted a
++pos;
view_set_cursor(app, &view, seek_line_char(start_line, pos+1), true);
view_set_cursor(app, view, seek_line_char(start_line, pos + 1), true);
}
else if (in.key.keycode == key_back){
if (pos > 0){
Temp_Memory temp = begin_temp_memory(part);
Buffer_Edit *edit = push_array(part, Buffer_Edit, line_count);
Buffer_Edit *edits = edit;
@ -177,7 +213,7 @@ CUSTOM_DOC("Begin multi-line mode. In multi-line mode characters are inserted a
for (i32 i = rect.line0; i <= rect.line1; ++i){
Partial_Cursor cursor = {};
if (buffer_compute_cursor(app, buffer, seek_line_char(i, pos+1), &cursor)){
if (buffer_compute_cursor(app, buffer, seek_line_char(i, pos + 1), &cursor)){
edit->str_start = 0;
edit->len = 0;
edit->start = cursor.pos-1;
@ -203,11 +239,11 @@ CUSTOM_DOC("Begin multi-line mode. In multi-line mode characters are inserted a
// NOTE(allen): An experimental mutli-pasting thing
CUSTOM_COMMAND_SIG(multi_paste){
u32 access = AccessOpen;
i32 count = clipboard_count(app, 0);
if (count > 0){
View_Summary view = get_active_view(app, access);
Managed_Scope scope = view_get_managed_scope(app, view.view_id);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Managed_Scope scope = view_get_managed_scope(app, view);
u64 rewrite = 0;
managed_variable_get(app, scope, view_rewrite_loc, &rewrite);
@ -226,17 +262,17 @@ CUSTOM_COMMAND_SIG(multi_paste){
clipboard_index(app, 0, paste_index, str + 1, len);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
Range range = get_view_range(&view);
view_get_buffer(app, view, AccessOpen, &buffer);
Range range = get_view_range(app, view);
buffer_replace_range(app, buffer, make_range(range.max), make_string(str, len + 1));
view_set_mark(app, &view, seek_pos(range.max + 1));
view_set_cursor(app, &view, seek_pos(range.max + len + 1), true);
view_set_mark(app, view, seek_pos(range.max + 1));
view_set_cursor(app, view, seek_pos(range.max + len + 1), true);
// TODO(allen): Send this to all views.
Theme_Color paste;
paste.tag = Stag_Paste;
get_theme_colors(app, &paste, 1);
view_post_fade(app, &view, 0.667f, range.max + 1, range.max + len + 1, paste.color);
view_post_fade(app, view, 0.667f, range.max + 1, range.max + len + 1, paste.color);
}
}
else{
@ -246,11 +282,11 @@ CUSTOM_COMMAND_SIG(multi_paste){
}
static Range
multi_paste_range(Application_Links *app, View_Summary *view, Range range, i32 paste_count, b32 old_to_new){
multi_paste_range(Application_Links *app, View_ID view, Range range, i32 paste_count, b32 old_to_new){
Range finish_range = range;
if (paste_count >= 1){
Buffer_ID buffer = 0;
if (view_get_buffer(app, view->view_id, AccessOpen, &buffer)){
if (view_get_buffer(app, view, AccessOpen, &buffer)){
i32 total_size = 0;
for (i32 paste_index = 0; paste_index < paste_count; ++paste_index){
total_size += 1 + clipboard_index(app, 0, paste_index, 0, 0);
@ -301,14 +337,16 @@ multi_paste_range(Application_Links *app, View_Summary *view, Range range, i32 p
static void
multi_paste_interactive_up_down(Application_Links *app, i32 paste_count, i32 clip_count){
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
Range range = {};
range.min = range.max = view.cursor.pos;
Range range = make_range(pos);;
b32 old_to_new = true;
range = multi_paste_range(app, &view, range, paste_count, old_to_new);
range = multi_paste_range(app, view, range, paste_count, old_to_new);
Query_Bar bar = {};
bar.prompt = make_lit_string("Up and Down to condense and expand paste stages; R to reverse order; Return to finish; Escape to abort.");
@ -341,13 +379,13 @@ multi_paste_interactive_up_down(Application_Links *app, i32 paste_count, i32 cli
}
if (did_modify){
range = multi_paste_range(app, &view, range, paste_count, old_to_new);
range = multi_paste_range(app, view, range, paste_count, old_to_new);
}
}
if (in.abort){
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
buffer_replace_range(app, buffer, range, make_lit_string(""));
}
}
@ -387,16 +425,19 @@ CUSTOM_COMMAND_SIG(multi_paste_interactive_quick){
CUSTOM_COMMAND_SIG(rename_parameter)
CUSTOM_DOC("If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.")
{
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
i32 cursor_pos = 0;
view_get_cursor_pos(app, view, &cursor_pos);
Partition *part = &global_part;
Temp_Memory temp = begin_temp_memory(part);
Cpp_Get_Token_Result result;
if (buffer_get_token_index(app, buffer, view.cursor.pos, &result)){
if (buffer_get_token_index(app, buffer, cursor_pos, &result)){
if (!result.in_whitespace_after_token){
static const i32 stream_space_size = 512;
Cpp_Token stream_space[stream_space_size];
@ -542,16 +583,20 @@ enum{
static void
write_explicit_enum_values_parameters(Application_Links *app, Write_Explicit_Enum_Values_Mode mode){
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
Partition *part = &global_part;
Temp_Memory temp = begin_temp_memory(part);
Cpp_Get_Token_Result result;
if (buffer_get_token_index(app, buffer, view.cursor.pos, &result)){
if (buffer_get_token_index(app, buffer, pos, &result)){
if (!result.in_whitespace_after_token){
Cpp_Token stream_space[32];
Stream_Tokens_DEP stream = {};

View File

@ -170,7 +170,6 @@ struct Application_Links;
#define DRAW_CLIP_POP_SIG(n) f32_Rect n(Application_Links *app)
#define DRAW_COORDINATE_CENTER_PUSH_SIG(n) void n(Application_Links *app, Vec2 point)
#define DRAW_COORDINATE_CENTER_POP_SIG(n) Vec2 n(Application_Links *app)
#define GET_DEFAULT_FONT_FOR_VIEW_SIG(n) Face_ID n(Application_Links *app, View_ID view_id)
#define TEXT_LAYOUT_GET_BUFFER_SIG(n) b32 n(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID *buffer_id_out)
#define TEXT_LAYOUT_BUFFER_POINT_TO_LAYOUT_POINT_SIG(n) b32 n(Application_Links *app, Text_Layout_ID text_layout_id, Vec2 buffer_relative_p, Vec2 *p_out)
#define TEXT_LAYOUT_LAYOUT_POINT_TO_BUFFER_POINT_SIG(n) b32 n(Application_Links *app, Text_Layout_ID text_layout_id, Vec2 layout_relative_p, Vec2 *p_out)
@ -354,7 +353,6 @@ typedef DRAW_CLIP_PUSH_SIG(Draw_Clip_Push_Function);
typedef DRAW_CLIP_POP_SIG(Draw_Clip_Pop_Function);
typedef DRAW_COORDINATE_CENTER_PUSH_SIG(Draw_Coordinate_Center_Push_Function);
typedef DRAW_COORDINATE_CENTER_POP_SIG(Draw_Coordinate_Center_Pop_Function);
typedef GET_DEFAULT_FONT_FOR_VIEW_SIG(Get_Default_Font_For_View_Function);
typedef TEXT_LAYOUT_GET_BUFFER_SIG(Text_Layout_Get_Buffer_Function);
typedef TEXT_LAYOUT_BUFFER_POINT_TO_LAYOUT_POINT_SIG(Text_Layout_Buffer_Point_To_Layout_Point_Function);
typedef TEXT_LAYOUT_LAYOUT_POINT_TO_BUFFER_POINT_SIG(Text_Layout_Layout_Point_To_Buffer_Point_Function);
@ -540,7 +538,6 @@ Draw_Clip_Push_Function *draw_clip_push;
Draw_Clip_Pop_Function *draw_clip_pop;
Draw_Coordinate_Center_Push_Function *draw_coordinate_center_push;
Draw_Coordinate_Center_Pop_Function *draw_coordinate_center_pop;
Get_Default_Font_For_View_Function *get_default_font_for_view;
Text_Layout_Get_Buffer_Function *text_layout_get_buffer;
Text_Layout_Buffer_Point_To_Layout_Point_Function *text_layout_buffer_point_to_layout_point;
Text_Layout_Layout_Point_To_Buffer_Point_Function *text_layout_layout_point_to_buffer_point;
@ -725,7 +722,6 @@ Draw_Clip_Push_Function *draw_clip_push_;
Draw_Clip_Pop_Function *draw_clip_pop_;
Draw_Coordinate_Center_Push_Function *draw_coordinate_center_push_;
Draw_Coordinate_Center_Pop_Function *draw_coordinate_center_pop_;
Get_Default_Font_For_View_Function *get_default_font_for_view_;
Text_Layout_Get_Buffer_Function *text_layout_get_buffer_;
Text_Layout_Buffer_Point_To_Layout_Point_Function *text_layout_buffer_point_to_layout_point_;
Text_Layout_Layout_Point_To_Buffer_Point_Function *text_layout_layout_point_to_buffer_point_;
@ -918,7 +914,6 @@ app_links->draw_clip_push_ = Draw_Clip_Push;\
app_links->draw_clip_pop_ = Draw_Clip_Pop;\
app_links->draw_coordinate_center_push_ = Draw_Coordinate_Center_Push;\
app_links->draw_coordinate_center_pop_ = Draw_Coordinate_Center_Pop;\
app_links->get_default_font_for_view_ = Get_Default_Font_For_View;\
app_links->text_layout_get_buffer_ = Text_Layout_Get_Buffer;\
app_links->text_layout_buffer_point_to_layout_point_ = Text_Layout_Buffer_Point_To_Layout_Point;\
app_links->text_layout_layout_point_to_buffer_point_ = Text_Layout_Layout_Point_To_Buffer_Point;\
@ -1103,7 +1098,6 @@ static void draw_clip_push(Application_Links *app, f32_Rect clip_box){(app->draw
static f32_Rect draw_clip_pop(Application_Links *app){return(app->draw_clip_pop(app));}
static void draw_coordinate_center_push(Application_Links *app, Vec2 point){(app->draw_coordinate_center_push(app, point));}
static Vec2 draw_coordinate_center_pop(Application_Links *app){return(app->draw_coordinate_center_pop(app));}
static Face_ID get_default_font_for_view(Application_Links *app, View_ID view_id){return(app->get_default_font_for_view(app, view_id));}
static b32 text_layout_get_buffer(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID *buffer_id_out){return(app->text_layout_get_buffer(app, text_layout_id, buffer_id_out));}
static b32 text_layout_buffer_point_to_layout_point(Application_Links *app, Text_Layout_ID text_layout_id, Vec2 buffer_relative_p, Vec2 *p_out){return(app->text_layout_buffer_point_to_layout_point(app, text_layout_id, buffer_relative_p, p_out));}
static b32 text_layout_layout_point_to_buffer_point(Application_Links *app, Text_Layout_ID text_layout_id, Vec2 layout_relative_p, Vec2 *p_out){return(app->text_layout_layout_point_to_buffer_point(app, text_layout_id, layout_relative_p, p_out));}
@ -1288,7 +1282,6 @@ static void draw_clip_push(Application_Links *app, f32_Rect clip_box){(app->draw
static f32_Rect draw_clip_pop(Application_Links *app){return(app->draw_clip_pop_(app));}
static void draw_coordinate_center_push(Application_Links *app, Vec2 point){(app->draw_coordinate_center_push_(app, point));}
static Vec2 draw_coordinate_center_pop(Application_Links *app){return(app->draw_coordinate_center_pop_(app));}
static Face_ID get_default_font_for_view(Application_Links *app, View_ID view_id){return(app->get_default_font_for_view_(app, view_id));}
static b32 text_layout_get_buffer(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID *buffer_id_out){return(app->text_layout_get_buffer_(app, text_layout_id, buffer_id_out));}
static b32 text_layout_buffer_point_to_layout_point(Application_Links *app, Text_Layout_ID text_layout_id, Vec2 buffer_relative_p, Vec2 *p_out){return(app->text_layout_buffer_point_to_layout_point_(app, text_layout_id, buffer_relative_p, p_out));}
static b32 text_layout_layout_point_to_buffer_point(Application_Links *app, Text_Layout_ID text_layout_id, Vec2 layout_relative_p, Vec2 *p_out){return(app->text_layout_layout_point_to_buffer_point_(app, text_layout_id, layout_relative_p, p_out));}

View File

@ -256,11 +256,11 @@ int32_t line_number;
};
static Command_Metadata fcoder_metacmd_table[234] = {
{ 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, 336 },
{ 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, 633 },
{ 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, 624 },
{ 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(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, 612 },
{ 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, 104 },
{ PROC_LINKS(backspace_word, 0), "backspace_word", 14, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1215 },
{ PROC_LINKS(backspace_word, 0), "backspace_word", 14, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1241 },
{ 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, 516 },
{ PROC_LINKS(build_in_build_panel, 0), "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 180 },
{ PROC_LINKS(build_search, 0), "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 146 },
@ -276,28 +276,28 @@ static Command_Metadata fcoder_metacmd_table[234] = {
{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1062 },
{ PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 196 },
{ 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, 524 },
{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 1037 },
{ PROC_LINKS(comment_line, 0), "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 135 },
{ PROC_LINKS(comment_line_toggle, 0), "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 161 },
{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 1047 },
{ PROC_LINKS(comment_line, 0), "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 143 },
{ PROC_LINKS(comment_line_toggle, 0), "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 171 },
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 26 },
{ PROC_LINKS(cursor_mark_swap, 0), "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 134 },
{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 36 },
{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 37 },
{ 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, 621 },
{ 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, 597 },
{ 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, 84 },
{ 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(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, 493 },
{ 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, 1197 },
{ 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, 1451 },
{ 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, 144 },
{ 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, 1221 },
{ 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(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, 1428 },
{ 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, 675 },
{ 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, 684 },
{ PROC_LINKS(execute_any_cli, 0), "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "w:\\4ed\\code\\4coder_system_command.cpp", 37, 23 },
{ PROC_LINKS(execute_previous_cli, 0), "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "w:\\4ed\\code\\4coder_system_command.cpp", 37, 7 },
{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 693 },
{ PROC_LINKS(goto_beginning_of_file, 0), "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1131 },
{ PROC_LINKS(goto_end_of_file, 0), "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1139 },
{ PROC_LINKS(goto_beginning_of_file, 0), "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1155 },
{ PROC_LINKS(goto_end_of_file, 0), "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1164 },
{ PROC_LINKS(goto_first_jump_direct, 0), "goto_first_jump_direct", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 83 },
{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 562 },
{ PROC_LINKS(goto_first_jump_sticky, 0), "goto_first_jump_sticky", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 544 },
@ -316,16 +316,16 @@ static Command_Metadata fcoder_metacmd_table[234] = {
{ PROC_LINKS(goto_prev_jump_sticky, 0), "goto_prev_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 495 },
{ 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, 554 },
{ 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, 540 },
{ PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 79 },
{ PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 84 },
{ 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, 608 },
{ 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, 586 },
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 806 },
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 919 },
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 952 },
{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 880 },
{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 786 },
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 816 },
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 929 },
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 962 },
{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 890 },
{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 796 },
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1635 },
{ PROC_LINKS(kill_rect, 0), "kill_rect", 9, "Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.", 93, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 26 },
{ PROC_LINKS(kill_rect, 0), "kill_rect", 9, "Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.", 93, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 50 },
{ 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, 172 },
{ PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 345 },
{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 351 },
@ -341,23 +341,23 @@ static Command_Metadata fcoder_metacmd_table[234] = {
{ 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, 868 },
{ 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, 808 },
{ 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, 822 },
{ 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, 15 },
{ PROC_LINKS(lister__backspace_text_field, 0), "lister__backspace_text_field", 28, "A lister mode command that dispatches to the lister's backspace text field handler.", 83, "w:\\4ed\\code\\4coder_lists.cpp", 28, 42 },
{ PROC_LINKS(lister__backspace_text_field__default, 0), "lister__backspace_text_field__default", 37, "A lister mode command that backspaces one character from the text field.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 151 },
{ PROC_LINKS(lister__backspace_text_field__file_path, 0), "lister__backspace_text_field__file_path", 39, "A lister mode command that backspaces one character from the text field of a file system list.", 94, "w:\\4ed\\code\\4coder_lists.cpp", 28, 227 },
{ PROC_LINKS(lister__mouse_press, 0), "lister__mouse_press", 19, "A lister mode command that beings a click interaction with a list item under the mouse.", 87, "w:\\4ed\\code\\4coder_lists.cpp", 28, 89 },
{ PROC_LINKS(lister__mouse_release, 0), "lister__mouse_release", 21, "A lister mode command that ends a click interaction with a list item under the mouse, possibly activating it.", 109, "w:\\4ed\\code\\4coder_lists.cpp", 28, 101 },
{ PROC_LINKS(lister__move_down, 0), "lister__move_down", 17, "A lister mode command that dispatches to the lister's navigate down handler.", 76, "w:\\4ed\\code\\4coder_lists.cpp", 28, 62 },
{ PROC_LINKS(lister__move_down__default, 0), "lister__move_down__default", 26, "A lister mode command that moves the highlighted item one down in the list.", 75, "w:\\4ed\\code\\4coder_lists.cpp", 28, 184 },
{ PROC_LINKS(lister__move_up, 0), "lister__move_up", 15, "A lister mode command that dispatches to the lister's navigate up handler.", 74, "w:\\4ed\\code\\4coder_lists.cpp", 28, 52 },
{ PROC_LINKS(lister__move_up__default, 0), "lister__move_up__default", 24, "A lister mode command that moves the highlighted item one up in the list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 167 },
{ 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__backspace_text_field, 0), "lister__backspace_text_field", 28, "A lister mode command that dispatches to the lister's backspace text field handler.", 83, "w:\\4ed\\code\\4coder_lists.cpp", 28, 44 },
{ PROC_LINKS(lister__backspace_text_field__default, 0), "lister__backspace_text_field__default", 37, "A lister mode command that backspaces one character from the text field.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 157 },
{ PROC_LINKS(lister__backspace_text_field__file_path, 0), "lister__backspace_text_field__file_path", 39, "A lister mode command that backspaces one character from the text field of a file system list.", 94, "w:\\4ed\\code\\4coder_lists.cpp", 28, 233 },
{ PROC_LINKS(lister__mouse_press, 0), "lister__mouse_press", 19, "A lister mode command that beings a click interaction with a list item under the mouse.", 87, "w:\\4ed\\code\\4coder_lists.cpp", 28, 94 },
{ PROC_LINKS(lister__mouse_release, 0), "lister__mouse_release", 21, "A lister mode command that ends a click interaction with a list item under the mouse, possibly activating it.", 109, "w:\\4ed\\code\\4coder_lists.cpp", 28, 107 },
{ PROC_LINKS(lister__move_down, 0), "lister__move_down", 17, "A lister mode command that dispatches to the lister's navigate down handler.", 76, "w:\\4ed\\code\\4coder_lists.cpp", 28, 66 },
{ PROC_LINKS(lister__move_down__default, 0), "lister__move_down__default", 26, "A lister mode command that moves the highlighted item one down in the list.", 75, "w:\\4ed\\code\\4coder_lists.cpp", 28, 190 },
{ PROC_LINKS(lister__move_up, 0), "lister__move_up", 15, "A lister mode command that dispatches to the lister's navigate up handler.", 74, "w:\\4ed\\code\\4coder_lists.cpp", 28, 55 },
{ PROC_LINKS(lister__move_up__default, 0), "lister__move_up__default", 24, "A lister mode command that moves the highlighted item one up in the list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 173 },
{ 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__repaint, 0), "lister__repaint", 15, "A lister mode command that updates the lists UI data.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 118 },
{ PROC_LINKS(lister__wheel_scroll, 0), "lister__wheel_scroll", 20, "A lister mode command that scrolls the list in response to the mouse wheel.", 75, "w:\\4ed\\code\\4coder_lists.cpp", 28, 72 },
{ 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 },
{ PROC_LINKS(lister__write_character__default, 0), "lister__write_character__default", 32, "A lister mode command that inserts a new character to the text field.", 69, "w:\\4ed\\code\\4coder_lists.cpp", 28, 130 },
{ PROC_LINKS(lister__write_character__file_path, 0), "lister__write_character__file_path", 34, "A lister mode command that inserts a character into the text field of a file system list.", 89, "w:\\4ed\\code\\4coder_lists.cpp", 28, 201 },
{ PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 267 },
{ PROC_LINKS(lister__repaint, 0), "lister__repaint", 15, "A lister mode command that updates the lists UI data.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 124 },
{ PROC_LINKS(lister__wheel_scroll, 0), "lister__wheel_scroll", 20, "A lister mode command that scrolls the list in response to the mouse wheel.", 75, "w:\\4ed\\code\\4coder_lists.cpp", 28, 77 },
{ 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, 33 },
{ PROC_LINKS(lister__write_character__default, 0), "lister__write_character__default", 32, "A lister mode command that inserts a new character to the text field.", 69, "w:\\4ed\\code\\4coder_lists.cpp", 28, 136 },
{ PROC_LINKS(lister__write_character__file_path, 0), "lister__write_character__file_path", 34, "A lister mode command that inserts a character into the text field of a file system list.", 89, "w:\\4ed\\code\\4coder_lists.cpp", 28, 207 },
{ PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 273 },
{ PROC_LINKS(load_project, 0), "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1085 },
{ 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, 1319 },
{ PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 113 },
@ -377,7 +377,7 @@ static Command_Metadata fcoder_metacmd_table[234] = {
{ 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, 384 },
{ PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 319 },
{ 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, 331 },
{ PROC_LINKS(multi_line_edit, 0), "multi_line_edit", 15, "Begin multi-line mode. In multi-line mode characters are inserted at every line between the mark and cursor. All characters are inserted at the same character offset into the line. This mode uses line_char coordinates.", 221, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 118 },
{ PROC_LINKS(multi_line_edit, 0), "multi_line_edit", 15, "Begin multi-line mode. In multi-line mode characters are inserted at every line between the mark and cursor. All characters are inserted at the same character offset into the line. This mode uses line_char coordinates.", 221, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 136 },
{ PROC_LINKS(newline_or_goto_position_direct, 0), "newline_or_goto_position_direct", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 100 },
{ PROC_LINKS(newline_or_goto_position_same_panel_direct, 0), "newline_or_goto_position_same_panel_direct", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 114 },
{ PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 599 },
@ -386,19 +386,19 @@ static Command_Metadata fcoder_metacmd_table[234] = {
{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1076 },
{ 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, 1535 },
{ 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, 1939 },
{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 55 },
{ PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 71 },
{ PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 63 },
{ PROC_LINKS(open_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, 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, 76 },
{ 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, 68 },
{ 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, 1578 },
{ 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, 265 },
{ 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, 256 },
{ 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, 363 },
{ 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, 354 },
{ PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 48 },
{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 138 },
{ PROC_LINKS(paste_next, 0), "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 88 },
{ PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 145 },
{ 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(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 50 },
{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 142 },
{ PROC_LINKS(paste_next, 0), "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 91 },
{ PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 149 },
{ 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, 487 },
{ PROC_LINKS(project_command_lister, 0), "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1527 },
{ PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1092 },
{ PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1115 },
@ -409,40 +409,40 @@ static Command_Metadata fcoder_metacmd_table[234] = {
{ PROC_LINKS(redo_this_buffer, 0), "redo_this_buffer", 16, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1734 },
{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 386 },
{ 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, 1269 },
{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 387 },
{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 425 },
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1655 },
{ 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, 778 },
{ 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, 823 },
{ 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, 959 },
{ 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, 930 },
{ 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, 948 },
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1642 },
{ 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, 1171 },
{ 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, 1224 },
{ 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, 716 },
{ 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, 734 },
{ 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, 923 },
{ 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, 937 },
{ PROC_LINKS(seek_alphanumeric_left, 0), "seek_alphanumeric_left", 22, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1195 },
{ PROC_LINKS(seek_alphanumeric_or_camel_left, 0), "seek_alphanumeric_or_camel_left", 31, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1207 },
{ PROC_LINKS(seek_alphanumeric_or_camel_right, 0), "seek_alphanumeric_or_camel_right", 32, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1201 },
{ PROC_LINKS(seek_alphanumeric_right, 0), "seek_alphanumeric_right", 23, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1189 },
{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1083 },
{ PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1061 },
{ PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1095 },
{ PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1072 },
{ PROC_LINKS(seek_token_left, 0), "seek_token_left", 15, "Seek left for the next beginning of a token.", 44, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1171 },
{ PROC_LINKS(seek_token_right, 0), "seek_token_right", 16, "Seek right for the next end of a token.", 39, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1165 },
{ PROC_LINKS(seek_white_or_token_left, 0), "seek_white_or_token_left", 24, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1183 },
{ PROC_LINKS(seek_white_or_token_right, 0), "seek_white_or_token_right", 25, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1177 },
{ PROC_LINKS(seek_whitespace_down, 0), "seek_whitespace_down", 20, "Seeks the cursor down to the next blank line.", 45, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1050 },
{ PROC_LINKS(seek_whitespace_down_end_line, 0), "seek_whitespace_down_end_line", 29, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1119 },
{ PROC_LINKS(seek_whitespace_left, 0), "seek_whitespace_left", 20, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1159 },
{ PROC_LINKS(seek_whitespace_right, 0), "seek_whitespace_right", 21, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1153 },
{ PROC_LINKS(seek_whitespace_up, 0), "seek_whitespace_up", 18, "Seeks the cursor up to the next blank line.", 43, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1039 },
{ PROC_LINKS(seek_whitespace_up_end_line, 0), "seek_whitespace_up_end_line", 27, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1107 },
{ PROC_LINKS(seek_alphanumeric_left, 0), "seek_alphanumeric_left", 22, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1221 },
{ PROC_LINKS(seek_alphanumeric_or_camel_left, 0), "seek_alphanumeric_or_camel_left", 31, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1233 },
{ PROC_LINKS(seek_alphanumeric_or_camel_right, 0), "seek_alphanumeric_or_camel_right", 32, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1227 },
{ PROC_LINKS(seek_alphanumeric_right, 0), "seek_alphanumeric_right", 23, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1215 },
{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1097 },
{ 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 },
{ PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1111 },
{ PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1083 },
{ PROC_LINKS(seek_token_left, 0), "seek_token_left", 15, "Seek left for the next beginning of a token.", 44, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1197 },
{ PROC_LINKS(seek_token_right, 0), "seek_token_right", 16, "Seek right for the next end of a token.", 39, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1191 },
{ PROC_LINKS(seek_white_or_token_left, 0), "seek_white_or_token_left", 24, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1209 },
{ PROC_LINKS(seek_white_or_token_right, 0), "seek_white_or_token_right", 25, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1203 },
{ 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_whitespace_down_end_line, 0), "seek_whitespace_down_end_line", 29, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1140 },
{ PROC_LINKS(seek_whitespace_left, 0), "seek_whitespace_left", 20, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1185 },
{ PROC_LINKS(seek_whitespace_right, 0), "seek_whitespace_right", 21, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1179 },
{ 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_up_end_line, 0), "seek_whitespace_up_end_line", 27, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1125 },
{ 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, 394 },
{ 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, 376 },
{ 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, 342 },
{ 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(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(set_bindings_choose, 0), "set_bindings_choose", 19, "Remap keybindings using the 'choose' mapping rule.", 50, "w:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 47 },
{ PROC_LINKS(set_bindings_default, 0), "set_bindings_default", 20, "Remap keybindings using the 'default' mapping rule.", 51, "w:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 61 },
{ PROC_LINKS(set_bindings_mac_default, 0), "set_bindings_mac_default", 24, "Remap keybindings using the 'mac-default' mapping rule.", 55, "w:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 75 },
@ -455,9 +455,9 @@ static Command_Metadata fcoder_metacmd_table[234] = {
{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1493 },
{ 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, 547 },
{ 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, 533 },
{ 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, 1227 },
{ 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, 1233 },
{ PROC_LINKS(snippet_lister, 0), "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 249 },
{ 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(snippet_lister, 0), "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 260 },
{ 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, 330 },
{ 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, 1602 },
{ 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, 428 },
@ -473,22 +473,22 @@ static Command_Metadata fcoder_metacmd_table[234] = {
{ 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, 372 },
{ 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, 662 },
{ 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, 651 },
{ PROC_LINKS(uncomment_line, 0), "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 148 },
{ PROC_LINKS(uncomment_line, 0), "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 157 },
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1750 },
{ PROC_LINKS(undo_this_buffer, 0), "undo_this_buffer", 16, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1719 },
{ 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, 1592 },
{ PROC_LINKS(view_jump_list_with_lister, 0), "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\4coder_jump_lister.cpp", 34, 104 },
{ PROC_LINKS(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, 889 },
{ 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, 644 },
{ PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 103 },
{ 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, 649 },
{ PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 108 },
{ 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, 68 },
{ 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, 704 },
{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 698 },
{ PROC_LINKS(write_hack, 0), "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 91 },
{ PROC_LINKS(write_note, 0), "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 97 },
{ PROC_LINKS(write_todo, 0), "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 85 },
{ 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, 749 },
{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 743 },
{ PROC_LINKS(write_hack, 0), "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 96 },
{ PROC_LINKS(write_note, 0), "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 102 },
{ PROC_LINKS(write_todo, 0), "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 90 },
{ PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 77 },
{ PROC_LINKS(write_zero_struct, 0), "write_zero_struct", 17, "At the cursor, insert a ' = {};'.", 33, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 109 },
{ PROC_LINKS(write_zero_struct, 0), "write_zero_struct", 17, "At the cursor, insert a ' = {};'.", 33, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 114 },
};
static int32_t fcoder_metacmd_ID_allow_mouse = 0;
static int32_t fcoder_metacmd_ID_auto_tab_line_at_cursor = 1;

View File

@ -531,51 +531,6 @@ adjust_all_buffer_wrap_widths(Application_Links *app, i32 wrap_width, i32 min_ba
}
}
static Buffer_Rect
get_rect(View_Summary *view){
Buffer_Rect rect = {};
rect.char0 = view->mark.character;
rect.line0 = view->mark.line;
rect.char1 = view->cursor.character;
rect.line1 = view->cursor.line;
if (rect.line0 > rect.line1){
Swap(i32, rect.line0, rect.line1);
}
if (rect.char0 > rect.char1){
Swap(i32, rect.char0, rect.char1);
}
return(rect);
}
static i32_Rect
get_line_x_rect(View_Summary *view){
i32_Rect rect = {};
if (view->unwrapped_lines){
rect.x0 = (i32)view->mark.unwrapped_x;
rect.x1 = (i32)view->cursor.unwrapped_x;
}
else{
rect.x0 = (i32)view->mark.wrapped_x;
rect.x1 = (i32)view->cursor.wrapped_x;
}
rect.y0 = view->mark.line;
rect.y1 = view->cursor.line;
if (rect.y0 > rect.y1){
Swap(i32, rect.y0, rect.y1);
}
if (rect.x0 > rect.x1){
Swap(i32, rect.x0, rect.x1);
}
return(rect);
}
static View_ID
get_first_view_with_buffer(Application_Links *app, Buffer_ID buffer_id){
View_ID result = {};
@ -756,8 +711,11 @@ get_view_x(View_Summary *view){
}
static Range
get_view_range(View_Summary *view){
return(make_range(view->cursor.pos, view->mark.pos));
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
@ -1281,7 +1239,7 @@ get_string_in_view_range(Application_Links *app, Partition *arena, View_Summary
Buffer_ID buffer = 0;
view_get_buffer(app, view->view_id, AccessProtected, &buffer);
if (buffer_exists(app, buffer)){
Range range = get_view_range(view);
Range range = get_view_range(app, view->view_id);
i32 query_length = range.max - range.min;
if (query_length != 0){
char *query_space = push_array(arena, char, query_length);
@ -1576,7 +1534,7 @@ if_view_has_highlighted_range_delete_range(Application_Links *app, View_ID view_
b32 result = false;
if (view_has_highlighted_range(app, view_id)){
View_Summary view = get_view(app, view_id, AccessAll);
Range range = get_view_range(&view);
Range range = get_view_range(app, view_id);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
buffer_replace_range(app, buffer, range, make_lit_string(""));

View File

@ -44,15 +44,6 @@ struct File_Name_Path_Data{
////////////////////////////////
struct Buffer_Rect{
i32 char0;
i32 line0;
i32 char1;
i32 line1;
};
////////////////////////////////
struct Stream_Chunk{
Application_Links *app;
Buffer_ID buffer_id;

View File

@ -8,8 +8,9 @@ such as open file, switch buffer, or kill buffer.
CUSTOM_COMMAND_SIG(lister__quit)
CUSTOM_DOC("A lister mode command that quits the list without executing any actions.")
{
View_Summary view = get_active_view(app, AccessAll);
view_end_ui_mode(app, &view);
View_ID view = 0;
get_active_view(app, AccessAll, &view);
view_end_ui_mode(app, view);
}
CUSTOM_COMMAND_SIG(lister__activate)
@ -32,8 +33,9 @@ CUSTOM_DOC("A lister mode command that activates the list's action on the highli
CUSTOM_COMMAND_SIG(lister__write_character)
CUSTOM_DOC("A lister mode command that dispatches to the lister's write character handler.")
{
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(view.view_id);
View_ID view = 0;
get_active_view(app, AccessAll, &view);
Lister_State *state = view_get_lister_state(view);
if (state->lister.data.handlers.write_character != 0){
state->lister.data.handlers.write_character(app);
}
@ -42,8 +44,9 @@ CUSTOM_DOC("A lister mode command that dispatches to the lister's write characte
CUSTOM_COMMAND_SIG(lister__backspace_text_field)
CUSTOM_DOC("A lister mode command that dispatches to the lister's backspace text field handler.")
{
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(view.view_id);
View_ID view = 0;
get_active_view(app, AccessAll, &view);
Lister_State *state = view_get_lister_state(view);
if (state->lister.data.handlers.backspace != 0){
state->lister.data.handlers.backspace(app);
}
@ -52,8 +55,9 @@ CUSTOM_DOC("A lister mode command that dispatches to the lister's backspace text
CUSTOM_COMMAND_SIG(lister__move_up)
CUSTOM_DOC("A lister mode command that dispatches to the lister's navigate up handler.")
{
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(view.view_id);
View_ID view = 0;
get_active_view(app, AccessAll, &view);
Lister_State *state = view_get_lister_state(view);
if (state->lister.data.handlers.navigate_up != 0){
state->lister.data.handlers.navigate_up(app);
}
@ -62,8 +66,9 @@ CUSTOM_DOC("A lister mode command that dispatches to the lister's navigate up ha
CUSTOM_COMMAND_SIG(lister__move_down)
CUSTOM_DOC("A lister mode command that dispatches to the lister's navigate down handler.")
{
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(view.view_id);
View_ID view = 0;
get_active_view(app, AccessAll, &view);
Lister_State *state = view_get_lister_state(view);
if (state->lister.data.handlers.navigate_down != 0){
state->lister.data.handlers.navigate_down(app);
}
@ -90,10 +95,11 @@ CUSTOM_COMMAND_SIG(lister__mouse_press)
CUSTOM_DOC("A lister mode command that beings a click interaction with a list item under the mouse.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(view.view_id);
View_ID view = 0;
get_active_view(app, AccessAll, &view);
Lister_State *state = view_get_lister_state(view);
if (state->initialized){
UI_Item clicked = lister_get_clicked_item(app, view.view_id, scratch);
UI_Item clicked = lister_get_clicked_item(app, view, scratch);
state->hot_user_data = clicked.user_data;
}
}
@ -508,17 +514,21 @@ generate_all_buffers_list(Application_Links *app, Lister *lister){
i32 currently_viewed_buffer_count = 0;
// List currently viewed buffers
for (View_Summary view = get_view_first(app, AccessAll);
view.exists;
get_view_next(app, &view, AccessAll)){
Buffer_ID new_buffer_id = view.buffer_id;
for (i32 i = 0; i < currently_viewed_buffer_count; i += 1){
if (new_buffer_id == buffers_currently_being_viewed[i]){
goto skip0;
{
View_ID view = 0;
for (get_view_next(app, 0, AccessAll, &view);
view != 0;
get_view_next(app, view, AccessAll, &view)){
Buffer_ID new_buffer_id = 0;
view_get_buffer(app, view, AccessAll, &new_buffer_id);
for (i32 i = 0; i < currently_viewed_buffer_count; i += 1){
if (new_buffer_id == buffers_currently_being_viewed[i]){
goto skip0;
}
}
buffers_currently_being_viewed[currently_viewed_buffer_count++] = new_buffer_id;
skip0:;
}
buffers_currently_being_viewed[currently_viewed_buffer_count++] = new_buffer_id;
skip0:;
}
// Regular Buffers

View File

@ -287,7 +287,7 @@ find_scope_range(Application_Links *app, Buffer_ID buffer, i32 start_pos, Range
}
static void
view_set_to_region(Application_Links *app, View_Summary *view, i32 major_pos, i32 minor_pos, f32 normalized_threshold){
view_set_to_region(Application_Links *app, View_ID view, i32 major_pos, i32 minor_pos, f32 normalized_threshold){
Range range = make_range(major_pos, minor_pos);
b32 bottom_major = false;
if (major_pos == range.max){
@ -300,15 +300,12 @@ view_set_to_region(Application_Links *app, View_Summary *view, i32 major_pos, i3
if (view_compute_cursor(app, view, seek_pos(range.max), &bottom)){
f32 top_y = top.wrapped_y;
f32 bottom_y = bottom.wrapped_y;
if (view->unwrapped_lines){
top_y = top.unwrapped_y;
bottom_y = bottom.unwrapped_y;
}
Rect_i32 region = {};
view_get_buffer_region(app, view->view_id, &region);
view_get_buffer_region(app, view, &region);
GUI_Scroll_Vars scroll = view->scroll_vars;
GUI_Scroll_Vars scroll = {};
view_get_scroll_vars(app, view, &scroll);
f32 half_view_height = .5f*(f32)(rect_height(region));
f32 threshold = normalized_threshold * half_view_height;
f32 current_center_y = ((f32)scroll.target_y) + half_view_height;
@ -342,33 +339,39 @@ view_set_to_region(Application_Links *app, View_Summary *view, i32 major_pos, i3
CUSTOM_COMMAND_SIG(select_surrounding_scope)
CUSTOM_DOC("Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.")
{
View_Summary view = get_active_view(app, AccessProtected);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessProtected, &buffer);
view_get_buffer(app, view, AccessProtected, &buffer);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
Range range = {};
if (find_scope_range(app, buffer, view.cursor.pos, &range, FindScope_Brace)){
view_set_cursor(app, &view, seek_pos(range.first), true);
view_set_mark(app, &view, seek_pos(range.end));
view_set_to_region(app, &view, range.first, range.end, scope_center_threshold);
no_mark_snap_to_cursor(app, view.view_id);
if (find_scope_range(app, buffer, pos, &range, FindScope_Brace)){
view_set_cursor(app, view, seek_pos(range.first), true);
view_set_mark(app, view, seek_pos(range.end));
view_set_to_region(app, view, range.first, range.end, scope_center_threshold);
no_mark_snap_to_cursor(app, view);
}
}
CUSTOM_COMMAND_SIG(select_next_scope_absolute)
CUSTOM_DOC("Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.")
{
View_Summary view = get_active_view(app, AccessProtected);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessProtected, &buffer);
i32 start_pos = view.cursor.pos;
view_get_buffer(app, view, AccessProtected, &buffer);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
i32 start_pos = pos;
i32 top = 0;
i32 bottom = 0;
if (find_next_scope(app, buffer, start_pos, FindScope_Brace, &top)){
if (find_scope_bottom(app, buffer, top, FindScope_EndOfToken|FindScope_Brace, &bottom)){
view_set_cursor(app, &view, seek_pos(top), true);
view_set_mark(app, &view, seek_pos(bottom));
view_set_to_region(app, &view, top, bottom, scope_center_threshold);
no_mark_snap_to_cursor(app, view.view_id);
view_set_cursor(app, view, seek_pos(top), true);
view_set_mark(app, view, seek_pos(bottom));
view_set_to_region(app, view, top, bottom, scope_center_threshold);
no_mark_snap_to_cursor(app, view);
}
}
}
@ -376,29 +379,34 @@ CUSTOM_DOC("Finds the first scope started by '{' after the cursor and puts the c
CUSTOM_COMMAND_SIG(select_prev_scope_absolute)
CUSTOM_DOC("Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.")
{
View_Summary view = get_active_view(app, AccessProtected);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessProtected, &buffer);
i32 start_pos = view.cursor.pos;
i32 top = 0, bottom = 0;
view_get_buffer(app, view, AccessProtected, &buffer);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
i32 start_pos = pos;
i32 top = 0;
i32 bottom = 0;
if (find_prev_scope(app, buffer, start_pos, FindScope_Brace, &top)){
if (find_scope_bottom(app, buffer, top, FindScope_EndOfToken|FindScope_Brace, &bottom)){
view_set_cursor(app, &view, seek_pos(top), true);
view_set_mark(app, &view, seek_pos(bottom));
view_set_to_region(app, &view, top, bottom, scope_center_threshold);
no_mark_snap_to_cursor(app, view.view_id);
view_set_cursor(app, view, seek_pos(top), true);
view_set_mark(app, view, seek_pos(bottom));
view_set_to_region(app, view, top, bottom, scope_center_threshold);
no_mark_snap_to_cursor(app, view);
}
}
}
static void
place_begin_and_end_on_own_lines(Application_Links *app, Partition *scratch, char *begin, char *end){
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
Range lines = {};
Range range = get_view_range(&view);
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);
@ -442,7 +450,11 @@ place_begin_and_end_on_own_lines(Application_Links *app, Partition *scratch, cha
i32 cursor_pos = min_pos;
i32 mark_pos = max_pos;
if (view.cursor.pos > view.mark.pos){
i32 view_cursor_pos = 0;
view_get_cursor_pos(app, view, &view_cursor_pos);
i32 view_mark_pos = 0;
view_get_mark_pos(app, view, &view_mark_pos);
if (view_cursor_pos > view_mark_pos){
cursor_pos = max_pos;
mark_pos = min_pos;
}
@ -459,14 +471,14 @@ place_begin_and_end_on_own_lines(Application_Links *app, Partition *scratch, cha
buffer_batch_edit(app, buffer, str, edits, 2);
view_set_cursor(app, &view, seek_pos(cursor_pos), true);
view_set_mark(app, &view, seek_pos(mark_pos));
view_set_cursor(app, view, seek_pos(cursor_pos), true);
view_set_mark(app, view, seek_pos(mark_pos));
}
else{
buffer_replace_range(app, buffer, range, make_string(str, str_size));
i32 center_pos = range.min + begin_len + 1;
view_set_cursor(app, &view, seek_pos(center_pos), true);
view_set_mark(app, &view, seek_pos(center_pos));
view_set_cursor(app, view, seek_pos(center_pos), true);
view_set_mark(app, view, seek_pos(center_pos));
}
end_temp_memory(temp);
@ -481,12 +493,18 @@ CUSTOM_DOC("Wraps the code contained in the range between cursor and mark with a
CUSTOM_COMMAND_SIG(delete_current_scope)
CUSTOM_DOC("Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.")
{
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
i32 top = view.cursor.pos;
i32 bottom = view.mark.pos;
i32 view_cursor_pos = 0;
view_get_cursor_pos(app, view, &view_cursor_pos);
i32 view_mark_pos = 0;
view_get_mark_pos(app, view, &view_mark_pos);
i32 top = view_cursor_pos;
i32 bottom = view_mark_pos;
if (top > bottom){
i32 x = top;
@ -716,12 +734,18 @@ find_whole_statement_down(Application_Links *app, Buffer_ID buffer, i32 pos, i32
CUSTOM_COMMAND_SIG(scope_absorb_down)
CUSTOM_DOC("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.")
{
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer);
view_get_buffer(app, view, AccessOpen, &buffer);
i32 top = view.cursor.pos;
i32 bottom = view.mark.pos;
i32 view_cursor_pos = 0;
view_get_cursor_pos(app, view, &view_cursor_pos);
i32 view_mark_pos = 0;
view_get_mark_pos(app, view, &view_mark_pos);
i32 top = view_cursor_pos;
i32 bottom = view_mark_pos;
if (top > bottom){
i32 x = top;
@ -785,7 +809,7 @@ CUSTOM_DOC("If a scope is currently selected, and a statement or block statement
}
end_temp_memory(temp);
no_mark_snap_to_cursor(app, view.view_id);
no_mark_snap_to_cursor(app, view);
}
// BOTTOM

View File

@ -60,10 +60,11 @@ seek_line_beginning(Application_Links *app, Buffer_ID buffer_id, i32 pos){
}
static void
move_past_lead_whitespace(Application_Links *app, View_Summary *view, Buffer_ID buffer_id){
refresh_view(app, view);
move_past_lead_whitespace(Application_Links *app, View_ID view, Buffer_ID buffer_id){
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
i32 new_pos = seek_line_beginning(app, buffer_id, view->cursor.pos);
i32 new_pos = seek_line_beginning(app, buffer_id, pos);
char space[1024];
Stream_Chunk chunk = {};
i32 still_looping = false;
@ -81,7 +82,7 @@ move_past_lead_whitespace(Application_Links *app, View_Summary *view, Buffer_ID
}while(still_looping);
break2:;
if (i > view->cursor.pos){
if (i > pos){
view_set_cursor(app, view, seek_pos(i), true);
}
}
@ -962,51 +963,52 @@ buffer_boundary_seek(Application_Links *app, Buffer_ID buffer_id, i32 start_pos,
}
static void
view_buffer_boundary_seek_set_pos(Application_Links *app, View_Summary *view, Buffer_ID buffer_id, i32 dir, u32 flags){
i32 pos = buffer_boundary_seek(app, buffer_id, &global_part, view->cursor.pos, dir, flags);
view_buffer_boundary_seek_set_pos(Application_Links *app, View_ID view, Buffer_ID buffer_id, i32 dir, u32 flags){
i32 cursor_pos = 0;
view_get_cursor_pos(app, view, &cursor_pos);
i32 pos = buffer_boundary_seek(app, buffer_id, &global_part, cursor_pos, dir, flags);
view_set_cursor(app, view, seek_pos(pos), true);
no_mark_snap_to_cursor_if_shift(app, view->view_id);
no_mark_snap_to_cursor_if_shift(app, view);
}
static void
view_boundary_seek_set_pos(Application_Links *app, View_Summary *view, i32 dir, u32 flags){
view_boundary_seek_set_pos(Application_Links *app, View_ID view, i32 dir, u32 flags){
Buffer_ID buffer_id = 0;
view_get_buffer(app, view->view_id, AccessProtected, &buffer_id);
view_get_buffer(app, view, AccessProtected, &buffer_id);
view_buffer_boundary_seek_set_pos(app, view, buffer_id, dir, flags);
}
static void
current_view_boundary_seek_set_pos(Application_Links *app, i32 dir, u32 flags){
View_Summary view = get_active_view(app, AccessProtected);
view_boundary_seek_set_pos(app, &view, dir, flags);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
view_boundary_seek_set_pos(app, view, dir, flags);
}
static Range
view_buffer_boundary_range(Application_Links *app, View_Summary *view, Buffer_ID buffer_id, i32 dir, u32 flags){
i32 pos1 = view->cursor.pos;
view_buffer_boundary_range(Application_Links *app, View_ID view, Buffer_ID buffer_id, i32 dir, u32 flags){
i32 pos1 = 0;
view_get_cursor_pos(app, view, &pos1);
i32 pos2 = buffer_boundary_seek(app, buffer_id, pos1, dir, flags);
return(make_range(pos1, pos2));
}
static Range
view_buffer_snipe_range(Application_Links *app, View_Summary *view, Buffer_ID buffer_id, i32 dir, u32 flags){
view_buffer_snipe_range(Application_Links *app, View_ID view, Buffer_ID buffer_id, i32 dir, u32 flags){
i32 buffer_size = 0;
buffer_get_size(app, buffer_id, &buffer_size);
Range result = {};
i32 pos0 = view->cursor.pos;
i32 pos0 = 0;
view_get_cursor_pos(app, view, &pos0);
i32 pos1 = buffer_boundary_seek(app, buffer_id, pos0, dir, flags);
if (0 <= pos1 && pos1 <= buffer_size){
i32 pos2 = buffer_boundary_seek(app, buffer_id, pos1, flip_dir(dir), flags);
if (0 <= pos2 && pos2 <= buffer_size){
if (dir == DirLeft){
if (pos2 < pos0){
pos2 = pos0;
}
pos2 = clamp_bottom(pos2, pos0);
}
else{
if (pos2 > pos0){
pos2 = pos0;
}
pos2 = clamp_top(pos2, pos0);
}
result = make_range(pos1, pos2);
}
@ -1016,22 +1018,22 @@ view_buffer_snipe_range(Application_Links *app, View_Summary *view, Buffer_ID bu
static void
current_view_boundary_delete(Application_Links *app, i32 dir, u32 flags){
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer_id = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer_id);
Range range = view_buffer_boundary_range(app, &view, buffer_id, dir, flags);
String zero = {};
buffer_replace_range(app, buffer_id, range, zero);
view_get_buffer(app, view, AccessOpen, &buffer_id);
Range range = view_buffer_boundary_range(app, view, buffer_id, dir, flags);
buffer_replace_range(app, buffer_id, range, make_lit_string(""));
}
static void
current_view_snipe_delete(Application_Links *app, i32 dir, u32 flags){
View_Summary view = get_active_view(app, AccessOpen);
View_ID view = 0;
get_active_view(app, AccessOpen, &view);
Buffer_ID buffer_id = 0;
view_get_buffer(app, view.view_id, AccessOpen, &buffer_id);
Range range = view_buffer_snipe_range(app, &view, buffer_id, dir, flags);
String zero = {};
buffer_replace_range(app, buffer_id, range, zero);
view_get_buffer(app, view, AccessOpen, &buffer_id);
Range range = view_buffer_snipe_range(app, view, buffer_id, dir, flags);
buffer_replace_range(app, buffer_id, range, make_lit_string(""));
}
////////////////////////////////
@ -1039,113 +1041,137 @@ current_view_snipe_delete(Application_Links *app, i32 dir, u32 flags){
CUSTOM_COMMAND_SIG(seek_whitespace_up)
CUSTOM_DOC("Seeks the cursor up to the next blank line.")
{
View_Summary view = get_active_view(app, AccessProtected);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
Buffer_ID buffer_id = 0;
view_get_buffer(app, view.view_id, AccessProtected, &buffer_id);
i32 new_pos = buffer_seek_whitespace_up(app, buffer_id, view.cursor.pos);
view_set_cursor(app, &view, seek_pos(new_pos), true);
no_mark_snap_to_cursor_if_shift(app, view.view_id);
view_get_buffer(app, view, AccessProtected, &buffer_id);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
i32 new_pos = buffer_seek_whitespace_up(app, buffer_id, pos);
view_set_cursor(app, view, seek_pos(new_pos), true);
no_mark_snap_to_cursor_if_shift(app, view);
}
CUSTOM_COMMAND_SIG(seek_whitespace_down)
CUSTOM_DOC("Seeks the cursor down to the next blank line.")
{
View_Summary view = get_active_view(app, AccessProtected);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
Buffer_ID buffer_id = 0;
view_get_buffer(app, view.view_id, AccessProtected, &buffer_id);
i32 new_pos = buffer_seek_whitespace_down(app, buffer_id, view.cursor.pos);
view_set_cursor(app, &view, seek_pos(new_pos), true);
no_mark_snap_to_cursor_if_shift(app, view.view_id);
view_get_buffer(app, view, AccessProtected, &buffer_id);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
i32 new_pos = buffer_seek_whitespace_down(app, buffer_id, pos);
view_set_cursor(app, view, seek_pos(new_pos), true);
no_mark_snap_to_cursor_if_shift(app, view);
}
CUSTOM_COMMAND_SIG(seek_beginning_of_textual_line)
CUSTOM_DOC("Seeks the cursor to the beginning of the line across all text.")
{
View_Summary view = get_active_view(app, AccessProtected);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
Buffer_ID buffer_id = 0;
view_get_buffer(app, view.view_id, AccessProtected, &buffer_id);
i32 new_pos = seek_line_beginning(app, buffer_id, view.cursor.pos);
view_set_cursor(app, &view, seek_pos(new_pos), true);
no_mark_snap_to_cursor_if_shift(app, view.view_id);
view_get_buffer(app, view, AccessProtected, &buffer_id);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
i32 new_pos = seek_line_beginning(app, buffer_id, pos);
view_set_cursor(app, view, seek_pos(new_pos), true);
no_mark_snap_to_cursor_if_shift(app, view);
}
CUSTOM_COMMAND_SIG(seek_end_of_textual_line)
CUSTOM_DOC("Seeks the cursor to the end of the line across all text.")
{
View_Summary view = get_active_view(app, AccessProtected);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
Buffer_ID buffer_id = 0;
view_get_buffer(app, view.view_id, AccessProtected, &buffer_id);
i32 new_pos = seek_line_end(app, buffer_id, view.cursor.pos);
view_set_cursor(app, &view, seek_pos(new_pos), true);
no_mark_snap_to_cursor_if_shift(app, view.view_id);
view_get_buffer(app, view, AccessProtected, &buffer_id);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
i32 new_pos = seek_line_end(app, buffer_id, pos);
view_set_cursor(app, view, seek_pos(new_pos), true);
no_mark_snap_to_cursor_if_shift(app, view);
}
CUSTOM_COMMAND_SIG(seek_beginning_of_line)
CUSTOM_DOC("Seeks the cursor to the beginning of the visual line.")
{
View_Summary view = get_active_view(app, AccessProtected);
float y = view.cursor.wrapped_y;
if (view.unwrapped_lines){
y = view.cursor.unwrapped_y;
}
view_set_cursor(app, &view, seek_xy(0, y, 1, view.unwrapped_lines), 1);
no_mark_snap_to_cursor_if_shift(app, view.view_id);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
Full_Cursor cursor = {};
view_compute_cursor(app, view, seek_pos(pos), &cursor);
f32 y = cursor.wrapped_y;
view_set_cursor(app, view, seek_wrapped_xy(0.f, y, true), true);
no_mark_snap_to_cursor_if_shift(app, view);
}
CUSTOM_COMMAND_SIG(seek_end_of_line)
CUSTOM_DOC("Seeks the cursor to the end of the visual line.")
{
View_Summary view = get_active_view(app, AccessProtected);
float y = view.cursor.wrapped_y;
if (view.unwrapped_lines){
y = view.cursor.unwrapped_y;
}
view_set_cursor(app, &view, seek_xy(max_f32, y, 1, view.unwrapped_lines), 1);
no_mark_snap_to_cursor_if_shift(app, view.view_id);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
Full_Cursor cursor = {};
view_compute_cursor(app, view, seek_pos(pos), &cursor);
f32 y = cursor.wrapped_y;
view_set_cursor(app, view, seek_wrapped_xy(max_f32, y, true), true);
no_mark_snap_to_cursor_if_shift(app, view);
}
CUSTOM_COMMAND_SIG(seek_whitespace_up_end_line)
CUSTOM_DOC("Seeks the cursor up to the next blank line and places it at the end of the line.")
{
View_Summary view = get_active_view(app, AccessProtected);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
Buffer_ID buffer_id = 0;
view_get_buffer(app, view.view_id, AccessProtected, &buffer_id);
i32 new_pos = buffer_seek_whitespace_up(app, buffer_id, view.cursor.pos);
view_get_buffer(app, view, AccessProtected, &buffer_id);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
i32 new_pos = buffer_seek_whitespace_up(app, buffer_id, pos);
new_pos = seek_line_end(app, buffer_id, new_pos);
view_set_cursor(app, &view, seek_pos(new_pos), true);
no_mark_snap_to_cursor_if_shift(app, view.view_id);
view_set_cursor(app, view, seek_pos(new_pos), true);
no_mark_snap_to_cursor_if_shift(app, view);
}
CUSTOM_COMMAND_SIG(seek_whitespace_down_end_line)
CUSTOM_DOC("Seeks the cursor down to the next blank line and places it at the end of the line.")
{
View_Summary view = get_active_view(app, AccessProtected);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
Buffer_ID buffer_id = 0;
view_get_buffer(app, view.view_id, AccessProtected, &buffer_id);
i32 new_pos = buffer_seek_whitespace_down(app, buffer_id, view.cursor.pos);
view_get_buffer(app, view, AccessProtected, &buffer_id);
i32 pos = 0;
view_get_cursor_pos(app, view, &pos);
i32 new_pos = buffer_seek_whitespace_down(app, buffer_id, pos);
new_pos = seek_line_end(app, buffer_id, new_pos);
view_set_cursor(app, &view, seek_pos(new_pos), true);
no_mark_snap_to_cursor_if_shift(app, view.view_id);
view_set_cursor(app, view, seek_pos(new_pos), true);
no_mark_snap_to_cursor_if_shift(app, view);
}
CUSTOM_COMMAND_SIG(goto_beginning_of_file)
CUSTOM_DOC("Sets the cursor to the beginning of the file.")
{
View_Summary view = get_active_view(app, AccessProtected);
view_set_cursor(app, &view, seek_pos(0), true);
no_mark_snap_to_cursor_if_shift(app, view.view_id);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
view_set_cursor(app, view, seek_pos(0), true);
no_mark_snap_to_cursor_if_shift(app, view);
}
CUSTOM_COMMAND_SIG(goto_end_of_file)
CUSTOM_DOC("Sets the cursor to the end of the file.")
{
View_Summary view = get_active_view(app, AccessProtected);
View_ID view = 0;
get_active_view(app, AccessProtected, &view);
Buffer_ID buffer_id = 0;
view_get_buffer(app, view.view_id, AccessProtected, &buffer_id);
view_get_buffer(app, view, AccessProtected, &buffer_id);
i32 size = 0;
buffer_get_size(app, buffer_id, &size);
view_set_cursor(app, &view, seek_pos(size), true);
no_mark_snap_to_cursor_if_shift(app, view.view_id);
view_set_cursor(app, view, seek_pos(size), true);
no_mark_snap_to_cursor_if_shift(app, view);
}
////////////////////////////////

View File

@ -4051,17 +4051,6 @@ Draw_Coordinate_Center_Pop(Application_Links *app){
return(result);
}
API_EXPORT Face_ID
Get_Default_Font_For_View(Application_Links *app, View_ID view_id)
{
Models *models = (Models*)app->cmd_context;
View *view = imp_get_view(models, view_id);
Editing_File *file = view->file;
Assert(file != 0);
Face_ID face_id = file->settings.font_id;
return(face_id);
}
API_EXPORT b32
Text_Layout_Get_Buffer(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID *buffer_id_out){
Models *models = (Models*)app->cmd_context;