Face* instead of Face_ID as much as possible; Preferred X works again

This commit is contained in:
Allen Webster 2019-09-02 14:32:52 -07:00
parent aaec0cc3c8
commit 352cb27b73
25 changed files with 342 additions and 396 deletions

View File

@ -49,7 +49,7 @@ write_character_parameter(Application_Links *app, u8 *character, u32 length){
// NOTE(allen): finish updating the cursor // NOTE(allen): finish updating the cursor
if (edit_success){ if (edit_success){
view_set_cursor(app, view, seek_pos(pos + length), true); view_set_cursor_and_preferred_x(app, view, seek_pos(pos + length));
} }
} }
} }
@ -100,7 +100,7 @@ CUSTOM_DOC("Deletes the character to the left of the cursor.")
i64 character = view_relative_character_from_pos(app, view, cursor.line, cursor.pos); i64 character = view_relative_character_from_pos(app, view, cursor.line, cursor.pos);
i64 start = view_pos_from_relative_character(app, view, cursor.line, character - 1); i64 start = view_pos_from_relative_character(app, view, cursor.line, character - 1);
if (buffer_replace_range(app, buffer, Ii64(start, end), string_u8_empty)){ if (buffer_replace_range(app, buffer, Ii64(start, end), string_u8_empty)){
view_set_cursor(app, view, seek_pos(start), true); view_set_cursor_and_preferred_x(app, view, seek_pos(start));
} }
} }
} }
@ -112,7 +112,7 @@ CUSTOM_DOC("Sets the mark to the current position of the cursor.")
View_ID view = get_active_view(app, AccessProtected); View_ID view = get_active_view(app, AccessProtected);
i64 pos = view_get_cursor_pos(app, view); i64 pos = view_get_cursor_pos(app, view);
view_set_mark(app, view, seek_pos(pos)); view_set_mark(app, view, seek_pos(pos));
view_set_cursor(app, view, seek_pos(pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(pos));
} }
CUSTOM_COMMAND_SIG(cursor_mark_swap) CUSTOM_COMMAND_SIG(cursor_mark_swap)
@ -121,7 +121,7 @@ CUSTOM_DOC("Swaps the position of the cursor and the mark.")
View_ID view = get_active_view(app, AccessProtected); View_ID view = get_active_view(app, AccessProtected);
i64 cursor = view_get_cursor_pos(app, view); i64 cursor = view_get_cursor_pos(app, view);
i64 mark = view_get_mark_pos(app, view); i64 mark = view_get_mark_pos(app, view);
view_set_cursor(app, view, seek_pos(mark), true); view_set_cursor_and_preferred_x(app, view, seek_pos(mark));
view_set_mark(app, view, seek_pos(cursor)); view_set_mark(app, view, seek_pos(cursor));
} }
@ -227,7 +227,7 @@ CUSTOM_DOC("Sets the cursor position and mark to the mouse position.")
if (!view_is_in_ui_mode(app, view)){ if (!view_is_in_ui_mode(app, view)){
Mouse_State mouse = get_mouse_state(app); Mouse_State mouse = get_mouse_state(app);
i64 pos = view_pos_from_xy(app, view, V2(mouse.p)); i64 pos = view_pos_from_xy(app, view, V2(mouse.p));
view_set_cursor(app, view, seek_pos(pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(pos));
view_set_mark(app, view, seek_pos(pos)); view_set_mark(app, view, seek_pos(pos));
} }
} }
@ -239,7 +239,7 @@ CUSTOM_DOC("Sets the cursor position to the mouse position.")
if (!view_is_in_ui_mode(app, view)){ if (!view_is_in_ui_mode(app, view)){
Mouse_State mouse = get_mouse_state(app); Mouse_State mouse = get_mouse_state(app);
i64 pos = view_pos_from_xy(app, view, V2(mouse.p)); i64 pos = view_pos_from_xy(app, view, V2(mouse.p));
view_set_cursor(app, view, seek_pos(pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(pos));
no_mark_snap_to_cursor(app, view); no_mark_snap_to_cursor(app, view);
} }
} }
@ -252,7 +252,7 @@ CUSTOM_DOC("If the mouse left button is pressed, sets the cursor position to the
Mouse_State mouse = get_mouse_state(app); Mouse_State mouse = get_mouse_state(app);
if (mouse.l){ if (mouse.l){
i64 pos = view_pos_from_xy(app, view, V2(mouse.p)); i64 pos = view_pos_from_xy(app, view, V2(mouse.p));
view_set_cursor(app, view, seek_pos(pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(pos));
} }
no_mark_snap_to_cursor(app, view); no_mark_snap_to_cursor(app, view);
} }
@ -296,9 +296,10 @@ move_vertical_pixels(Application_Links *app, View_ID view, f32 pixels){
i64 pos = view_get_cursor_pos(app, view); i64 pos = view_get_cursor_pos(app, view);
Buffer_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos)); Buffer_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos));
Vec2_f32 p = view_relative_xy_of_pos(app, view, cursor.line, pos); Vec2_f32 p = view_relative_xy_of_pos(app, view, cursor.line, pos);
p.x = view_get_preferred_x(app, view);
p.y += pixels; p.y += pixels;
i64 new_pos = view_pos_at_relative_xy(app, view, cursor.line, p); i64 new_pos = view_pos_at_relative_xy(app, view, cursor.line, p);
view_set_cursor(app, view, seek_pos(new_pos), false); view_set_cursor(app, view, seek_pos(new_pos));
no_mark_snap_to_cursor_if_shift(app, view); no_mark_snap_to_cursor_if_shift(app, view);
} }
@ -324,8 +325,6 @@ move_vertical_lines(Application_Links *app, f32 lines){
move_vertical_lines(app, view, lines); move_vertical_lines(app, view, lines);
} }
#define move_vertical move_vertical_lines
internal f32 internal f32
get_page_jump(Application_Links *app, View_ID view){ get_page_jump(Application_Links *app, View_ID view){
Rect_f32 region = view_get_buffer_region(app, view); Rect_f32 region = view_get_buffer_region(app, view);
@ -335,25 +334,25 @@ get_page_jump(Application_Links *app, View_ID view){
CUSTOM_COMMAND_SIG(move_up) CUSTOM_COMMAND_SIG(move_up)
CUSTOM_DOC("Moves the cursor up one line.") CUSTOM_DOC("Moves the cursor up one line.")
{ {
move_vertical(app, -1.f); move_vertical_lines(app, -1.f);
} }
CUSTOM_COMMAND_SIG(move_down) CUSTOM_COMMAND_SIG(move_down)
CUSTOM_DOC("Moves the cursor down one line.") CUSTOM_DOC("Moves the cursor down one line.")
{ {
move_vertical(app, 1.f); move_vertical_lines(app, 1.f);
} }
CUSTOM_COMMAND_SIG(move_up_10) CUSTOM_COMMAND_SIG(move_up_10)
CUSTOM_DOC("Moves the cursor up ten lines.") CUSTOM_DOC("Moves the cursor up ten lines.")
{ {
move_vertical(app, -10.f); move_vertical_lines(app, -10.f);
} }
CUSTOM_COMMAND_SIG(move_down_10) CUSTOM_COMMAND_SIG(move_down_10)
CUSTOM_DOC("Moves the cursor down ten lines.") CUSTOM_DOC("Moves the cursor down ten lines.")
{ {
move_vertical(app, 10.f); move_vertical_lines(app, 10.f);
} }
CUSTOM_COMMAND_SIG(move_down_textual) CUSTOM_COMMAND_SIG(move_down_textual)
@ -363,7 +362,7 @@ CUSTOM_DOC("Moves down to the next line of actual text, regardless of line wrapp
i64 pos = view_get_cursor_pos(app, view); i64 pos = view_get_cursor_pos(app, view);
Buffer_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos)); Buffer_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos));
i64 next_line = cursor.line + 1; i64 next_line = cursor.line + 1;
view_set_cursor(app, view, seek_line_col(next_line, 1), true); view_set_cursor_and_preferred_x(app, view, seek_line_col(next_line, 1));
} }
CUSTOM_COMMAND_SIG(page_up) CUSTOM_COMMAND_SIG(page_up)
@ -399,7 +398,7 @@ seek_blank_line(Application_Links *app, Scan_Direction direction, Position_Withi
new_pos = get_line_side_pos_from_pos(app, buffer, new_pos, Side_Max); new_pos = get_line_side_pos_from_pos(app, buffer, new_pos, Side_Max);
}break; }break;
} }
view_set_cursor(app, view, seek_pos(new_pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(new_pos));
no_mark_snap_to_cursor_if_shift(app, view); no_mark_snap_to_cursor_if_shift(app, view);
} }
@ -439,11 +438,6 @@ CUSTOM_DOC("Seeks the cursor down to the next blank line and places it at the en
seek_blank_line(app, Scan_Forward, PositionWithinLine_End); seek_blank_line(app, Scan_Forward, PositionWithinLine_End);
} }
#define seek_whitespace_up move_up_to_blank_line
#define seek_whitespace_down move_down_to_blank_line
#define seek_whitespace_up_end_line move_up_to_blank_line_skip_whitespace
#define seek_whitespace_down_end_line move_down_to_blank_line_skip_whitespace
CUSTOM_COMMAND_SIG(move_left) CUSTOM_COMMAND_SIG(move_left)
CUSTOM_DOC("Moves the cursor one character to the left.") CUSTOM_DOC("Moves the cursor one character to the left.")
{ {
@ -452,7 +446,7 @@ CUSTOM_DOC("Moves the cursor one character to the left.")
Buffer_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos)); Buffer_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos));
i64 character = view_relative_character_from_pos(app, view, cursor.line, pos); i64 character = view_relative_character_from_pos(app, view, cursor.line, pos);
i64 new_pos = view_pos_from_relative_character(app, view, cursor.line, character - 1); i64 new_pos = view_pos_from_relative_character(app, view, cursor.line, character - 1);
view_set_cursor(app, view, seek_pos(new_pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(new_pos));
no_mark_snap_to_cursor_if_shift(app, view); no_mark_snap_to_cursor_if_shift(app, view);
} }
@ -464,7 +458,7 @@ CUSTOM_DOC("Moves the cursor one character to the right.")
Buffer_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos)); Buffer_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos));
i64 character = view_relative_character_from_pos(app, view, cursor.line, pos); i64 character = view_relative_character_from_pos(app, view, cursor.line, pos);
i64 new_pos = view_pos_from_relative_character(app, view, cursor.line, character + 1); i64 new_pos = view_pos_from_relative_character(app, view, cursor.line, character + 1);
view_set_cursor(app, view, seek_pos(new_pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(new_pos));
no_mark_snap_to_cursor_if_shift(app, view); no_mark_snap_to_cursor_if_shift(app, view);
} }
@ -474,7 +468,7 @@ current_view_scan_move(Application_Links *app, Scan_Direction direction, Boundar
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected); Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
i64 cursor_pos = view_get_cursor_pos(app, view); i64 cursor_pos = view_get_cursor_pos(app, view);
i64 pos = scan(app, funcs, buffer, direction, cursor_pos); i64 pos = scan(app, funcs, buffer, direction, cursor_pos);
view_set_cursor(app, view, seek_pos(pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(pos));
no_mark_snap_to_cursor_if_shift(app, view); no_mark_snap_to_cursor_if_shift(app, view);
} }
@ -577,7 +571,7 @@ CUSTOM_DOC("Puts the cursor at the top of the file, and the mark at the bottom o
View_ID view = get_active_view(app, AccessProtected); View_ID view = get_active_view(app, AccessProtected);
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected); Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
i32 buffer_size = (i32)buffer_get_size(app, buffer); i32 buffer_size = (i32)buffer_get_size(app, buffer);
view_set_cursor(app, view, seek_pos(0), true); view_set_cursor_and_preferred_x(app, view, seek_pos(0));
view_set_mark(app, view, seek_pos(buffer_size)); view_set_mark(app, view, seek_pos(buffer_size));
no_mark_snap_to_cursor(app, view); no_mark_snap_to_cursor(app, view);
} }
@ -594,7 +588,7 @@ CUSTOM_DOC("Converts all ascii text in the range between the cursor and the mark
String_Const_u8 string = push_buffer_range(app, scratch, buffer, range); String_Const_u8 string = push_buffer_range(app, scratch, buffer, range);
string = string_mod_upper(string); string = string_mod_upper(string);
buffer_replace_range(app, buffer, range, string); buffer_replace_range(app, buffer, range, string);
view_set_cursor(app, view, seek_pos(range.max), true); view_set_cursor_and_preferred_x(app, view, seek_pos(range.max));
} }
CUSTOM_COMMAND_SIG(to_lowercase) CUSTOM_COMMAND_SIG(to_lowercase)
@ -607,7 +601,7 @@ CUSTOM_DOC("Converts all ascii text in the range between the cursor and the mark
String_Const_u8 string = push_buffer_range(app, scratch, buffer, range); String_Const_u8 string = push_buffer_range(app, scratch, buffer, range);
string = string_mod_lower(string); string = string_mod_lower(string);
buffer_replace_range(app, buffer, range, string); buffer_replace_range(app, buffer, range, string);
view_set_cursor(app, view, seek_pos(range.max), true); view_set_cursor_and_preferred_x(app, view, seek_pos(range.max));
} }
CUSTOM_COMMAND_SIG(clean_all_lines) CUSTOM_COMMAND_SIG(clean_all_lines)
@ -833,7 +827,7 @@ CUSTOM_DOC("Queries the user for a number, and jumps the cursor to the correspon
if (query_user_number(app, &bar)){ if (query_user_number(app, &bar)){
i32 line_number = (i32)string_to_integer(bar.string, 10); i32 line_number = (i32)string_to_integer(bar.string, 10);
View_ID view = get_active_view(app, AccessProtected); View_ID view = get_active_view(app, AccessProtected);
view_set_cursor(app, view, seek_line_col(line_number, 0), true); view_set_cursor_and_preferred_x(app, view, seek_line_col(line_number, 0));
} }
} }
@ -843,7 +837,7 @@ CUSTOM_COMMAND_SIG(reverse_search);
static void static void
isearch__update_highlight(Application_Links *app, View_ID view, Range_i64 range){ isearch__update_highlight(Application_Links *app, View_ID view, Range_i64 range){
view_set_highlight_range(app, view, range); view_set_highlight_range(app, view, range);
view_set_cursor(app, view, seek_pos(range.start), true); view_set_cursor_and_preferred_x(app, view, seek_pos(range.start));
} }
static void static void
@ -1029,7 +1023,7 @@ isearch(Application_Links *app, b32 start_reversed, String_Const_u8 query_init,
size = clamp_top(size, sizeof(previous_isearch_query) - 1); size = clamp_top(size, sizeof(previous_isearch_query) - 1);
block_copy(previous_isearch_query, bar.string.str, size); block_copy(previous_isearch_query, bar.string.str, size);
previous_isearch_query[size] = 0; previous_isearch_query[size] = 0;
view_set_cursor(app, view, seek_pos(first_pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(first_pos));
} }
} }
@ -1178,7 +1172,7 @@ query_replace_base(Application_Links *app, View_ID view, Buffer_ID buffer_id, i6
return; return;
} }
view_set_cursor(app, view, seek_pos(pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(pos));
} }
static void static void
@ -1452,7 +1446,7 @@ current_view_move_line(Application_Links *app, Scan_Direction direction){
i64 pos = view_get_cursor_pos(app, view); i64 pos = view_get_cursor_pos(app, view);
i64 line_number = get_line_number_from_pos(app, buffer, pos); i64 line_number = get_line_number_from_pos(app, buffer, pos);
pos = move_line(app, buffer, line_number, direction); pos = move_line(app, buffer, line_number, direction);
view_set_cursor(app, view, seek_pos(pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(pos));
} }
CUSTOM_COMMAND_SIG(move_line_up) CUSTOM_COMMAND_SIG(move_line_up)
@ -1600,7 +1594,7 @@ CUSTOM_DOC("Set the other non-active panel to view the buffer that the active pa
change_active_panel(app); change_active_panel(app);
view = get_active_view(app, AccessAll); view = get_active_view(app, AccessAll);
view_set_buffer(app, view, buffer, 0); view_set_buffer(app, view, buffer, 0);
view_set_cursor(app, view, seek_pos(pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(pos));
} }
CUSTOM_COMMAND_SIG(swap_buffers_between_panels) CUSTOM_COMMAND_SIG(swap_buffers_between_panels)
@ -1627,11 +1621,11 @@ CUSTOM_DOC("Set the other non-active panel to view the buffer that the active pa
i64 m2 = view_get_mark_pos(app, view2); i64 m2 = view_get_mark_pos(app, view2);
Buffer_Scroll sc2 = view_get_buffer_scroll(app, view2); Buffer_Scroll sc2 = view_get_buffer_scroll(app, view2);
view_set_cursor(app, view1, seek_pos(p2), true); view_set_cursor_and_preferred_x(app, view1, seek_pos(p2));
view_set_mark (app, view1, seek_pos(m2)); view_set_mark(app, view1, seek_pos(m2));
view_set_buffer_scroll(app, view1, sc2); view_set_buffer_scroll(app, view1, sc2);
view_set_cursor(app, view2, seek_pos(p1), true); view_set_cursor_and_preferred_x(app, view2, seek_pos(p1));
view_set_mark (app, view2, seek_pos(m1)); view_set_mark(app, view2, seek_pos(m1));
view_set_buffer_scroll(app, view2, sc1); view_set_buffer_scroll(app, view2, sc1);
} }
} }
@ -1726,7 +1720,7 @@ CUSTOM_DOC("Advances backwards through the undo history of the current buffer.")
if (current > 0){ if (current > 0){
i32 new_position = record_get_new_cursor_position_undo(app, buffer, current); i32 new_position = record_get_new_cursor_position_undo(app, buffer, current);
buffer_history_set_current_state_index(app, buffer, current - 1); buffer_history_set_current_state_index(app, buffer, current - 1);
view_set_cursor(app, view, seek_pos(new_position), true); view_set_cursor_and_preferred_x(app, view, seek_pos(new_position));
} }
} }
@ -1740,7 +1734,7 @@ CUSTOM_DOC("Advances forwards through the undo history of the current buffer.")
if (current < max_index){ if (current < max_index){
i32 new_position = record_get_new_cursor_position_redo(app, buffer, current + 1); i32 new_position = record_get_new_cursor_position_redo(app, buffer, current + 1);
buffer_history_set_current_state_index(app, buffer, current + 1); buffer_history_set_current_state_index(app, buffer, current + 1);
view_set_cursor(app, view, seek_pos(new_position), true); view_set_cursor_and_preferred_x(app, view, seek_pos(new_position));
} }
} }

View File

@ -58,7 +58,7 @@ CUSTOM_DOC("At the cursor, insert the text at the top of the clipboard.")
i64 pos = view_get_cursor_pos(app, view); i64 pos = view_get_cursor_pos(app, view);
buffer_replace_range(app, buffer, Ii64(pos), string); buffer_replace_range(app, buffer, Ii64(pos), string);
view_set_mark(app, view, seek_pos(pos)); view_set_mark(app, view, seek_pos(pos));
view_set_cursor(app, view, seek_pos(pos + (i32)string.size), true); view_set_cursor_and_preferred_x(app, view, seek_pos(pos + (i32)string.size));
// TODO(allen): Send this to all views. // TODO(allen): Send this to all views.
Theme_Color paste = {}; Theme_Color paste = {};
@ -97,7 +97,7 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste
i64 pos = range.min; i64 pos = range.min;
buffer_replace_range(app, buffer, range, string); buffer_replace_range(app, buffer, range, string);
view_set_cursor(app, view, seek_pos(pos + string.size), true); view_set_cursor_and_preferred_x(app, view, seek_pos(pos + string.size));
// TODO(allen): Send this to all views. // TODO(allen): Send this to all views.
Theme_Color paste = {}; Theme_Color paste = {};

View File

@ -8,7 +8,7 @@ static void
write_string(Application_Links *app, View_ID view, Buffer_ID buffer, String_Const_u8 string){ write_string(Application_Links *app, View_ID view, Buffer_ID buffer, String_Const_u8 string){
i64 pos = view_get_cursor_pos(app, view); i64 pos = view_get_cursor_pos(app, view);
buffer_replace_range(app, buffer, Ii64(pos), string); buffer_replace_range(app, buffer, Ii64(pos), string);
view_set_cursor(app, view, seek_pos(pos + string.size), true); view_set_cursor_and_preferred_x(app, view, seek_pos(pos + string.size));
} }
static void static void
@ -38,7 +38,7 @@ long_braces(Application_Links *app, char *text, i32 size){
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen); Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
i64 pos = view_get_cursor_pos(app, view); i64 pos = view_get_cursor_pos(app, view);
buffer_replace_range(app, buffer, Ii64(pos), SCu8(text, size)); buffer_replace_range(app, buffer, Ii64(pos), SCu8(text, size));
view_set_cursor(app, view, seek_pos(pos + 2), true); view_set_cursor_and_preferred_x(app, view, seek_pos(pos + 2));
buffer_auto_indent(app, buffer, pos, pos + size, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens); buffer_auto_indent(app, 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);
} }
@ -205,7 +205,7 @@ activate_snippet(Application_Links *app, Heap *heap, View_ID view, struct Lister
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen); Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
i64 pos = view_get_cursor_pos(app, view); i64 pos = view_get_cursor_pos(app, view);
buffer_replace_range(app, buffer, Ii64(pos), SCu8(snippet.text)); buffer_replace_range(app, buffer, Ii64(pos), SCu8(snippet.text));
view_set_cursor(app, view, seek_pos(pos + snippet.cursor_offset), true); view_set_cursor_and_preferred_x(app, view, seek_pos(pos + snippet.cursor_offset));
view_set_mark(app, view, seek_pos(pos + snippet.mark_offset)); view_set_mark(app, view, seek_pos(pos + snippet.mark_offset));
} }
else{ else{

View File

@ -188,7 +188,7 @@ view_buffer_set(Application_Links *app, Buffer_ID *buffers, i32 *positions, i32
View_Node *node = primary_view_first; View_Node *node = primary_view_first;
for (i32 i = 0; i < buffer_set_count; i += 1, node = node->next){ for (i32 i = 0; i < buffer_set_count; i += 1, node = node->next){
if (view_set_buffer(app, node->view_id, buffers[i], 0)){ if (view_set_buffer(app, node->view_id, buffers[i], 0)){
view_set_cursor(app, node->view_id, seek_pos(positions[i]), true); view_set_cursor_and_preferred_x(app, node->view_id, seek_pos(positions[i]));
} }
} }

View File

@ -39,7 +39,7 @@ CUSTOM_COMMAND_SIG(multi_paste){
Range_i64 range = get_view_range(app, view); Range_i64 range = get_view_range(app, view);
buffer_replace_range(app, buffer, Ii64(range.max), insert_string); buffer_replace_range(app, buffer, Ii64(range.max), insert_string);
view_set_mark(app, view, seek_pos(range.max + 1)); view_set_mark(app, view, seek_pos(range.max + 1));
view_set_cursor(app, view, seek_pos(range.max + insert_string.size), true); view_set_cursor_and_preferred_x(app, view, seek_pos(range.max + insert_string.size));
// TODO(allen): Send this to all views. // TODO(allen): Send this to all views.
Theme_Color paste = {}; Theme_Color paste = {};
@ -98,7 +98,7 @@ multi_paste_range(Application_Links *app, View_ID view, Range_i64 range, i32 pas
finish_range.min = pos; finish_range.min = pos;
finish_range.max = pos + total_size; finish_range.max = pos + total_size;
view_set_mark(app, view, seek_pos(finish_range.min)); view_set_mark(app, view, seek_pos(finish_range.min));
view_set_cursor(app, view, seek_pos(finish_range.max), true); view_set_cursor_and_preferred_x(app, view, seek_pos(finish_range.max));
// TODO(allen): Send this to all views. // TODO(allen): Send this to all views.
Theme_Color paste; Theme_Color paste;

View File

@ -65,6 +65,7 @@ struct Application_Links;
#define VIEW_GET_CURSOR_POS_SIG(n) i64 n(Application_Links *app, View_ID view_id) #define VIEW_GET_CURSOR_POS_SIG(n) i64 n(Application_Links *app, View_ID view_id)
#define VIEW_GET_MARK_POS_SIG(n) i64 n(Application_Links *app, View_ID view_id) #define VIEW_GET_MARK_POS_SIG(n) i64 n(Application_Links *app, View_ID view_id)
#define VIEW_GET_PREFERRED_X_SIG(n) f32 n(Application_Links *app, View_ID view_id) #define VIEW_GET_PREFERRED_X_SIG(n) f32 n(Application_Links *app, View_ID view_id)
#define VIEW_SET_PREFERRED_X_SIG(n) b32 n(Application_Links *app, View_ID view_id, f32 x)
#define VIEW_GET_SCREEN_RECT_SIG(n) Rect_f32 n(Application_Links *app, View_ID view_id) #define VIEW_GET_SCREEN_RECT_SIG(n) Rect_f32 n(Application_Links *app, View_ID view_id)
#define VIEW_GET_PANEL_SIG(n) Panel_ID n(Application_Links *app, View_ID view_id) #define VIEW_GET_PANEL_SIG(n) Panel_ID n(Application_Links *app, View_ID view_id)
#define PANEL_GET_VIEW_SIG(n) View_ID n(Application_Links *app, Panel_ID panel_id) #define PANEL_GET_VIEW_SIG(n) View_ID n(Application_Links *app, Panel_ID panel_id)
@ -86,7 +87,8 @@ struct Application_Links;
#define VIEW_SET_SETTING_SIG(n) b32 n(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 value) #define VIEW_SET_SETTING_SIG(n) b32 n(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 value)
#define VIEW_GET_MANAGED_SCOPE_SIG(n) Managed_Scope n(Application_Links *app, View_ID view_id) #define VIEW_GET_MANAGED_SCOPE_SIG(n) Managed_Scope n(Application_Links *app, View_ID view_id)
#define BUFFER_COMPUTE_CURSOR_SIG(n) Buffer_Cursor n(Application_Links *app, Buffer_ID buffer, Buffer_Seek seek) #define BUFFER_COMPUTE_CURSOR_SIG(n) Buffer_Cursor n(Application_Links *app, Buffer_ID buffer, Buffer_Seek seek)
#define VIEW_SET_CURSOR_SIG(n) b32 n(Application_Links *app, View_ID view_id, Buffer_Seek seek, b32 set_preferred_x) #define VIEW_COMPUTE_CURSOR_SIG(n) Buffer_Cursor n(Application_Links *app, View_ID view_id, Buffer_Seek seek)
#define VIEW_SET_CURSOR_SIG(n) b32 n(Application_Links *app, View_ID view_id, Buffer_Seek seek)
#define VIEW_SET_BUFFER_SCROLL_SIG(n) b32 n(Application_Links *app, View_ID view_id, Buffer_Scroll scroll) #define VIEW_SET_BUFFER_SCROLL_SIG(n) b32 n(Application_Links *app, View_ID view_id, Buffer_Scroll scroll)
#define VIEW_SET_BASIC_SCROLL_SIG(n) b32 n(Application_Links *app, View_ID view_id, Basic_Scroll scroll) #define VIEW_SET_BASIC_SCROLL_SIG(n) b32 n(Application_Links *app, View_ID view_id, Basic_Scroll scroll)
#define VIEW_SET_MARK_SIG(n) b32 n(Application_Links *app, View_ID view_id, Buffer_Seek seek) #define VIEW_SET_MARK_SIG(n) b32 n(Application_Links *app, View_ID view_id, Buffer_Seek seek)
@ -249,6 +251,7 @@ typedef VIEW_GET_BUFFER_SIG(View_Get_Buffer_Function);
typedef VIEW_GET_CURSOR_POS_SIG(View_Get_Cursor_Pos_Function); typedef VIEW_GET_CURSOR_POS_SIG(View_Get_Cursor_Pos_Function);
typedef VIEW_GET_MARK_POS_SIG(View_Get_Mark_Pos_Function); typedef VIEW_GET_MARK_POS_SIG(View_Get_Mark_Pos_Function);
typedef VIEW_GET_PREFERRED_X_SIG(View_Get_Preferred_X_Function); typedef VIEW_GET_PREFERRED_X_SIG(View_Get_Preferred_X_Function);
typedef VIEW_SET_PREFERRED_X_SIG(View_Set_Preferred_X_Function);
typedef VIEW_GET_SCREEN_RECT_SIG(View_Get_Screen_Rect_Function); typedef VIEW_GET_SCREEN_RECT_SIG(View_Get_Screen_Rect_Function);
typedef VIEW_GET_PANEL_SIG(View_Get_Panel_Function); typedef VIEW_GET_PANEL_SIG(View_Get_Panel_Function);
typedef PANEL_GET_VIEW_SIG(Panel_Get_View_Function); typedef PANEL_GET_VIEW_SIG(Panel_Get_View_Function);
@ -270,6 +273,7 @@ typedef VIEW_GET_SETTING_SIG(View_Get_Setting_Function);
typedef VIEW_SET_SETTING_SIG(View_Set_Setting_Function); typedef VIEW_SET_SETTING_SIG(View_Set_Setting_Function);
typedef VIEW_GET_MANAGED_SCOPE_SIG(View_Get_Managed_Scope_Function); typedef VIEW_GET_MANAGED_SCOPE_SIG(View_Get_Managed_Scope_Function);
typedef BUFFER_COMPUTE_CURSOR_SIG(Buffer_Compute_Cursor_Function); typedef BUFFER_COMPUTE_CURSOR_SIG(Buffer_Compute_Cursor_Function);
typedef VIEW_COMPUTE_CURSOR_SIG(View_Compute_Cursor_Function);
typedef VIEW_SET_CURSOR_SIG(View_Set_Cursor_Function); typedef VIEW_SET_CURSOR_SIG(View_Set_Cursor_Function);
typedef VIEW_SET_BUFFER_SCROLL_SIG(View_Set_Buffer_Scroll_Function); typedef VIEW_SET_BUFFER_SCROLL_SIG(View_Set_Buffer_Scroll_Function);
typedef VIEW_SET_BASIC_SCROLL_SIG(View_Set_Basic_Scroll_Function); typedef VIEW_SET_BASIC_SCROLL_SIG(View_Set_Basic_Scroll_Function);
@ -435,6 +439,7 @@ View_Get_Buffer_Function *view_get_buffer;
View_Get_Cursor_Pos_Function *view_get_cursor_pos; View_Get_Cursor_Pos_Function *view_get_cursor_pos;
View_Get_Mark_Pos_Function *view_get_mark_pos; View_Get_Mark_Pos_Function *view_get_mark_pos;
View_Get_Preferred_X_Function *view_get_preferred_x; View_Get_Preferred_X_Function *view_get_preferred_x;
View_Set_Preferred_X_Function *view_set_preferred_x;
View_Get_Screen_Rect_Function *view_get_screen_rect; View_Get_Screen_Rect_Function *view_get_screen_rect;
View_Get_Panel_Function *view_get_panel; View_Get_Panel_Function *view_get_panel;
Panel_Get_View_Function *panel_get_view; Panel_Get_View_Function *panel_get_view;
@ -456,6 +461,7 @@ View_Get_Setting_Function *view_get_setting;
View_Set_Setting_Function *view_set_setting; View_Set_Setting_Function *view_set_setting;
View_Get_Managed_Scope_Function *view_get_managed_scope; View_Get_Managed_Scope_Function *view_get_managed_scope;
Buffer_Compute_Cursor_Function *buffer_compute_cursor; Buffer_Compute_Cursor_Function *buffer_compute_cursor;
View_Compute_Cursor_Function *view_compute_cursor;
View_Set_Cursor_Function *view_set_cursor; View_Set_Cursor_Function *view_set_cursor;
View_Set_Buffer_Scroll_Function *view_set_buffer_scroll; View_Set_Buffer_Scroll_Function *view_set_buffer_scroll;
View_Set_Basic_Scroll_Function *view_set_basic_scroll; View_Set_Basic_Scroll_Function *view_set_basic_scroll;
@ -620,6 +626,7 @@ View_Get_Buffer_Function *view_get_buffer_;
View_Get_Cursor_Pos_Function *view_get_cursor_pos_; View_Get_Cursor_Pos_Function *view_get_cursor_pos_;
View_Get_Mark_Pos_Function *view_get_mark_pos_; View_Get_Mark_Pos_Function *view_get_mark_pos_;
View_Get_Preferred_X_Function *view_get_preferred_x_; View_Get_Preferred_X_Function *view_get_preferred_x_;
View_Set_Preferred_X_Function *view_set_preferred_x_;
View_Get_Screen_Rect_Function *view_get_screen_rect_; View_Get_Screen_Rect_Function *view_get_screen_rect_;
View_Get_Panel_Function *view_get_panel_; View_Get_Panel_Function *view_get_panel_;
Panel_Get_View_Function *panel_get_view_; Panel_Get_View_Function *panel_get_view_;
@ -641,6 +648,7 @@ View_Get_Setting_Function *view_get_setting_;
View_Set_Setting_Function *view_set_setting_; View_Set_Setting_Function *view_set_setting_;
View_Get_Managed_Scope_Function *view_get_managed_scope_; View_Get_Managed_Scope_Function *view_get_managed_scope_;
Buffer_Compute_Cursor_Function *buffer_compute_cursor_; Buffer_Compute_Cursor_Function *buffer_compute_cursor_;
View_Compute_Cursor_Function *view_compute_cursor_;
View_Set_Cursor_Function *view_set_cursor_; View_Set_Cursor_Function *view_set_cursor_;
View_Set_Buffer_Scroll_Function *view_set_buffer_scroll_; View_Set_Buffer_Scroll_Function *view_set_buffer_scroll_;
View_Set_Basic_Scroll_Function *view_set_basic_scroll_; View_Set_Basic_Scroll_Function *view_set_basic_scroll_;
@ -813,6 +821,7 @@ app_links->view_get_buffer_ = View_Get_Buffer;\
app_links->view_get_cursor_pos_ = View_Get_Cursor_Pos;\ app_links->view_get_cursor_pos_ = View_Get_Cursor_Pos;\
app_links->view_get_mark_pos_ = View_Get_Mark_Pos;\ app_links->view_get_mark_pos_ = View_Get_Mark_Pos;\
app_links->view_get_preferred_x_ = View_Get_Preferred_X;\ app_links->view_get_preferred_x_ = View_Get_Preferred_X;\
app_links->view_set_preferred_x_ = View_Set_Preferred_X;\
app_links->view_get_screen_rect_ = View_Get_Screen_Rect;\ app_links->view_get_screen_rect_ = View_Get_Screen_Rect;\
app_links->view_get_panel_ = View_Get_Panel;\ app_links->view_get_panel_ = View_Get_Panel;\
app_links->panel_get_view_ = Panel_Get_View;\ app_links->panel_get_view_ = Panel_Get_View;\
@ -834,6 +843,7 @@ app_links->view_get_setting_ = View_Get_Setting;\
app_links->view_set_setting_ = View_Set_Setting;\ app_links->view_set_setting_ = View_Set_Setting;\
app_links->view_get_managed_scope_ = View_Get_Managed_Scope;\ app_links->view_get_managed_scope_ = View_Get_Managed_Scope;\
app_links->buffer_compute_cursor_ = Buffer_Compute_Cursor;\ app_links->buffer_compute_cursor_ = Buffer_Compute_Cursor;\
app_links->view_compute_cursor_ = View_Compute_Cursor;\
app_links->view_set_cursor_ = View_Set_Cursor;\ app_links->view_set_cursor_ = View_Set_Cursor;\
app_links->view_set_buffer_scroll_ = View_Set_Buffer_Scroll;\ app_links->view_set_buffer_scroll_ = View_Set_Buffer_Scroll;\
app_links->view_set_basic_scroll_ = View_Set_Basic_Scroll;\ app_links->view_set_basic_scroll_ = View_Set_Basic_Scroll;\
@ -998,6 +1008,7 @@ static Buffer_ID view_get_buffer(Application_Links *app, View_ID view_id, Access
static i64 view_get_cursor_pos(Application_Links *app, View_ID view_id){return(app->view_get_cursor_pos(app, view_id));} static i64 view_get_cursor_pos(Application_Links *app, View_ID view_id){return(app->view_get_cursor_pos(app, view_id));}
static i64 view_get_mark_pos(Application_Links *app, View_ID view_id){return(app->view_get_mark_pos(app, view_id));} static i64 view_get_mark_pos(Application_Links *app, View_ID view_id){return(app->view_get_mark_pos(app, view_id));}
static f32 view_get_preferred_x(Application_Links *app, View_ID view_id){return(app->view_get_preferred_x(app, view_id));} static f32 view_get_preferred_x(Application_Links *app, View_ID view_id){return(app->view_get_preferred_x(app, view_id));}
static b32 view_set_preferred_x(Application_Links *app, View_ID view_id, f32 x){return(app->view_set_preferred_x(app, view_id, x));}
static Rect_f32 view_get_screen_rect(Application_Links *app, View_ID view_id){return(app->view_get_screen_rect(app, view_id));} static Rect_f32 view_get_screen_rect(Application_Links *app, View_ID view_id){return(app->view_get_screen_rect(app, view_id));}
static Panel_ID view_get_panel(Application_Links *app, View_ID view_id){return(app->view_get_panel(app, view_id));} static Panel_ID view_get_panel(Application_Links *app, View_ID view_id){return(app->view_get_panel(app, view_id));}
static View_ID panel_get_view(Application_Links *app, Panel_ID panel_id){return(app->panel_get_view(app, panel_id));} static View_ID panel_get_view(Application_Links *app, Panel_ID panel_id){return(app->panel_get_view(app, panel_id));}
@ -1019,7 +1030,8 @@ static b32 view_get_setting(Application_Links *app, View_ID view_id, View_Settin
static b32 view_set_setting(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 value){return(app->view_set_setting(app, view_id, setting, value));} static b32 view_set_setting(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 value){return(app->view_set_setting(app, view_id, setting, value));}
static Managed_Scope view_get_managed_scope(Application_Links *app, View_ID view_id){return(app->view_get_managed_scope(app, view_id));} static Managed_Scope view_get_managed_scope(Application_Links *app, View_ID view_id){return(app->view_get_managed_scope(app, view_id));}
static Buffer_Cursor buffer_compute_cursor(Application_Links *app, Buffer_ID buffer, Buffer_Seek seek){return(app->buffer_compute_cursor(app, buffer, seek));} static Buffer_Cursor buffer_compute_cursor(Application_Links *app, Buffer_ID buffer, Buffer_Seek seek){return(app->buffer_compute_cursor(app, buffer, seek));}
static b32 view_set_cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek, b32 set_preferred_x){return(app->view_set_cursor(app, view_id, seek, set_preferred_x));} static Buffer_Cursor view_compute_cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek){return(app->view_compute_cursor(app, view_id, seek));}
static b32 view_set_cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek){return(app->view_set_cursor(app, view_id, seek));}
static b32 view_set_buffer_scroll(Application_Links *app, View_ID view_id, Buffer_Scroll scroll){return(app->view_set_buffer_scroll(app, view_id, scroll));} static b32 view_set_buffer_scroll(Application_Links *app, View_ID view_id, Buffer_Scroll scroll){return(app->view_set_buffer_scroll(app, view_id, scroll));}
static b32 view_set_basic_scroll(Application_Links *app, View_ID view_id, Basic_Scroll scroll){return(app->view_set_basic_scroll(app, view_id, scroll));} static b32 view_set_basic_scroll(Application_Links *app, View_ID view_id, Basic_Scroll scroll){return(app->view_set_basic_scroll(app, view_id, scroll));}
static b32 view_set_mark(Application_Links *app, View_ID view_id, Buffer_Seek seek){return(app->view_set_mark(app, view_id, seek));} static b32 view_set_mark(Application_Links *app, View_ID view_id, Buffer_Seek seek){return(app->view_set_mark(app, view_id, seek));}
@ -1183,6 +1195,7 @@ static Buffer_ID view_get_buffer(Application_Links *app, View_ID view_id, Access
static i64 view_get_cursor_pos(Application_Links *app, View_ID view_id){return(app->view_get_cursor_pos_(app, view_id));} static i64 view_get_cursor_pos(Application_Links *app, View_ID view_id){return(app->view_get_cursor_pos_(app, view_id));}
static i64 view_get_mark_pos(Application_Links *app, View_ID view_id){return(app->view_get_mark_pos_(app, view_id));} static i64 view_get_mark_pos(Application_Links *app, View_ID view_id){return(app->view_get_mark_pos_(app, view_id));}
static f32 view_get_preferred_x(Application_Links *app, View_ID view_id){return(app->view_get_preferred_x_(app, view_id));} static f32 view_get_preferred_x(Application_Links *app, View_ID view_id){return(app->view_get_preferred_x_(app, view_id));}
static b32 view_set_preferred_x(Application_Links *app, View_ID view_id, f32 x){return(app->view_set_preferred_x_(app, view_id, x));}
static Rect_f32 view_get_screen_rect(Application_Links *app, View_ID view_id){return(app->view_get_screen_rect_(app, view_id));} static Rect_f32 view_get_screen_rect(Application_Links *app, View_ID view_id){return(app->view_get_screen_rect_(app, view_id));}
static Panel_ID view_get_panel(Application_Links *app, View_ID view_id){return(app->view_get_panel_(app, view_id));} static Panel_ID view_get_panel(Application_Links *app, View_ID view_id){return(app->view_get_panel_(app, view_id));}
static View_ID panel_get_view(Application_Links *app, Panel_ID panel_id){return(app->panel_get_view_(app, panel_id));} static View_ID panel_get_view(Application_Links *app, Panel_ID panel_id){return(app->panel_get_view_(app, panel_id));}
@ -1204,7 +1217,8 @@ static b32 view_get_setting(Application_Links *app, View_ID view_id, View_Settin
static b32 view_set_setting(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 value){return(app->view_set_setting_(app, view_id, setting, value));} static b32 view_set_setting(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 value){return(app->view_set_setting_(app, view_id, setting, value));}
static Managed_Scope view_get_managed_scope(Application_Links *app, View_ID view_id){return(app->view_get_managed_scope_(app, view_id));} static Managed_Scope view_get_managed_scope(Application_Links *app, View_ID view_id){return(app->view_get_managed_scope_(app, view_id));}
static Buffer_Cursor buffer_compute_cursor(Application_Links *app, Buffer_ID buffer, Buffer_Seek seek){return(app->buffer_compute_cursor_(app, buffer, seek));} static Buffer_Cursor buffer_compute_cursor(Application_Links *app, Buffer_ID buffer, Buffer_Seek seek){return(app->buffer_compute_cursor_(app, buffer, seek));}
static b32 view_set_cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek, b32 set_preferred_x){return(app->view_set_cursor_(app, view_id, seek, set_preferred_x));} static Buffer_Cursor view_compute_cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek){return(app->view_compute_cursor_(app, view_id, seek));}
static b32 view_set_cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek){return(app->view_set_cursor_(app, view_id, seek));}
static b32 view_set_buffer_scroll(Application_Links *app, View_ID view_id, Buffer_Scroll scroll){return(app->view_set_buffer_scroll_(app, view_id, scroll));} static b32 view_set_buffer_scroll(Application_Links *app, View_ID view_id, Buffer_Scroll scroll){return(app->view_set_buffer_scroll_(app, view_id, scroll));}
static b32 view_set_basic_scroll(Application_Links *app, View_ID view_id, Basic_Scroll scroll){return(app->view_set_basic_scroll_(app, view_id, scroll));} static b32 view_set_basic_scroll(Application_Links *app, View_ID view_id, Basic_Scroll scroll){return(app->view_set_basic_scroll_(app, view_id, scroll));}
static b32 view_set_mark(Application_Links *app, View_ID view_id, Buffer_Seek seek){return(app->view_set_mark_(app, view_id, seek));} static b32 view_set_mark(Application_Links *app, View_ID view_id, Buffer_Seek seek){return(app->view_set_mark_(app, view_id, seek));}

View File

@ -293,87 +293,87 @@ static Command_Metadata fcoder_metacmd_table[233] = {
{ PROC_LINKS(click_set_cursor_if_lbutton, 0), "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 247 }, { PROC_LINKS(click_set_cursor_if_lbutton, 0), "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 247 },
{ PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 261 }, { PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 261 },
{ PROC_LINKS(mouse_wheel_scroll, 0), "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 273 }, { PROC_LINKS(mouse_wheel_scroll, 0), "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 273 },
{ PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 335 }, { PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 334 },
{ PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 341 }, { PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 340 },
{ 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, 347 }, { 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, 346 },
{ PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 353 }, { PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 352 },
{ PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 359 }, { PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 358 },
{ 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, 369 }, { 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, 368 },
{ 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, 377 }, { 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, 376 },
{ PROC_LINKS(move_up_to_blank_line, 0), "move_up_to_blank_line", 21, "Seeks the cursor up to the next blank line.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 406 }, { PROC_LINKS(move_up_to_blank_line, 0), "move_up_to_blank_line", 21, "Seeks the cursor up to the next blank line.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 405 },
{ PROC_LINKS(move_down_to_blank_line, 0), "move_down_to_blank_line", 23, "Seeks the cursor down to the next blank line.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 412 }, { PROC_LINKS(move_down_to_blank_line, 0), "move_down_to_blank_line", 23, "Seeks the cursor down to the next blank line.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 411 },
{ PROC_LINKS(move_up_to_blank_line_skip_whitespace, 0), "move_up_to_blank_line_skip_whitespace", 37, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 418 }, { PROC_LINKS(move_up_to_blank_line_skip_whitespace, 0), "move_up_to_blank_line_skip_whitespace", 37, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 417 },
{ PROC_LINKS(move_down_to_blank_line_skip_whitespace, 0), "move_down_to_blank_line_skip_whitespace", 39, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 424 }, { PROC_LINKS(move_down_to_blank_line_skip_whitespace, 0), "move_down_to_blank_line_skip_whitespace", 39, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 423 },
{ PROC_LINKS(move_up_to_blank_line_end, 0), "move_up_to_blank_line_end", 25, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 430 }, { PROC_LINKS(move_up_to_blank_line_end, 0), "move_up_to_blank_line_end", 25, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 429 },
{ PROC_LINKS(move_down_to_blank_line_end, 0), "move_down_to_blank_line_end", 27, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 436 }, { PROC_LINKS(move_down_to_blank_line_end, 0), "move_down_to_blank_line_end", 27, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 435 },
{ PROC_LINKS(move_left, 0), "move_left", 9, "Moves the cursor one character to the left.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 447 }, { PROC_LINKS(move_left, 0), "move_left", 9, "Moves the cursor one character to the left.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 441 },
{ 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, 459 }, { 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, 453 },
{ PROC_LINKS(move_right_whitespace_boundary, 0), "move_right_whitespace_boundary", 30, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 481 }, { PROC_LINKS(move_right_whitespace_boundary, 0), "move_right_whitespace_boundary", 30, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 475 },
{ PROC_LINKS(move_left_whitespace_boundary, 0), "move_left_whitespace_boundary", 29, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 489 }, { PROC_LINKS(move_left_whitespace_boundary, 0), "move_left_whitespace_boundary", 29, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 483 },
{ PROC_LINKS(move_right_token_boundary, 0), "move_right_token_boundary", 25, "Seek right for the next end of a token.", 39, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 497 }, { PROC_LINKS(move_right_token_boundary, 0), "move_right_token_boundary", 25, "Seek right for the next end of a token.", 39, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 491 },
{ PROC_LINKS(move_left_token_boundary, 0), "move_left_token_boundary", 24, "Seek left for the next beginning of a token.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 505 }, { PROC_LINKS(move_left_token_boundary, 0), "move_left_token_boundary", 24, "Seek left for the next beginning of a token.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 499 },
{ PROC_LINKS(move_right_whitespace_or_token_boundary, 0), "move_right_whitespace_or_token_boundary", 39, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 513 }, { PROC_LINKS(move_right_whitespace_or_token_boundary, 0), "move_right_whitespace_or_token_boundary", 39, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 507 },
{ PROC_LINKS(move_left_whitespace_or_token_boundary, 0), "move_left_whitespace_or_token_boundary", 38, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 521 }, { PROC_LINKS(move_left_whitespace_or_token_boundary, 0), "move_left_whitespace_or_token_boundary", 38, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 515 },
{ PROC_LINKS(move_right_alpha_numeric_boundary, 0), "move_right_alpha_numeric_boundary", 33, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 529 }, { PROC_LINKS(move_right_alpha_numeric_boundary, 0), "move_right_alpha_numeric_boundary", 33, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 523 },
{ PROC_LINKS(move_left_alpha_numeric_boundary, 0), "move_left_alpha_numeric_boundary", 32, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 537 }, { PROC_LINKS(move_left_alpha_numeric_boundary, 0), "move_left_alpha_numeric_boundary", 32, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 531 },
{ PROC_LINKS(move_right_alpha_numeric_or_camel_boundary, 0), "move_right_alpha_numeric_or_camel_boundary", 42, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 545 }, { PROC_LINKS(move_right_alpha_numeric_or_camel_boundary, 0), "move_right_alpha_numeric_or_camel_boundary", 42, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 539 },
{ PROC_LINKS(move_left_alpha_numeric_or_camel_boundary, 0), "move_left_alpha_numeric_or_camel_boundary", 41, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 553 }, { PROC_LINKS(move_left_alpha_numeric_or_camel_boundary, 0), "move_left_alpha_numeric_or_camel_boundary", 41, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 547 },
{ 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, 574 }, { 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, 568 },
{ PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 587 }, { PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 581 },
{ 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, 600 }, { 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, 594 },
{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 613 }, { PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 607 },
{ 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, 647 }, { 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, 641 },
{ 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, 655 }, { 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, 649 },
{ 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, 664 }, { 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, 658 },
{ 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, 671 }, { 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, 665 },
{ 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, 678 }, { 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, 672 },
{ 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, 685 }, { 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, 679 },
{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 692 }, { PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 686 },
{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 701 }, { PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 695 },
{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 711 }, { PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 705 },
{ 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, 717 }, { 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, 711 },
{ 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, 727 }, { 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, 721 },
{ 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, 737 }, { 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, 731 },
{ 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, 748 }, { 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, 742 },
{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 759 }, { PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 753 },
{ 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, 776 }, { 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, 770 },
{ 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, 786 }, { 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, 780 },
{ PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 795 }, { PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 789 },
{ 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, 801 }, { 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, 795 },
{ 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, 809 }, { 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, 803 },
{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 817 }, { PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 811 },
{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 825 }, { PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 819 },
{ 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, 1036 }, { 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, 1030 },
{ 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, 1042 }, { 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, 1036 },
{ 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, 1048 }, { 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, 1042 },
{ 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, 1059 }, { 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, 1053 },
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1110 }, { PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1104 },
{ PROC_LINKS(replace_in_buffer, 0), "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1119 }, { PROC_LINKS(replace_in_buffer, 0), "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1113 },
{ PROC_LINKS(replace_in_all_buffers, 0), "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1128 }, { PROC_LINKS(replace_in_all_buffers, 0), "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1122 },
{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1216 }, { PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1210 },
{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1236 }, { PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1230 },
{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1252 }, { PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1246 },
{ 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, 1287 }, { 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, 1281 },
{ 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, 1312 }, { 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, 1306 },
{ 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, 1350 }, { 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, 1344 },
{ 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, 1385 }, { 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, 1379 },
{ 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, 1425 }, { 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, 1419 },
{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1458 }, { PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1452 },
{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1464 }, { PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1458 },
{ 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, 1470 }, { 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, 1464 },
{ 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, 1484 }, { 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, 1478 },
{ 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, 1549 }, { 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, 1543 },
{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1581 }, { 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, 1575 },
{ 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, 1594 }, { 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, 1588 },
{ 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, 1606 }, { 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, 1600 },
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1642 }, { PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1636 },
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1650 }, { PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1644 },
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1662 }, { PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1656 },
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1720 }, { PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1714 },
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1733 }, { PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1727 },
{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1747 }, { PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1741 },
{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1821 }, { PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1815 },
{ 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, 1924 }, { 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, 1918 },
{ 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__quit, 0), "lister__quit", 12, "A lister mode command that quits the list without executing any actions.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 8 },
{ PROC_LINKS(lister__activate, 0), "lister__activate", 16, "A lister mode command that activates the list's action on the highlighted item.", 79, "w:\\4ed\\code\\4coder_lists.cpp", 28, 15 }, { 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__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, 30 }, { 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, 30 },

View File

@ -408,11 +408,6 @@ buffer_seek_character_class_change_0_1(Application_Links *app, Buffer_ID buffer,
//////////////////////////////// ////////////////////////////////
internal Buffer_Cursor
view_compute_cursor(Application_Links *app, View_ID view, Buffer_Seek seek){
return(buffer_compute_cursor(app, view_get_buffer(app, view, AccessAll), seek));
}
internal i64 internal i64
view_pos_from_xy(Application_Links *app, View_ID view, Vec2_f32 p){ view_pos_from_xy(Application_Links *app, View_ID view, Vec2_f32 p){
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected); Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
@ -446,6 +441,14 @@ view_zero_scroll(Application_Links *app, View_ID view){
} }
} }
internal void
view_set_cursor_and_preferred_x(Application_Links *app, View_ID view, Buffer_Seek seek){
view_set_cursor(app, view, seek);
Buffer_Cursor cursor = view_compute_cursor(app, view, seek);
Vec2_f32 p = view_relative_xy_of_pos(app, view, cursor.line, cursor.pos);
view_set_preferred_x(app, view, p.x);
}
//////////////////////////////// ////////////////////////////////
internal Range_i64 internal Range_i64
@ -470,12 +473,12 @@ set_view_range(Application_Links *app, View_ID view, Range_i64 range){
i64 c = view_get_cursor_pos(app, view); i64 c = view_get_cursor_pos(app, view);
i64 m = view_get_mark_pos(app, view); i64 m = view_get_mark_pos(app, view);
if (c < m){ if (c < m){
view_set_cursor(app, view, seek_pos(range.min), true); view_set_cursor_and_preferred_x(app, view, seek_pos(range.min));
view_set_mark(app, view, seek_pos(range.max)); view_set_mark(app, view, seek_pos(range.max));
} }
else{ else{
view_set_mark(app, view, seek_pos(range.min)); view_set_mark(app, view, seek_pos(range.min));
view_set_cursor(app, view, seek_pos(range.max), true); view_set_cursor_and_preferred_x(app, view, seek_pos(range.max));
} }
} }
@ -1291,7 +1294,7 @@ internal void
move_past_lead_whitespace(Application_Links *app, View_ID view, Buffer_ID buffer){ move_past_lead_whitespace(Application_Links *app, View_ID view, Buffer_ID buffer){
i64 pos = view_get_cursor_pos(app, view); i64 pos = view_get_cursor_pos(app, view);
i64 new_pos = get_pos_past_lead_whitespace(app, buffer, pos); i64 new_pos = get_pos_past_lead_whitespace(app, buffer, pos);
view_set_cursor(app, view, seek_pos(new_pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(new_pos));
} }
internal void internal void

View File

@ -440,7 +440,7 @@ goto_next_filtered_jump(Application_Links *app, Marker_List *list, View_ID jump_
if (!skip_this){ if (!skip_this){
goto_jump_in_order(app, list, jump_view, location); goto_jump_in_order(app, list, jump_view, location);
i64 updated_line = get_line_from_list(app, list, list_index); i64 updated_line = get_line_from_list(app, list, list_index);
view_set_cursor(app, jump_view, seek_line_col(updated_line, 1), true); view_set_cursor_and_preferred_x(app, jump_view, seek_line_col(updated_line, 1));
break; break;
} }
} }
@ -538,7 +538,7 @@ CUSTOM_DOC("If a buffer containing jump locations has been locked in, goes to th
if (get_jump_from_list(app, jump_state.list, list_index, &location)){ if (get_jump_from_list(app, jump_state.list, list_index, &location)){
goto_jump_in_order(app, jump_state.list, jump_state.view, location); goto_jump_in_order(app, jump_state.list, jump_state.view, location);
i64 updated_line = get_line_from_list(app, jump_state.list, list_index); i64 updated_line = get_line_from_list(app, jump_state.list, list_index);
view_set_cursor(app, jump_state.view, seek_line_col(updated_line, 1), true); view_set_cursor_and_preferred_x(app, jump_state.view, seek_line_col(updated_line, 1));
} }
} }
} }

View File

@ -240,7 +240,7 @@ set_view_to_location(Application_Links *app, View_ID view, Buffer_ID buffer, Buf
if (current_buffer != buffer){ if (current_buffer != buffer){
view_set_buffer(app, view, buffer, 0); view_set_buffer(app, view, buffer, 0);
} }
view_set_cursor(app, view, seek, true); view_set_cursor_and_preferred_x(app, view, seek);
} }
static void static void

View File

@ -37,7 +37,7 @@ CUSTOM_DOC("Increment an integer under the cursor by one.")
Scratch_Block scratch(app); Scratch_Block scratch(app);
String_Const_u8 str = push_u8_stringf(scratch, "%d", number.x + 1); String_Const_u8 str = push_u8_stringf(scratch, "%d", number.x + 1);
buffer_replace_range(app, buffer, number.range, str); buffer_replace_range(app, buffer, number.range, str);
view_set_cursor(app, view, seek_pos(number.range.start + str.size - 1), true); view_set_cursor_and_preferred_x(app, view, seek_pos(number.range.start + str.size - 1));
} }
} }
@ -52,7 +52,7 @@ CUSTOM_DOC("Decrement an integer under the cursor by one.")
Scratch_Block scratch(app); Scratch_Block scratch(app);
String_Const_u8 str = push_u8_stringf(scratch, "%d", number.x - 1); String_Const_u8 str = push_u8_stringf(scratch, "%d", number.x - 1);
buffer_replace_range(app, buffer, number.range, str); buffer_replace_range(app, buffer, number.range, str);
view_set_cursor(app, view, seek_pos(number.range.start + str.size - 1), true); view_set_cursor_and_preferred_x(app, view, seek_pos(number.range.start + str.size - 1));
} }
} }
@ -224,7 +224,7 @@ miblo_time_stamp_alter(Application_Links *app, i32 unit_type, i32 amt){
Miblo_Timestamp inc_timestamp = increment_timestamp(timestamp.time, unit_type, amt); Miblo_Timestamp inc_timestamp = increment_timestamp(timestamp.time, unit_type, amt);
String_Const_u8 str = timestamp_to_string(scratch, inc_timestamp); String_Const_u8 str = timestamp_to_string(scratch, inc_timestamp);
buffer_replace_range(app, buffer, timestamp.range, str); buffer_replace_range(app, buffer, timestamp.range, str);
view_set_cursor(app, view, seek_pos(timestamp.range.start + str.size - 1), true); view_set_cursor_and_preferred_x(app, view, seek_pos(timestamp.range.start + str.size - 1));
} }
} }

View File

@ -346,7 +346,7 @@ CUSTOM_DOC("Finds the scope enclosed by '{' '}' surrounding the cursor and puts
i64 pos = view_get_cursor_pos(app, view); i64 pos = view_get_cursor_pos(app, view);
Range_i64 range = {}; Range_i64 range = {};
if (find_scope_range(app, buffer, pos, &range, FindScope_Brace)){ if (find_scope_range(app, buffer, pos, &range, FindScope_Brace)){
view_set_cursor(app, view, seek_pos(range.first), true); view_set_cursor_and_preferred_x(app, view, seek_pos(range.first));
view_set_mark(app, view, seek_pos(range.end)); view_set_mark(app, view, seek_pos(range.end));
view_set_to_region(app, view, range.first, range.end); view_set_to_region(app, view, range.first, range.end);
no_mark_snap_to_cursor(app, view); no_mark_snap_to_cursor(app, view);
@ -364,7 +364,7 @@ CUSTOM_DOC("Finds the first scope started by '{' after the cursor and puts the c
i64 bottom = 0; i64 bottom = 0;
if (find_next_scope(app, buffer, start_pos, FindScope_Brace, &top)){ if (find_next_scope(app, buffer, start_pos, FindScope_Brace, &top)){
if (find_scope_bottom(app, buffer, top, FindScope_EndOfToken|FindScope_Brace, &bottom)){ if (find_scope_bottom(app, buffer, top, FindScope_EndOfToken|FindScope_Brace, &bottom)){
view_set_cursor(app, view, seek_pos(top), true); view_set_cursor_and_preferred_x(app, view, seek_pos(top));
view_set_mark(app, view, seek_pos(bottom)); view_set_mark(app, view, seek_pos(bottom));
view_set_to_region(app, view, top, bottom); view_set_to_region(app, view, top, bottom);
no_mark_snap_to_cursor(app, view); no_mark_snap_to_cursor(app, view);
@ -383,7 +383,7 @@ CUSTOM_DOC("Finds the first scope started by '{' before the cursor and puts the
i64 bottom = 0; i64 bottom = 0;
if (find_prev_scope(app, buffer, start_pos, FindScope_Brace, &top)){ if (find_prev_scope(app, buffer, start_pos, FindScope_Brace, &top)){
if (find_scope_bottom(app, buffer, top, FindScope_EndOfToken|FindScope_Brace, &bottom)){ if (find_scope_bottom(app, buffer, top, FindScope_EndOfToken|FindScope_Brace, &bottom)){
view_set_cursor(app, view, seek_pos(top), true); view_set_cursor_and_preferred_x(app, view, seek_pos(top));
view_set_mark(app, view, seek_pos(bottom)); view_set_mark(app, view, seek_pos(bottom));
view_set_to_region(app, view, top, bottom); view_set_to_region(app, view, top, bottom);
no_mark_snap_to_cursor(app, view); no_mark_snap_to_cursor(app, view);
@ -441,7 +441,7 @@ place_begin_and_end_on_own_lines(Application_Links *app, char *begin, char *end)
String_Const_u8 str = push_u8_stringf(scratch, "%s\n\n%s", begin, end); String_Const_u8 str = push_u8_stringf(scratch, "%s\n\n%s", begin, end);
buffer_replace_range(app, buffer, range, str); buffer_replace_range(app, buffer, range, str);
i64 center_pos = range.min + cstring_length(begin) + 1; i64 center_pos = range.min + cstring_length(begin) + 1;
view_set_cursor(app, view, seek_pos(center_pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(center_pos));
view_set_mark(app, view, seek_pos(center_pos)); view_set_mark(app, view, seek_pos(center_pos));
} }
} }

View File

@ -424,7 +424,7 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with
buffer_replace_range(app, buffer, state.range, str); buffer_replace_range(app, buffer, state.range, str);
state.range.max = state.range.min + str.size; state.range.max = state.range.min + str.size;
view_set_cursor(app, view, seek_pos(state.range.max), true); view_set_cursor_and_preferred_x(app, view, seek_pos(state.range.max));
} }
} }
} }

View File

@ -10,7 +10,7 @@ seek_pos_of_textual_line(Application_Links *app, Side side){
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected); Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
i64 pos = view_get_cursor_pos(app, view); i64 pos = view_get_cursor_pos(app, view);
i64 new_pos = get_line_side_pos_from_pos(app, buffer, pos, side); i64 new_pos = get_line_side_pos_from_pos(app, buffer, pos, side);
view_set_cursor(app, view, seek_pos(new_pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(new_pos));
no_mark_snap_to_cursor_if_shift(app, view); no_mark_snap_to_cursor_if_shift(app, view);
} }
@ -22,7 +22,7 @@ seek_pos_of_visual_line(Application_Links *app, Side side){
Vec2_f32 p = view_relative_xy_of_pos(app, view, cursor.line, pos); Vec2_f32 p = view_relative_xy_of_pos(app, view, cursor.line, pos);
p.x = (side == Side_Min)?(0.f):(max_f32); p.x = (side == Side_Min)?(0.f):(max_f32);
i64 new_pos = view_pos_at_relative_xy(app, view, cursor.line, p); i64 new_pos = view_pos_at_relative_xy(app, view, cursor.line, p);
view_set_cursor(app, view, seek_pos(new_pos), true); view_set_cursor_and_preferred_x(app, view, seek_pos(new_pos));
no_mark_snap_to_cursor_if_shift(app, view); no_mark_snap_to_cursor_if_shift(app, view);
} }
@ -54,7 +54,7 @@ CUSTOM_COMMAND_SIG(goto_beginning_of_file)
CUSTOM_DOC("Sets the cursor to the beginning of the file.") CUSTOM_DOC("Sets the cursor to the beginning of the file.")
{ {
View_ID view = get_active_view(app, AccessProtected); View_ID view = get_active_view(app, AccessProtected);
view_set_cursor(app, view, seek_pos(0), true); view_set_cursor_and_preferred_x(app, view, seek_pos(0));
no_mark_snap_to_cursor_if_shift(app, view); no_mark_snap_to_cursor_if_shift(app, view);
} }
@ -64,7 +64,7 @@ CUSTOM_DOC("Sets the cursor to the end of the file.")
View_ID view = get_active_view(app, AccessProtected); View_ID view = get_active_view(app, AccessProtected);
Buffer_ID buffer_id = view_get_buffer(app, view, AccessProtected); Buffer_ID buffer_id = view_get_buffer(app, view, AccessProtected);
i32 size = (i32)buffer_get_size(app, buffer_id); i32 size = (i32)buffer_get_size(app, buffer_id);
view_set_cursor(app, view, seek_pos(size), true); view_set_cursor_and_preferred_x(app, view, seek_pos(size));
no_mark_snap_to_cursor_if_shift(app, view); no_mark_snap_to_cursor_if_shift(app, view);
} }

View File

@ -52,8 +52,8 @@ app_coroutine_handle_request(Models *models, Coroutine *co, u32 *vals){
case AppCoroutineRequest_NewFontFace: case AppCoroutineRequest_NewFontFace:
{ {
Face_Description *description = ((Face_Description**)vals)[0]; Face_Description *description = ((Face_Description**)vals)[0];
Face_ID face_id = font_set_new_face(&models->font_set, description); Face *face = font_set_new_face(&models->font_set, description);
result = coroutine_run(&models->coroutines, co, &face_id, vals); result = coroutine_run(&models->coroutines, co, &face->id, vals);
}break; }break;
case AppCoroutineRequest_ModifyFace: case AppCoroutineRequest_ModifyFace:
@ -925,7 +925,8 @@ App_Init_Sig(app_init){
description.font.file_name = string_u8_litexpr("liberation-mono.ttf"); description.font.file_name = string_u8_litexpr("liberation-mono.ttf");
description.font.in_4coder_font_folder = true; description.font.in_4coder_font_folder = true;
description.parameters.pt_size = 12; description.parameters.pt_size = 12;
models->global_font_id = font_set_new_face(&models->font_set, &description); Face *new_face = font_set_new_face(&models->font_set, &description);
models->global_face_id = new_face->id;
} }
app_hardcode_default_style(models); app_hardcode_default_style(models);

View File

@ -391,7 +391,10 @@ Buffer_Line_Y_Difference(Application_Links *app, Buffer_ID buffer_id, f32 width,
Editing_File *file = imp_get_file(models, buffer_id); Editing_File *file = imp_get_file(models, buffer_id);
f32 result = {}; f32 result = {};
if (api_check_buffer(file)){ if (api_check_buffer(file)){
result = file_line_y_difference(models, file, width, face_id, line_a, line_b); Face *face = font_set_face_from_id(&models->font_set, face_id);
if (face != 0){
result = file_line_y_difference(models, file, width, face, line_a, line_b);
}
} }
return(result); return(result);
} }
@ -402,7 +405,10 @@ Buffer_Line_Shift_Y(Application_Links *app, Buffer_ID buffer_id, f32 width, Face
Editing_File *file = imp_get_file(models, buffer_id); Editing_File *file = imp_get_file(models, buffer_id);
Line_Shift_Vertical result = {}; Line_Shift_Vertical result = {};
if (api_check_buffer(file)){ if (api_check_buffer(file)){
result = file_line_shift_y(models, file, width, face_id, line, y_shift); Face *face = font_set_face_from_id(&models->font_set, face_id);
if (face != 0){
result = file_line_shift_y(models, file, width, face, line, y_shift);
}
} }
return(result); return(result);
} }
@ -413,7 +419,10 @@ Buffer_Pos_At_Relative_XY(Application_Links *app, Buffer_ID buffer_id, f32 width
Editing_File *file = imp_get_file(models, buffer_id); Editing_File *file = imp_get_file(models, buffer_id);
i64 result = -1; i64 result = -1;
if (api_check_buffer(file)){ if (api_check_buffer(file)){
result = file_pos_at_relative_xy(models, file, width, face_id, base_line, relative_xy); Face *face = font_set_face_from_id(&models->font_set, face_id);
if (face != 0){
result = file_pos_at_relative_xy(models, file, width, face, base_line, relative_xy);
}
} }
return(result); return(result);
} }
@ -425,7 +434,10 @@ Buffer_Relative_XY_Of_Pos(Application_Links *app, Buffer_ID buffer_id, f32 width
Editing_File *file = imp_get_file(models, buffer_id); Editing_File *file = imp_get_file(models, buffer_id);
Vec2_f32 result = {}; Vec2_f32 result = {};
if (api_check_buffer(file)){ if (api_check_buffer(file)){
result = file_relative_xy_of_pos(models, file, width, face_id, base_line, pos); Face *face = font_set_face_from_id(&models->font_set, face_id);
if (face != 0){
result = file_relative_xy_of_pos(models, file, width, face, base_line, pos);
}
} }
return(result); return(result);
} }
@ -437,7 +449,10 @@ Buffer_Relative_Character_From_Pos(Application_Links *app, Buffer_ID buffer_id,
Editing_File *file = imp_get_file(models, buffer_id); Editing_File *file = imp_get_file(models, buffer_id);
i64 result = {}; i64 result = {};
if (api_check_buffer(file)){ if (api_check_buffer(file)){
result = file_relative_character_from_pos(models, file, width, face_id, base_line, pos); Face *face = font_set_face_from_id(&models->font_set, face_id);
if (face != 0){
result = file_relative_character_from_pos(models, file, width, face, base_line, pos);
}
} }
return(result); return(result);
} }
@ -449,7 +464,10 @@ Buffer_Pos_From_Relative_Character(Application_Links *app, Buffer_ID buffer_id,
Editing_File *file = imp_get_file(models, buffer_id); Editing_File *file = imp_get_file(models, buffer_id);
i64 result = -1; i64 result = -1;
if (api_check_buffer(file)){ if (api_check_buffer(file)){
result = file_pos_from_relative_character(models, file, width, face_id, base_line, relative_character); Face *face = font_set_face_from_id(&models->font_set, face_id);
if (face != 0){
result = file_pos_from_relative_character(models, file, width, face, base_line, relative_character);
}
} }
return(result); return(result);
} }
@ -1299,6 +1317,18 @@ View_Get_Preferred_X(Application_Links *app, View_ID view_id){
return(result); return(result);
} }
API_EXPORT b32
View_Set_Preferred_X(Application_Links *app, View_ID view_id, f32 x){
Models *models = (Models*)app->cmd_context;
View *view = imp_get_view(models, view_id);
b32 result = false;
if (api_check_view(view)){
view->preferred_x = x;
result = true;
}
return(result);
}
API_EXPORT Rect_f32 API_EXPORT Rect_f32
View_Get_Screen_Rect(Application_Links *app, View_ID view_id){ View_Get_Screen_Rect(Application_Links *app, View_ID view_id){
Models *models = (Models*)app->cmd_context; Models *models = (Models*)app->cmd_context;
@ -1673,8 +1703,19 @@ Buffer_Compute_Cursor(Application_Links *app, Buffer_ID buffer, Buffer_Seek seek
return(result); return(result);
} }
API_EXPORT Buffer_Cursor
View_Compute_Cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek){
Models *models = (Models*)app->cmd_context;
View *view = imp_get_view(models, view_id);
Buffer_Cursor result = {};
if (api_check_view(view)){
result = view_compute_cursor(view, seek);
}
return(result);
}
API_EXPORT b32 API_EXPORT b32
View_Set_Cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek, b32 set_preferred_x) View_Set_Cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek)
{ {
Models *models = (Models*)app->cmd_context; Models *models = (Models*)app->cmd_context;
View *view = imp_get_view(models, view_id); View *view = imp_get_view(models, view_id);
@ -1684,14 +1725,7 @@ View_Set_Cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek, b32 s
Assert(file != 0); Assert(file != 0);
if (api_check_buffer(file)){ if (api_check_buffer(file)){
Buffer_Cursor cursor = file_compute_cursor(file, seek); Buffer_Cursor cursor = file_compute_cursor(file, seek);
f32 preferred_x = 0.f;
if (!set_preferred_x){
preferred_x = view->preferred_x;
}
view_set_cursor(models, view, cursor.pos); view_set_cursor(models, view, cursor.pos);
if (!set_preferred_x){
view->preferred_x = preferred_x;
}
result = true; result = true;
} }
} }
@ -2403,10 +2437,10 @@ Set_Global_Face(Application_Links *app, Face_ID id, b32 apply_to_all_buffers)
Face *face = font_set_face_from_id(&models->font_set, id); Face *face = font_set_face_from_id(&models->font_set, id);
if (face != 0){ if (face != 0){
if (apply_to_all_buffers){ if (apply_to_all_buffers){
global_set_font_and_update_files(system, models, id); global_set_font_and_update_files(system, models, face);
} }
else{ else{
models->global_font_id = id; models->global_face_id = face->id;
} }
did_change = true; did_change = true;
} }
@ -2592,9 +2626,10 @@ Buffer_Set_Face(Application_Links *app, Buffer_ID buffer_id, Face_ID id)
b32 did_change = false; b32 did_change = false;
if (api_check_buffer(file)){ if (api_check_buffer(file)){
if (font_set_face_from_id(&models->font_set, id) != 0){ Face *face = font_set_face_from_id(&models->font_set, id);
if (face != 0){
file->settings.face_id = face->id;
did_change = true; did_change = true;
file_set_font(models->system, models, file, id);
} }
} }
return(did_change); return(did_change);
@ -2641,11 +2676,11 @@ Get_Face_ID(Application_Links *app, Buffer_ID buffer_id)
if (buffer_id != 0){ if (buffer_id != 0){
Editing_File *file = imp_get_file(models, buffer_id); Editing_File *file = imp_get_file(models, buffer_id);
if (api_check_buffer(file)){ if (api_check_buffer(file)){
result = file->settings.font_id; result = file->settings.face_id;
} }
} }
else{ else{
result = models->global_font_id; result = models->global_face_id;
} }
return(result); return(result);
} }
@ -2665,7 +2700,8 @@ Try_Create_New_Face(Application_Links *app, Face_Description *description)
result = *(Face_ID*)(coroutine->in); result = *(Face_ID*)(coroutine->in);
} }
else{ else{
result = font_set_new_face(&models->font_set, description); Face *new_face = font_set_new_face(&models->font_set, description);
result = new_face->id;
} }
return(result); return(result);
} }
@ -2695,8 +2731,10 @@ API_EXPORT b32
Try_Release_Face(Application_Links *app, Face_ID id, Face_ID replacement_id) Try_Release_Face(Application_Links *app, Face_ID id, Face_ID replacement_id)
{ {
Models *models = (Models*)app->cmd_context; Models *models = (Models*)app->cmd_context;
b32 success = release_font_and_update_files(models->system, models, id, replacement_id); Font_Set *font_set = &models->font_set;
return(success); Face *face = font_set_face_from_id(font_set, id);
Face *replacement = font_set_face_from_id(font_set, replacement_id);
return(release_font_and_update(models->system, models, face, replacement));
} }
API_EXPORT void API_EXPORT void
@ -2982,7 +3020,7 @@ Text_Layout_Create(Application_Links *app, Buffer_ID buffer_id, Rect_f32 rect, B
if (api_check_buffer(file)){ if (api_check_buffer(file)){
Scratch_Block scratch(app); Scratch_Block scratch(app);
Arena arena = make_arena_models(models); Arena arena = make_arena_models(models);
Face_ID face_id = file->settings.font_id; Face *face = file_get_face(models, file);
Gap_Buffer *buffer = &file->state.buffer; Gap_Buffer *buffer = &file->state.buffer;
@ -2993,7 +3031,7 @@ Text_Layout_Create(Application_Links *app, Buffer_ID buffer_id, Rect_f32 rect, B
f32 y = -buffer_point.pixel_shift.y; f32 y = -buffer_point.pixel_shift.y;
for (;line_number <= line_count; for (;line_number <= line_count;
line_number += 1){ line_number += 1){
Buffer_Layout_Item_List line = file_get_line_layout(models, file, dim.x, face_id, line_number); Buffer_Layout_Item_List line = file_get_line_layout(models, file, dim.x, face, line_number);
f32 next_y = y + line.height; f32 next_y = y + line.height;
if (next_y >= dim.y){ if (next_y >= dim.y){
break; break;
@ -3049,13 +3087,13 @@ Text_Layout_Line_On_Screen(Application_Links *app, Text_Layout_ID layout_id, i64
if (api_check_buffer(file)){ if (api_check_buffer(file)){
Rect_f32 rect = layout->rect; Rect_f32 rect = layout->rect;
f32 width = rect_width(rect); f32 width = rect_width(rect);
Face_ID face_id = file->settings.font_id; Face *face = file_get_face(models, file);
f32 top = 0.f; f32 top = 0.f;
f32 bot = 0.f; f32 bot = 0.f;
for (i64 line_number_it = layout->visible_line_number_range.first;; for (i64 line_number_it = layout->visible_line_number_range.first;;
line_number_it += 1){ line_number_it += 1){
Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face_id, line_number_it); Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number_it);
bot += line.height; bot += line.height;
if (line_number_it == line_number){ if (line_number_it == line_number){
break; break;
@ -3090,13 +3128,13 @@ Text_Layout_Character_On_Screen(Application_Links *app, Text_Layout_ID layout_id
Rect_f32 rect = layout->rect; Rect_f32 rect = layout->rect;
f32 width = rect_width(rect); f32 width = rect_width(rect);
Face_ID face_id = file->settings.font_id; Face *face = file_get_face(models, file);
f32 y = 0.f; f32 y = 0.f;
Buffer_Layout_Item_List line = {}; Buffer_Layout_Item_List line = {};
for (i64 line_number_it = layout->visible_line_number_range.first;; for (i64 line_number_it = layout->visible_line_number_range.first;;
line_number_it += 1){ line_number_it += 1){
line = file_get_line_layout(models, file, width, face_id, line_number_it); line = file_get_line_layout(models, file, width, face, line_number_it);
if (line_number_it == line_number){ if (line_number_it == line_number){
break; break;
} }

View File

@ -42,7 +42,7 @@ struct Models{
App_Settings settings; App_Settings settings;
App_State state; App_State state;
Face_ID global_font_id; Face_ID global_face_id;
Mapping mapping; Mapping mapping;
Command_Binding prev_command; Command_Binding prev_command;

View File

@ -143,8 +143,7 @@ edit_fix_markers(Models *models, Editing_File *file, Edit edit){
buffer_unsort_cursors( cursors, cursor_count); buffer_unsort_cursors( cursors, cursor_count);
buffer_unsort_cursors(r_cursors, r_cursor_count); buffer_unsort_cursors(r_cursors, r_cursor_count);
Face *face = font_set_face_from_id(&models->font_set, file->settings.font_id); Face *face = file_get_face(models, file);
Assert(face != 0);
cursor_count = 0; cursor_count = 0;
r_cursor_count = 0; r_cursor_count = 0;

View File

@ -51,6 +51,11 @@ file_edit_positions_pop(Editing_File *file){
//////////////////////////////// ////////////////////////////////
internal Face*
file_get_face(Models *models, Editing_File *file){
return(font_set_face_from_id(&models->font_set, file->settings.face_id));
}
internal u32 internal u32
file_get_access_flags(Editing_File *file){ file_get_access_flags(Editing_File *file){
u32 flags = 0; u32 flags = 0;
@ -223,10 +228,7 @@ file_create_from_string(Models *models, Editing_File *file, String_Const_u8 val,
file_clear_dirty_flags(file); file_clear_dirty_flags(file);
file->attributes = attributes; file->attributes = attributes;
Face_ID font_id = models->global_font_id; file->settings.face_id = models->global_face_id;
file->settings.font_id = font_id;
Face *face = font_set_face_from_id(&models->font_set, font_id);
Assert(face != 0);
buffer_measure_starts(scratch, &file->state.buffer); buffer_measure_starts(scratch, &file->state.buffer);
@ -315,17 +317,13 @@ file_get_managed_scope(Editing_File *file){
//////////////////////////////// ////////////////////////////////
internal Buffer_Layout_Item_List internal Buffer_Layout_Item_List
file_get_line_layout(Models *models, Editing_File *file, f32 width, Face_ID face_id, i64 line_number){ file_get_line_layout(Models *models, Editing_File *file, f32 width, Face *face, i64 line_number){
Buffer_Layout_Item_List result = {}; Buffer_Layout_Item_List result = {};
i64 line_count = buffer_line_count(&file->state.buffer); i64 line_count = buffer_line_count(&file->state.buffer);
if (1 <= line_number && line_number <= line_count){ if (1 <= line_number && line_number <= line_count){
// TODO(allen): optimization: most places that CALL this do so in a LOOP, which could HOIST
// this font_set_face_from_id call OUTSIDE of the LOOP.
Face *face = font_set_face_from_id(&models->font_set, face_id);
if (face != 0){
Line_Layout_Key key = {}; Line_Layout_Key key = {};
key.face_id = face_id; key.face_id = face->id;
key.face_version_number = face->version_number; key.face_version_number = face->version_number;
key.width = width; key.width = width;
key.line_number = line_number; key.line_number = line_number;
@ -350,7 +348,6 @@ file_get_line_layout(Models *models, Editing_File *file, f32 width, Face_ID face
} }
block_copy_struct(&result, list); block_copy_struct(&result, list);
} }
}
return(result); return(result);
} }
@ -362,7 +359,7 @@ file_clear_layout_cache(Editing_File *file){
} }
internal Line_Shift_Vertical internal Line_Shift_Vertical
file_line_shift_y(Models *models, Editing_File *file, f32 width, Face_ID face_id, i64 line_number, f32 y_delta){ file_line_shift_y(Models *models, Editing_File *file, f32 width, Face *face, i64 line_number, f32 y_delta){
Line_Shift_Vertical result = {}; Line_Shift_Vertical result = {};
f32 line_y = 0.f; f32 line_y = 0.f;
@ -382,7 +379,7 @@ file_line_shift_y(Models *models, Editing_File *file, f32 width, Face_ID face_id
line_number = 1; line_number = 1;
break; break;
} }
Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face_id, line_number); Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number);
line_y -= line.height; line_y -= line.height;
} }
if (!has_result){ if (!has_result){
@ -395,7 +392,7 @@ file_line_shift_y(Models *models, Editing_File *file, f32 width, Face_ID face_id
b32 has_result = false; b32 has_result = false;
i64 line_count = buffer_line_count(&file->state.buffer); i64 line_count = buffer_line_count(&file->state.buffer);
for (;;line_number += 1){ for (;;line_number += 1){
Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face_id, line_number); Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number);
f32 next_y = line_y + line.height; f32 next_y = line_y + line.height;
if (y_delta < next_y){ if (y_delta < next_y){
has_result = true; has_result = true;
@ -418,12 +415,12 @@ file_line_shift_y(Models *models, Editing_File *file, f32 width, Face_ID face_id
} }
internal f32 internal f32
file_line_y_difference(Models *models, Editing_File *file, f32 width, Face_ID face_id, i64 line_a, i64 line_b){ file_line_y_difference(Models *models, Editing_File *file, f32 width, Face *face, i64 line_a, i64 line_b){
f32 result = 0.f; f32 result = 0.f;
if (line_a != line_b){ if (line_a != line_b){
Interval_i64 line_range = Ii64(line_a, line_b); Interval_i64 line_range = Ii64(line_a, line_b);
for (i64 i = line_range.min; i < line_range.max; i += 1){ for (i64 i = line_range.min; i < line_range.max; i += 1){
Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face_id, i); Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, i);
result += line.height; result += line.height;
} }
if (line_a < line_b){ if (line_a < line_b){
@ -434,25 +431,25 @@ file_line_y_difference(Models *models, Editing_File *file, f32 width, Face_ID fa
} }
internal i64 internal i64
file_pos_at_relative_xy(Models *models, Editing_File *file, f32 width, Face_ID face_id, i64 base_line, Vec2_f32 relative_xy){ file_pos_at_relative_xy(Models *models, Editing_File *file, f32 width, Face *face, i64 base_line, Vec2_f32 relative_xy){
Line_Shift_Vertical shift = file_line_shift_y(models, file, width, face_id, base_line, relative_xy.y); Line_Shift_Vertical shift = file_line_shift_y(models, file, width, face, base_line, relative_xy.y);
relative_xy.y -= shift.y_delta; relative_xy.y -= shift.y_delta;
Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face_id, shift.line); Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, shift.line);
return(buffer_layout_nearest_pos_to_xy(line, relative_xy)); return(buffer_layout_nearest_pos_to_xy(line, relative_xy));
} }
internal Vec2_f32 internal Vec2_f32
file_relative_xy_of_pos(Models *models, Editing_File *file, f32 width, Face_ID face_id, i64 base_line, i64 pos){ file_relative_xy_of_pos(Models *models, Editing_File *file, f32 width, Face *face, i64 base_line, i64 pos){
i64 line_number = buffer_get_line_index(&file->state.buffer, pos) + 1; i64 line_number = buffer_get_line_index(&file->state.buffer, pos) + 1;
Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face_id, line_number); Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number);
Vec2_f32 result = buffer_layout_xy_center_of_pos(line, pos); Vec2_f32 result = buffer_layout_xy_center_of_pos(line, pos);
result.y += file_line_y_difference(models, file, width, face_id, line_number, base_line); result.y += file_line_y_difference(models, file, width, face, line_number, base_line);
return(result); return(result);
} }
internal Buffer_Point internal Buffer_Point
file_normalize_buffer_point(Models *models, Editing_File *file, f32 width, Face_ID face_id, Buffer_Point point){ file_normalize_buffer_point(Models *models, Editing_File *file, f32 width, Face *face, Buffer_Point point){
Line_Shift_Vertical shift = file_line_shift_y(models, file, width, face_id, point.line_number, point.pixel_shift.y); Line_Shift_Vertical shift = file_line_shift_y(models, file, width, face, point.line_number, point.pixel_shift.y);
point.line_number = shift.line; point.line_number = shift.line;
point.pixel_shift.y -= shift.y_delta; point.pixel_shift.y -= shift.y_delta;
point.pixel_shift.x = clamp_bot(0.f, point.pixel_shift.x); point.pixel_shift.x = clamp_bot(0.f, point.pixel_shift.x);
@ -461,15 +458,15 @@ file_normalize_buffer_point(Models *models, Editing_File *file, f32 width, Face_
} }
internal Vec2_f32 internal Vec2_f32
file_buffer_point_difference(Models *models, Editing_File *file, f32 width, Face_ID face_id, Buffer_Point a, Buffer_Point b){ file_buffer_point_difference(Models *models, Editing_File *file, f32 width, Face *face, Buffer_Point a, Buffer_Point b){
f32 y_difference = file_line_y_difference(models, file, width, face_id, a.line_number, b.line_number); f32 y_difference = file_line_y_difference(models, file, width, face, a.line_number, b.line_number);
Vec2_f32 result = a.pixel_shift - b.pixel_shift; Vec2_f32 result = a.pixel_shift - b.pixel_shift;
result.y += y_difference; result.y += y_difference;
return(result); return(result);
} }
internal Line_Shift_Character internal Line_Shift_Character
file_line_shift_characters(Models *models, Editing_File *file, f32 width, Face_ID face_id, i64 line_number, i64 character_delta){ file_line_shift_characters(Models *models, Editing_File *file, f32 width, Face *face, i64 line_number, i64 character_delta){
Line_Shift_Character result = {}; Line_Shift_Character result = {};
i64 line_character = 0; i64 line_character = 0;
@ -489,7 +486,7 @@ file_line_shift_characters(Models *models, Editing_File *file, f32 width, Face_I
line_number = 1; line_number = 1;
break; break;
} }
Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face_id, line_number); Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number);
line_character -= line.character_count; line_character -= line.character_count;
} }
if (!has_result){ if (!has_result){
@ -502,7 +499,7 @@ file_line_shift_characters(Models *models, Editing_File *file, f32 width, Face_I
b32 has_result = false; b32 has_result = false;
i64 line_count = buffer_line_count(&file->state.buffer); i64 line_count = buffer_line_count(&file->state.buffer);
for (;;line_number += 1){ for (;;line_number += 1){
Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face_id, line_number); Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number);
i64 next_character = line_character + line.character_count; i64 next_character = line_character + line.character_count;
if (character_delta < next_character){ if (character_delta < next_character){
has_result = true; has_result = true;
@ -525,12 +522,12 @@ file_line_shift_characters(Models *models, Editing_File *file, f32 width, Face_I
} }
internal i64 internal i64
file_line_character_difference(Models *models, Editing_File *file, f32 width, Face_ID face_id, i64 line_a, i64 line_b){ file_line_character_difference(Models *models, Editing_File *file, f32 width, Face *face, i64 line_a, i64 line_b){
i64 result = 0; i64 result = 0;
if (line_a != line_b){ if (line_a != line_b){
Interval_i64 line_range = Ii64(line_a, line_b); Interval_i64 line_range = Ii64(line_a, line_b);
for (i64 i = line_range.min; i < line_range.max; i += 1){ for (i64 i = line_range.min; i < line_range.max; i += 1){
Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face_id, i); Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, i);
result += line.character_count; result += line.character_count;
} }
if (line_a < line_b){ if (line_a < line_b){
@ -541,19 +538,19 @@ file_line_character_difference(Models *models, Editing_File *file, f32 width, Fa
} }
internal i64 internal i64
file_pos_from_relative_character(Models *models, Editing_File *file, f32 width, Face_ID face_id, i64 base_line, i64 relative_character){ file_pos_from_relative_character(Models *models, Editing_File *file, f32 width, Face *face, i64 base_line, i64 relative_character){
Line_Shift_Character shift = file_line_shift_characters(models, file, width, face_id, base_line, relative_character); Line_Shift_Character shift = file_line_shift_characters(models, file, width, face, base_line, relative_character);
relative_character -= shift.character_delta; relative_character -= shift.character_delta;
Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face_id, shift.line); Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, shift.line);
return(buffer_layout_get_pos_at_character(line, relative_character)); return(buffer_layout_get_pos_at_character(line, relative_character));
} }
internal i64 internal i64
file_relative_character_from_pos(Models *models, Editing_File *file, f32 width, Face_ID face_id, i64 base_line, i64 pos){ file_relative_character_from_pos(Models *models, Editing_File *file, f32 width, Face *face, i64 base_line, i64 pos){
i64 line_number = buffer_get_line_index(&file->state.buffer, pos) + 1; i64 line_number = buffer_get_line_index(&file->state.buffer, pos) + 1;
Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face_id, line_number); Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number);
i64 result = buffer_layout_character_from_pos(line, pos); i64 result = buffer_layout_character_from_pos(line, pos);
result += file_line_character_difference(models, file, width, face_id, line_number, base_line); result += file_line_character_difference(models, file, width, face, line_number, base_line);
return(result); return(result);
} }

View File

@ -37,7 +37,7 @@ struct Editing_File_Settings{
i32 base_map_id; i32 base_map_id;
Parse_Context_ID parse_context_id; Parse_Context_ID parse_context_id;
b32 dos_write_mode; b32 dos_write_mode;
Face_ID font_id; Face_ID face_id;
b8 tokens_exist; b8 tokens_exist;
b8 tokens_without_strings; b8 tokens_without_strings;
b8 is_initialized; b8 is_initialized;

View File

@ -75,23 +75,22 @@ font_set_init(System_Functions *system, Font_Set *set){
set->id_to_slot_table = make_table_u64_u64(set->arena.base_allocator, 40); set->id_to_slot_table = make_table_u64_u64(set->arena.base_allocator, 40);
} }
internal Face_ID internal Face*
font_set_new_face(Font_Set *set, Face_Description *description){ font_set_new_face(Font_Set *set, Face_Description *description){
Face_ID result = 0;
Arena arena = make_arena_system(set->system); Arena arena = make_arena_system(set->system);
Face *face = set->system->font_make_face(&arena, description); Face *face = set->system->font_make_face(&arena, description);
if (face != 0){ if (face != 0){
Font_Face_Slot *slot = font_set__alloc_face_slot(set); Font_Face_Slot *slot = font_set__alloc_face_slot(set);
slot->arena = arena; slot->arena = arena;
slot->face = face; slot->face = face;
result = font_set__alloc_face_id(set); Face_ID new_id = font_set__alloc_face_id(set);
face->id = result; face->id = new_id;
table_insert(&set->id_to_slot_table, result, (u64)slot); table_insert(&set->id_to_slot_table, new_id, (u64)slot);
} }
else{ else{
linalloc_clear(&arena); linalloc_clear(&arena);
} }
return(result); return(face);
} }
internal Font_Face_Slot* internal Font_Face_Slot*

View File

@ -226,14 +226,6 @@ draw_font_glyph(Render_Target *target, Face *face, u32 codepoint, f32 x, f32 y,
draw__write_vertices_in_current_group(target, vertices, 6); draw__write_vertices_in_current_group(target, vertices, 6);
} }
internal void
draw_font_glyph(Render_Target *target, Font_Set *font_set, Face_ID face_id, u32 codepoint, f32 x, f32 y, u32 color, u32 flags){
Face *face = font_set_face_from_id(font_set, face_id);
if (face != 0){
draw_font_glyph(target, face, codepoint, x, y, color, flags);
}
}
//////////////////////////////// ////////////////////////////////
internal void internal void

View File

@ -88,8 +88,7 @@ text_layout_render(Models *models, Text_Layout *layout){
Arena *scratch = &models->mem.arena; Arena *scratch = &models->mem.arena;
Render_Target *target = models->target; Render_Target *target = models->target;
Color_Table color_table = models->color_table; Color_Table color_table = models->color_table;
Font_Set *font_set = &models->font_set; Face *face = file_get_face(models, file);
Face_ID font_id = file->settings.font_id;
f32 width = rect_width(layout->rect); f32 width = rect_width(layout->rect);
u32 special_color = color_table.vals[Stag_Special_Character]; u32 special_color = color_table.vals[Stag_Special_Character];
@ -100,7 +99,7 @@ text_layout_render(Models *models, Text_Layout *layout){
i64 line_number = layout->visible_line_number_range.min; i64 line_number = layout->visible_line_number_range.min;
i64 line_number_last = layout->visible_line_number_range.max; i64 line_number_last = layout->visible_line_number_range.max;
for (;line_number <= line_number_last; line_number += 1){ for (;line_number <= line_number_last; line_number += 1){
Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, font_id, line_number); Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number);
for (Buffer_Layout_Item_Block *block = line.first; for (Buffer_Layout_Item_Block *block = line.first;
block != 0; block != 0;
block = block->next){ block = block->next){
@ -127,7 +126,7 @@ text_layout_render(Models *models, Text_Layout *layout){
} }
Vec2_f32 p = item->rect.p0 + shift_p; Vec2_f32 p = item->rect.p0 + shift_p;
draw_font_glyph(target, font_set, font_id, item->codepoint, p.x, p.y, color, GlyphFlag_None); draw_font_glyph(target, face, item->codepoint, p.x, p.y, color, GlyphFlag_None);
} }
} }
} }

View File

@ -123,7 +123,7 @@ view_height(Models *models, View *view){
internal Buffer_Layout_Item_List internal Buffer_Layout_Item_List
view_get_line_layout(Models *models, View *view, i64 line_number){ view_get_line_layout(Models *models, View *view, i64 line_number){
Editing_File *file = view->file; Editing_File *file = view->file;
Face_ID face = file->settings.font_id; Face *face = file_get_face(models, file);
f32 width = view_width(models, view); f32 width = view_width(models, view);
return(file_get_line_layout(models, file, width, face, line_number)); return(file_get_line_layout(models, file, width, face, line_number));
} }
@ -131,7 +131,7 @@ view_get_line_layout(Models *models, View *view, i64 line_number){
internal Line_Shift_Vertical internal Line_Shift_Vertical
view_line_shift_y(Models *models, View *view, i64 line_number, f32 y_delta){ view_line_shift_y(Models *models, View *view, i64 line_number, f32 y_delta){
Editing_File *file = view->file; Editing_File *file = view->file;
Face_ID face = file->settings.font_id; Face *face = file_get_face(models, file);
f32 width = view_width(models, view); f32 width = view_width(models, view);
return(file_line_shift_y(models, file, width, face, line_number, y_delta)); return(file_line_shift_y(models, file, width, face, line_number, y_delta));
} }
@ -139,7 +139,7 @@ view_line_shift_y(Models *models, View *view, i64 line_number, f32 y_delta){
internal f32 internal f32
view_line_y_difference(Models *models, View *view, i64 line_a, i64 line_b){ view_line_y_difference(Models *models, View *view, i64 line_a, i64 line_b){
Editing_File *file = view->file; Editing_File *file = view->file;
Face_ID face = file->settings.font_id; Face *face = file_get_face(models, file);
f32 width = view_width(models, view); f32 width = view_width(models, view);
return(file_line_y_difference(models, file, width, face, line_a, line_b)); return(file_line_y_difference(models, file, width, face, line_a, line_b));
} }
@ -147,7 +147,7 @@ view_line_y_difference(Models *models, View *view, i64 line_a, i64 line_b){
internal i64 internal i64
view_pos_at_relative_xy(Models *models, View *view, i64 base_line, Vec2_f32 relative_xy){ view_pos_at_relative_xy(Models *models, View *view, i64 base_line, Vec2_f32 relative_xy){
Editing_File *file = view->file; Editing_File *file = view->file;
Face_ID face = file->settings.font_id; Face *face = file_get_face(models, file);
f32 width = view_width(models, view); f32 width = view_width(models, view);
return(file_pos_at_relative_xy(models, file, width, face, base_line, relative_xy)); return(file_pos_at_relative_xy(models, file, width, face, base_line, relative_xy));
} }
@ -155,7 +155,7 @@ view_pos_at_relative_xy(Models *models, View *view, i64 base_line, Vec2_f32 rela
internal Vec2_f32 internal Vec2_f32
view_relative_xy_of_pos(Models *models, View *view, i64 base_line, i64 pos){ view_relative_xy_of_pos(Models *models, View *view, i64 base_line, i64 pos){
Editing_File *file = view->file; Editing_File *file = view->file;
Face_ID face = file->settings.font_id; Face *face = file_get_face(models, file);
f32 width = view_width(models, view); f32 width = view_width(models, view);
return(file_relative_xy_of_pos(models, file, width, face, base_line, pos)); return(file_relative_xy_of_pos(models, file, width, face, base_line, pos));
} }
@ -163,7 +163,7 @@ view_relative_xy_of_pos(Models *models, View *view, i64 base_line, i64 pos){
internal Buffer_Point internal Buffer_Point
view_normalize_buffer_point(Models *models, View *view, Buffer_Point point){ view_normalize_buffer_point(Models *models, View *view, Buffer_Point point){
Editing_File *file = view->file; Editing_File *file = view->file;
Face_ID face = file->settings.font_id; Face *face = file_get_face(models, file);
f32 width = view_width(models, view); f32 width = view_width(models, view);
return(file_normalize_buffer_point(models, file, width, face, point)); return(file_normalize_buffer_point(models, file, width, face, point));
} }
@ -171,7 +171,7 @@ view_normalize_buffer_point(Models *models, View *view, Buffer_Point point){
internal Vec2_f32 internal Vec2_f32
view_buffer_point_difference(Models *models, View *view, Buffer_Point a, Buffer_Point b){ view_buffer_point_difference(Models *models, View *view, Buffer_Point a, Buffer_Point b){
Editing_File *file = view->file; Editing_File *file = view->file;
Face_ID face = file->settings.font_id; Face *face = file_get_face(models, file);
f32 width = view_width(models, view); f32 width = view_width(models, view);
return(file_buffer_point_difference(models, file, width, face, a, b)); return(file_buffer_point_difference(models, file, width, face, a, b));
} }
@ -188,7 +188,7 @@ view_move_buffer_point(Models *models, View *view, Buffer_Point buffer_point, Ve
internal Line_Shift_Character internal Line_Shift_Character
view_line_shift_characters(Models *models, View *view, i64 line_number, i64 character_delta){ view_line_shift_characters(Models *models, View *view, i64 line_number, i64 character_delta){
Editing_File *file = view->file; Editing_File *file = view->file;
Face_ID face = file->settings.font_id; Face *face = file_get_face(models, file);
f32 width = view_width(models, view); f32 width = view_width(models, view);
return(file_line_shift_characters(models, file, width, face, line_number, character_delta)); return(file_line_shift_characters(models, file, width, face, line_number, character_delta));
} }
@ -196,7 +196,7 @@ view_line_shift_characters(Models *models, View *view, i64 line_number, i64 char
internal i64 internal i64
view_line_character_difference(Models *models, View *view, i64 line_a, i64 line_b){ view_line_character_difference(Models *models, View *view, i64 line_a, i64 line_b){
Editing_File *file = view->file; Editing_File *file = view->file;
Face_ID face = file->settings.font_id; Face *face = file_get_face(models, file);
f32 width = view_width(models, view); f32 width = view_width(models, view);
return(file_line_character_difference(models, file, width, face, line_a, line_b)); return(file_line_character_difference(models, file, width, face, line_a, line_b));
} }
@ -204,7 +204,7 @@ view_line_character_difference(Models *models, View *view, i64 line_a, i64 line_
internal i64 internal i64
view_pos_from_relative_character(Models *models, View *view, i64 base_line, i64 relative_character){ view_pos_from_relative_character(Models *models, View *view, i64 base_line, i64 relative_character){
Editing_File *file = view->file; Editing_File *file = view->file;
Face_ID face = file->settings.font_id; Face *face = file_get_face(models, file);
f32 width = view_width(models, view); f32 width = view_width(models, view);
return(file_pos_from_relative_character(models, file, width, face, base_line, relative_character)); return(file_pos_from_relative_character(models, file, width, face, base_line, relative_character));
} }
@ -212,11 +212,17 @@ view_pos_from_relative_character(Models *models, View *view, i64 base_line, i64
internal i64 internal i64
view_relative_character_from_pos(Models *models, View *view, i64 base_line, i64 pos){ view_relative_character_from_pos(Models *models, View *view, i64 base_line, i64 pos){
Editing_File *file = view->file; Editing_File *file = view->file;
Face_ID face = file->settings.font_id; Face *face = file_get_face(models, file);
f32 width = view_width(models, view); f32 width = view_width(models, view);
return(file_relative_character_from_pos(models, file, width, face, base_line, pos)); return(file_relative_character_from_pos(models, file, width, face, base_line, pos));
} }
internal Buffer_Cursor
view_compute_cursor(View *view, Buffer_Seek seek){
Editing_File *file = view->file;
return(file_compute_cursor(file, seek));
}
//////////////////////////////// ////////////////////////////////
internal Interval_f32 internal Interval_f32
@ -247,16 +253,15 @@ view_safety_margin(f32 view_width, f32 acceptable_y_height, f32 line_height, f32
internal b32 internal b32
view_move_view_to_cursor(Models *models, View *view, Buffer_Scroll *scroll){ view_move_view_to_cursor(Models *models, View *view, Buffer_Scroll *scroll){
Editing_File *file = view->file; Editing_File *file = view->file;
Face_ID face_id = file->settings.font_id; Face *face = file_get_face(models, file);
Rect_f32 rect = view_get_buffer_rect(models, view); Rect_f32 rect = view_get_buffer_rect(models, view);
Vec2_f32 view_dim = rect_dim(rect); Vec2_f32 view_dim = rect_dim(rect);
File_Edit_Positions edit_pos = view_get_edit_pos(view); File_Edit_Positions edit_pos = view_get_edit_pos(view);
Vec2_f32 p = file_relative_xy_of_pos(models, file, view_dim.x, face_id, scroll->target.line_number, Vec2_f32 p = file_relative_xy_of_pos(models, file, view_dim.x, face, scroll->target.line_number,
edit_pos.cursor_pos); edit_pos.cursor_pos);
p -= scroll->target.pixel_shift; p -= scroll->target.pixel_shift;
Face *face = font_set_face_from_id(&models->font_set, face_id);
f32 line_height = face->height; f32 line_height = face->height;
f32 typical_advance = face->typical_advance; f32 typical_advance = face->typical_advance;
Interval_f32 acceptable_y = view_acceptable_y(view_dim.y, line_height); Interval_f32 acceptable_y = view_acceptable_y(view_dim.y, line_height);
@ -286,14 +291,13 @@ view_move_view_to_cursor(Models *models, View *view, Buffer_Scroll *scroll){
internal b32 internal b32
view_move_cursor_to_view(Models *models, View *view, Buffer_Scroll scroll, i64 *pos_in_out, f32 preferred_x){ view_move_cursor_to_view(Models *models, View *view, Buffer_Scroll scroll, i64 *pos_in_out, f32 preferred_x){
Editing_File *file = view->file; Editing_File *file = view->file;
Face_ID face_id = file->settings.font_id; Face *face = file_get_face(models, file);
Rect_f32 rect = view_get_buffer_rect(models, view); Rect_f32 rect = view_get_buffer_rect(models, view);
Vec2_f32 view_dim = rect_dim(rect); Vec2_f32 view_dim = rect_dim(rect);
Vec2_f32 p = file_relative_xy_of_pos(models, file, view_dim.x, face_id, scroll.target.line_number, *pos_in_out); Vec2_f32 p = file_relative_xy_of_pos(models, file, view_dim.x, face, scroll.target.line_number, *pos_in_out);
p -= scroll.target.pixel_shift; p -= scroll.target.pixel_shift;
Face *face = font_set_face_from_id(&models->font_set, face_id);
f32 line_height = face->height; f32 line_height = face->height;
Interval_f32 acceptable_y = view_acceptable_y(view_dim.y, line_height); Interval_f32 acceptable_y = view_acceptable_y(view_dim.y, line_height);
Vec2_f32 safety = view_safety_margin(view_dim.x, range_size(acceptable_y), Vec2_f32 safety = view_safety_margin(view_dim.x, range_size(acceptable_y),
@ -313,28 +317,17 @@ view_move_cursor_to_view(Models *models, View *view, Buffer_Scroll scroll, i64 *
b32 result = false; b32 result = false;
if (adjusted_y){ if (adjusted_y){
p += scroll.target.pixel_shift; p += scroll.target.pixel_shift;
*pos_in_out = file_pos_at_relative_xy(models, file, view_dim.x, face_id, scroll.target.line_number, p); *pos_in_out = file_pos_at_relative_xy(models, file, view_dim.x, face, scroll.target.line_number, p);
result = true; result = true;
} }
return(result); return(result);
} }
internal void
view_set_preferred_x_to_current_position(Models *models, View *view){
view->preferred_x = 0.f;
#if 0
File_Edit_Positions edit_pos = view_get_edit_pos(view);
Full_Cursor cursor = file_compute_cursor(models, view->file, seek_pos(edit_pos.cursor_pos));
view_set_preferred_x(view, cursor);
#endif
}
internal void internal void
view_set_cursor(Models *models, View *view, i64 pos){ view_set_cursor(Models *models, View *view, i64 pos){
File_Edit_Positions edit_pos = view_get_edit_pos(view); File_Edit_Positions edit_pos = view_get_edit_pos(view);
file_edit_positions_set_cursor(&edit_pos, pos); file_edit_positions_set_cursor(&edit_pos, pos);
view->preferred_x = 0.f;
view_set_edit_pos(view, edit_pos); view_set_edit_pos(view, edit_pos);
Buffer_Scroll scroll = edit_pos.scroll; Buffer_Scroll scroll = edit_pos.scroll;
if (view_move_view_to_cursor(models, view, &scroll)){ if (view_move_view_to_cursor(models, view, &scroll)){
@ -390,10 +383,9 @@ view_set_file(System_Functions *system, Models *models, View *view, Editing_File
File_Edit_Positions edit_pos = file_edit_positions_pop(file); File_Edit_Positions edit_pos = file_edit_positions_pop(file);
view_set_edit_pos(view, edit_pos); view_set_edit_pos(view, edit_pos);
view->mark = edit_pos.cursor_pos; view->mark = edit_pos.cursor_pos;
view_set_preferred_x_to_current_position(models, view); Buffer_Cursor cursor = view_compute_cursor(view, seek_pos(edit_pos.cursor_pos));
Vec2_f32 p = view_relative_xy_of_pos(models, view, cursor.line, edit_pos.cursor_pos);
Face *face = font_set_face_from_id(&models->font_set, file->settings.font_id); view->preferred_x = p.x;
Assert(face != 0);
models->layout.panel_state_dirty = true; models->layout.panel_state_dirty = true;
} }
@ -430,38 +422,32 @@ adjust_views_looking_at_file_to_new_cursor(System_Functions *system, Models *mod
} }
internal void internal void
file_set_font(System_Functions *system, Models *models, Editing_File *file, Face_ID font_id){ global_set_font_and_update_files(System_Functions *system, Models *models, Face *new_global_face){
file->settings.font_id = font_id;
}
internal void
global_set_font_and_update_files(System_Functions *system, Models *models, Face_ID font_id){
for (Node *node = models->working_set.active_file_sentinel.next; for (Node *node = models->working_set.active_file_sentinel.next;
node != &models->working_set.active_file_sentinel; node != &models->working_set.active_file_sentinel;
node = node->next){ node = node->next){
Editing_File *file = CastFromMember(Editing_File, main_chain_node, node); Editing_File *file = CastFromMember(Editing_File, main_chain_node, node);
file_set_font(system, models, file, font_id); file->settings.face_id = new_global_face->id;
} }
models->global_font_id = font_id; models->global_face_id = new_global_face->id;
} }
internal b32 internal b32
release_font_and_update_files(System_Functions *system, Models *models, Face_ID font_id, Face_ID replacement_id){ release_font_and_update(System_Functions *system, Models *models, Face *face, Face *replacement_face){
b32 success = false; b32 success = false;
if (font_set_release_face(&models->font_set, font_id)){ Assert(replacement_face != 0 && replacement_face != face);
Face *face = font_set_face_from_id(&models->font_set, replacement_id); if (font_set_release_face(&models->font_set, face->id)){
if (face == 0){
replacement_id = font_set_get_fallback_face(&models->font_set);
Assert(font_set_face_from_id(&models->font_set, replacement_id) != 0);
}
for (Node *node = models->working_set.active_file_sentinel.next; for (Node *node = models->working_set.active_file_sentinel.next;
node != &models->working_set.active_file_sentinel; node != &models->working_set.active_file_sentinel;
node = node->next){ node = node->next){
Editing_File *file = CastFromMember(Editing_File, main_chain_node, node); Editing_File *file = CastFromMember(Editing_File, main_chain_node, node);
if (file->settings.font_id == font_id){ if (file->settings.face_id == face->id){
file_set_font(system, models, file, replacement_id); file->settings.face_id = replacement_face->id;
} }
} }
if (models->global_face_id == face->id){
models->global_face_id = replacement_face->id;
}
success = true; success = true;
} }
return(success); return(success);

View File

@ -13,8 +13,8 @@
#define FRED_VIEW_H #define FRED_VIEW_H
struct View{ struct View{
struct View *next; View *next;
struct View *prev; View *prev;
struct Panel *panel; struct Panel *panel;
b32 in_use; b32 in_use;
@ -25,10 +25,6 @@ struct View{
i64 mark; i64 mark;
f32 preferred_x; f32 preferred_x;
// TODO(allen): ELIMINATE THESE
i32 temp_view_top_left_pos;
i32 temp_view_top_left_target_pos;
b8 new_scroll_target; b8 new_scroll_target;
b8 ui_mode; b8 ui_mode;
@ -52,78 +48,6 @@ struct Live_Views{
i32 max; i32 max;
}; };
enum{
GROW_FAILED,
GROW_NOT_NEEDED,
GROW_SUCCESS,
};
struct Wrap_Indent_Pair{
i32 wrap_position;
f32 line_shift;
};
struct Potential_Wrap_Indent_Pair{
i32 wrap_position;
f32 line_shift;
f32 wrap_x;
i32 wrappable_score;
b32 adjust_top_to_this;
};
struct Shift_Information{
i32 start;
i32 end;
i32 amount;
};
struct File_Bar{
Vec2 pos;
Vec2 text_shift;
i32_Rect rect;
Face_ID font_id;
};
#if 0
struct Style_Color_Edit{
Style_Tag target;
Style_Tag fore;
Style_Tag back;
String_Const_u8 text;
};
#endif
struct Single_Line_Input_Step{
b8 hit_newline;
b8 hit_ctrl_newline;
b8 hit_a_character;
b8 hit_backspace;
b8 hit_esc;
b8 made_a_change;
b8 did_command;
b8 no_file_match;
};
enum Single_Line_Input_Type{
SINGLE_LINE_STRING,
SINGLE_LINE_FILE
};
struct Single_Line_Mode{
Single_Line_Input_Type type;
String_Const_u8 *string;
Hot_Directory *hot_directory;
b32 fast_folder_select;
};
struct View_Step_Result{
b32 animating;
b32 consume_keys;
b32 consume_esc;
};
#endif #endif
// BOTTOM // BOTTOM