Switching the API over to i64 and Range_i64 for positions inside buffers
parent
bd6b84ce81
commit
7072c92dc2
|
@ -37,7 +37,7 @@ TYPEDEF i32 Panel_ID;
|
|||
TYPEDEF u32 Text_Layout_ID;
|
||||
|
||||
STRUCT Buffer_Point{
|
||||
i32 line_number;
|
||||
i64 line_number;
|
||||
Vec2 pixel_shift;
|
||||
};
|
||||
|
||||
|
@ -425,14 +425,6 @@ STRUCT Mouse_State{
|
|||
};
|
||||
};
|
||||
|
||||
/* DOC(An array of ranges. This is just a plain pointer bundled with a count, no additional special structure.) */
|
||||
STRUCT Range_Array{
|
||||
/* DOC(A pointer to the array of ranges.) */
|
||||
Range *ranges;
|
||||
/* DOC(The number of ranges in the array.) */
|
||||
i32 count;
|
||||
};
|
||||
|
||||
/* DOC(Parser_String_And_Type contains a string and type integer used to specify information about keywords to the parser.) */
|
||||
STRUCT Parser_String_And_Type{
|
||||
/* DOC(The string specified by the pair, it need not be null terminated.) */
|
||||
|
@ -549,21 +541,21 @@ STRUCT Buffer_Seek{
|
|||
UNION{
|
||||
STRUCT {
|
||||
/* DOC(The pos field specified the pos when the seek is in absolute position.) */
|
||||
i32 pos;
|
||||
i64 pos;
|
||||
};
|
||||
STRUCT {
|
||||
/* DOC(For xy coordinate seeks, rounding down means that any x in the box of the character lands on that character. For instance when clicking rounding down is the user's expected behavior. Not rounding down means that the right hand portion of the character's box, which is closer to the next character, will land on that next character. The unrounded behavior is the expected behavior when moving vertically and keeping the preferred x.) */
|
||||
b32 round_down;
|
||||
/* DOC(The x coordinate for xy type seeks.) */
|
||||
float x;
|
||||
f32 x;
|
||||
/* DOC(The y coordinate for xy type seeks.) */
|
||||
float y;
|
||||
f32 y;
|
||||
};
|
||||
STRUCT {
|
||||
/* DOC(The line number of a line-character type seek.) */
|
||||
i32 line;
|
||||
i64 line;
|
||||
/* DOC(The character number of a line-character type seek.) */
|
||||
i32 character;
|
||||
i64 character;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -572,15 +564,15 @@ STRUCT Buffer_Seek{
|
|||
DOC_SEE(4coder_Buffer_Positioning_System) */
|
||||
STRUCT Full_Cursor{
|
||||
/* DOC(This field contains the cursor's position in absolute byte index positioning.) */
|
||||
i32 pos;
|
||||
i64 pos;
|
||||
/* DOC(This field contains the cursor's position in apparent character index positioning.) */
|
||||
i32 character_pos;
|
||||
i64 character_pos;
|
||||
/* DOC(This field contains the number of the line where the cursor is located. This field is one based.) */
|
||||
i32 line;
|
||||
i64 line;
|
||||
/* DOC(This field contains the number of the character from the beginninf of the line where the cursor is located. This field is one based.) */
|
||||
i32 character;
|
||||
i64 character;
|
||||
/* DOC(This field contains the number of the line where the cursor is located, taking the line wrapping into account. This field is one based.) */
|
||||
i32 wrap_line;
|
||||
i64 wrap_line;
|
||||
union{
|
||||
struct{
|
||||
/* DOC(This field contains the x position measured with unwrapped lines.) */
|
||||
|
|
|
@ -78,7 +78,7 @@ get_view_summary(Application_Links *app, View_ID view_id, Access_Flag access, Vi
|
|||
view->unwrapped_lines = !view->unwrapped_lines;
|
||||
view_get_setting(app, view_id, ViewSetting_ShowWhitespace, &view->show_whitespace);
|
||||
view->buffer_id = buffer;
|
||||
i32 pos = view_get_mark_pos(app, view_id);
|
||||
i64 pos = view_get_mark_pos(app, view_id);
|
||||
view->mark = view_compute_cursor(app, view_id, seek_pos(pos));
|
||||
pos = view_get_cursor_pos(app, view_id);
|
||||
view->cursor = view_compute_cursor(app, view_id, seek_pos(pos));
|
||||
|
@ -159,7 +159,7 @@ static b32
|
|||
buffer_read_range(Application_Links *app, Buffer_Summary *buffer, i32 start, i32 one_past_last, char *out){
|
||||
b32 result = false;
|
||||
if (buffer != 0 && buffer->exists){
|
||||
result = buffer_read_range(app, buffer->buffer_id, start, one_past_last, out);
|
||||
result = buffer_read_range(app, buffer->buffer_id, Ii64(start, one_past_last), out);
|
||||
get_buffer_summary(app, buffer->buffer_id, AccessAll, buffer);
|
||||
}
|
||||
return(result);
|
||||
|
@ -169,7 +169,7 @@ static b32
|
|||
buffer_replace_range(Application_Links *app, Buffer_Summary *buffer, i32 start, i32 one_past_last, char *str, i32 len){
|
||||
b32 result = false;
|
||||
if (buffer != 0 && buffer->exists){
|
||||
result = buffer_replace_range(app, buffer->buffer_id, make_range(start, one_past_last), SCu8(str, len));
|
||||
result = buffer_replace_range(app, buffer->buffer_id, Ii64(start, one_past_last), SCu8(str, len));
|
||||
get_buffer_summary(app, buffer->buffer_id, AccessAll, buffer);
|
||||
}
|
||||
return(result);
|
||||
|
@ -485,7 +485,7 @@ static b32
|
|||
view_post_fade(Application_Links *app, View_Summary *view, float seconds, i32 start, i32 end, int_color color){
|
||||
b32 result = false;
|
||||
if (view != 0 && view->exists){
|
||||
result = view_post_fade(app, view->view_id, seconds, start, end, color);
|
||||
result = view_post_fade(app, view->view_id, seconds, Ii64(start, end), color);
|
||||
get_view_summary(app, view->view_id, AccessAll, view);
|
||||
}
|
||||
return(result);
|
||||
|
|
|
@ -96,12 +96,12 @@ buffer_get_char(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|||
|
||||
static i32
|
||||
buffer_get_line_start(Application_Links *app, Buffer_Summary *buffer, i32 line){
|
||||
return(buffer==0?0:get_line_start_pos(app, buffer->buffer_id, line));
|
||||
return(buffer==0?0:(i32)get_line_start_pos(app, buffer->buffer_id, line));
|
||||
}
|
||||
|
||||
static i32
|
||||
buffer_get_line_end(Application_Links *app, Buffer_Summary *buffer, i32 line){
|
||||
return(buffer==0?0:get_line_end_pos(app, buffer->buffer_id, line));
|
||||
return(buffer==0?0:(i32)get_line_end_pos(app, buffer->buffer_id, line));
|
||||
}
|
||||
|
||||
static Cpp_Token*
|
||||
|
@ -252,12 +252,12 @@ get_token_or_word_under_pos(Application_Links *app, Buffer_Summary *buffer, i32
|
|||
|
||||
static i32
|
||||
seek_line_end(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
||||
return(buffer==0?0:get_line_end_pos_from_pos(app, buffer->buffer_id, pos));
|
||||
return(buffer==0?0:(i32)get_line_end_pos_from_pos(app, buffer->buffer_id, pos));
|
||||
}
|
||||
|
||||
static i32
|
||||
seek_line_beginning(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
||||
return(buffer==0?0:get_line_start_pos_from_pos(app, buffer->buffer_id, pos));
|
||||
return(buffer==0?0:(i32)get_line_start_pos_from_pos(app, buffer->buffer_id, pos));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -267,61 +267,61 @@ move_past_lead_whitespace(Application_Links *app, View_Summary *view, Buffer_Sum
|
|||
|
||||
static i32
|
||||
buffer_seek_whitespace_up(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
||||
return(buffer==0?0:get_pos_of_blank_line(app, buffer->buffer_id, Scan_Backward, pos));
|
||||
return(buffer==0?0:(i32)get_pos_of_blank_line(app, buffer->buffer_id, Scan_Backward, pos));
|
||||
}
|
||||
|
||||
static i32
|
||||
buffer_seek_whitespace_down(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
||||
return(buffer==0?0:get_pos_of_blank_line(app, buffer->buffer_id, Scan_Forward, pos));
|
||||
return(buffer==0?0:(i32)get_pos_of_blank_line(app, buffer->buffer_id, Scan_Forward, pos));
|
||||
}
|
||||
|
||||
static i32
|
||||
buffer_seek_whitespace_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
||||
return(buffer==0?0:scan(app, boundary_non_whitespace, buffer->buffer_id, Scan_Forward, pos));
|
||||
return(buffer==0?0:(i32)scan(app, boundary_non_whitespace, buffer->buffer_id, Scan_Forward, pos));
|
||||
}
|
||||
|
||||
static i32
|
||||
buffer_seek_whitespace_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
||||
return(buffer==0?0:scan(app, boundary_non_whitespace, buffer->buffer_id, Scan_Backward, pos));
|
||||
return(buffer==0?0:(i32)scan(app, boundary_non_whitespace, buffer->buffer_id, Scan_Backward, pos));
|
||||
}
|
||||
|
||||
static i32
|
||||
buffer_seek_alphanumeric_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
||||
return(buffer==0?0:scan(app, boundary_alpha_numeric, buffer->buffer_id, Scan_Forward, pos));
|
||||
return(buffer==0?0:(i32)scan(app, boundary_alpha_numeric, buffer->buffer_id, Scan_Forward, pos));
|
||||
}
|
||||
|
||||
static i32
|
||||
buffer_seek_alphanumeric_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
||||
return(buffer==0?0:scan(app, boundary_alpha_numeric, buffer->buffer_id, Scan_Backward, pos));
|
||||
return(buffer==0?0:(i32)scan(app, boundary_alpha_numeric, buffer->buffer_id, Scan_Backward, pos));
|
||||
}
|
||||
|
||||
static i32
|
||||
buffer_seek_alphanumeric_or_underscore_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
||||
return(buffer==0?0:scan(app, boundary_alpha_numeric_underscore, buffer->buffer_id,
|
||||
return(buffer==0?0:(i32)scan(app, boundary_alpha_numeric_underscore, buffer->buffer_id,
|
||||
Scan_Forward, pos));
|
||||
}
|
||||
|
||||
static i32
|
||||
buffer_seek_alphanumeric_or_underscore_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
||||
return(buffer==0?0:scan(app, boundary_alpha_numeric_underscore, buffer->buffer_id,
|
||||
return(buffer==0?0:(i32)scan(app, boundary_alpha_numeric_underscore, buffer->buffer_id,
|
||||
Scan_Backward, pos));
|
||||
}
|
||||
|
||||
static i32
|
||||
buffer_seek_alphanumeric_or_camel_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
||||
return(buffer==0?0:scan(app, boundary_alpha_numeric_camel, buffer->buffer_id,
|
||||
return(buffer==0?0:(i32)scan(app, boundary_alpha_numeric_camel, buffer->buffer_id,
|
||||
Scan_Forward, pos));
|
||||
}
|
||||
|
||||
static i32
|
||||
buffer_seek_alphanumeric_or_camel_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
||||
return(buffer==0?0:scan(app, boundary_alpha_numeric_camel, buffer->buffer_id,
|
||||
return(buffer==0?0:(i32)scan(app, boundary_alpha_numeric_camel, buffer->buffer_id,
|
||||
Scan_Backward, pos));
|
||||
}
|
||||
|
||||
static i32
|
||||
buffer_seek_alpha_numeric_end(Application_Links *app, Buffer_Summary *buffer, int32_t pos){
|
||||
return(buffer!=0?0:scan(app, boundary_alpha_numeric_unicode,
|
||||
return(buffer!=0?0:(i32)scan(app, boundary_alpha_numeric_unicode,
|
||||
buffer->buffer_id,
|
||||
Scan_Forward, pos));
|
||||
}
|
||||
|
@ -352,6 +352,20 @@ buffer_get_all_tokens(Application_Links *app, Arena *arena, Buffer_Summary *buff
|
|||
return(result);
|
||||
}
|
||||
|
||||
void
|
||||
buffer_seek_delimiter_forward(Application_Links *app, Buffer_ID buffer, i32 pos, char delim, i32 *result){
|
||||
Character_Predicate predicate = character_predicate_from_character((u8)delim);
|
||||
String_Match m = buffer_seek_character_class(app, buffer, &predicate, Scan_Forward, pos);
|
||||
*result = (i32)m.range.min;
|
||||
}
|
||||
|
||||
void
|
||||
buffer_seek_delimiter_backward(Application_Links *app, Buffer_ID buffer, i32 pos, char delim, i32 *result){
|
||||
Character_Predicate predicate = character_predicate_from_character((u8)delim);
|
||||
String_Match m = buffer_seek_character_class(app, buffer, &predicate, Scan_Backward, pos);
|
||||
*result = (i32)m.range.min;
|
||||
}
|
||||
|
||||
static void
|
||||
buffer_seek_delimiter_forward(Application_Links *app, Buffer_Summary *buffer, i32 pos, char delim, i32 *result){
|
||||
if (buffer != 0){
|
||||
|
@ -369,35 +383,45 @@ buffer_seek_delimiter_backward(Application_Links *app, Buffer_Summary *buffer, i
|
|||
static void
|
||||
buffer_seek_string_forward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, char *str, i32 size, i32 *result){
|
||||
if (buffer != 0){
|
||||
buffer_seek_string_forward(app, buffer->buffer_id, pos, end, SCu8(str, size), result);
|
||||
i64 result_i64 = 0;
|
||||
buffer_seek_string_forward(app, buffer->buffer_id, pos, end, SCu8(str, size), &result_i64);
|
||||
*result = (i32)result_i64;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
buffer_seek_string_backward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, char *str, i32 size, i32 *result){
|
||||
if (buffer != 0){
|
||||
buffer_seek_string_backward(app, buffer->buffer_id, pos, end, SCu8(str, size), result);
|
||||
i64 result_i64 = 0;
|
||||
buffer_seek_string_backward(app, buffer->buffer_id, pos, end, SCu8(str, size), &result_i64);
|
||||
*result = (i32)result_i64;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
buffer_seek_string_insensitive_forward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, char *str, i32 size, i32 *result){
|
||||
if (buffer != 0){
|
||||
buffer_seek_string_insensitive_forward(app, buffer->buffer_id, pos, end, SCu8(str, size), result);
|
||||
i64 result_i64 = 0;
|
||||
buffer_seek_string_insensitive_forward(app, buffer->buffer_id, pos, end, SCu8(str, size), &result_i64);
|
||||
*result = (i32)result_i64;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
buffer_seek_string_insensitive_backward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, char *str, i32 size, i32 *result){
|
||||
if (buffer != 0){
|
||||
buffer_seek_string_insensitive_backward(app, buffer->buffer_id, pos, end, SCu8(str, size), result);
|
||||
i64 result_i64 = 0;
|
||||
buffer_seek_string_insensitive_backward(app, buffer->buffer_id, pos, end, SCu8(str, size), &result_i64);
|
||||
*result = (i32)result_i64;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
buffer_seek_string(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, i32 min, char *str, i32 size, i32 *result, Buffer_Seek_String_Flags flags){
|
||||
if (buffer != 0){
|
||||
buffer_seek_string(app, buffer->buffer_id, pos, end, min, SCu8(str, size), result, flags);
|
||||
i64 result_i64 = 0;
|
||||
buffer_seek_string(app, buffer->buffer_id, pos, end, min, SCu8(str, size), &result_i64, flags);
|
||||
*result = (i32)result_i64;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -411,10 +435,10 @@ read_identifier_at_pos(Application_Links *app, Buffer_Summary *buffer, i32 pos,
|
|||
String result = {};
|
||||
if (buffer != 0){
|
||||
Scratch_Block scratch(app);
|
||||
Range range = enclose_alpha_numeric_underscore(app, buffer->buffer_id, make_range(pos));
|
||||
Range_i64 range = enclose_pos_alpha_numeric_underscore(app, buffer->buffer_id, pos);
|
||||
String_Const_u8 string = push_buffer_range(app, scratch, buffer->buffer_id, range);
|
||||
if (range_out != 0){
|
||||
*range_out = range;
|
||||
*range_out = Ii32((i32)range.min, (i32)range.max);;
|
||||
}
|
||||
i32 size = (i32)string.size;
|
||||
size = clamp_top(size, max);
|
||||
|
@ -447,8 +471,7 @@ buffer_boundary_seek(Application_Links *app, Buffer_Summary *buffer, i32 start_p
|
|||
i32 result = 0;
|
||||
if (buffer != 0){
|
||||
Scratch_Block scratch(app);
|
||||
result = scan(app, boundary_list_from_old_flags(scratch, flags),
|
||||
buffer->buffer_id, dir, start_pos);
|
||||
result = (i32)scan(app, boundary_list_from_old_flags(scratch, flags), buffer->buffer_id, dir, start_pos);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
@ -471,40 +494,50 @@ make_statement_parser(Application_Links *app, Buffer_Summary *buffer, i32 token_
|
|||
|
||||
static b32
|
||||
find_whole_statement_down(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 *start_out, i32 *end_out){
|
||||
return(buffer==0?false:find_whole_statement_down(app, buffer->buffer_id, pos, start_out, end_out));
|
||||
Range_i64 r = {};
|
||||
b32 result = (buffer==0?false:find_whole_statement_down(app, buffer->buffer_id, pos, &r.min, &r.max));
|
||||
*start_out = (i32)r.min;
|
||||
*end_out = (i32)r.max;
|
||||
return(result);
|
||||
}
|
||||
|
||||
static b32
|
||||
find_scope_top(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, u32 flags, i32 *end_pos_out){
|
||||
return(buffer==0?false:find_scope_top(app, buffer->buffer_id, start_pos, flags, end_pos_out));
|
||||
i64 r = 0;
|
||||
b32 result = (buffer==0?false:find_scope_top(app, buffer->buffer_id, start_pos, flags, &r));
|
||||
*end_pos_out = (i32)r;
|
||||
return(result);
|
||||
}
|
||||
|
||||
static b32
|
||||
find_scope_bottom(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, u32 flags, i32 *end_pos_out){
|
||||
return(buffer==0?false:find_scope_bottom(app, buffer->buffer_id, start_pos, flags, end_pos_out));
|
||||
i64 r = 0;
|
||||
b32 result = (buffer==0?false:find_scope_bottom(app, buffer->buffer_id, start_pos, flags, &r));
|
||||
*end_pos_out = (i32)r;
|
||||
return(result);
|
||||
}
|
||||
|
||||
static b32
|
||||
find_scope_range(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, Range *range_out, u32 flags){
|
||||
return(buffer==0?false:find_scope_range(app, buffer->buffer_id, start_pos, range_out, flags));
|
||||
Range_i64 r = {};
|
||||
b32 result = (buffer==0?false:find_scope_range(app, buffer->buffer_id, start_pos, &r, flags));
|
||||
*range_out = Ii32((i32)r.min, (i32)r.max);
|
||||
return(result);
|
||||
}
|
||||
|
||||
static b32
|
||||
find_next_scope(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, u32 flags, i32 *end_pos_out){
|
||||
return(buffer==0?false:find_next_scope(app, buffer->buffer_id, start_pos, flags, end_pos_out));
|
||||
i64 r = 0;
|
||||
b32 result = (buffer==0?false:find_next_scope(app, buffer->buffer_id, start_pos, flags, &r));
|
||||
*end_pos_out = (i32)r;
|
||||
return(result);
|
||||
}
|
||||
|
||||
static b32
|
||||
find_prev_scope(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, u32 flags, i32 *end_pos_out){
|
||||
return(buffer==0?false:find_prev_scope(app, buffer->buffer_id, start_pos, flags, end_pos_out));
|
||||
}
|
||||
|
||||
static Range_Array
|
||||
get_enclosure_ranges(Application_Links *app, Arena *arena, Buffer_Summary *buffer, i32 pos, u32 flags){
|
||||
Range_Array result = {};
|
||||
if (buffer != 0){
|
||||
result = get_enclosure_ranges(app, arena, buffer->buffer_id, pos, flags);
|
||||
}
|
||||
i64 r = 0;
|
||||
b32 result = (buffer==0?false:find_prev_scope(app, buffer->buffer_id, start_pos, flags, &r));
|
||||
*end_pos_out = (i32)r;
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
@ -527,7 +560,7 @@ buffer_find_hard_start(Application_Links *app, Buffer_Summary *buffer, i32 line_
|
|||
Hard_Start_Result result = {};
|
||||
if (buffer != 0){
|
||||
Indent_Info info = get_indent_info_line_start(app, buffer->buffer_id, line_start, tab_width);
|
||||
result.char_pos = info.first_char_pos;
|
||||
result.char_pos = (i32)info.first_char_pos;
|
||||
result.indent_pos = info.indent_pos;
|
||||
result.all_whitespace = info.is_blank;
|
||||
result.all_space = info.all_space;
|
||||
|
@ -535,22 +568,6 @@ buffer_find_hard_start(Application_Links *app, Buffer_Summary *buffer, i32 line_
|
|||
return(result);
|
||||
}
|
||||
|
||||
static Buffer_Batch_Edit
|
||||
make_batch_from_indent_marks(Application_Links *app, Arena *arena, Buffer_Summary *buffer, i32 first_line, i32 one_past_last_line, i32 *indent_marks, Indent_Options opts){
|
||||
Buffer_Batch_Edit result = {};
|
||||
if (buffer != 0){
|
||||
make_batch_from_indent_marks(app, arena, buffer->buffer_id, first_line, one_past_last_line, indent_marks, opts);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
static void
|
||||
set_line_indents(Application_Links *app, Arena *arena, Buffer_Summary *buffer, i32 first_line, i32 one_past_last_line, i32 *indent_marks, Indent_Options opts){
|
||||
if (buffer != 0){
|
||||
set_line_indents(app, arena, buffer->buffer_id, first_line, one_past_last_line, indent_marks, opts);
|
||||
}
|
||||
}
|
||||
|
||||
static Indent_Anchor_Position
|
||||
find_anchor_token(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Array tokens, i32 line_start, i32 tab_width){
|
||||
Indent_Anchor_Position result = {};
|
||||
|
@ -560,35 +577,34 @@ find_anchor_token(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Arra
|
|||
return(result);
|
||||
}
|
||||
|
||||
static i32*
|
||||
get_indentation_marks(Application_Links *app, Arena *arena, Buffer_Summary *buffer,
|
||||
Cpp_Token_Array tokens, i32 first_line, i32 one_past_last_line,
|
||||
b32 exact_align, i32 tab_width){
|
||||
return(buffer==0?0:get_indentation_marks(app, arena, buffer->buffer_id, tokens, first_line, one_past_last_line, exact_align, tab_width));
|
||||
}
|
||||
|
||||
static i32
|
||||
buffer_get_line_number(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
||||
return(buffer==0?0:get_line_number_from_pos(app, buffer->buffer_id, pos));
|
||||
return(buffer==0?0:(i32)get_line_number_from_pos(app, buffer->buffer_id, pos));
|
||||
}
|
||||
|
||||
static void
|
||||
get_indent_lines_minimum(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, i32 end_pos, i32 *line_start_out, i32 *line_end_out){
|
||||
if (buffer != 0){
|
||||
get_indent_lines_minimum(app, buffer->buffer_id, start_pos, end_pos, line_start_out, line_end_out);
|
||||
Range_i64 r = {};
|
||||
get_indent_lines_minimum(app, buffer->buffer_id, start_pos, end_pos, &r.min, &r.max);
|
||||
*line_start_out = (i32)r.min;
|
||||
*line_end_out = (i32)r.max;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
get_indent_lines_whole_tokens(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Array tokens, i32 start_pos, i32 end_pos, i32 *line_start_out, i32 *line_end_out){
|
||||
if (buffer != 0){
|
||||
get_indent_lines_whole_tokens(app, buffer->buffer_id, tokens, start_pos, end_pos, line_start_out, line_end_out);
|
||||
Range_i64 r = {};
|
||||
get_indent_lines_whole_tokens(app, buffer->buffer_id, tokens, start_pos, end_pos, &r.min, &r.max);
|
||||
*line_start_out = (i32)r.min;
|
||||
*line_end_out = (i32)r.max;
|
||||
}
|
||||
}
|
||||
|
||||
static b32
|
||||
buffer_auto_indent(Application_Links *app, Arena *arena, Buffer_Summary *buffer, i32 start, i32 end, i32 tab_width, Auto_Indent_Flag flags){
|
||||
return(buffer==0?0:buffer_auto_indent(app, arena, buffer->buffer_id, start, end, tab_width, flags));
|
||||
return(buffer==0?0:buffer_auto_indent(app, buffer->buffer_id, start, end, tab_width, flags));
|
||||
}
|
||||
|
||||
static b32
|
||||
|
@ -614,7 +630,7 @@ list_all_functions(Application_Links *app, Buffer_Summary *optional_target_buffe
|
|||
|
||||
static i32
|
||||
get_start_of_line_at_cursor(Application_Links *app, View_Summary *view, Buffer_Summary *buffer){
|
||||
return(get_start_of_line_at_cursor(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id));
|
||||
return((i32)get_start_of_line_at_cursor(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id));
|
||||
}
|
||||
|
||||
static b32
|
||||
|
@ -757,7 +773,7 @@ execute_standard_build(Application_Links *app, View_Summary *view, Buffer_ID act
|
|||
|
||||
static b32
|
||||
post_buffer_range_to_clipboard(Application_Links *app, i32 clipboard_index, Buffer_Summary *buffer, i32 first, i32 one_past_last){
|
||||
return(post_buffer_range_to_clipboard(app, clipboard_index, buffer==0?0:buffer->buffer_id, first, one_past_last));
|
||||
return(clipboard_post_buffer_range(app, clipboard_index, buffer==0?0:buffer->buffer_id, Ii64(first, one_past_last)));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -772,7 +788,10 @@ advance_cursor_in_jump_view(Application_Links *app, View_Summary *view, i32 skip
|
|||
|
||||
static Parsed_Jump
|
||||
seek_next_jump_in_view(Application_Links *app, Arena *arena, View_Summary *view, i32 skip_sub_errors, i32 direction, i32 *line_out){
|
||||
return(seek_next_jump_in_view(app, arena, view==0?0:view->view_id, skip_sub_errors, direction, line_out));
|
||||
i64 r = 0;
|
||||
Parsed_Jump result = (seek_next_jump_in_view(app, arena, view==0?0:view->view_id, skip_sub_errors, direction, &r));
|
||||
*line_out = (i32)r;
|
||||
return(result);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -797,7 +816,7 @@ view_set_to_region(Application_Links *app, View_Summary *view, i32 major_pos, i3
|
|||
|
||||
static i32
|
||||
character_pos_to_pos(Application_Links *app, View_Summary *view, i32 character_pos){
|
||||
return(character_pos_to_pos_view(app, view==0?0:view->view_id, character_pos));
|
||||
return((i32)character_pos_to_pos_view(app, view==0?0:view->view_id, character_pos));
|
||||
}
|
||||
|
||||
static b32
|
||||
|
@ -812,7 +831,7 @@ get_page_jump(Application_Links *app, View_Summary *view){
|
|||
|
||||
static void
|
||||
isearch__update_highlight(Application_Links *app, View_Summary *view, Managed_Object highlight, i32 start, i32 end){
|
||||
isearch__update_highlight(app, view==0?0:view->view_id, highlight, start, end);
|
||||
isearch__update_highlight(app, view==0?0:view->view_id, highlight, Ii64(start, end));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -840,7 +859,7 @@ refresh_view(Application_Links *app, View_Summary *view){
|
|||
|
||||
static String
|
||||
get_string_in_view_range(Application_Links *app, Arena *arena, View_Summary *view){
|
||||
return(string_old_from_new(push_string_in_view_range(app, arena, view==0?0:view->view_id)));
|
||||
return(string_old_from_new(push_view_range_string(app, arena, view==0?0:view->view_id)));
|
||||
}
|
||||
|
||||
static b32
|
||||
|
@ -1064,17 +1083,17 @@ open_all_files_in_directory_pattern_match(Application_Links *app,
|
|||
|
||||
static String_Const_u8
|
||||
scratch_read(Application_Links *app, Arena *arena, Buffer_ID buffer, umem start, umem end){
|
||||
return(push_buffer_range(app, arena, buffer, start, end));
|
||||
return(push_buffer_range(app, arena, buffer, Ii64(start, end)));
|
||||
}
|
||||
|
||||
static String_Const_u8
|
||||
scratch_read(Application_Links *app, Arena *arena, Buffer_ID buffer, Range range){
|
||||
return(push_buffer_range(app, arena, buffer, range));
|
||||
return(push_buffer_range(app, arena, buffer, Ii64(range.min, range.max)));
|
||||
}
|
||||
|
||||
static String_Const_u8
|
||||
scratch_read(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_u64 range){
|
||||
return(push_buffer_range(app, arena, buffer, range));
|
||||
return(push_buffer_range(app, arena, buffer, Ii64(range.min, range.max)));
|
||||
}
|
||||
|
||||
static String_Const_u8
|
||||
|
@ -1105,7 +1124,7 @@ read_entire_buffer(Application_Links *app, Buffer_ID buffer_id, Arena *scratch){
|
|||
static String_Const_u8
|
||||
buffer_read_string(Application_Links *app, Buffer_ID buffer, Range range, void *dest){
|
||||
Scratch_Block scratch(app);
|
||||
String_Const_u8 result = push_buffer_range(app, scratch, buffer, range);
|
||||
String_Const_u8 result = push_buffer_range(app, scratch, buffer, Ii64(range.min, range.max));
|
||||
block_copy(dest, result.str, result.size);
|
||||
result.str = (u8*)dest;
|
||||
return(result);
|
||||
|
@ -1119,7 +1138,7 @@ token_match(Application_Links *app, Buffer_ID buffer, Cpp_Token token, String b)
|
|||
static i32
|
||||
view_get_line_number(Application_Links *app, View_ID view, i32 pos){
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos));
|
||||
return(cursor.line);
|
||||
return((i32)cursor.line);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -6,23 +6,23 @@
|
|||
|
||||
internal Buffer_Batch_Edit
|
||||
make_batch_from_indent_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
||||
i32 first_line, i32 one_past_last_line, i32 *indent_marks,
|
||||
i64 first_line, i64 one_past_last_line, i64 *indent_marks,
|
||||
Indent_Options opts){
|
||||
i32 *shifted_indent_marks = indent_marks - first_line;
|
||||
i64 *shifted_indent_marks = indent_marks - first_line;
|
||||
|
||||
i32 edit_count = 0;
|
||||
i32 edit_max = one_past_last_line - first_line;
|
||||
i64 edit_count = 0;
|
||||
i64 edit_max = one_past_last_line - first_line;
|
||||
Buffer_Edit *edits = push_array(arena, Buffer_Edit, edit_max);
|
||||
|
||||
List_String_Const_u8 list = {};
|
||||
|
||||
for (i32 line_number = first_line;
|
||||
for (i64 line_number = first_line;
|
||||
line_number < one_past_last_line;
|
||||
++line_number){
|
||||
i32 line_start_pos = get_line_start_pos(app, buffer, line_number);
|
||||
i64 line_start_pos = get_line_start_pos(app, buffer, line_number);
|
||||
Indent_Info hard_start = get_indent_info_line_start(app, buffer, line_start_pos, opts.tab_width);
|
||||
|
||||
i32 correct_indentation = shifted_indent_marks[line_number];
|
||||
i64 correct_indentation = shifted_indent_marks[line_number];
|
||||
if (hard_start.is_blank && opts.empty_blank_lines){
|
||||
correct_indentation = 0;
|
||||
}
|
||||
|
@ -34,9 +34,9 @@ make_batch_from_indent_marks(Application_Links *app, Arena *arena, Buffer_ID buf
|
|||
umem str_size = 0;
|
||||
char *str = 0;
|
||||
if (opts.use_tabs){
|
||||
i32 tab_count = correct_indentation/opts.tab_width;
|
||||
i32 indent = tab_count*opts.tab_width;
|
||||
i32 space_count = correct_indentation - indent;
|
||||
i64 tab_count = correct_indentation/opts.tab_width;
|
||||
i64 indent = tab_count*opts.tab_width;
|
||||
i64 space_count = correct_indentation - indent;
|
||||
str_size = tab_count + space_count;
|
||||
str = push_array(arena, char, str_size);
|
||||
block_fill_u8(str, tab_count, '\t');
|
||||
|
@ -48,13 +48,13 @@ make_batch_from_indent_marks(Application_Links *app, Arena *arena, Buffer_ID buf
|
|||
block_fill_u8(str, str_size, ' ');
|
||||
}
|
||||
|
||||
umem str_position = list.total_size;
|
||||
i64 str_position = list.total_size;
|
||||
string_list_push(arena, &list, SCu8(str, str_size));
|
||||
|
||||
edits[edit_count].str_start = (i32)str_position;
|
||||
edits[edit_count].len = (i32)str_size;
|
||||
edits[edit_count].start = line_start_pos;
|
||||
edits[edit_count].end = hard_start.first_char_pos;
|
||||
edits[edit_count].start = (i32)line_start_pos;
|
||||
edits[edit_count].end = (i32)hard_start.first_char_pos;
|
||||
edit_count += 1;
|
||||
}
|
||||
|
||||
|
@ -67,12 +67,12 @@ make_batch_from_indent_marks(Application_Links *app, Arena *arena, Buffer_ID buf
|
|||
result.str = (char*)contiguous_text.str;
|
||||
result.str_len = (i32)contiguous_text.size;
|
||||
result.edits = edits;
|
||||
result.edit_count = edit_count;
|
||||
result.edit_count = (i32)edit_count;
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal void
|
||||
set_line_indents(Application_Links *app, Arena *arena, Buffer_ID buffer, i32 first_line, i32 one_past_last_line, i32 *indent_marks, Indent_Options opts){
|
||||
set_line_indents(Application_Links *app, Arena *arena, Buffer_ID buffer, i64 first_line, i64 one_past_last_line, i64 *indent_marks, Indent_Options opts){
|
||||
Buffer_Batch_Edit batch = make_batch_from_indent_marks(app, arena, buffer, first_line, one_past_last_line, indent_marks, opts);
|
||||
if (batch.edit_count > 0){
|
||||
buffer_batch_edit(app, buffer, batch.str, batch.edits, batch.edit_count);
|
||||
|
@ -107,7 +107,7 @@ seek_matching_token_backwards(Cpp_Token_Array tokens, Cpp_Token *token,
|
|||
}
|
||||
|
||||
internal Indent_Anchor_Position
|
||||
find_anchor_token(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array tokens, i32 line_start, i32 tab_width){
|
||||
find_anchor_token(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array tokens, i64 line_start, i32 tab_width){
|
||||
Indent_Anchor_Position anchor = {};
|
||||
if (tokens.count > 0){
|
||||
Cpp_Token *first_invalid_token = get_first_token_from_line(app, buffer, tokens, line_start);
|
||||
|
@ -118,9 +118,9 @@ find_anchor_token(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array toke
|
|||
i32 stack[256];
|
||||
i32 top = -1;
|
||||
Cpp_Token *token_it = tokens.tokens;
|
||||
i32 highest_checked_line_number = -1;
|
||||
i64 highest_checked_line_number = -1;
|
||||
for (; token_it < first_invalid_token; ++token_it){
|
||||
i32 line_number = get_line_number_from_pos(app, buffer, token_it->start);
|
||||
i64 line_number = get_line_number_from_pos(app, buffer, token_it->start);
|
||||
if (highest_checked_line_number < line_number){
|
||||
highest_checked_line_number = line_number;
|
||||
if (top == -1){
|
||||
|
@ -183,12 +183,12 @@ find_anchor_token(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array toke
|
|||
return(anchor);
|
||||
}
|
||||
|
||||
internal i32*
|
||||
internal i64*
|
||||
get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
||||
Cpp_Token_Array tokens, i32 first_line, i32 one_past_last_line,
|
||||
Cpp_Token_Array tokens, i64 first_line, i64 one_past_last_line,
|
||||
b32 exact_align, i32 tab_width){
|
||||
i32 indent_mark_count = one_past_last_line - first_line;
|
||||
i32 *indent_marks = push_array(arena, i32, indent_mark_count);
|
||||
i64 indent_mark_count = one_past_last_line - first_line;
|
||||
i64 *indent_marks = push_array(arena, i64, indent_mark_count);
|
||||
// Shift the array so line_index works correctly.
|
||||
indent_marks -= first_line;
|
||||
|
||||
|
@ -199,12 +199,12 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
|||
indent.current_indent = anchor.indentation;
|
||||
|
||||
if (token_ptr == 0){
|
||||
for (i32 line_index = first_line; line_index < one_past_last_line; ++line_index){
|
||||
for (i64 line_index = first_line; line_index < one_past_last_line; ++line_index){
|
||||
indent_marks[line_index] = 0;
|
||||
}
|
||||
}
|
||||
else{
|
||||
i32 line_number = get_line_number_from_pos(app, buffer, token_ptr->start);
|
||||
i64 line_number = get_line_number_from_pos(app, buffer, token_ptr->start);
|
||||
if (line_number > first_line){
|
||||
line_number = first_line;
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
|||
indent.current_indent = 0;
|
||||
}
|
||||
|
||||
i32 next_line_start_pos = get_line_start_pos(app, buffer, line_number);
|
||||
i64 next_line_start_pos = get_line_start_pos(app, buffer, line_number);
|
||||
indent.previous_line_indent = indent.current_indent;
|
||||
Cpp_Token prev_token = {};
|
||||
Cpp_Token token = {};
|
||||
|
@ -246,11 +246,11 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
|||
for (;token.start >= next_line_start_pos && line_number < one_past_last_line;){
|
||||
next_line_start_pos = get_line_start_pos(app, buffer, line_number + 1);
|
||||
|
||||
i32 this_indent = 0;
|
||||
i32 previous_indent = indent.previous_line_indent;
|
||||
i64 this_indent = 0;
|
||||
i64 previous_indent = indent.previous_line_indent;
|
||||
|
||||
i32 this_line_start = get_line_start_pos(app, buffer, line_number);
|
||||
i32 next_line_start = next_line_start_pos;
|
||||
i64 this_line_start = get_line_start_pos(app, buffer, line_number);
|
||||
i64 next_line_start = next_line_start_pos;
|
||||
|
||||
b32 did_multi_line_behavior = false;
|
||||
|
||||
|
@ -267,7 +267,7 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
|||
this_indent = previous_indent;
|
||||
}
|
||||
else{
|
||||
i32 line_pos = hard_start.first_char_pos - this_line_start;
|
||||
i64 line_pos = hard_start.first_char_pos - this_line_start;
|
||||
this_indent = line_pos + indent.comment_shift;
|
||||
if (this_indent < 0){
|
||||
this_indent = 0;
|
||||
|
@ -365,10 +365,8 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
|||
|
||||
if (indent.paren_nesting > 0){
|
||||
if (prev_token.type != CPP_TOKEN_PARENTHESE_OPEN){
|
||||
i32 level = indent.paren_nesting - 1;
|
||||
if (level >= ArrayCount(indent.paren_anchor_indent)){
|
||||
level = ArrayCount(indent.paren_anchor_indent) - 1;
|
||||
}
|
||||
i64 level = indent.paren_nesting - 1;
|
||||
level = clamp_top(level, ArrayCount(indent.paren_anchor_indent) - 1);
|
||||
this_indent = indent.paren_anchor_indent[level];
|
||||
}
|
||||
}
|
||||
|
@ -377,10 +375,8 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
|||
// after the open paren is on the next line.
|
||||
if (indent.paren_nesting > 0){
|
||||
if (prev_token.type == CPP_TOKEN_PARENTHESE_OPEN){
|
||||
i32 level = indent.paren_nesting - 1;
|
||||
if (level >= ArrayCount(indent.paren_anchor_indent)){
|
||||
level = ArrayCount(indent.paren_anchor_indent) - 1;
|
||||
}
|
||||
i64 level = indent.paren_nesting - 1;
|
||||
level = clamp_top(level, ArrayCount(indent.paren_anchor_indent) - 1);
|
||||
indent.paren_anchor_indent[level] = this_indent;
|
||||
}
|
||||
}
|
||||
|
@ -403,14 +399,14 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
|||
case CPP_TOKEN_COMMENT:
|
||||
case CPP_TOKEN_STRING_CONSTANT:
|
||||
{
|
||||
i32 line = get_line_number_from_pos(app, buffer, token.start);
|
||||
i32 start = get_line_start_pos(app, buffer, line);
|
||||
i64 line = get_line_number_from_pos(app, buffer, token.start);
|
||||
i64 start = get_line_start_pos(app, buffer, line);
|
||||
Indent_Info hard_start = get_indent_info_line_start(app, buffer, start, tab_width);
|
||||
|
||||
i32 old_dist_to_token = (token.start - start);
|
||||
i32 old_indent = hard_start.indent_pos;
|
||||
i32 token_start_inset = old_dist_to_token - old_indent;
|
||||
i32 new_dist_to_token = indent.current_indent + token_start_inset;
|
||||
i64 old_dist_to_token = (token.start - start);
|
||||
i64 old_indent = hard_start.indent_pos;
|
||||
i64 token_start_inset = old_dist_to_token - old_indent;
|
||||
i64 new_dist_to_token = indent.current_indent + token_start_inset;
|
||||
|
||||
indent.comment_shift = (new_dist_to_token - old_dist_to_token);
|
||||
indent.previous_comment_indent = old_indent;
|
||||
|
@ -420,13 +416,13 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
|||
{
|
||||
if (!(token.flags & CPP_TFLAG_PP_BODY)){
|
||||
if (indent.paren_nesting < ArrayCount(indent.paren_anchor_indent)){
|
||||
i32 line = get_line_number_from_pos(app, buffer, token.start);
|
||||
i32 start = get_line_start_pos(app, buffer, line);
|
||||
i32 char_pos = token.start - start;
|
||||
i64 line = get_line_number_from_pos(app, buffer, token.start);
|
||||
i64 start = get_line_start_pos(app, buffer, line);
|
||||
i64 char_pos = token.start - start;
|
||||
|
||||
Indent_Info hard_start = get_indent_info_line_start(app, buffer, start, tab_width);
|
||||
|
||||
i32 line_pos = hard_start.first_char_pos - start;
|
||||
i64 line_pos = hard_start.first_char_pos - start;
|
||||
|
||||
indent.paren_anchor_indent[indent.paren_nesting] = char_pos - line_pos + indent.previous_line_indent + 1;
|
||||
}
|
||||
|
@ -451,21 +447,22 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
|||
return(indent_marks);
|
||||
}
|
||||
|
||||
// TODO(allen): replace these with new range operators.
|
||||
internal void
|
||||
get_indent_lines_minimum(Application_Links *app, Buffer_ID buffer, i32 start_pos, i32 end_pos, i32 *line_start_out, i32 *line_end_out){
|
||||
i32 line_start = get_line_number_from_pos(app, buffer, start_pos);
|
||||
i32 line_end = get_line_number_from_pos(app, buffer, end_pos) + 1;
|
||||
get_indent_lines_minimum(Application_Links *app, Buffer_ID buffer, i64 start_pos, i64 end_pos, i64 *line_start_out, i64 *line_end_out){
|
||||
i64 line_start = get_line_number_from_pos(app, buffer, start_pos);
|
||||
i64 line_end = get_line_number_from_pos(app, buffer, end_pos) + 1;
|
||||
*line_start_out = line_start;
|
||||
*line_end_out = line_end;
|
||||
}
|
||||
|
||||
internal void
|
||||
get_indent_lines_whole_tokens(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array tokens, i32 start_pos, i32 end_pos, i32 *line_start_out, i32 *line_end_out){
|
||||
i32 line_start = get_line_number_from_pos(app, buffer, start_pos);
|
||||
i32 line_end = get_line_number_from_pos(app, buffer, end_pos);
|
||||
get_indent_lines_whole_tokens(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array tokens, i64 start_pos, i64 end_pos, i64 *line_start_out, i64 *line_end_out){
|
||||
i64 line_start = get_line_number_from_pos(app, buffer, start_pos);
|
||||
i64 line_end = get_line_number_from_pos(app, buffer, end_pos);
|
||||
|
||||
for (;line_start > 1;){
|
||||
i32 line_start_pos = get_line_start_pos(app, buffer, line_start);
|
||||
i64 line_start_pos = get_line_start_pos(app, buffer, line_start);
|
||||
Cpp_Token *token = get_first_token_from_pos(tokens, line_start_pos);
|
||||
if (token != 0 && token->start < line_start_pos){
|
||||
line_start = get_line_number_from_pos(app, buffer, token->start);
|
||||
|
@ -475,10 +472,10 @@ get_indent_lines_whole_tokens(Application_Links *app, Buffer_ID buffer, Cpp_Toke
|
|||
}
|
||||
}
|
||||
|
||||
i32 line_count = (i32)buffer_get_line_count(app, buffer);
|
||||
i64 line_count = buffer_get_line_count(app, buffer);
|
||||
|
||||
for (;line_end < line_count;){
|
||||
i32 next_line_start_pos = get_line_start_pos(app, buffer, line_end + 1);
|
||||
i64 next_line_start_pos = get_line_start_pos(app, buffer, line_end + 1);
|
||||
Cpp_Token *token = get_first_token_from_pos(tokens, next_line_start_pos);
|
||||
if (token != 0 && token->start < next_line_start_pos){
|
||||
line_end = get_line_number_from_pos(app, buffer, token->start + token->size);
|
||||
|
@ -496,19 +493,20 @@ get_indent_lines_whole_tokens(Application_Links *app, Buffer_ID buffer, Cpp_Toke
|
|||
}
|
||||
|
||||
internal b32
|
||||
buffer_auto_indent(Application_Links *app, Arena *scratch, Buffer_ID buffer, i32 start, i32 end, i32 tab_width, Auto_Indent_Flag flags){
|
||||
buffer_auto_indent(Application_Links *app, Buffer_ID buffer, i64 start, i64 end, i32 tab_width, Auto_Indent_Flag flags){
|
||||
b32 result = false;
|
||||
if (buffer_exists(app, buffer) && buffer_tokens_are_ready(app, buffer)){
|
||||
result = true;
|
||||
|
||||
Temp_Memory temp = begin_temp(scratch);
|
||||
Scratch_Block scratch(app);
|
||||
|
||||
// Stage 1: Read the tokens to be used for indentation.
|
||||
Cpp_Token_Array tokens = buffer_get_token_array(app, buffer);
|
||||
|
||||
// Stage 2: Decide where the first and last lines are.
|
||||
// The lines in the range [line_start,line_end) will be indented.
|
||||
i32 line_start = 0, line_end = 0;
|
||||
i64 line_start = 0;
|
||||
i64 line_end = 0;
|
||||
if (HasFlag(flags, AutoIndent_FullTokens)){
|
||||
get_indent_lines_whole_tokens(app, buffer, tokens, start, end, &line_start, &line_end);
|
||||
}
|
||||
|
@ -519,7 +517,7 @@ buffer_auto_indent(Application_Links *app, Arena *scratch, Buffer_ID buffer, i32
|
|||
// Stage 3: Decide Indent Amounts
|
||||
// Get an array representing how much each line in
|
||||
// the range [line_start,line_end) should be indented.
|
||||
i32 *indent_marks = get_indentation_marks(app, scratch, buffer, tokens, line_start, line_end, (flags & AutoIndent_ExactAlignBlock), tab_width);
|
||||
i64 *indent_marks = get_indentation_marks(app, scratch, buffer, tokens, line_start, line_end, (flags & AutoIndent_ExactAlignBlock), tab_width);
|
||||
|
||||
// Stage 4: Set the Line Indents
|
||||
Indent_Options opts = {};
|
||||
|
@ -528,19 +526,11 @@ buffer_auto_indent(Application_Links *app, Arena *scratch, Buffer_ID buffer, i32
|
|||
opts.tab_width = tab_width;
|
||||
|
||||
set_line_indents(app, scratch, buffer, line_start, line_end, indent_marks, opts);
|
||||
|
||||
end_temp(temp);
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal b32
|
||||
buffer_auto_indent(Application_Links *app, Buffer_ID buffer, i32 start, i32 end, i32 tab_width, Auto_Indent_Flag flags){
|
||||
Arena *scratch = context_get_arena(app);
|
||||
return(buffer_auto_indent(app, scratch, buffer, start, end, tab_width, flags));
|
||||
}
|
||||
|
||||
//
|
||||
// Commands
|
||||
//
|
||||
|
@ -559,8 +549,7 @@ CUSTOM_DOC("Audo-indents the entire current buffer.")
|
|||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 buffer_size = (i32)buffer_get_size(app, buffer);
|
||||
Arena *scratch = context_get_arena(app);
|
||||
buffer_auto_indent(app, scratch, buffer, 0, buffer_size, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens);
|
||||
buffer_auto_indent(app, buffer, 0, buffer_size, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(auto_tab_line_at_cursor)
|
||||
|
@ -568,9 +557,8 @@ CUSTOM_DOC("Auto-indents the line on which the cursor sits.")
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
Arena *scratch = context_get_arena(app);
|
||||
buffer_auto_indent(app, scratch, buffer, pos, pos, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
buffer_auto_indent(app, buffer, pos, pos, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens);
|
||||
move_past_lead_whitespace(app, view, buffer);
|
||||
}
|
||||
|
||||
|
@ -579,9 +567,8 @@ CUSTOM_DOC("Auto-indents the range between the cursor and the mark.")
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
Range range = get_view_range(app, view);
|
||||
Arena *scratch = context_get_arena(app);
|
||||
buffer_auto_indent(app, scratch, buffer, range.min, range.max, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens);
|
||||
Range_i64 range = get_view_range(app, view);
|
||||
buffer_auto_indent(app, buffer, range.min, range.max, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens);
|
||||
move_past_lead_whitespace(app, view, buffer);
|
||||
}
|
||||
|
||||
|
@ -596,9 +583,8 @@ CUSTOM_DOC("Inserts a character and auto-indents the line on which the cursor si
|
|||
if (in.key.character == '\n'){
|
||||
flags |= AutoIndent_ExactAlignBlock;
|
||||
}
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
Arena *scratch = context_get_arena(app);
|
||||
buffer_auto_indent(app, scratch, buffer, pos, pos, DEF_TAB_WIDTH, flags);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
buffer_auto_indent(app, buffer, pos, pos, DEF_TAB_WIDTH, flags);
|
||||
move_past_lead_whitespace(app, view, buffer);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,12 +14,12 @@ struct Indent_Options{
|
|||
};
|
||||
|
||||
struct Indent_Parse_State{
|
||||
i32 current_indent;
|
||||
i32 previous_line_indent;
|
||||
i32 paren_nesting;
|
||||
i32 paren_anchor_indent[16];
|
||||
i32 comment_shift;
|
||||
i32 previous_comment_indent;
|
||||
i64 current_indent;
|
||||
i64 previous_line_indent;
|
||||
i64 paren_nesting;
|
||||
i64 paren_anchor_indent[16];
|
||||
i64 comment_shift;
|
||||
i64 previous_comment_indent;
|
||||
};
|
||||
|
||||
struct Indent_Anchor_Position{
|
||||
|
|
|
@ -12,13 +12,13 @@ write_character_parameter(Application_Links *app, u8 *character, u32 length){
|
|||
if_view_has_highlighted_range_delete_range(app, view);
|
||||
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos));
|
||||
|
||||
// NOTE(allen): setup markers to figure out the new position of cursor after the insert
|
||||
Marker next_cursor_marker = {};
|
||||
// TODO(allen): should be using character_pos_to_pos_buffer here!
|
||||
next_cursor_marker.pos = character_pos_to_pos_view(app, view, cursor.character_pos);
|
||||
next_cursor_marker.pos = (i32)character_pos_to_pos_view(app, view, cursor.character_pos);
|
||||
next_cursor_marker.lean_right = true;
|
||||
Managed_Object handle = alloc_buffer_markers_on_buffer(app, buffer, 1, 0);
|
||||
managed_object_store_data(app, handle, 0, 1, &next_cursor_marker);
|
||||
|
@ -46,7 +46,7 @@ write_character_parameter(Application_Links *app, u8 *character, u32 length){
|
|||
}
|
||||
|
||||
// NOTE(allen): perform the edit
|
||||
b32 edit_success = buffer_replace_range(app, buffer, make_range(pos), SCu8(character, length));
|
||||
b32 edit_success = buffer_replace_range(app, buffer, Ii64(pos), SCu8(character, length));
|
||||
|
||||
// NOTE(allen): finish merging records if necessary
|
||||
if (do_merge){
|
||||
|
@ -85,13 +85,13 @@ CUSTOM_DOC("Deletes the character to the right of the cursor.")
|
|||
View_ID view = get_active_view(app, AccessOpen);
|
||||
if (!if_view_has_highlighted_range_delete_range(app, view)){
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 start = view_get_cursor_pos(app, view);
|
||||
i32 buffer_size = (i32)buffer_get_size(app, buffer);
|
||||
i64 start = view_get_cursor_pos(app, view);
|
||||
i64 buffer_size = buffer_get_size(app, buffer);
|
||||
if (0 <= start && start < buffer_size){
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(start));
|
||||
cursor = view_compute_cursor(app, view, seek_character_pos(cursor.character_pos + 1));
|
||||
i32 end = cursor.pos;
|
||||
buffer_replace_range(app, buffer, make_range(start, end), string_u8_litexpr(""));
|
||||
i64 end = cursor.pos;
|
||||
buffer_replace_range(app, buffer, Ii64(start, end), string_u8_empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,13 +102,13 @@ CUSTOM_DOC("Deletes the character to the left of the cursor.")
|
|||
View_ID view = get_active_view(app, AccessOpen);
|
||||
if (!if_view_has_highlighted_range_delete_range(app, view)){
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 end = view_get_cursor_pos(app, view);
|
||||
i32 buffer_size = (i32)buffer_get_size(app, buffer);
|
||||
i64 end = view_get_cursor_pos(app, view);
|
||||
i64 buffer_size = buffer_get_size(app, buffer);
|
||||
if (0 < end && end <= buffer_size){
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(end));
|
||||
cursor = view_compute_cursor(app, view, seek_character_pos(cursor.character_pos - 1));
|
||||
i32 start = cursor.pos;
|
||||
if (buffer_replace_range(app, buffer, make_range(start, end), string_u8_litexpr(""))){
|
||||
i64 start = cursor.pos;
|
||||
if (buffer_replace_range(app, buffer, Ii64(start, end), string_u8_empty)){
|
||||
view_set_cursor(app, view, seek_pos(start), true);
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ CUSTOM_COMMAND_SIG(set_mark)
|
|||
CUSTOM_DOC("Sets the mark to the current position of the cursor.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
i32 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_cursor(app, view, seek_pos(pos), true);
|
||||
}
|
||||
|
@ -128,8 +128,8 @@ CUSTOM_COMMAND_SIG(cursor_mark_swap)
|
|||
CUSTOM_DOC("Swaps the position of the cursor and the mark.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
i32 cursor = view_get_cursor_pos(app, view);
|
||||
i32 mark = view_get_mark_pos(app, view);
|
||||
i64 cursor = view_get_cursor_pos(app, view);
|
||||
i64 mark = view_get_mark_pos(app, view);
|
||||
view_set_cursor(app, view, seek_pos(mark), true);
|
||||
view_set_mark(app, view, seek_pos(cursor));
|
||||
}
|
||||
|
@ -139,19 +139,19 @@ CUSTOM_DOC("Deletes the text in the range between the cursor and the mark.")
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
Range range = get_view_range(app, view);
|
||||
buffer_replace_range(app, buffer, range, string_u8_litexpr(""));
|
||||
Range_i64 range = get_view_range(app, view);
|
||||
buffer_replace_range(app, buffer, range, string_u8_empty);
|
||||
}
|
||||
|
||||
static void
|
||||
current_view_boundary_delete(Application_Links *app, Scan_Direction direction, Boundary_Function_List funcs){
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
Range range = {};
|
||||
Range_i64 range = {};
|
||||
range.first = view_get_cursor_pos(app, view);
|
||||
range.one_past_last = scan(app, funcs, buffer, direction, range.first);
|
||||
range = rectify(range);
|
||||
buffer_replace_range(app, buffer, range, string_u8_litexpr(""));
|
||||
buffer_replace_range(app, buffer, range, string_u8_empty);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(backspace_alpha_numeric_boundary)
|
||||
|
@ -177,8 +177,8 @@ static void
|
|||
current_view_snipe_delete(Application_Links *app, Scan_Direction direction, Boundary_Function_List funcs){
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
Range range = get_snipe_range(app, funcs, buffer, pos, direction);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Range_i64 range = get_snipe_range(app, funcs, buffer, pos, direction);
|
||||
buffer_replace_range(app, buffer, range, string_u8_litexpr(""));
|
||||
}
|
||||
|
||||
|
@ -389,9 +389,9 @@ CUSTOM_COMMAND_SIG(move_down_textual)
|
|||
CUSTOM_DOC("Moves down to the next line of actual text, regardless of line wrapping.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos));
|
||||
i32 next_line = cursor.line + 1;
|
||||
i64 next_line = cursor.line + 1;
|
||||
view_set_cursor(app, view, seek_line_char(next_line, 1), true);
|
||||
}
|
||||
|
||||
|
@ -415,8 +415,8 @@ internal void
|
|||
seek_blank_line(Application_Links *app, Scan_Direction direction, Position_Within_Line position){
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i32 new_pos = get_pos_of_blank_line_grouped(app, buffer, direction, pos);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
i64 new_pos = get_pos_of_blank_line_grouped(app, buffer, direction, pos);
|
||||
switch (position){
|
||||
case PositionWithinLine_SkipLeadingWhitespace:
|
||||
{
|
||||
|
@ -477,9 +477,9 @@ CUSTOM_COMMAND_SIG(move_left)
|
|||
CUSTOM_DOC("Moves the cursor one character to the left.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos));
|
||||
i32 new_pos = clamp_bot(0, cursor.character_pos - 1);
|
||||
i64 new_pos = clamp_bot(0, cursor.character_pos - 1);
|
||||
view_set_cursor(app, view, seek_character_pos(new_pos), true);
|
||||
no_mark_snap_to_cursor_if_shift(app, view);
|
||||
}
|
||||
|
@ -488,9 +488,9 @@ CUSTOM_COMMAND_SIG(move_right)
|
|||
CUSTOM_DOC("Moves the cursor one character to the right.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos));
|
||||
i32 new_pos = cursor.character_pos + 1;
|
||||
i64 new_pos = cursor.character_pos + 1;
|
||||
view_set_cursor(app, view, seek_character_pos(new_pos), 1);
|
||||
no_mark_snap_to_cursor_if_shift(app, view);
|
||||
}
|
||||
|
@ -499,8 +499,8 @@ static void
|
|||
current_view_scan_move(Application_Links *app, Scan_Direction direction, Boundary_Function_List funcs){
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||
i32 cursor_pos = view_get_cursor_pos(app, view);
|
||||
i32 pos = scan(app, funcs, buffer, direction, cursor_pos);
|
||||
i64 cursor_pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = scan(app, funcs, buffer, direction, cursor_pos);
|
||||
view_set_cursor(app, view, seek_pos(pos), true);
|
||||
no_mark_snap_to_cursor_if_shift(app, view);
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ CUSTOM_DOC("Converts all ascii text in the range between the cursor and the mark
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
Range range = get_view_range(app, view);
|
||||
Range_i64 range = get_view_range(app, view);
|
||||
Scratch_Block scratch(app);
|
||||
String_Const_u8 string = push_buffer_range(app, scratch, buffer, range);
|
||||
string = string_mod_upper(string);
|
||||
|
@ -629,7 +629,7 @@ CUSTOM_DOC("Converts all ascii text in the range between the cursor and the mark
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
Range range = get_view_range(app, view);
|
||||
Range_i64 range = get_view_range(app, view);
|
||||
Scratch_Block scratch(app);
|
||||
String_Const_u8 string = push_buffer_range(app, scratch, buffer, range);
|
||||
string = string_mod_lower(string);
|
||||
|
@ -872,12 +872,12 @@ CUSTOM_COMMAND_SIG(search);
|
|||
CUSTOM_COMMAND_SIG(reverse_search);
|
||||
|
||||
static void
|
||||
isearch__update_highlight(Application_Links *app, View_ID view, Managed_Object highlight, i32 start, i32 end){
|
||||
isearch__update_highlight(Application_Links *app, View_ID view, Managed_Object highlight, Range_i64 range){
|
||||
Marker markers[4] = {};
|
||||
markers[0].pos = start;
|
||||
markers[1].pos = end;
|
||||
markers[0].pos = (i32)range.start;
|
||||
markers[1].pos = (i32)range.end;
|
||||
managed_object_store_data(app, highlight, 0, 2, markers);
|
||||
view_set_cursor(app, view, seek_pos(start), false);
|
||||
view_set_cursor(app, view, seek_pos(range.start), false);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -894,15 +894,15 @@ isearch(Application_Links *app, b32 start_reversed, String_Const_u8 query_init,
|
|||
}
|
||||
|
||||
b32 reverse = start_reversed;
|
||||
i32 first_pos = view_get_cursor_pos(app, view);
|
||||
i64 first_pos = view_get_cursor_pos(app, view);
|
||||
|
||||
i32 pos = first_pos;
|
||||
i64 pos = first_pos;
|
||||
if (query_init.size != 0){
|
||||
pos += 2;
|
||||
}
|
||||
|
||||
i32 start_pos = pos;
|
||||
Range match = make_range(pos, pos);
|
||||
i64 start_pos = pos;
|
||||
Range_i64 match = Ii64(pos);
|
||||
|
||||
u8 bar_string_space[256];
|
||||
bar.string = SCu8(bar_string_space, query_init.size);
|
||||
|
@ -922,7 +922,7 @@ isearch(Application_Links *app, b32 start_reversed, String_Const_u8 query_init,
|
|||
Stag_At_Highlight, 0);
|
||||
marker_visual_set_view_key(app, visual, view);
|
||||
marker_visual_set_priority(app, visual, VisualPriority_Default + 1);
|
||||
isearch__update_highlight(app, view, highlight, match.start, match.end);
|
||||
isearch__update_highlight(app, view, highlight, match);
|
||||
cursor_is_hidden = true;
|
||||
|
||||
User_Input in = {};
|
||||
|
@ -1019,7 +1019,7 @@ isearch(Application_Links *app, b32 start_reversed, String_Const_u8 query_init,
|
|||
|
||||
if (!backspace){
|
||||
if (reverse){
|
||||
i32 new_pos = 0;
|
||||
i64 new_pos = 0;
|
||||
buffer_seek_string_insensitive_backward(app, buffer, start_pos - 1, 0, bar.string, &new_pos);
|
||||
if (new_pos >= 0){
|
||||
if (step_backward){
|
||||
|
@ -1035,9 +1035,9 @@ isearch(Application_Links *app, b32 start_reversed, String_Const_u8 query_init,
|
|||
}
|
||||
}
|
||||
else{
|
||||
i32 new_pos = 0;
|
||||
i64 new_pos = 0;
|
||||
buffer_seek_string_insensitive_forward(app, buffer, start_pos + 1, 0, bar.string, &new_pos);
|
||||
i32 buffer_size = (i32)buffer_get_size(app, buffer);
|
||||
i64 buffer_size = buffer_get_size(app, buffer);
|
||||
if (new_pos < buffer_size){
|
||||
if (step_forward){
|
||||
pos = new_pos;
|
||||
|
@ -1059,7 +1059,7 @@ isearch(Application_Links *app, b32 start_reversed, String_Const_u8 query_init,
|
|||
}
|
||||
|
||||
if (!suppress_highligh_update){
|
||||
isearch__update_highlight(app, view, highlight, match.start, match.end);
|
||||
isearch__update_highlight(app, view, highlight, match);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1092,10 +1092,9 @@ CUSTOM_DOC("Begins an incremental search down through the current buffer for the
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer_id = view_get_buffer(app, view, AccessProtected);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Scratch_Block scratch(app);
|
||||
String_Const_u8 query = push_enclose_range_at_pos(app, scratch, buffer_id, pos,
|
||||
enclose_alpha_numeric_underscore);
|
||||
String_Const_u8 query = push_enclose_range_at_pos(app, scratch, buffer_id, pos, enclose_alpha_numeric_underscore);
|
||||
isearch(app, false, query, true);
|
||||
}
|
||||
|
||||
|
@ -1104,10 +1103,9 @@ CUSTOM_DOC("Begins an incremental search up through the current buffer for the w
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer_id = view_get_buffer(app, view, AccessProtected);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Scratch_Block scratch(app);
|
||||
String_Const_u8 query = push_enclose_range_at_pos(app, scratch, buffer_id, pos,
|
||||
enclose_alpha_numeric_underscore);
|
||||
String_Const_u8 query = push_enclose_range_at_pos(app, scratch, buffer_id, pos, enclose_alpha_numeric_underscore);
|
||||
isearch(app, true, query, true);
|
||||
}
|
||||
|
||||
|
@ -1131,14 +1129,14 @@ CUSTOM_DOC("Queries the user for two strings, and replaces all occurences of the
|
|||
String_Const_u8 w = with.string;
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
Range range = get_view_range(app, view);
|
||||
Range_i64 range = get_view_range(app, view);
|
||||
replace_in_range(app, buffer, range, r, w);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
query_replace_base(Application_Links *app, View_ID view, Buffer_ID buffer_id, i32 pos, String_Const_u8 r, String_Const_u8 w){
|
||||
i32 new_pos = 0;
|
||||
query_replace_base(Application_Links *app, View_ID view, Buffer_ID buffer_id, i64 pos, String_Const_u8 r, String_Const_u8 w){
|
||||
i64 new_pos = 0;
|
||||
buffer_seek_string_forward(app, buffer_id, pos - 1, 0, r, &new_pos);
|
||||
|
||||
Managed_Scope view_scope = view_get_managed_scope(app, view);
|
||||
|
@ -1148,12 +1146,12 @@ query_replace_base(Application_Links *app, View_ID view, Buffer_ID buffer_id, i3
|
|||
marker_visual_set_view_key(app, visual, view);
|
||||
cursor_is_hidden = true;
|
||||
|
||||
i32 buffer_size = (i32)buffer_get_size(app, buffer_id);
|
||||
i64 buffer_size = buffer_get_size(app, buffer_id);
|
||||
|
||||
User_Input in = {};
|
||||
for (;new_pos < buffer_size;){
|
||||
Range match = make_range(new_pos, new_pos + (i32)r.size);
|
||||
isearch__update_highlight(app, view, highlight, match.min, match.max);
|
||||
Range_i64 match = Ii64(new_pos, new_pos + r.size);
|
||||
isearch__update_highlight(app, view, highlight, match);
|
||||
|
||||
in = get_user_input(app, EventOnAnyKey, EventOnMouseLeftButton|EventOnMouseRightButton);
|
||||
if (in.abort || in.key.keycode == key_esc || !key_is_unmodified(&in.key)) break;
|
||||
|
@ -1161,7 +1159,7 @@ query_replace_base(Application_Links *app, View_ID view, Buffer_ID buffer_id, i3
|
|||
if (in.key.character == 'y' || in.key.character == 'Y' ||
|
||||
in.key.character == '\n' || in.key.character == '\t'){
|
||||
buffer_replace_range(app, buffer_id, match, w);
|
||||
pos = match.start + (i32)w.size;
|
||||
pos = match.start + w.size;
|
||||
}
|
||||
else{
|
||||
pos = match.max;
|
||||
|
@ -1181,7 +1179,7 @@ query_replace_base(Application_Links *app, View_ID view, Buffer_ID buffer_id, i3
|
|||
}
|
||||
|
||||
static void
|
||||
query_replace_parameter(Application_Links *app, String_Const_u8 replace_str, i32 start_pos, b32 add_replace_query_bar){
|
||||
query_replace_parameter(Application_Links *app, String_Const_u8 replace_str, i64 start_pos, b32 add_replace_query_bar){
|
||||
Query_Bar replace = {};
|
||||
replace.prompt = string_u8_litexpr("Replace: ");
|
||||
replace.string = replace_str;
|
||||
|
@ -1202,7 +1200,7 @@ query_replace_parameter(Application_Links *app, String_Const_u8 replace_str, i32
|
|||
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||
i32 pos = start_pos;
|
||||
i64 pos = start_pos;
|
||||
|
||||
Query_Bar bar = {};
|
||||
bar.prompt = string_u8_litexpr("Replace? (y)es, (n)ext, (esc)\n");
|
||||
|
@ -1225,7 +1223,7 @@ CUSTOM_DOC("Queries the user for two strings, and incrementally replaces every o
|
|||
replace.string_capacity = sizeof(replace_space);
|
||||
if (query_user_string(app, &replace)){
|
||||
if (replace.string.size > 0){
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
query_replace_parameter(app, replace.string, pos, false);
|
||||
}
|
||||
}
|
||||
|
@ -1238,9 +1236,9 @@ CUSTOM_DOC("Queries the user for a string, and incrementally replace every occur
|
|||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
if (buffer != 0){
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
Scratch_Block scratch(app);
|
||||
Range range = enclose_alpha_numeric_underscore(app, buffer, make_range(pos));
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Range_i64 range = enclose_pos_alpha_numeric_underscore(app, buffer, pos);
|
||||
String_Const_u8 replace = push_buffer_range(app, scratch, buffer, range);
|
||||
if (replace.size != 0){
|
||||
query_replace_parameter(app, replace, range.min, true);
|
||||
|
@ -1254,18 +1252,13 @@ CUSTOM_DOC("Queries the user for a string, and incrementally replace every occur
|
|||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
if (buffer != 0){
|
||||
Arena *scratch = context_get_arena(app);
|
||||
Temp_Memory temp = begin_temp(scratch);
|
||||
Range range = get_view_range(app, view);
|
||||
i32 replace_length = range.max - range.min;
|
||||
if (replace_length != 0){
|
||||
u8 *replace_space = push_array(scratch, u8, replace_length);
|
||||
if (buffer_read_range(app, buffer, range.min, range.max, (char*)replace_space)){
|
||||
query_replace_parameter(app, SCu8(replace_space, replace_length), range.min, true);
|
||||
Scratch_Block scratch(app);
|
||||
Range_i64 range = get_view_range(app, view);
|
||||
String_Const_u8 replace = push_buffer_range(app, scratch, buffer, range);
|
||||
if (replace.size != 0){
|
||||
query_replace_parameter(app, replace, range.min, true);
|
||||
}
|
||||
}
|
||||
end_temp(temp);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
@ -1453,8 +1446,8 @@ internal void
|
|||
current_view_move_line(Application_Links *app, Scan_Direction direction){
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i32 line_number = get_line_number_from_pos(app, buffer, pos);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
i64 line_number = get_line_number_from_pos(app, buffer, pos);
|
||||
pos = move_line(app, buffer, line_number, direction);
|
||||
view_set_cursor(app, view, seek_pos(pos), true);
|
||||
}
|
||||
|
@ -1476,13 +1469,13 @@ CUSTOM_DOC("Create a copy of the line on which the cursor sits.")
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i32 line = get_line_number_from_pos(app, buffer, pos);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
i64 line = get_line_number_from_pos(app, buffer, pos);
|
||||
Scratch_Block scratch(app);
|
||||
String_Const_u8 s = push_buffer_line(app, scratch, buffer, line);
|
||||
s = push_u8_stringf(scratch, "%.*s\n", string_expand(s));
|
||||
pos = get_line_side_pos(app, buffer, line, Side_Min);
|
||||
buffer_replace_range(app, buffer, make_range(pos), s);
|
||||
buffer_replace_range(app, buffer, Ii64(pos), s);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(delete_line)
|
||||
|
@ -1490,9 +1483,9 @@ CUSTOM_DOC("Delete the line the on which the cursor sits.")
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i32 line = get_line_number_from_pos(app, buffer, pos);
|
||||
Range range = get_line_pos_range(app, buffer, line);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
i64 line = get_line_number_from_pos(app, buffer, pos);
|
||||
Range_i64 range = get_line_pos_range(app, buffer, line);
|
||||
range.end += 1;
|
||||
i32 size = (i32)buffer_get_size(app, buffer);
|
||||
range.end = clamp_top(range.end, size);
|
||||
|
@ -1554,20 +1547,17 @@ CUSTOM_COMMAND_SIG(open_file_in_quotes)
|
|||
CUSTOM_DOC("Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer_id = view_get_buffer(app, view, AccessProtected);
|
||||
if (buffer_exists(app, buffer_id)){
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||
if (buffer_exists(app, buffer)){
|
||||
Scratch_Block scratch(app);
|
||||
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
|
||||
Range range = {};
|
||||
buffer_seek_delimiter_forward(app, buffer_id, pos, '"', &range.end);
|
||||
buffer_seek_delimiter_backward(app, buffer_id, pos, '"', &range.start);
|
||||
range.start += 1;
|
||||
Range_i64 range = enclose_pos_inside_quotes(app, buffer, pos);
|
||||
|
||||
String_Const_u8 quoted_name = push_buffer_range(app, scratch, buffer_id, range);
|
||||
String_Const_u8 quoted_name = push_buffer_range(app, scratch, buffer, range);
|
||||
|
||||
String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer_id);
|
||||
String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer);
|
||||
String_Const_u8 path = string_remove_last_folder(file_name);
|
||||
|
||||
if (character_is_slash(string_get_character(path, path.size - 1))){
|
||||
|
@ -1603,7 +1593,7 @@ CUSTOM_DOC("Set the other non-active panel to view the buffer that the active pa
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessAll);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
change_active_panel(app);
|
||||
view = get_active_view(app, AccessAll);
|
||||
view_set_buffer(app, view, buffer, 0);
|
||||
|
@ -1625,11 +1615,11 @@ CUSTOM_DOC("Set the other non-active panel to view the buffer that the active pa
|
|||
view_set_buffer(app, view2, buffer1, 0);
|
||||
}
|
||||
else{
|
||||
i32 p1 = view_get_cursor_pos(app, view1);
|
||||
i32 m1 = view_get_mark_pos(app, view1);
|
||||
i64 p1 = view_get_cursor_pos(app, view1);
|
||||
i64 m1 = view_get_mark_pos(app, view1);
|
||||
GUI_Scroll_Vars sc1 = view_get_scroll_vars(app, view1);
|
||||
i32 p2 = view_get_cursor_pos(app, view2);
|
||||
i32 m2 = view_get_mark_pos(app, view2);
|
||||
i64 p2 = view_get_cursor_pos(app, view2);
|
||||
i64 m2 = view_get_mark_pos(app, view2);
|
||||
GUI_Scroll_Vars sc2 = view_get_scroll_vars(app, view2);
|
||||
|
||||
view_set_cursor(app, view1, seek_pos(p2), true);
|
||||
|
|
|
@ -1825,6 +1825,18 @@ internal i64
|
|||
replace_range_compute_shift(Interval_i64 range, i64 insert_length){
|
||||
return(insert_length - (range.end - range.start));
|
||||
}
|
||||
internal i64
|
||||
replace_range_compute_shift(u64 replace_length, u64 insert_length){
|
||||
return((i64)insert_length - replace_length);
|
||||
}
|
||||
internal i64
|
||||
replace_range_compute_shift(i64 start, i64 end, u64 insert_length){
|
||||
return((i64)insert_length - (end - start));
|
||||
}
|
||||
internal i64
|
||||
replace_range_compute_shift(Interval_i64 range, u64 insert_length){
|
||||
return((i64)insert_length - (range.end - range.start));
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
|
@ -3020,6 +3032,9 @@ SCany(String_Const_u32 str){
|
|||
|
||||
#define string_expand(s) (i32)(s).size, (char*)(s).str
|
||||
|
||||
static String_Const_char string_empty = {"", 0};
|
||||
static String_Const_u8 string_u8_empty = {"", 0};
|
||||
|
||||
static char
|
||||
string_get_character(String_Const_char str, umem i){
|
||||
char r = 0;
|
||||
|
@ -3205,6 +3220,23 @@ string_chop(String_Const_Any str, umem n){
|
|||
return(str);
|
||||
}
|
||||
|
||||
static String_Const_char
|
||||
string_substring(String_Const_char str, Range_i64 range){
|
||||
return(SCchar(str.str + range.min, str.str + range.max));
|
||||
}
|
||||
static String_Const_u8
|
||||
string_substring(String_Const_u8 str, Range_i64 range){
|
||||
return(SCu8(str.str + range.min, str.str + range.max));
|
||||
}
|
||||
static String_Const_u16
|
||||
string_substring(String_Const_u16 str, Range_i64 range){
|
||||
return(SCu16(str.str + range.min, str.str + range.max));
|
||||
}
|
||||
static String_Const_u32
|
||||
string_substring(String_Const_u32 str, Range_i64 range){
|
||||
return(SCu32(str.str + range.min, str.str + range.max));
|
||||
}
|
||||
|
||||
static umem
|
||||
string_find_first(String_Const_char str, char c){
|
||||
umem i = 0;
|
||||
|
|
|
@ -691,6 +691,24 @@ typedef Range_u64 Interval_u64;
|
|||
typedef Range_f32 Interval_f32;
|
||||
typedef Range_i32 Range;
|
||||
|
||||
struct Range_i32_Array{
|
||||
Range_i32 *ranges;
|
||||
i32 count;
|
||||
};
|
||||
struct Range_i64_Array{
|
||||
Range_i64 *ranges;
|
||||
i32 count;
|
||||
};
|
||||
struct Range_u64_Array{
|
||||
Range_u64 *ranges;
|
||||
i32 count;
|
||||
};
|
||||
struct Range_f32_Array{
|
||||
Range_f32 *ranges;
|
||||
i32 count;
|
||||
};
|
||||
typedef Range_i32_Array Range_Array;
|
||||
|
||||
union Rect_i32{
|
||||
struct{
|
||||
i32 x0;
|
||||
|
@ -790,22 +808,22 @@ enum{
|
|||
|
||||
struct String_Const_char{
|
||||
char *str;
|
||||
umem size;
|
||||
u64 size;
|
||||
};
|
||||
struct String_Const_u8{
|
||||
union{
|
||||
void *data;
|
||||
u8 *str;
|
||||
};
|
||||
umem size;
|
||||
u64 size;
|
||||
};
|
||||
struct String_Const_u16{
|
||||
u16 *str;
|
||||
umem size;
|
||||
u64 size;
|
||||
};
|
||||
struct String_Const_u32{
|
||||
u32 *str;
|
||||
umem size;
|
||||
u64 size;
|
||||
};
|
||||
|
||||
struct String_Const_char_Array{
|
||||
|
@ -850,7 +868,7 @@ struct String_Const_Any{
|
|||
union{
|
||||
struct{
|
||||
void *str;
|
||||
umem size;
|
||||
u64 size;
|
||||
};
|
||||
String_Const_char s_char;
|
||||
String_Const_u8 s_u8;
|
||||
|
@ -878,26 +896,26 @@ struct Node_String_Const_u32{
|
|||
struct List_String_Const_char{
|
||||
Node_String_Const_char *first;
|
||||
Node_String_Const_char *last;
|
||||
u64 total_size;
|
||||
i32 node_count;
|
||||
umem total_size;
|
||||
};
|
||||
struct List_String_Const_u8{
|
||||
Node_String_Const_u8 *first;
|
||||
Node_String_Const_u8 *last;
|
||||
u64 total_size;
|
||||
i32 node_count;
|
||||
umem total_size;
|
||||
};
|
||||
struct List_String_Const_u16{
|
||||
Node_String_Const_u16 *first;
|
||||
Node_String_Const_u16 *last;
|
||||
u64 total_size;
|
||||
i32 node_count;
|
||||
umem total_size;
|
||||
};
|
||||
struct List_String_Const_u32{
|
||||
Node_String_Const_u32 *first;
|
||||
Node_String_Const_u32 *last;
|
||||
u64 total_size;
|
||||
i32 node_count;
|
||||
umem total_size;
|
||||
};
|
||||
|
||||
struct Node_String_Const_Any{
|
||||
|
@ -907,8 +925,8 @@ struct Node_String_Const_Any{
|
|||
struct List_String_Const_Any{
|
||||
Node_String_Const_Any *first;
|
||||
Node_String_Const_Any *last;
|
||||
u64 total_size;
|
||||
i32 node_count;
|
||||
umem total_size;
|
||||
};
|
||||
|
||||
struct String_char{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// TOP
|
||||
|
||||
static Buffer_Seek
|
||||
seek_pos(i32 pos){
|
||||
seek_pos(i64 pos){
|
||||
Buffer_Seek result;
|
||||
result.type = buffer_seek_pos;
|
||||
result.pos = pos;
|
||||
|
@ -13,7 +13,7 @@ seek_pos(i32 pos){
|
|||
}
|
||||
|
||||
static Buffer_Seek
|
||||
seek_character_pos(i32 pos){
|
||||
seek_character_pos(i64 pos){
|
||||
Buffer_Seek result;
|
||||
result.type = buffer_seek_character_pos;
|
||||
result.pos = pos;
|
||||
|
@ -51,7 +51,7 @@ seek_xy(f32 x, f32 y, b32 round_down, b32 unwrapped){
|
|||
}
|
||||
|
||||
static Buffer_Seek
|
||||
seek_line_char(i32 line, i32 character){
|
||||
seek_line_char(i64 line, i64 character){
|
||||
Buffer_Seek result;
|
||||
result.type = buffer_seek_line_char;
|
||||
result.line = line;
|
||||
|
|
|
@ -5,18 +5,14 @@
|
|||
// TOP
|
||||
|
||||
static b32
|
||||
post_buffer_range_to_clipboard(Application_Links *app, i32 clipboard_index, Buffer_ID buffer, i32 first, i32 one_past_last){
|
||||
clipboard_post_buffer_range(Application_Links *app, i32 clipboard_index, Buffer_ID buffer, Range_i64 range){
|
||||
b32 success = false;
|
||||
i32 buffer_size = (i32)buffer_get_size(app, buffer);
|
||||
if (buffer != 0 && 0 <= first && first < one_past_last && one_past_last <= buffer_size){
|
||||
Scratch_Block scratch(app);
|
||||
Range range = make_range(first, one_past_last);
|
||||
String_Const_u8 string = push_buffer_range(app, scratch, buffer, range);
|
||||
if (string.size > 0){
|
||||
clipboard_post(app, clipboard_index, string);
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
return(success);
|
||||
}
|
||||
|
||||
|
@ -25,8 +21,8 @@ CUSTOM_DOC("Copy the text in the range from the cursor to the mark onto the clip
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||
Range range = get_view_range(app, view);
|
||||
post_buffer_range_to_clipboard(app, 0, buffer, range.min, range.max);
|
||||
Range_i64 range = get_view_range(app, view);
|
||||
clipboard_post_buffer_range(app, 0, buffer, range);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(cut)
|
||||
|
@ -34,9 +30,9 @@ CUSTOM_DOC("Cut the text in the range from the cursor to the mark onto the clipb
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
Range range = get_view_range(app, view);
|
||||
if (post_buffer_range_to_clipboard(app, 0, buffer, range.min, range.max)){
|
||||
buffer_replace_range(app, buffer, range, string_u8_litexpr(""));
|
||||
Range_i64 range = get_view_range(app, view);
|
||||
if (clipboard_post_buffer_range(app, 0, buffer, range)){
|
||||
buffer_replace_range(app, buffer, range, string_u8_empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,8 +55,8 @@ CUSTOM_DOC("At the cursor, insert the text at the top of the clipboard.")
|
|||
if (string.size > 0){
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
buffer_replace_range(app, buffer, make_range(pos), string);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
buffer_replace_range(app, buffer, Ii64(pos), string);
|
||||
view_set_mark(app, view, seek_pos(pos));
|
||||
view_set_cursor(app, view, seek_pos(pos + (i32)string.size), true);
|
||||
|
||||
|
@ -68,7 +64,7 @@ CUSTOM_DOC("At the cursor, insert the text at the top of the clipboard.")
|
|||
Theme_Color paste = {};
|
||||
paste.tag = Stag_Paste;
|
||||
get_theme_colors(app, &paste, 1);
|
||||
view_post_fade(app, view, 0.667f, pos, pos + (i32)string.size, paste.color);
|
||||
view_post_fade(app, view, 0.667f, Ii64(pos, pos + string.size), paste.color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,18 +93,17 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste
|
|||
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
|
||||
Range range = get_view_range(app, view);
|
||||
i32 pos = range.min;
|
||||
Range_i64 range = get_view_range(app, view);
|
||||
i64 pos = range.min;
|
||||
|
||||
buffer_replace_range(app, buffer, range, string);
|
||||
view_set_cursor(app, view, seek_pos(pos + (i32)string.size), true);
|
||||
view_set_cursor(app, view, seek_pos(pos + string.size), true);
|
||||
|
||||
// TODO(allen): Send this to all views.
|
||||
Theme_Color paste = {};
|
||||
paste.tag = Stag_Paste;
|
||||
get_theme_colors(app, &paste, 1);
|
||||
view_post_fade(app, view, 0.667f, pos, pos + (i32)string.size, paste.color);
|
||||
|
||||
view_post_fade(app, view, 0.667f, Ii64(pos, pos + string.size), paste.color);
|
||||
}
|
||||
else{
|
||||
exec_command(app, paste);
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
static void
|
||||
write_string(Application_Links *app, View_ID view, Buffer_ID buffer, String_Const_u8 string){
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
buffer_replace_range(app, buffer, make_range(pos), string);
|
||||
view_set_cursor(app, view, seek_pos(pos + (i32)string.size), 1);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
buffer_replace_range(app, buffer, Ii64(pos), string);
|
||||
view_set_cursor(app, view, seek_pos(pos + string.size), true);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -36,8 +36,8 @@ static void
|
|||
long_braces(Application_Links *app, char *text, i32 size){
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
buffer_replace_range(app, buffer, make_range(pos), SCu8(text, size));
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
buffer_replace_range(app, buffer, Ii64(pos), SCu8(text, size));
|
||||
view_set_cursor(app, view, seek_pos(pos + 2), true);
|
||||
buffer_auto_indent(app, buffer, pos, pos + size, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens);
|
||||
move_past_lead_whitespace(app, view, buffer);
|
||||
|
@ -103,19 +103,19 @@ CUSTOM_DOC("At the cursor, insert a ' = {};'.")
|
|||
write_string(app, string_u8_litexpr(" = {};"));
|
||||
}
|
||||
|
||||
static i32
|
||||
static i64
|
||||
get_start_of_line_at_cursor(Application_Links *app, View_ID view, Buffer_ID buffer){
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i32 line = get_line_number_from_pos(app, buffer, pos);
|
||||
pos = get_line_side_pos(app, buffer, line, Side_Min);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
i64 line = get_line_number_from_pos(app, buffer, pos);
|
||||
pos = get_pos_past_lead_whitespace_from_line_number(app, buffer, line);
|
||||
return(pos);
|
||||
}
|
||||
|
||||
static b32
|
||||
c_line_comment_starts_at_position(Application_Links *app, Buffer_ID buffer, i32 pos){
|
||||
c_line_comment_starts_at_position(Application_Links *app, Buffer_ID buffer, i64 pos){
|
||||
b32 alread_has_comment = false;
|
||||
char check_buffer[2];
|
||||
if (buffer_read_range(app, buffer, pos, pos + 2, check_buffer)){
|
||||
if (buffer_read_range(app, buffer, Ii64(pos, pos + 2), check_buffer)){
|
||||
if (check_buffer[0] == '/' && check_buffer[1] == '/'){
|
||||
alread_has_comment = true;
|
||||
}
|
||||
|
@ -128,10 +128,10 @@ CUSTOM_DOC("Insert '//' at the beginning of the line after leading whitespace.")
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 pos = get_start_of_line_at_cursor(app, view, buffer);
|
||||
i64 pos = get_start_of_line_at_cursor(app, view, buffer);
|
||||
b32 alread_has_comment = c_line_comment_starts_at_position(app, buffer, pos);
|
||||
if (!alread_has_comment){
|
||||
buffer_replace_range(app, buffer, make_range(pos), string_u8_litexpr("//"));
|
||||
buffer_replace_range(app, buffer, Ii64(pos), string_u8_litexpr("//"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,10 +140,10 @@ CUSTOM_DOC("If present, delete '//' at the beginning of the line after leading w
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 pos = get_start_of_line_at_cursor(app, view, buffer);
|
||||
i64 pos = get_start_of_line_at_cursor(app, view, buffer);
|
||||
b32 alread_has_comment = c_line_comment_starts_at_position(app, buffer, pos);
|
||||
if (alread_has_comment){
|
||||
buffer_replace_range(app, buffer, make_range(pos, pos + 2), string_u8_litexpr(""));
|
||||
buffer_replace_range(app, buffer, Ii64(pos, pos + 2), string_u8_empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,13 +152,13 @@ CUSTOM_DOC("Turns uncommented lines into commented lines and vice versa for comm
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 pos = get_start_of_line_at_cursor(app, view, buffer);
|
||||
i64 pos = get_start_of_line_at_cursor(app, view, buffer);
|
||||
b32 alread_has_comment = c_line_comment_starts_at_position(app, buffer, pos);
|
||||
if (alread_has_comment){
|
||||
buffer_replace_range(app, buffer, make_range(pos, pos + 2), string_u8_litexpr(""));
|
||||
buffer_replace_range(app, buffer, Ii64(pos, pos + 2), string_u8_empty);
|
||||
}
|
||||
else{
|
||||
buffer_replace_range(app, buffer, make_range(pos), string_u8_litexpr("//"));
|
||||
buffer_replace_range(app, buffer, Ii64(pos), string_u8_litexpr("//"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,8 +202,8 @@ activate_snippet(Application_Links *app, Heap *heap, View_ID view, struct Lister
|
|||
Snippet snippet = snippets.snippets[index];
|
||||
lister_default(app, heap, view, state, ListerActivation_Finished);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
buffer_replace_range(app, buffer, make_range(pos), SCu8(snippet.text));
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
buffer_replace_range(app, buffer, Ii64(pos), SCu8(snippet.text));
|
||||
view_set_cursor(app, view, seek_pos(pos + snippet.cursor_offset), true);
|
||||
view_set_mark(app, view, seek_pos(pos + snippet.mark_offset));
|
||||
}
|
||||
|
|
|
@ -256,10 +256,8 @@ create_or_switch_to_buffer_and_clear_by_name(Application_Links *app, String_Cons
|
|||
}
|
||||
view_set_active(app, target_view);
|
||||
|
||||
i32 buffer_size = (i32)buffer_get_size(app, search_buffer);
|
||||
|
||||
clear_buffer(app, search_buffer);
|
||||
buffer_send_end_signal(app, search_buffer);
|
||||
buffer_replace_range(app, search_buffer, make_range(0, buffer_size), string_u8_litexpr(""));
|
||||
}
|
||||
else{
|
||||
search_buffer = create_buffer(app, name_string, BufferCreate_AlwaysNew);
|
||||
|
|
|
@ -103,7 +103,7 @@ COMMAND_CALLER_HOOK(default_command_caller){
|
|||
u64 val = 0;
|
||||
if (managed_variable_get(app, scope_it, view_snap_mark_to_cursor, &val)){
|
||||
if (val != 0){
|
||||
i32 pos = view_get_cursor_pos(app, view_it);
|
||||
i64 pos = view_get_cursor_pos(app, view_it);
|
||||
view_set_mark(app, view_it, seek_pos(pos));
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ COMMAND_CALLER_HOOK(default_command_caller){
|
|||
|
||||
struct Highlight_Record{
|
||||
Highlight_Record *next;
|
||||
Range range;
|
||||
Range_i64 range;
|
||||
int_color color;
|
||||
};
|
||||
|
||||
|
@ -140,13 +140,13 @@ sort_highlight_record(Highlight_Record *records, i32 first, i32 one_past_last){
|
|||
}
|
||||
}
|
||||
|
||||
static Range_Array
|
||||
get_enclosure_ranges(Application_Links *app, Arena *arena, Buffer_ID buffer, i32 pos, u32 flags){
|
||||
Range_Array array = {};
|
||||
static Range_i64_Array
|
||||
get_enclosure_ranges(Application_Links *app, Arena *arena, Buffer_ID buffer, i64 pos, u32 flags){
|
||||
Range_i64_Array array = {};
|
||||
i32 max = 100;
|
||||
array.ranges = push_array(arena, Range, max);
|
||||
array.ranges = push_array(arena, Range_i64, max);
|
||||
for (;;){
|
||||
Range range = {};
|
||||
Range_i64 range = {};
|
||||
if (find_scope_range(app, buffer, pos, &range, flags)){
|
||||
array.ranges[array.count] = range;
|
||||
array.count += 1;
|
||||
|
@ -163,22 +163,22 @@ get_enclosure_ranges(Application_Links *app, Arena *arena, Buffer_ID buffer, i32
|
|||
}
|
||||
|
||||
static void
|
||||
mark_enclosures(Application_Links *app, Managed_Scope render_scope, Buffer_ID buffer, i32 pos, u32 flags,
|
||||
mark_enclosures(Application_Links *app, Managed_Scope render_scope, Buffer_ID buffer, i64 pos, u32 flags,
|
||||
Marker_Visual_Type type, int_color *back_colors, int_color *fore_colors, i32 color_count){
|
||||
Arena *scratch = context_get_arena(app);
|
||||
Temp_Memory temp = begin_temp(scratch);
|
||||
Range_Array ranges = get_enclosure_ranges(app, scratch, buffer, pos, flags);
|
||||
Range_i64_Array ranges = get_enclosure_ranges(app, scratch, buffer, pos, flags);
|
||||
|
||||
if (ranges.count > 0){
|
||||
i32 marker_count = ranges.count*2;
|
||||
Marker *markers = push_array(scratch, Marker, marker_count);
|
||||
Marker *marker = markers;
|
||||
Range *range = ranges.ranges;
|
||||
Range_i64 *range = ranges.ranges;
|
||||
for (i32 i = 0;
|
||||
i < ranges.count;
|
||||
i += 1, range += 1, marker += 2){
|
||||
marker[0].pos = range->first;
|
||||
marker[1].pos = range->one_past_last - 1;
|
||||
marker[0].pos = (i32)range->first;
|
||||
marker[1].pos = (i32)range->one_past_last - 1;
|
||||
}
|
||||
Managed_Object o = alloc_buffer_markers_on_buffer(app, buffer, marker_count, &render_scope);
|
||||
managed_object_store_data(app, o, 0, marker_count, markers);
|
||||
|
@ -324,7 +324,7 @@ buffer_position_from_scroll_position(Application_Links *app, View_ID view_id, Ve
|
|||
return(result);
|
||||
}
|
||||
|
||||
static i32
|
||||
static i64
|
||||
abs_position_from_buffer_point(Application_Links *app, View_ID view_id, Buffer_Point buffer_point){
|
||||
Full_Cursor cursor = view_compute_cursor(app, view_id, seek_line_char(buffer_point.line_number, 0));
|
||||
Buffer_Seek seek = seek_wrapped_xy(buffer_point.pixel_shift.x,
|
||||
|
@ -352,8 +352,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
|||
|
||||
Buffer_Point buffer_point = buffer_position_from_scroll_position(app, view_id, scroll.scroll_p);
|
||||
Text_Layout_ID text_layout_id = compute_render_layout(app, view_id, buffer, buffer_rect.p0, rect_dim(buffer_rect), buffer_point, max_i32);
|
||||
Range on_screen_range = {};
|
||||
text_layout_get_on_screen_range(app, text_layout_id, &on_screen_range);
|
||||
Range_i64 on_screen_range = text_layout_get_on_screen_range(app, text_layout_id);
|
||||
text_layout_free(app, text_layout_id);
|
||||
|
||||
View_ID active_view = get_active_view(app, AccessAll);
|
||||
|
@ -387,13 +386,13 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
|||
|
||||
Temp_Memory temp = begin_temp(scratch);
|
||||
|
||||
i32 cursor_position = view_get_cursor_pos(app, view_id);
|
||||
i64 cursor_position = view_get_cursor_pos(app, view_id);
|
||||
Full_Cursor cursor = view_compute_cursor(app, view_id, seek_pos(cursor_position));
|
||||
|
||||
Fancy_String_List list = {};
|
||||
String_Const_u8 unique_name = push_buffer_unique_name(app, scratch, buffer);
|
||||
push_fancy_string(scratch, &list, base_color, unique_name);
|
||||
push_fancy_stringf(scratch, &list, base_color, " - Row: %3.d Col: %3.d -", cursor.line, cursor.character);
|
||||
push_fancy_stringf(scratch, &list, base_color, " - Row: %3.lld Col: %3.lld -", cursor.line, cursor.character);
|
||||
|
||||
b32 is_dos_mode = false;
|
||||
if (buffer_get_setting(app, buffer, BufferSetting_Eol, &is_dos_mode)){
|
||||
|
@ -475,7 +474,11 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
|||
r_cursor.x0 = left_margin.x1;
|
||||
|
||||
draw_rectangle(app, left_margin, Stag_Line_Numbers_Back);
|
||||
draw_clip_push(app, left_margin);
|
||||
|
||||
Rect_f32 clip_region = left_margin;
|
||||
clip_region.p0 += view_inner_rect.p0;
|
||||
clip_region.p1 += view_inner_rect.p0;
|
||||
draw_clip_push(app, clip_region);
|
||||
|
||||
Fancy_Color line_color = fancy_id(Stag_Line_Numbers_Text);
|
||||
|
||||
|
@ -483,13 +486,12 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
|||
GUI_Scroll_Vars scroll_vars = view_get_scroll_vars(app, view_id);
|
||||
for (;cursor.pos <= on_screen_range.one_past_last;){
|
||||
Vec2 p = panel_space_from_view_space(cursor.wrapped_p, scroll_vars.scroll_p);
|
||||
p += V2(buffer_rect.p0);
|
||||
p.x = left_margin.x0;
|
||||
Temp_Memory temp = begin_temp(scratch);
|
||||
Fancy_String *line_string = push_fancy_stringf(scratch, line_color, "%*d", line_count_digit_count, cursor.line);
|
||||
Fancy_String *line_string = push_fancy_stringf(scratch, line_color, "%*lld", line_count_digit_count, cursor.line);
|
||||
draw_fancy_string(app, face_id, line_string, p, Stag_Margin_Active, 0);
|
||||
end_temp(temp);
|
||||
i32 next_line = cursor.line + 1;
|
||||
i64 next_line = cursor.line + 1;
|
||||
cursor = view_compute_cursor(app, view_id, seek_line_char(next_line, 1));
|
||||
if (cursor.line < next_line){
|
||||
break;
|
||||
|
@ -550,8 +552,8 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
|||
int_color current_color = records[0].color;
|
||||
{
|
||||
Marker *marker = &markers[marker_index];
|
||||
marker[0].pos = records[0].range.first;
|
||||
marker[1].pos = records[0].range.one_past_last;
|
||||
marker[0].pos = (i32)records[0].range.first;
|
||||
marker[1].pos = (i32)records[0].range.one_past_last;
|
||||
marker_index += 2;
|
||||
}
|
||||
for (i32 i = 1; i <= record_count; i += 1){
|
||||
|
@ -568,8 +570,8 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
|||
}
|
||||
if (i < record_count){
|
||||
Marker *marker = &markers[marker_index];
|
||||
marker[0].pos = records[i].range.first;
|
||||
marker[1].pos = records[i].range.one_past_last;
|
||||
marker[0].pos = (i32)records[i].range.first;
|
||||
marker[1].pos = (i32)records[i].range.one_past_last;
|
||||
marker_index += 2;
|
||||
}
|
||||
}
|
||||
|
@ -579,13 +581,13 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
|||
}
|
||||
|
||||
// NOTE(allen): Cursor and mark
|
||||
i32 cursor_pos = view_get_cursor_pos(app, view_id);
|
||||
i32 mark_pos = view_get_mark_pos(app, view_id);
|
||||
i64 cursor_pos = view_get_cursor_pos(app, view_id);
|
||||
i64 mark_pos = view_get_mark_pos(app, view_id);
|
||||
|
||||
Managed_Object cursor_and_mark = alloc_buffer_markers_on_buffer(app, buffer, 2, &render_scope);
|
||||
Marker cm_markers[2] = {};
|
||||
cm_markers[0].pos = cursor_pos;
|
||||
cm_markers[1].pos = mark_pos;
|
||||
cm_markers[0].pos = (i32)cursor_pos;
|
||||
cm_markers[1].pos = (i32)mark_pos;
|
||||
managed_object_store_data(app, cursor_and_mark, 0, 2, cm_markers);
|
||||
|
||||
b32 cursor_is_hidden_in_this_view = (cursor_is_hidden && is_active_view);
|
||||
|
@ -662,12 +664,12 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
|||
|
||||
Temp_Memory temp = begin_temp(scratch);
|
||||
Boundary_Function_List funcs = push_boundary_list(scratch, boundary_token, boundary_non_whitespace);
|
||||
Range snipe_range = get_snipe_range(app, funcs, buffer, cursor_pos, Scan_Backward);
|
||||
Range_i64 snipe_range = get_snipe_range(app, funcs, buffer, cursor_pos, Scan_Backward);
|
||||
if (range_size(snipe_range) > 0){
|
||||
Managed_Object token_highlight = alloc_buffer_markers_on_buffer(app, buffer, 2, &render_scope);
|
||||
Marker range_markers[2] = {};
|
||||
range_markers[0].pos = snipe_range.min;
|
||||
range_markers[1].pos = snipe_range.max;
|
||||
range_markers[0].pos = (i32)snipe_range.min;
|
||||
range_markers[1].pos = (i32)snipe_range.max;
|
||||
managed_object_store_data(app, token_highlight, 0, 2, range_markers);
|
||||
Marker_Visual visual = create_marker_visual(app, token_highlight);
|
||||
marker_visual_set_effect(app, visual, VisualType_CharacterHighlightRanges, token_color, Stag_At_Highlight, 0);
|
||||
|
@ -685,7 +687,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
|||
mark_enclosures(app, render_scope, buffer, cursor_pos, FindScope_Brace, VisualType_LineHighlightRanges, colors, 0, color_count);
|
||||
}
|
||||
if (do_matching_paren_highlight){
|
||||
i32 pos = cursor_pos;
|
||||
i64 pos = cursor_pos;
|
||||
if (buffer_get_char(app, buffer, pos) == '('){
|
||||
pos += 1;
|
||||
}
|
||||
|
|
|
@ -20,16 +20,16 @@ get_line_y(Application_Links *app, View_ID view, i32 line){
|
|||
|
||||
static Rect_i32
|
||||
get_line_x_rect(Application_Links *app, View_ID view){
|
||||
i32 cursor_pos = view_get_cursor_pos(app, view);
|
||||
i64 cursor_pos = view_get_cursor_pos(app, view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(cursor_pos));
|
||||
i32 mark_pos = view_get_mark_pos(app, view);
|
||||
i64 mark_pos = view_get_mark_pos(app, view);
|
||||
Full_Cursor mark = view_compute_cursor(app, view, seek_pos(mark_pos));
|
||||
|
||||
Rect_i32 rect = {};
|
||||
rect.x0 = (i32)mark.wrapped_x;
|
||||
rect.x1 = (i32)cursor.wrapped_x;
|
||||
rect.y0 = mark.line;
|
||||
rect.y1 = cursor.line;
|
||||
rect.y0 = (i32)mark.line;
|
||||
rect.y1 = (i32)cursor.line;
|
||||
|
||||
if (rect.y0 > rect.y1){
|
||||
Swap(i32, rect.y0, rect.y1);
|
||||
|
@ -53,28 +53,28 @@ CUSTOM_DOC("Delete characters in a rectangular region. Range testing is done by
|
|||
f32 y = get_line_y(app, view, line);
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_wrapped_xy((f32)rect.x0, y, 0));
|
||||
if (cursor.line > 0){
|
||||
i32 start = cursor.pos;
|
||||
i64 start = cursor.pos;
|
||||
cursor = view_compute_cursor(app, view, seek_wrapped_xy((f32)rect.x1, y, 0));
|
||||
if (cursor.line > 0){
|
||||
i32 end = cursor.pos;
|
||||
buffer_replace_range(app, buffer, make_range(start, end), string_u8_litexpr(""));
|
||||
i64 end = cursor.pos;
|
||||
buffer_replace_range(app, buffer, Ii64(start, end), string_u8_empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pad_buffer_line(Application_Links *app, Buffer_ID buffer, i32 line, char padchar, i32 target){
|
||||
pad_buffer_line(Application_Links *app, Buffer_ID buffer, i64 line, char padchar, i64 target){
|
||||
Partial_Cursor start = buffer_compute_cursor(app, buffer, seek_line_char(line, 1));
|
||||
if (start.line == line){
|
||||
Partial_Cursor end = buffer_compute_cursor(app, buffer, seek_line_char(line, 65536));
|
||||
if (end.line == line){
|
||||
if (end.character - 1 < target){
|
||||
Scratch_Block scratch(app);
|
||||
i32 size = target - (end.character - 1);
|
||||
i64 size = target - (end.character - 1);
|
||||
char *str = push_array(scratch, char, size);
|
||||
block_fill_u8(str, size, ' ');
|
||||
buffer_replace_range(app, buffer, make_range(end.pos), SCu8(str, size));
|
||||
buffer_replace_range(app, buffer, Ii64(end.pos), SCu8(str, size));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,10 +116,10 @@ doing multi-cursor for now.
|
|||
*/
|
||||
|
||||
struct Buffer_Rect{
|
||||
i32 char0;
|
||||
i32 line0;
|
||||
i32 char1;
|
||||
i32 line1;
|
||||
i64 char0;
|
||||
i64 line0;
|
||||
i64 char1;
|
||||
i64 line1;
|
||||
};
|
||||
|
||||
CUSTOM_COMMAND_SIG(multi_line_edit)
|
||||
|
@ -128,9 +128,9 @@ CUSTOM_DOC("Begin multi-line mode. In multi-line mode characters are inserted a
|
|||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
|
||||
i32 cursor_pos = view_get_cursor_pos(app, view);
|
||||
i64 cursor_pos = view_get_cursor_pos(app, view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(cursor_pos));
|
||||
i32 mark_pos = view_get_mark_pos(app, view);
|
||||
i64 mark_pos = view_get_mark_pos(app, view);
|
||||
Full_Cursor mark = view_compute_cursor(app, view, seek_pos(mark_pos));
|
||||
Buffer_Rect rect = {};
|
||||
rect.char0 = mark.character;
|
||||
|
@ -138,20 +138,20 @@ CUSTOM_DOC("Begin multi-line mode. In multi-line mode characters are inserted a
|
|||
rect.char1 = cursor.character;
|
||||
rect.line1 = cursor.line;
|
||||
if (rect.line0 > rect.line1){
|
||||
Swap(i32, rect.line0, rect.line1);
|
||||
Swap(i64, rect.line0, rect.line1);
|
||||
}
|
||||
if (rect.char0 > rect.char1){
|
||||
Swap(i32, rect.char0, rect.char1);
|
||||
Swap(i64, rect.char0, rect.char1);
|
||||
}
|
||||
|
||||
i32 start_line = cursor.line;
|
||||
i32 pos = cursor.character - 1;
|
||||
i64 start_line = cursor.line;
|
||||
i64 pos = cursor.character - 1;
|
||||
|
||||
for (i32 i = rect.line0; i <= rect.line1; ++i){
|
||||
for (i64 i = rect.line0; i <= rect.line1; ++i){
|
||||
pad_buffer_line(app, buffer, i, ' ', pos);
|
||||
}
|
||||
|
||||
i32 line_count = rect.line1 - rect.line0 + 1;
|
||||
i64 line_count = rect.line1 - rect.line0 + 1;
|
||||
|
||||
for (;;){
|
||||
User_Input in = get_user_input(app, EventOnAnyKey, EventOnEsc|EventOnMouseLeftButton|EventOnMouseRightButton);
|
||||
|
@ -164,7 +164,7 @@ CUSTOM_DOC("Begin multi-line mode. In multi-line mode characters are inserted a
|
|||
Buffer_Edit *edits = push_array(scratch, Buffer_Edit, line_count);
|
||||
Buffer_Edit *edit = edits;
|
||||
|
||||
for (i32 i = rect.line0; i <= rect.line1; ++i){
|
||||
for (i64 i = rect.line0; i <= rect.line1; ++i){
|
||||
Partial_Cursor partial_cursor = buffer_compute_cursor(app, buffer, seek_line_char(i, pos + 1));
|
||||
if (partial_cursor.line > 0){
|
||||
edit->str_start = 0;
|
||||
|
@ -188,7 +188,7 @@ CUSTOM_DOC("Begin multi-line mode. In multi-line mode characters are inserted a
|
|||
Buffer_Edit *edits = push_array(scratch, Buffer_Edit, line_count);
|
||||
Buffer_Edit *edit = edits;
|
||||
|
||||
for (i32 i = rect.line0; i <= rect.line1; ++i){
|
||||
for (i64 i = rect.line0; i <= rect.line1; ++i){
|
||||
Partial_Cursor partial_cursor = buffer_compute_cursor(app, buffer, seek_line_char(i, pos + 1));
|
||||
if (partial_cursor.line > 0){
|
||||
edit->str_start = 0;
|
||||
|
@ -235,16 +235,16 @@ CUSTOM_COMMAND_SIG(multi_paste){
|
|||
String_Const_u8 insert_string = push_u8_stringf(scratch, "\n%.*s", string_expand(string));
|
||||
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
Range range = get_view_range(app, view);
|
||||
buffer_replace_range(app, buffer, make_range(range.max), insert_string);
|
||||
Range_i64 range = get_view_range(app, view);
|
||||
buffer_replace_range(app, buffer, Ii64(range.max), insert_string);
|
||||
view_set_mark(app, view, seek_pos(range.max + 1));
|
||||
view_set_cursor(app, view, seek_pos((i32)(range.max + insert_string.size)), true);
|
||||
view_set_cursor(app, view, seek_pos(range.max + insert_string.size), true);
|
||||
|
||||
// TODO(allen): Send this to all views.
|
||||
Theme_Color paste = {};
|
||||
paste.tag = Stag_Paste;
|
||||
get_theme_colors(app, &paste, 1);
|
||||
view_post_fade(app, view, 0.667f, range.max + 1, (i32)(range.max + insert_string.size), paste.color);
|
||||
view_post_fade(app, view, 0.667f, Ii64(range.max + 1, range.max + insert_string.size), paste.color);
|
||||
}
|
||||
else{
|
||||
paste(app);
|
||||
|
@ -252,11 +252,11 @@ CUSTOM_COMMAND_SIG(multi_paste){
|
|||
}
|
||||
}
|
||||
|
||||
static Range
|
||||
multi_paste_range(Application_Links *app, View_ID view, Range range, i32 paste_count, b32 old_to_new){
|
||||
static Range_i64
|
||||
multi_paste_range(Application_Links *app, View_ID view, Range_i64 range, i32 paste_count, b32 old_to_new){
|
||||
Scratch_Block scratch(app);
|
||||
|
||||
Range finish_range = range;
|
||||
Range_i64 finish_range = range;
|
||||
if (paste_count >= 1){
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
if (buffer != 0){
|
||||
|
@ -290,8 +290,8 @@ multi_paste_range(Application_Links *app, View_ID view, Range range, i32 paste_c
|
|||
|
||||
String_Const_u8 flattened = string_list_flatten(scratch, list);
|
||||
|
||||
i32 pos = range.min;
|
||||
buffer_replace_range(app, buffer, range, flattened);
|
||||
i64 pos = range.min;
|
||||
finish_range.min = pos;
|
||||
finish_range.max = pos + total_size;
|
||||
view_set_mark(app, view, seek_pos(finish_range.min));
|
||||
|
@ -301,7 +301,7 @@ multi_paste_range(Application_Links *app, View_ID view, Range range, i32 paste_c
|
|||
Theme_Color paste;
|
||||
paste.tag = Stag_Paste;
|
||||
get_theme_colors(app, &paste, 1);
|
||||
view_post_fade(app, view, 0.667f, finish_range.min, finish_range.max, paste.color);
|
||||
view_post_fade(app, view, 0.667f, finish_range, paste.color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -311,13 +311,9 @@ multi_paste_range(Application_Links *app, View_ID view, Range range, i32 paste_c
|
|||
static void
|
||||
multi_paste_interactive_up_down(Application_Links *app, i32 paste_count, i32 clip_count){
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
|
||||
Range range = make_range(pos);;
|
||||
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
b32 old_to_new = true;
|
||||
|
||||
range = multi_paste_range(app, view, range, paste_count, old_to_new);
|
||||
Range_i64 range = multi_paste_range(app, view, Ii64(pos), paste_count, old_to_new);
|
||||
|
||||
Query_Bar bar = {};
|
||||
bar.prompt = string_u8_litexpr("Up and Down to condense and expand paste stages; R to reverse order; Return to finish; Escape to abort.");
|
||||
|
@ -392,7 +388,7 @@ CUSTOM_DOC("If the cursor is found to be on the name of a function parameter in
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 cursor_pos = view_get_cursor_pos(app, view);
|
||||
i64 cursor_pos = view_get_cursor_pos(app, view);
|
||||
|
||||
Arena *scratch = context_get_arena(app);
|
||||
Temp_Memory temp = begin_temp(scratch);
|
||||
|
@ -539,7 +535,7 @@ write_explicit_enum_values_parameters(Application_Links *app, Write_Explicit_Enu
|
|||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
|
||||
Arena *scratch = context_get_arena(app);
|
||||
Temp_Memory temp = begin_temp(scratch);
|
||||
|
@ -746,8 +742,8 @@ replace_all_occurrences_parameters(Application_Links *app, Heap *heap, String_Co
|
|||
}
|
||||
|
||||
// Use replacement list to do replacements
|
||||
imem shift_per_replacement = new_string.size - target_string.size;
|
||||
imem current_offset = 0;
|
||||
i64 shift_per_replacement = new_string.size - target_string.size;
|
||||
i64 current_offset = 0;
|
||||
Buffer_ID current_buffer_id = 0;
|
||||
for (Replace_Target *target = target_first;
|
||||
target != 0;
|
||||
|
@ -756,8 +752,8 @@ replace_all_occurrences_parameters(Application_Links *app, Heap *heap, String_Co
|
|||
current_buffer_id = target->buffer_id;
|
||||
current_offset = 0;
|
||||
}
|
||||
i32 pos = target->start_pos + (i32)current_offset;
|
||||
buffer_replace_range(app, target->buffer_id, make_range(pos, pos + (i32)target_string.size), new_string);
|
||||
i64 pos = target->start_pos + current_offset;
|
||||
buffer_replace_range(app, target->buffer_id, Ii64(pos, pos + target_string.size), new_string);
|
||||
current_offset += shift_per_replacement;
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ push_fancy_string(Arena *arena, String_Const_u8 value){
|
|||
|
||||
static Fancy_String*
|
||||
push_fancy_stringfv(Arena *arena, Fancy_String_List *list, Fancy_Color fore, Fancy_Color back, char *format, va_list args){
|
||||
String_Const_u8 str = push_u8_stringf(arena, format, args);
|
||||
String_Const_u8 str = push_u8_stringfv(arena, format, args);
|
||||
Fancy_String *result = 0;
|
||||
if (str.size > 0){
|
||||
result = push_fancy_string(arena, list, fore, back, str);
|
||||
|
|
|
@ -154,14 +154,14 @@ print_positions_buffered(Application_Links *app, Buffer_Insertion *out, Function
|
|||
|
||||
i32 start_index = positions->sig_start_index;
|
||||
i32 end_index = positions->sig_end_index;
|
||||
i32 open_paren_pos = positions->open_paren_pos;
|
||||
i32 line_number = get_line_number_from_pos(app, buffer, open_paren_pos);
|
||||
i64 open_paren_pos = positions->open_paren_pos;
|
||||
i64 line_number = get_line_number_from_pos(app, buffer, open_paren_pos);
|
||||
|
||||
Assert(end_index > start_index);
|
||||
|
||||
Token_Range token_range = buffer_get_token_range(app, buffer);
|
||||
if (token_range.first != 0){
|
||||
insertf(out, "%.*s:%d: ", string_expand(buffer_name), line_number);
|
||||
insertf(out, "%.*s:%lld: ", string_expand(buffer_name), line_number);
|
||||
|
||||
Cpp_Token prev_token = {};
|
||||
Token_Iterator token_it = make_token_iterator(token_range, start_index);
|
||||
|
@ -210,9 +210,8 @@ list_all_functions(Application_Links *app, Buffer_ID optional_target_buffer){
|
|||
buffer_set_setting(app, decls_buffer, BufferSetting_WrapLine, false);
|
||||
}
|
||||
else{
|
||||
clear_buffer(app, decls_buffer);
|
||||
buffer_send_end_signal(app, decls_buffer);
|
||||
i32 size = (i32)buffer_get_size(app, decls_buffer);
|
||||
buffer_replace_range(app, decls_buffer, make_range(0, size), string_u8_litexpr(""));
|
||||
}
|
||||
|
||||
Arena *scratch = context_get_arena(app);
|
||||
|
|
|
@ -17,8 +17,8 @@ struct Application_Links;
|
|||
#define GET_BUFFER_NEXT_SIG(n) Buffer_ID n(Application_Links *app, Buffer_ID buffer_id, Access_Flag access)
|
||||
#define GET_BUFFER_BY_NAME_SIG(n) Buffer_ID n(Application_Links *app, String_Const_u8 name, Access_Flag access)
|
||||
#define GET_BUFFER_BY_FILE_NAME_SIG(n) Buffer_ID n(Application_Links *app, String_Const_u8 file_name, Access_Flag access)
|
||||
#define BUFFER_READ_RANGE_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, i32 start, i32 one_past_last, char *out)
|
||||
#define BUFFER_REPLACE_RANGE_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Range range, String_Const_u8 string)
|
||||
#define BUFFER_READ_RANGE_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Range_i64 range, char *out)
|
||||
#define BUFFER_REPLACE_RANGE_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Range_i64 range, String_Const_u8 string)
|
||||
#define BUFFER_BATCH_EDIT_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, char *str, Buffer_Edit *edits, i32 edit_count)
|
||||
#define BUFFER_SEEK_STRING_SIG(n) String_Match n(Application_Links *app, Buffer_ID buffer, String_Const_u8 needle, Scan_Direction direction, i64 start_pos)
|
||||
#define BUFFER_SEEK_CHARACTER_CLASS_SIG(n) String_Match n(Application_Links *app, Buffer_ID buffer, Character_Predicate *predicate, Scan_Direction direction, i64 start_pos)
|
||||
|
@ -26,8 +26,8 @@ struct Application_Links;
|
|||
#define BUFFER_EXISTS_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id)
|
||||
#define BUFFER_READY_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id)
|
||||
#define BUFFER_GET_ACCESS_FLAGS_SIG(n) Access_Flag n(Application_Links *app, Buffer_ID buffer_id)
|
||||
#define BUFFER_GET_SIZE_SIG(n) u64 n(Application_Links *app, Buffer_ID buffer_id)
|
||||
#define BUFFER_GET_LINE_COUNT_SIG(n) u64 n(Application_Links *app, Buffer_ID buffer_id)
|
||||
#define BUFFER_GET_SIZE_SIG(n) i64 n(Application_Links *app, Buffer_ID buffer_id)
|
||||
#define BUFFER_GET_LINE_COUNT_SIG(n) i64 n(Application_Links *app, Buffer_ID buffer_id)
|
||||
#define PUSH_BUFFER_BASE_NAME_SIG(n) String_Const_u8 n(Application_Links *app, Arena *arena, Buffer_ID buffer_id)
|
||||
#define PUSH_BUFFER_UNIQUE_NAME_SIG(n) String_Const_u8 n(Application_Links *app, Arena *out, Buffer_ID buffer_id)
|
||||
#define PUSH_BUFFER_FILE_NAME_SIG(n) String_Const_u8 n(Application_Links *app, Arena *arena, Buffer_ID buffer_id)
|
||||
|
@ -51,8 +51,8 @@ struct Application_Links;
|
|||
#define GET_ACTIVE_PANEL_SIG(n) Panel_ID n(Application_Links *app)
|
||||
#define VIEW_EXISTS_SIG(n) b32 n(Application_Links *app, View_ID view_id)
|
||||
#define VIEW_GET_BUFFER_SIG(n) Buffer_ID n(Application_Links *app, View_ID view_id, Access_Flag access)
|
||||
#define VIEW_GET_CURSOR_POS_SIG(n) i32 n(Application_Links *app, View_ID view_id)
|
||||
#define VIEW_GET_MARK_POS_SIG(n) i32 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_PREFERRED_X_SIG(n) 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)
|
||||
|
@ -78,7 +78,7 @@ struct Application_Links;
|
|||
#define VIEW_SET_SCROLL_SIG(n) b32 n(Application_Links *app, View_ID view_id, GUI_Scroll_Vars scroll)
|
||||
#define VIEW_SET_MARK_SIG(n) b32 n(Application_Links *app, View_ID view_id, Buffer_Seek seek)
|
||||
#define VIEW_SET_BUFFER_SIG(n) b32 n(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Set_Buffer_Flag flags)
|
||||
#define VIEW_POST_FADE_SIG(n) b32 n(Application_Links *app, View_ID view_id, float seconds, i32 start, i32 end, int_color color)
|
||||
#define VIEW_POST_FADE_SIG(n) b32 n(Application_Links *app, View_ID view_id, f32 seconds, Range_i64 range, int_color color)
|
||||
#define VIEW_BEGIN_UI_MODE_SIG(n) b32 n(Application_Links *app, View_ID view_id)
|
||||
#define VIEW_END_UI_MODE_SIG(n) b32 n(Application_Links *app, View_ID view_id)
|
||||
#define VIEW_IS_IN_UI_MODE_SIG(n) b32 n(Application_Links *app, View_ID view_id)
|
||||
|
@ -171,7 +171,7 @@ struct Application_Links;
|
|||
#define TEXT_LAYOUT_GET_BUFFER_SIG(n) b32 n(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID *buffer_id_out)
|
||||
#define TEXT_LAYOUT_BUFFER_POINT_TO_LAYOUT_POINT_SIG(n) b32 n(Application_Links *app, Text_Layout_ID text_layout_id, Vec2 buffer_relative_p, Vec2 *p_out)
|
||||
#define TEXT_LAYOUT_LAYOUT_POINT_TO_BUFFER_POINT_SIG(n) b32 n(Application_Links *app, Text_Layout_ID text_layout_id, Vec2 layout_relative_p, Vec2 *p_out)
|
||||
#define TEXT_LAYOUT_GET_ON_SCREEN_RANGE_SIG(n) b32 n(Application_Links *app, Text_Layout_ID text_layout_id, Range *on_screen_range_out)
|
||||
#define TEXT_LAYOUT_GET_ON_SCREEN_RANGE_SIG(n) Range_i64 n(Application_Links *app, Text_Layout_ID text_layout_id)
|
||||
#define TEXT_LAYOUT_GET_HEIGHT_SIG(n) b32 n(Application_Links *app, Text_Layout_ID text_layout_id, f32 *height_out)
|
||||
#define TEXT_LAYOUT_FREE_SIG(n) b32 n(Application_Links *app, Text_Layout_ID text_layout_id)
|
||||
#define COMPUTE_RENDER_LAYOUT_SIG(n) b32 n(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Vec2 screen_p, Vec2 layout_dim, Buffer_Point buffer_point, i32 one_past_last)
|
||||
|
@ -935,8 +935,8 @@ static i32 get_buffer_count(Application_Links *app){return(app->get_buffer_count
|
|||
static Buffer_ID get_buffer_next(Application_Links *app, Buffer_ID buffer_id, Access_Flag access){return(app->get_buffer_next(app, buffer_id, access));}
|
||||
static Buffer_ID get_buffer_by_name(Application_Links *app, String_Const_u8 name, Access_Flag access){return(app->get_buffer_by_name(app, name, access));}
|
||||
static Buffer_ID get_buffer_by_file_name(Application_Links *app, String_Const_u8 file_name, Access_Flag access){return(app->get_buffer_by_file_name(app, file_name, access));}
|
||||
static b32 buffer_read_range(Application_Links *app, Buffer_ID buffer_id, i32 start, i32 one_past_last, char *out){return(app->buffer_read_range(app, buffer_id, start, one_past_last, out));}
|
||||
static b32 buffer_replace_range(Application_Links *app, Buffer_ID buffer_id, Range range, String_Const_u8 string){return(app->buffer_replace_range(app, buffer_id, range, string));}
|
||||
static b32 buffer_read_range(Application_Links *app, Buffer_ID buffer_id, Range_i64 range, char *out){return(app->buffer_read_range(app, buffer_id, range, out));}
|
||||
static b32 buffer_replace_range(Application_Links *app, Buffer_ID buffer_id, Range_i64 range, String_Const_u8 string){return(app->buffer_replace_range(app, buffer_id, range, string));}
|
||||
static b32 buffer_batch_edit(Application_Links *app, Buffer_ID buffer_id, char *str, Buffer_Edit *edits, i32 edit_count){return(app->buffer_batch_edit(app, buffer_id, str, edits, edit_count));}
|
||||
static String_Match buffer_seek_string(Application_Links *app, Buffer_ID buffer, String_Const_u8 needle, Scan_Direction direction, i64 start_pos){return(app->buffer_seek_string(app, buffer, needle, direction, start_pos));}
|
||||
static String_Match buffer_seek_character_class(Application_Links *app, Buffer_ID buffer, Character_Predicate *predicate, Scan_Direction direction, i64 start_pos){return(app->buffer_seek_character_class(app, buffer, predicate, direction, start_pos));}
|
||||
|
@ -944,8 +944,8 @@ static Partial_Cursor buffer_compute_cursor(Application_Links *app, Buffer_ID bu
|
|||
static b32 buffer_exists(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_exists(app, buffer_id));}
|
||||
static b32 buffer_ready(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_ready(app, buffer_id));}
|
||||
static Access_Flag buffer_get_access_flags(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_access_flags(app, buffer_id));}
|
||||
static u64 buffer_get_size(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_size(app, buffer_id));}
|
||||
static u64 buffer_get_line_count(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_line_count(app, buffer_id));}
|
||||
static i64 buffer_get_size(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_size(app, buffer_id));}
|
||||
static i64 buffer_get_line_count(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_line_count(app, buffer_id));}
|
||||
static String_Const_u8 push_buffer_base_name(Application_Links *app, Arena *arena, Buffer_ID buffer_id){return(app->push_buffer_base_name(app, arena, buffer_id));}
|
||||
static String_Const_u8 push_buffer_unique_name(Application_Links *app, Arena *out, Buffer_ID buffer_id){return(app->push_buffer_unique_name(app, out, buffer_id));}
|
||||
static String_Const_u8 push_buffer_file_name(Application_Links *app, Arena *arena, Buffer_ID buffer_id){return(app->push_buffer_file_name(app, arena, buffer_id));}
|
||||
|
@ -969,8 +969,8 @@ static View_ID get_active_view(Application_Links *app, Access_Flag access){retur
|
|||
static Panel_ID get_active_panel(Application_Links *app){return(app->get_active_panel(app));}
|
||||
static b32 view_exists(Application_Links *app, View_ID view_id){return(app->view_exists(app, view_id));}
|
||||
static Buffer_ID view_get_buffer(Application_Links *app, View_ID view_id, Access_Flag access){return(app->view_get_buffer(app, view_id, access));}
|
||||
static i32 view_get_cursor_pos(Application_Links *app, View_ID view_id){return(app->view_get_cursor_pos(app, view_id));}
|
||||
static i32 view_get_mark_pos(Application_Links *app, View_ID view_id){return(app->view_get_mark_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 f32 view_get_preferred_x(Application_Links *app, View_ID view_id){return(app->view_get_preferred_x(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));}
|
||||
|
@ -996,7 +996,7 @@ static b32 view_set_cursor(Application_Links *app, View_ID view_id, Buffer_Seek
|
|||
static b32 view_set_scroll(Application_Links *app, View_ID view_id, GUI_Scroll_Vars scroll){return(app->view_set_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_buffer(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Set_Buffer_Flag flags){return(app->view_set_buffer(app, view_id, buffer_id, flags));}
|
||||
static b32 view_post_fade(Application_Links *app, View_ID view_id, float seconds, i32 start, i32 end, int_color color){return(app->view_post_fade(app, view_id, seconds, start, end, color));}
|
||||
static b32 view_post_fade(Application_Links *app, View_ID view_id, f32 seconds, Range_i64 range, int_color color){return(app->view_post_fade(app, view_id, seconds, range, color));}
|
||||
static b32 view_begin_ui_mode(Application_Links *app, View_ID view_id){return(app->view_begin_ui_mode(app, view_id));}
|
||||
static b32 view_end_ui_mode(Application_Links *app, View_ID view_id){return(app->view_end_ui_mode(app, view_id));}
|
||||
static b32 view_is_in_ui_mode(Application_Links *app, View_ID view_id){return(app->view_is_in_ui_mode(app, view_id));}
|
||||
|
@ -1089,7 +1089,7 @@ static Vec2 draw_coordinate_center_pop(Application_Links *app){return(app->draw_
|
|||
static b32 text_layout_get_buffer(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID *buffer_id_out){return(app->text_layout_get_buffer(app, text_layout_id, buffer_id_out));}
|
||||
static b32 text_layout_buffer_point_to_layout_point(Application_Links *app, Text_Layout_ID text_layout_id, Vec2 buffer_relative_p, Vec2 *p_out){return(app->text_layout_buffer_point_to_layout_point(app, text_layout_id, buffer_relative_p, p_out));}
|
||||
static b32 text_layout_layout_point_to_buffer_point(Application_Links *app, Text_Layout_ID text_layout_id, Vec2 layout_relative_p, Vec2 *p_out){return(app->text_layout_layout_point_to_buffer_point(app, text_layout_id, layout_relative_p, p_out));}
|
||||
static b32 text_layout_get_on_screen_range(Application_Links *app, Text_Layout_ID text_layout_id, Range *on_screen_range_out){return(app->text_layout_get_on_screen_range(app, text_layout_id, on_screen_range_out));}
|
||||
static Range_i64 text_layout_get_on_screen_range(Application_Links *app, Text_Layout_ID text_layout_id){return(app->text_layout_get_on_screen_range(app, text_layout_id));}
|
||||
static b32 text_layout_get_height(Application_Links *app, Text_Layout_ID text_layout_id, f32 *height_out){return(app->text_layout_get_height(app, text_layout_id, height_out));}
|
||||
static b32 text_layout_free(Application_Links *app, Text_Layout_ID text_layout_id){return(app->text_layout_free(app, text_layout_id));}
|
||||
static b32 compute_render_layout(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Vec2 screen_p, Vec2 layout_dim, Buffer_Point buffer_point, i32 one_past_last){return(app->compute_render_layout(app, view_id, buffer_id, screen_p, layout_dim, buffer_point, one_past_last));}
|
||||
|
@ -1117,8 +1117,8 @@ static i32 get_buffer_count(Application_Links *app){return(app->get_buffer_count
|
|||
static Buffer_ID get_buffer_next(Application_Links *app, Buffer_ID buffer_id, Access_Flag access){return(app->get_buffer_next_(app, buffer_id, access));}
|
||||
static Buffer_ID get_buffer_by_name(Application_Links *app, String_Const_u8 name, Access_Flag access){return(app->get_buffer_by_name_(app, name, access));}
|
||||
static Buffer_ID get_buffer_by_file_name(Application_Links *app, String_Const_u8 file_name, Access_Flag access){return(app->get_buffer_by_file_name_(app, file_name, access));}
|
||||
static b32 buffer_read_range(Application_Links *app, Buffer_ID buffer_id, i32 start, i32 one_past_last, char *out){return(app->buffer_read_range_(app, buffer_id, start, one_past_last, out));}
|
||||
static b32 buffer_replace_range(Application_Links *app, Buffer_ID buffer_id, Range range, String_Const_u8 string){return(app->buffer_replace_range_(app, buffer_id, range, string));}
|
||||
static b32 buffer_read_range(Application_Links *app, Buffer_ID buffer_id, Range_i64 range, char *out){return(app->buffer_read_range_(app, buffer_id, range, out));}
|
||||
static b32 buffer_replace_range(Application_Links *app, Buffer_ID buffer_id, Range_i64 range, String_Const_u8 string){return(app->buffer_replace_range_(app, buffer_id, range, string));}
|
||||
static b32 buffer_batch_edit(Application_Links *app, Buffer_ID buffer_id, char *str, Buffer_Edit *edits, i32 edit_count){return(app->buffer_batch_edit_(app, buffer_id, str, edits, edit_count));}
|
||||
static String_Match buffer_seek_string(Application_Links *app, Buffer_ID buffer, String_Const_u8 needle, Scan_Direction direction, i64 start_pos){return(app->buffer_seek_string_(app, buffer, needle, direction, start_pos));}
|
||||
static String_Match buffer_seek_character_class(Application_Links *app, Buffer_ID buffer, Character_Predicate *predicate, Scan_Direction direction, i64 start_pos){return(app->buffer_seek_character_class_(app, buffer, predicate, direction, start_pos));}
|
||||
|
@ -1126,8 +1126,8 @@ static Partial_Cursor buffer_compute_cursor(Application_Links *app, Buffer_ID bu
|
|||
static b32 buffer_exists(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_exists_(app, buffer_id));}
|
||||
static b32 buffer_ready(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_ready_(app, buffer_id));}
|
||||
static Access_Flag buffer_get_access_flags(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_access_flags_(app, buffer_id));}
|
||||
static u64 buffer_get_size(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_size_(app, buffer_id));}
|
||||
static u64 buffer_get_line_count(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_line_count_(app, buffer_id));}
|
||||
static i64 buffer_get_size(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_size_(app, buffer_id));}
|
||||
static i64 buffer_get_line_count(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_line_count_(app, buffer_id));}
|
||||
static String_Const_u8 push_buffer_base_name(Application_Links *app, Arena *arena, Buffer_ID buffer_id){return(app->push_buffer_base_name_(app, arena, buffer_id));}
|
||||
static String_Const_u8 push_buffer_unique_name(Application_Links *app, Arena *out, Buffer_ID buffer_id){return(app->push_buffer_unique_name_(app, out, buffer_id));}
|
||||
static String_Const_u8 push_buffer_file_name(Application_Links *app, Arena *arena, Buffer_ID buffer_id){return(app->push_buffer_file_name_(app, arena, buffer_id));}
|
||||
|
@ -1151,8 +1151,8 @@ static View_ID get_active_view(Application_Links *app, Access_Flag access){retur
|
|||
static Panel_ID get_active_panel(Application_Links *app){return(app->get_active_panel_(app));}
|
||||
static b32 view_exists(Application_Links *app, View_ID view_id){return(app->view_exists_(app, view_id));}
|
||||
static Buffer_ID view_get_buffer(Application_Links *app, View_ID view_id, Access_Flag access){return(app->view_get_buffer_(app, view_id, access));}
|
||||
static i32 view_get_cursor_pos(Application_Links *app, View_ID view_id){return(app->view_get_cursor_pos_(app, view_id));}
|
||||
static i32 view_get_mark_pos(Application_Links *app, View_ID view_id){return(app->view_get_mark_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 f32 view_get_preferred_x(Application_Links *app, View_ID view_id){return(app->view_get_preferred_x_(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));}
|
||||
|
@ -1178,7 +1178,7 @@ static b32 view_set_cursor(Application_Links *app, View_ID view_id, Buffer_Seek
|
|||
static b32 view_set_scroll(Application_Links *app, View_ID view_id, GUI_Scroll_Vars scroll){return(app->view_set_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_buffer(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Set_Buffer_Flag flags){return(app->view_set_buffer_(app, view_id, buffer_id, flags));}
|
||||
static b32 view_post_fade(Application_Links *app, View_ID view_id, float seconds, i32 start, i32 end, int_color color){return(app->view_post_fade_(app, view_id, seconds, start, end, color));}
|
||||
static b32 view_post_fade(Application_Links *app, View_ID view_id, f32 seconds, Range_i64 range, int_color color){return(app->view_post_fade_(app, view_id, seconds, range, color));}
|
||||
static b32 view_begin_ui_mode(Application_Links *app, View_ID view_id){return(app->view_begin_ui_mode_(app, view_id));}
|
||||
static b32 view_end_ui_mode(Application_Links *app, View_ID view_id){return(app->view_end_ui_mode_(app, view_id));}
|
||||
static b32 view_is_in_ui_mode(Application_Links *app, View_ID view_id){return(app->view_is_in_ui_mode_(app, view_id));}
|
||||
|
@ -1271,7 +1271,7 @@ static Vec2 draw_coordinate_center_pop(Application_Links *app){return(app->draw_
|
|||
static b32 text_layout_get_buffer(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID *buffer_id_out){return(app->text_layout_get_buffer_(app, text_layout_id, buffer_id_out));}
|
||||
static b32 text_layout_buffer_point_to_layout_point(Application_Links *app, Text_Layout_ID text_layout_id, Vec2 buffer_relative_p, Vec2 *p_out){return(app->text_layout_buffer_point_to_layout_point_(app, text_layout_id, buffer_relative_p, p_out));}
|
||||
static b32 text_layout_layout_point_to_buffer_point(Application_Links *app, Text_Layout_ID text_layout_id, Vec2 layout_relative_p, Vec2 *p_out){return(app->text_layout_layout_point_to_buffer_point_(app, text_layout_id, layout_relative_p, p_out));}
|
||||
static b32 text_layout_get_on_screen_range(Application_Links *app, Text_Layout_ID text_layout_id, Range *on_screen_range_out){return(app->text_layout_get_on_screen_range_(app, text_layout_id, on_screen_range_out));}
|
||||
static Range_i64 text_layout_get_on_screen_range(Application_Links *app, Text_Layout_ID text_layout_id){return(app->text_layout_get_on_screen_range_(app, text_layout_id));}
|
||||
static b32 text_layout_get_height(Application_Links *app, Text_Layout_ID text_layout_id, f32 *height_out){return(app->text_layout_get_height_(app, text_layout_id, height_out));}
|
||||
static b32 text_layout_free(Application_Links *app, Text_Layout_ID text_layout_id){return(app->text_layout_free_(app, text_layout_id));}
|
||||
static b32 compute_render_layout(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Vec2 screen_p, Vec2 layout_dim, Buffer_Point buffer_point, i32 one_past_last){return(app->compute_render_layout_(app, view_id, buffer_id, screen_p, layout_dim, buffer_point, one_past_last));}
|
||||
|
|
|
@ -257,7 +257,7 @@ int32_t source_name_len;
|
|||
int32_t line_number;
|
||||
};
|
||||
static Command_Metadata fcoder_metacmd_table[236] = {
|
||||
{ PROC_LINKS(replace_all_occurrences, 0), "replace_all_occurrences", 23, "Queries the user for two strings, and replaces all occurrences of the first string with the second string in all open buffers.", 126, "c:\\4ed\\code\\4coder_experiments.cpp", 34, 770 },
|
||||
{ PROC_LINKS(replace_all_occurrences, 0), "replace_all_occurrences", 23, "Queries the user for two strings, and replaces all occurrences of the first string with the second string in all open buffers.", 126, "c:\\4ed\\code\\4coder_experiments.cpp", 34, 766 },
|
||||
{ PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "c:\\4ed\\code\\4coder_seek.cpp", 27, 28 },
|
||||
{ PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "c:\\4ed\\code\\4coder_seek.cpp", 27, 34 },
|
||||
{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "c:\\4ed\\code\\4coder_seek.cpp", 27, 40 },
|
||||
|
@ -268,16 +268,16 @@ static Command_Metadata fcoder_metacmd_table[236] = {
|
|||
{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 207 },
|
||||
{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 217 },
|
||||
{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 227 },
|
||||
{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 290 },
|
||||
{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 296 },
|
||||
{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 302 },
|
||||
{ PROC_LINKS(set_mode_to_original, 0), "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 308 },
|
||||
{ PROC_LINKS(set_mode_to_notepad_like, 0), "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 314 },
|
||||
{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 320 },
|
||||
{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 326 },
|
||||
{ PROC_LINKS(toggle_paren_matching_helper, 0), "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 332 },
|
||||
{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 338 },
|
||||
{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 346 },
|
||||
{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 288 },
|
||||
{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 294 },
|
||||
{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 300 },
|
||||
{ PROC_LINKS(set_mode_to_original, 0), "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 306 },
|
||||
{ PROC_LINKS(set_mode_to_notepad_like, 0), "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 312 },
|
||||
{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 318 },
|
||||
{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 324 },
|
||||
{ PROC_LINKS(toggle_paren_matching_helper, 0), "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 330 },
|
||||
{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 336 },
|
||||
{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "c:\\4ed\\code\\4coder_default_framework.cpp", 40, 344 },
|
||||
{ PROC_LINKS(write_character, 0), "write_character", 15, "Inserts whatever character was used to trigger this command.", 60, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 66 },
|
||||
{ PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 75 },
|
||||
{ PROC_LINKS(delete_char, 0), "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 82 },
|
||||
|
@ -349,32 +349,32 @@ static Command_Metadata fcoder_metacmd_table[236] = {
|
|||
{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1078 },
|
||||
{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1084 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1090 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1102 },
|
||||
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1114 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1215 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1235 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1251 },
|
||||
{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1291 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1316 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1354 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1389 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1429 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1462 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1468 },
|
||||
{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1474 },
|
||||
{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1488 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1553 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1588 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1601 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1613 },
|
||||
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1647 },
|
||||
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1655 },
|
||||
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1667 },
|
||||
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1725 },
|
||||
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1738 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1752 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1826 },
|
||||
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1929 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1101 },
|
||||
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1112 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1213 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1233 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1249 },
|
||||
{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1284 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1309 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1347 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1382 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1422 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1455 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1461 },
|
||||
{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1467 },
|
||||
{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1481 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1546 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1578 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1591 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1603 },
|
||||
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1637 },
|
||||
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1645 },
|
||||
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1657 },
|
||||
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1715 },
|
||||
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1728 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1742 },
|
||||
{ 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, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1816 },
|
||||
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "c:\\4ed\\code\\4coder_base_commands.cpp", 36, 1919 },
|
||||
{ PROC_LINKS(lister__quit, 0), "lister__quit", 12, "A lister mode command that quits the list without executing any actions.", 72, "c:\\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, "c:\\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, "c:\\4ed\\code\\4coder_lists.cpp", 28, 30 },
|
||||
|
@ -398,21 +398,21 @@ static Command_Metadata fcoder_metacmd_table[236] = {
|
|||
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "c:\\4ed\\code\\4coder_lists.cpp", 28, 856 },
|
||||
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "c:\\4ed\\code\\4coder_lists.cpp", 28, 889 },
|
||||
{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "c:\\4ed\\code\\4coder_lists.cpp", 28, 971 },
|
||||
{ PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "c:\\4ed\\code\\4coder_auto_indent.cpp", 34, 556 },
|
||||
{ PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "c:\\4ed\\code\\4coder_auto_indent.cpp", 34, 566 },
|
||||
{ PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "c:\\4ed\\code\\4coder_auto_indent.cpp", 34, 577 },
|
||||
{ PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "c:\\4ed\\code\\4coder_auto_indent.cpp", 34, 588 },
|
||||
{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "c:\\4ed\\code\\4coder_search.cpp", 29, 698 },
|
||||
{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "c:\\4ed\\code\\4coder_search.cpp", 29, 705 },
|
||||
{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "c:\\4ed\\code\\4coder_search.cpp", 29, 712 },
|
||||
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "c:\\4ed\\code\\4coder_search.cpp", 29, 719 },
|
||||
{ PROC_LINKS(list_all_locations_of_identifier, 0), "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "c:\\4ed\\code\\4coder_search.cpp", 29, 726 },
|
||||
{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "c:\\4ed\\code\\4coder_search.cpp", 29, 733 },
|
||||
{ PROC_LINKS(list_all_locations_of_selection, 0), "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "c:\\4ed\\code\\4coder_search.cpp", 29, 740 },
|
||||
{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "c:\\4ed\\code\\4coder_search.cpp", 29, 747 },
|
||||
{ PROC_LINKS(list_all_locations_of_type_definition, 0), "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "c:\\4ed\\code\\4coder_search.cpp", 29, 754 },
|
||||
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "c:\\4ed\\code\\4coder_search.cpp", 29, 765 },
|
||||
{ PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "c:\\4ed\\code\\4coder_search.cpp", 29, 786 },
|
||||
{ PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "c:\\4ed\\code\\4coder_auto_indent.cpp", 34, 546 },
|
||||
{ PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "c:\\4ed\\code\\4coder_auto_indent.cpp", 34, 555 },
|
||||
{ PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "c:\\4ed\\code\\4coder_auto_indent.cpp", 34, 565 },
|
||||
{ PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "c:\\4ed\\code\\4coder_auto_indent.cpp", 34, 575 },
|
||||
{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "c:\\4ed\\code\\4coder_search.cpp", 29, 696 },
|
||||
{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "c:\\4ed\\code\\4coder_search.cpp", 29, 703 },
|
||||
{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "c:\\4ed\\code\\4coder_search.cpp", 29, 710 },
|
||||
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "c:\\4ed\\code\\4coder_search.cpp", 29, 717 },
|
||||
{ PROC_LINKS(list_all_locations_of_identifier, 0), "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "c:\\4ed\\code\\4coder_search.cpp", 29, 724 },
|
||||
{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "c:\\4ed\\code\\4coder_search.cpp", 29, 731 },
|
||||
{ PROC_LINKS(list_all_locations_of_selection, 0), "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "c:\\4ed\\code\\4coder_search.cpp", 29, 738 },
|
||||
{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "c:\\4ed\\code\\4coder_search.cpp", 29, 745 },
|
||||
{ PROC_LINKS(list_all_locations_of_type_definition, 0), "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "c:\\4ed\\code\\4coder_search.cpp", 29, 752 },
|
||||
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "c:\\4ed\\code\\4coder_search.cpp", 29, 763 },
|
||||
{ PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "c:\\4ed\\code\\4coder_search.cpp", 29, 784 },
|
||||
{ PROC_LINKS(goto_jump_at_cursor_direct, 0), "goto_jump_at_cursor_direct", 26, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "c:\\4ed\\code\\4coder_jump_direct.cpp", 34, 8 },
|
||||
{ PROC_LINKS(goto_jump_at_cursor_same_panel_direct, 0), "goto_jump_at_cursor_same_panel_direct", 37, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list..", 168, "c:\\4ed\\code\\4coder_jump_direct.cpp", 34, 31 },
|
||||
{ PROC_LINKS(goto_next_jump_direct, 0), "goto_next_jump_direct", 21, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "c:\\4ed\\code\\4coder_jump_direct.cpp", 34, 52 },
|
||||
|
@ -433,12 +433,12 @@ static Command_Metadata fcoder_metacmd_table[236] = {
|
|||
{ PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "c:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 591 },
|
||||
{ PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "c:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 608 },
|
||||
{ PROC_LINKS(view_jump_list_with_lister, 0), "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "c:\\4ed\\code\\4coder_jump_lister.cpp", 34, 104 },
|
||||
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "c:\\4ed\\code\\4coder_clipboard.cpp", 32, 23 },
|
||||
{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "c:\\4ed\\code\\4coder_clipboard.cpp", 32, 32 },
|
||||
{ PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "c:\\4ed\\code\\4coder_clipboard.cpp", 32, 43 },
|
||||
{ PROC_LINKS(paste_next, 0), "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "c:\\4ed\\code\\4coder_clipboard.cpp", 32, 76 },
|
||||
{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "c:\\4ed\\code\\4coder_clipboard.cpp", 32, 119 },
|
||||
{ PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "c:\\4ed\\code\\4coder_clipboard.cpp", 32, 126 },
|
||||
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "c:\\4ed\\code\\4coder_clipboard.cpp", 32, 19 },
|
||||
{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "c:\\4ed\\code\\4coder_clipboard.cpp", 32, 28 },
|
||||
{ PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "c:\\4ed\\code\\4coder_clipboard.cpp", 32, 39 },
|
||||
{ PROC_LINKS(paste_next, 0), "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "c:\\4ed\\code\\4coder_clipboard.cpp", 32, 72 },
|
||||
{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "c:\\4ed\\code\\4coder_clipboard.cpp", 32, 114 },
|
||||
{ PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "c:\\4ed\\code\\4coder_clipboard.cpp", 32, 121 },
|
||||
{ PROC_LINKS(execute_previous_cli, 0), "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "c:\\4ed\\code\\4coder_system_command.cpp", 37, 7 },
|
||||
{ PROC_LINKS(execute_any_cli, 0), "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "c:\\4ed\\code\\4coder_system_command.cpp", 37, 22 },
|
||||
{ PROC_LINKS(build_search, 0), "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "c:\\4ed\\code\\4coder_build_commands.cpp", 37, 128 },
|
||||
|
@ -456,16 +456,16 @@ static Command_Metadata fcoder_metacmd_table[236] = {
|
|||
{ PROC_LINKS(setup_build_sh, 0), "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "c:\\4ed\\code\\4coder_project_commands.cpp", 39, 1326 },
|
||||
{ PROC_LINKS(setup_build_bat_and_sh, 0), "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "c:\\4ed\\code\\4coder_project_commands.cpp", 39, 1332 },
|
||||
{ PROC_LINKS(project_command_lister, 0), "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "c:\\4ed\\code\\4coder_project_commands.cpp", 39, 1347 },
|
||||
{ PROC_LINKS(list_all_functions_current_buffer, 0), "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "c:\\4ed\\code\\4coder_function_list.cpp", 36, 269 },
|
||||
{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "c:\\4ed\\code\\4coder_function_list.cpp", 36, 279 },
|
||||
{ PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "c:\\4ed\\code\\4coder_function_list.cpp", 36, 291 },
|
||||
{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "c:\\4ed\\code\\4coder_function_list.cpp", 36, 297 },
|
||||
{ PROC_LINKS(list_all_functions_current_buffer, 0), "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "c:\\4ed\\code\\4coder_function_list.cpp", 36, 268 },
|
||||
{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "c:\\4ed\\code\\4coder_function_list.cpp", 36, 278 },
|
||||
{ PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "c:\\4ed\\code\\4coder_function_list.cpp", 36, 290 },
|
||||
{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "c:\\4ed\\code\\4coder_function_list.cpp", 36, 296 },
|
||||
{ PROC_LINKS(select_surrounding_scope, 0), "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "c:\\4ed\\code\\4coder_scope_commands.cpp", 37, 337 },
|
||||
{ PROC_LINKS(select_next_scope_absolute, 0), "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "c:\\4ed\\code\\4coder_scope_commands.cpp", 37, 352 },
|
||||
{ PROC_LINKS(select_prev_scope_absolute, 0), "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "c:\\4ed\\code\\4coder_scope_commands.cpp", 37, 371 },
|
||||
{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "c:\\4ed\\code\\4coder_scope_commands.cpp", 37, 461 },
|
||||
{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "c:\\4ed\\code\\4coder_scope_commands.cpp", 37, 467 },
|
||||
{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "c:\\4ed\\code\\4coder_scope_commands.cpp", 37, 690 },
|
||||
{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "c:\\4ed\\code\\4coder_scope_commands.cpp", 37, 445 },
|
||||
{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "c:\\4ed\\code\\4coder_scope_commands.cpp", 37, 451 },
|
||||
{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "c:\\4ed\\code\\4coder_scope_commands.cpp", 37, 670 },
|
||||
{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "c:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 46 },
|
||||
{ PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "c:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 54 },
|
||||
{ PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "c:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 62 },
|
||||
|
@ -482,17 +482,17 @@ static Command_Metadata fcoder_metacmd_table[236] = {
|
|||
{ PROC_LINKS(set_bindings_choose, 0), "set_bindings_choose", 19, "Remap keybindings using the 'choose' mapping rule.", 50, "c:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 39 },
|
||||
{ PROC_LINKS(set_bindings_default, 0), "set_bindings_default", 20, "Remap keybindings using the 'default' mapping rule.", 51, "c:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 49 },
|
||||
{ PROC_LINKS(set_bindings_mac_default, 0), "set_bindings_mac_default", 24, "Remap keybindings using the 'mac-default' mapping rule.", 55, "c:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 64 },
|
||||
{ PROC_LINKS(miblo_increment_basic, 0), "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "c:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 95 },
|
||||
{ PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "c:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 110 },
|
||||
{ PROC_LINKS(miblo_increment_time_stamp, 0), "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 374 },
|
||||
{ PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 380 },
|
||||
{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 386 },
|
||||
{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 392 },
|
||||
{ PROC_LINKS(miblo_increment_basic, 0), "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "c:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 29 },
|
||||
{ PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "c:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 44 },
|
||||
{ PROC_LINKS(miblo_increment_time_stamp, 0), "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 231 },
|
||||
{ PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 237 },
|
||||
{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 243 },
|
||||
{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 249 },
|
||||
{ PROC_LINKS(kill_rect, 0), "kill_rect", 9, "Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.", 93, "c:\\4ed\\code\\4coder_experiments.cpp", 34, 44 },
|
||||
{ PROC_LINKS(multi_line_edit, 0), "multi_line_edit", 15, "Begin multi-line mode. In multi-line mode characters are inserted at every line between the mark and cursor. All characters are inserted at the same character offset into the line. This mode uses line_char coordinates.", 221, "c:\\4ed\\code\\4coder_experiments.cpp", 34, 125 },
|
||||
{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "c:\\4ed\\code\\4coder_experiments.cpp", 34, 390 },
|
||||
{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "c:\\4ed\\code\\4coder_experiments.cpp", 34, 697 },
|
||||
{ PROC_LINKS(write_explicit_enum_flags, 0), "write_explicit_enum_flags", 25, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.", 194, "c:\\4ed\\code\\4coder_experiments.cpp", 34, 703 },
|
||||
{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "c:\\4ed\\code\\4coder_experiments.cpp", 34, 386 },
|
||||
{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "c:\\4ed\\code\\4coder_experiments.cpp", 34, 693 },
|
||||
{ PROC_LINKS(write_explicit_enum_flags, 0), "write_explicit_enum_flags", 25, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.", 194, "c:\\4ed\\code\\4coder_experiments.cpp", 34, 699 },
|
||||
};
|
||||
static int32_t fcoder_metacmd_ID_replace_all_occurrences = 0;
|
||||
static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 1;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -121,7 +121,7 @@ global Character_Predicate character_predicate_alpha_numeric_underscore_utf8 = {
|
|||
255, 255, 255, 255, 255, 255, 255, 255,
|
||||
} };
|
||||
|
||||
typedef i32 Boundary_Function(Application_Links *app, Buffer_ID buffer, Side side, Scan_Direction direction, i32 pos);
|
||||
typedef i64 Boundary_Function(Application_Links *app, Buffer_ID buffer, Side side, Scan_Direction direction, i64 pos);
|
||||
|
||||
struct Boundary_Function_Node{
|
||||
Boundary_Function_Node *next;
|
||||
|
@ -133,13 +133,13 @@ struct Boundary_Function_List{
|
|||
i32 count;
|
||||
};
|
||||
|
||||
typedef Range Enclose_Function(Application_Links *app, Buffer_ID buffer, Range range);
|
||||
typedef Range_i64 Enclose_Function(Application_Links *app, Buffer_ID buffer, Range_i64 range);
|
||||
|
||||
struct Indent_Info{
|
||||
i32 first_char_pos;
|
||||
i64 first_char_pos;
|
||||
i32 indent_pos;
|
||||
i32 is_blank;
|
||||
i32 all_space;
|
||||
b32 is_blank;
|
||||
b32 all_space;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// TOP
|
||||
|
||||
static Buffer_Insertion
|
||||
begin_buffer_insertion_at(Application_Links *app, Buffer_ID buffer_id, i32 at){
|
||||
begin_buffer_insertion_at(Application_Links *app, Buffer_ID buffer_id, i64 at){
|
||||
Buffer_Insertion result = {};
|
||||
result.app = app;
|
||||
result.buffer = buffer_id;
|
||||
|
@ -14,7 +14,7 @@ begin_buffer_insertion_at(Application_Links *app, Buffer_ID buffer_id, i32 at){
|
|||
}
|
||||
|
||||
static Buffer_Insertion
|
||||
begin_buffer_insertion_at_buffered(Application_Links *app, Buffer_ID buffer_id, i32 at, Cursor *cursor){
|
||||
begin_buffer_insertion_at_buffered(Application_Links *app, Buffer_ID buffer_id, i64 at, Cursor *cursor){
|
||||
Buffer_Insertion result = begin_buffer_insertion_at(app, buffer_id, at);
|
||||
result.buffering = true;
|
||||
result.cursor = cursor;
|
||||
|
@ -26,14 +26,14 @@ static Buffer_Insertion
|
|||
begin_buffer_insertion(Application_Links *app){
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessAll);
|
||||
i32 cursor_pos = view_get_cursor_pos(app, view);
|
||||
i64 cursor_pos = view_get_cursor_pos(app, view);
|
||||
Buffer_Insertion result = begin_buffer_insertion_at(app, buffer, cursor_pos);
|
||||
return(result);
|
||||
}
|
||||
|
||||
static void
|
||||
insert_string__no_buffering(Buffer_Insertion *insertion, String_Const_u8 string){
|
||||
buffer_replace_range(insertion->app, insertion->buffer, make_range((i32)insertion->at), string);
|
||||
buffer_replace_range(insertion->app, insertion->buffer, Ii64(insertion->at), string);
|
||||
insertion->at += string.size;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
struct Buffer_Insertion{
|
||||
Application_Links *app;
|
||||
Buffer_ID buffer;
|
||||
umem at;
|
||||
i64 at;
|
||||
b32 buffering;
|
||||
Cursor *cursor;
|
||||
Temp_Memory temp;
|
||||
|
|
|
@ -12,7 +12,7 @@ CUSTOM_DOC("If the cursor is found to be on a jump location, parses the jump loc
|
|||
Temp_Memory temp = begin_temp(scratch);
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos));
|
||||
|
||||
Parsed_Jump jump = parse_jump_from_buffer_line(app, scratch, buffer, cursor.line, false);
|
||||
|
@ -35,7 +35,7 @@ CUSTOM_DOC("If the cursor is found to be on a jump location, parses the jump loc
|
|||
Temp_Memory temp = begin_temp(scratch);
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos));
|
||||
|
||||
Parsed_Jump jump = parse_jump_from_buffer_line(app, scratch, buffer, cursor.line, false);
|
||||
|
|
|
@ -10,16 +10,16 @@ static Marker_List_Node *marker_list_last = 0;
|
|||
|
||||
////////////////////////////////
|
||||
|
||||
static u32
|
||||
binary_search(u32 *array, i32 stride, i32 count, u32 x){
|
||||
static i32
|
||||
binary_search(i64 *array, i32 stride, i32 count, i64 x){
|
||||
u8 *raw = (u8*)array;
|
||||
u32 i = 0;
|
||||
u32 first = 0;
|
||||
u32 last = count;
|
||||
i32 i = 0;
|
||||
i32 first = 0;
|
||||
i32 last = count;
|
||||
if (first < last){
|
||||
for (;;){
|
||||
i = (first + last)/2;
|
||||
u32 k = *(u32*)(raw + stride*i);
|
||||
i64 k = *(i64*)(raw + stride*i);
|
||||
if (k < x){
|
||||
first = i;
|
||||
}
|
||||
|
@ -305,9 +305,9 @@ get_jump_from_list(Application_Links *app, Marker_List *list, i32 index, ID_Pos_
|
|||
return(result);
|
||||
}
|
||||
|
||||
static i32
|
||||
static i64
|
||||
get_line_from_list(Application_Links *app, Marker_List *list, i32 index){
|
||||
i32 result = 0;
|
||||
i64 result = 0;
|
||||
if (list != 0){
|
||||
Sticky_Jump_Stored stored = {};
|
||||
if (get_stored_jump_from_list(app, list, index, &stored)){
|
||||
|
@ -330,14 +330,14 @@ get_is_sub_error_from_list(Application_Links *app, Marker_List *list, i32 index)
|
|||
}
|
||||
|
||||
static i32
|
||||
get_index_nearest_from_list(Application_Links *app, Marker_List *list, i32 line){
|
||||
get_index_nearest_from_list(Application_Links *app, Marker_List *list, i64 line){
|
||||
i32 result = -1;
|
||||
if (list != 0){
|
||||
Arena *scratch = context_get_arena(app);
|
||||
Temp_Memory temp = begin_temp(scratch);
|
||||
Sticky_Jump_Stored *stored = get_all_stored_jumps_from_list(app, scratch, list);
|
||||
if (stored != 0){
|
||||
result = binary_search((u32*)&stored->list_line, sizeof(*stored), list->jump_count, line);
|
||||
result = binary_search((i64*)&stored->list_line, sizeof(*stored), list->jump_count, line);
|
||||
}
|
||||
end_temp(temp);
|
||||
}
|
||||
|
@ -345,14 +345,14 @@ get_index_nearest_from_list(Application_Links *app, Marker_List *list, i32 line)
|
|||
}
|
||||
|
||||
static i32
|
||||
get_index_exact_from_list(Application_Links *app, Marker_List *list, i32 line){
|
||||
get_index_exact_from_list(Application_Links *app, Marker_List *list, i64 line){
|
||||
i32 result = -1;
|
||||
if (list != 0){
|
||||
Arena *scratch = context_get_arena(app);
|
||||
Temp_Memory temp = begin_temp(scratch);
|
||||
Sticky_Jump_Stored *stored = get_all_stored_jumps_from_list(app, scratch, list);
|
||||
if (stored != 0){
|
||||
i32 index = binary_search((u32*)&stored->list_line, sizeof(*stored), list->jump_count, line);
|
||||
i32 index = binary_search((i64*)&stored->list_line, sizeof(*stored), list->jump_count, line);
|
||||
if (stored[index].list_line == line){
|
||||
result = index;
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ CUSTOM_DOC("If the cursor is found to be on a jump location, parses the jump loc
|
|||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||
Marker_List *list = get_or_make_list_for_buffer(app, heap, buffer);
|
||||
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos));
|
||||
|
||||
i32 list_index = get_index_exact_from_list(app, list, cursor.line);
|
||||
|
@ -399,7 +399,7 @@ CUSTOM_DOC("If the cursor is found to be on a jump location, parses the jump loc
|
|||
|
||||
Marker_List *list = get_or_make_list_for_buffer(app, heap, buffer);
|
||||
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos));
|
||||
|
||||
i32 list_index = get_index_exact_from_list(app, list, cursor.line);
|
||||
|
@ -462,7 +462,7 @@ goto_next_filtered_jump(Application_Links *app, Marker_List *list, View_ID jump_
|
|||
|
||||
if (!skip_this){
|
||||
goto_jump_in_order(app, list, jump_view, location);
|
||||
i32 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_char(updated_line, 1), true);
|
||||
break;
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ get_locked_jump_state(Application_Links *app, Heap *heap){
|
|||
Buffer_ID buffer = view_get_buffer(app, result.view, AccessAll);
|
||||
result.list = get_or_make_list_for_buffer(app, heap, buffer);
|
||||
|
||||
i32 cursor_position = view_get_cursor_pos(app, result.view);
|
||||
i64 cursor_position = view_get_cursor_pos(app, result.view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, result.view, seek_pos(cursor_position));
|
||||
result.list_index = get_index_nearest_from_list(app, result.list, cursor.line);
|
||||
}
|
||||
|
@ -495,9 +495,9 @@ CUSTOM_DOC("If a buffer containing jump locations has been locked in, goes to th
|
|||
|
||||
Locked_Jump_State jump_state = get_locked_jump_state(app, heap);
|
||||
if (jump_state.view != 0){
|
||||
i32 cursor_position = view_get_cursor_pos(app, jump_state.view);
|
||||
i64 cursor_position = view_get_cursor_pos(app, jump_state.view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, jump_state.view, seek_pos(cursor_position));
|
||||
i32 line = get_line_from_list(app, jump_state.list, jump_state.list_index);
|
||||
i64 line = get_line_from_list(app, jump_state.list, jump_state.list_index);
|
||||
if (line <= cursor.line){
|
||||
++jump_state.list_index;
|
||||
}
|
||||
|
@ -525,9 +525,9 @@ CUSTOM_DOC("If a buffer containing jump locations has been locked in, goes to th
|
|||
|
||||
Locked_Jump_State jump_state = get_locked_jump_state(app, heap);
|
||||
if (jump_state.view != 0){
|
||||
i32 cursor_position = view_get_cursor_pos(app, jump_state.view);
|
||||
i64 cursor_position = view_get_cursor_pos(app, jump_state.view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, jump_state.view, seek_pos(cursor_position));
|
||||
i32 line = get_line_from_list(app, jump_state.list, jump_state.list_index);
|
||||
i64 line = get_line_from_list(app, jump_state.list, jump_state.list_index);
|
||||
if (line <= cursor.line){
|
||||
++jump_state.list_index;
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ CUSTOM_DOC("If a buffer containing jump locations has been locked in, goes to th
|
|||
ID_Pos_Jump_Location 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);
|
||||
i32 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_char(updated_line, 1), true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,16 +8,16 @@
|
|||
#define FCODER_JUMP_STICKY_H
|
||||
|
||||
struct Sticky_Jump{
|
||||
i32 list_line;
|
||||
i32 list_colon_index;
|
||||
i64 list_line;
|
||||
i64 list_colon_index;
|
||||
b32 is_sub_error;
|
||||
Buffer_ID jump_buffer_id;
|
||||
i32 jump_pos;
|
||||
};
|
||||
|
||||
struct Sticky_Jump_Stored{
|
||||
i32 list_line;
|
||||
i32 list_colon_index;
|
||||
i64 list_line;
|
||||
i64 list_colon_index;
|
||||
b32 is_sub_error;
|
||||
Buffer_ID jump_buffer_id;
|
||||
i32 index_into_marker_array;
|
||||
|
|
|
@ -195,9 +195,9 @@ parse_jump_location(String_Const_u8 line, Jump_Flag flags){
|
|||
}
|
||||
|
||||
static Parsed_Jump
|
||||
parse_jump_from_buffer_line(Application_Links *app, Arena *arena, Buffer_ID buffer_id, i32 line, Jump_Flag flags){
|
||||
parse_jump_from_buffer_line(Application_Links *app, Arena *arena, Buffer_ID buffer, i64 line, Jump_Flag flags){
|
||||
Parsed_Jump jump = {};
|
||||
String_Const_u8 line_str = push_buffer_line(app, arena, buffer_id, line);
|
||||
String_Const_u8 line_str = push_buffer_line(app, arena, buffer, line);
|
||||
if (line_str.size > 0){
|
||||
jump = parse_jump_location(line_str, flags);
|
||||
}
|
||||
|
@ -263,16 +263,17 @@ jump_to_location(Application_Links *app, View_ID view, Buffer_ID buffer, ID_Pos_
|
|||
|
||||
////////////////////////////////
|
||||
|
||||
// TODO(allen): rewrite
|
||||
static Parsed_Jump
|
||||
seek_next_jump_in_buffer(Application_Links *app, Arena *arena,
|
||||
i32 buffer_id, i32 first_line, Jump_Flag flags, i32 direction,
|
||||
i32 *line_out){
|
||||
Buffer_ID buffer, i64 first_line, Jump_Flag flags, Scan_Direction direction,
|
||||
i64 *line_out){
|
||||
Assert(direction == 1 || direction == -1);
|
||||
Parsed_Jump jump = {};
|
||||
i32 line = first_line;
|
||||
i64 line = first_line;
|
||||
for (;;){
|
||||
if (is_valid_line(app, buffer_id, line)){
|
||||
String_Const_u8 line_str = push_buffer_line(app, arena, buffer_id, line);
|
||||
if (is_valid_line(app, buffer, line)){
|
||||
String_Const_u8 line_str = push_buffer_line(app, arena, buffer, line);
|
||||
jump = parse_jump_location(line_str, flags);
|
||||
if (jump.success){
|
||||
break;
|
||||
|
@ -302,10 +303,10 @@ convert_name_based_to_id_based(Application_Links *app, Name_Line_Column_Location
|
|||
}
|
||||
|
||||
static Parsed_Jump
|
||||
seek_next_jump_in_view(Application_Links *app, Arena *arena, View_ID view, i32 skip_sub_errors, i32 direction, i32 *line_out){
|
||||
i32 cursor_position = view_get_cursor_pos(app, view);
|
||||
seek_next_jump_in_view(Application_Links *app, Arena *arena, View_ID view, i32 skip_sub_errors, Scan_Direction direction, i64 *line_out){
|
||||
i64 cursor_position = view_get_cursor_pos(app, view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(cursor_position));
|
||||
i32 line = cursor.line;
|
||||
i64 line = cursor.line;
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessAll);
|
||||
Parsed_Jump jump = seek_next_jump_in_buffer(app, arena, buffer, line + direction, skip_sub_errors, direction, &line);
|
||||
if (jump.success){
|
||||
|
@ -324,13 +325,13 @@ skip_this_jump(ID_Line_Column_Jump_Location prev, ID_Line_Column_Jump_Location j
|
|||
}
|
||||
|
||||
static b32
|
||||
advance_cursor_in_jump_view(Application_Links *app, View_ID view, i32 skip_repeats, i32 skip_sub_error, i32 direction, Name_Line_Column_Location *location_out){
|
||||
advance_cursor_in_jump_view(Application_Links *app, View_ID view, b32 skip_repeats, b32 skip_sub_error, Scan_Direction direction, Name_Line_Column_Location *location_out){
|
||||
b32 result = true;
|
||||
|
||||
Name_Line_Column_Location location = {};
|
||||
ID_Line_Column_Jump_Location jump = {};
|
||||
i32 line = 0;
|
||||
i32 colon_index = 0;
|
||||
i64 line = 0;
|
||||
i64 colon_index = 0;
|
||||
|
||||
do{
|
||||
Arena *scratch = context_get_arena(app);
|
||||
|
|
|
@ -5,87 +5,21 @@ and decrementing various forms of number as numerical objects despite being enco
|
|||
|
||||
// TOP
|
||||
|
||||
static Range
|
||||
get_numeric_string_at_cursor(Application_Links *app, Buffer_ID buffer, i32 start_pos){
|
||||
Range result = {};
|
||||
|
||||
char current = buffer_get_char(app, buffer, start_pos);
|
||||
if (character_is_base10(current)){
|
||||
char chunk[1024];
|
||||
i32 chunk_size = sizeof(chunk);
|
||||
Stream_Chunk stream = {};
|
||||
|
||||
i32 pos = start_pos;
|
||||
if (init_stream_chunk(&stream, app, buffer, start_pos, chunk, chunk_size)){
|
||||
b32 still_looping = true;
|
||||
for (;still_looping;){
|
||||
for (; pos >= stream.start; --pos){
|
||||
char at_pos = stream.data[pos];
|
||||
if (!character_is_base10(at_pos)){
|
||||
++pos;
|
||||
goto double_break_1;
|
||||
}
|
||||
}
|
||||
still_looping = backward_stream_chunk(&stream);
|
||||
}
|
||||
double_break_1:;
|
||||
i32 pos1 = pos;
|
||||
|
||||
if (init_stream_chunk(&stream, app, buffer, start_pos, chunk, chunk_size)){
|
||||
still_looping = true;
|
||||
while (still_looping){
|
||||
for (; pos < stream.end; ++pos){
|
||||
char at_pos = stream.data[pos];
|
||||
if (!character_is_base10(at_pos)){
|
||||
goto double_break_2;
|
||||
}
|
||||
}
|
||||
still_looping = forward_stream_chunk(&stream);
|
||||
}
|
||||
double_break_2:;
|
||||
i32 pos2 = pos;
|
||||
|
||||
result = make_range(pos1, pos2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static b32
|
||||
get_numeric_string_at_cursor(Application_Links *app, Buffer_ID buffer, i32 start_pos, i32 *numeric_start, i32 *numeric_end){
|
||||
Range range = get_numeric_string_at_cursor(app, buffer, start_pos);
|
||||
b32 result = (range_size(range) > 0);
|
||||
if (result){
|
||||
*numeric_start = range.start;
|
||||
*numeric_end = range.end;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
#endif
|
||||
|
||||
struct Miblo_Number_Info{
|
||||
union{
|
||||
Range range;
|
||||
i32 start;
|
||||
i32 end;
|
||||
};
|
||||
i32 x;
|
||||
Range_i64 range;
|
||||
i64 x;
|
||||
};
|
||||
|
||||
static b32
|
||||
get_numeric_at_cursor(Application_Links *app, Buffer_ID buffer, i32 pos, Miblo_Number_Info *info){
|
||||
get_numeric_at_cursor(Application_Links *app, Buffer_ID buffer, i64 pos, Miblo_Number_Info *info){
|
||||
b32 result = false;
|
||||
Range range = get_numeric_string_at_cursor(app, buffer, pos);
|
||||
Range_i64 range = enclose_pos_base10(app, buffer, pos);
|
||||
if (range_size(range) > 0){
|
||||
Scratch_Block scratch(app);
|
||||
String_Const_u8 str = push_buffer_range(app, scratch, buffer, range);
|
||||
if (str.size > 0){
|
||||
i32 x = (i32)string_to_integer(str, 10);
|
||||
info->range = range;
|
||||
info->x = x;
|
||||
info->x = string_to_integer(str, 10);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
@ -97,13 +31,13 @@ CUSTOM_DOC("Increment an integer under the cursor by one.")
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Miblo_Number_Info number = {};
|
||||
if (get_numeric_at_cursor(app, buffer, pos, &number)){
|
||||
Scratch_Block scratch(app);
|
||||
String_Const_u8 str = push_u8_stringf(scratch, "%d", number.x + 1);
|
||||
buffer_replace_range(app, buffer, number.range, str);
|
||||
view_set_cursor(app, view, seek_pos(number.start + (i32)str.size - 1), true);
|
||||
view_set_cursor(app, view, seek_pos(number.range.start + str.size - 1), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,82 +46,19 @@ CUSTOM_DOC("Decrement an integer under the cursor by one.")
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Miblo_Number_Info number = {};
|
||||
if (get_numeric_at_cursor(app, buffer, pos, &number)){
|
||||
Scratch_Block scratch(app);
|
||||
String_Const_u8 str = push_u8_stringf(scratch, "%d", number.x - 1);
|
||||
buffer_replace_range(app, buffer, number.range, str);
|
||||
view_set_cursor(app, view, seek_pos(number.start + (i32)str.size - 1), true);
|
||||
view_set_cursor(app, view, seek_pos(number.range.start + str.size - 1), true);
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(allen): miblo time stamp format
|
||||
// (h+:)?m?m:ss
|
||||
|
||||
static Range
|
||||
get_timestamp_string_at_cursor(Application_Links *app, Buffer_ID buffer, i32 start_pos){
|
||||
Range result = {};
|
||||
|
||||
char current = buffer_get_char(app, buffer, start_pos);
|
||||
|
||||
if (character_is_base10(current) || current == ':'){
|
||||
char chunk[1024];
|
||||
i32 chunk_size = sizeof(chunk);
|
||||
Stream_Chunk stream = {};
|
||||
|
||||
i32 pos = start_pos;
|
||||
|
||||
i32 pos1 = 0;
|
||||
i32 pos2 = 0;
|
||||
|
||||
if (init_stream_chunk(&stream, app, buffer, start_pos, chunk, chunk_size)){
|
||||
b32 still_looping = true;
|
||||
while (still_looping){
|
||||
for (; pos >= stream.start; --pos){
|
||||
char at_pos = stream.data[pos];
|
||||
if (!(character_is_base10(at_pos) || at_pos == ':')){
|
||||
++pos;
|
||||
goto double_break_1;
|
||||
}
|
||||
}
|
||||
still_looping = backward_stream_chunk(&stream);
|
||||
}
|
||||
double_break_1:;
|
||||
pos1 = pos;
|
||||
|
||||
if (init_stream_chunk(&stream, app, buffer, start_pos, chunk, chunk_size)){
|
||||
still_looping = true;
|
||||
while (still_looping){
|
||||
for (; pos < stream.end; ++pos){
|
||||
char at_pos = stream.data[pos];
|
||||
if (!(character_is_base10(at_pos) || at_pos == ':')){
|
||||
goto double_break_2;
|
||||
}
|
||||
}
|
||||
still_looping = forward_stream_chunk(&stream);
|
||||
}
|
||||
double_break_2:;
|
||||
pos2 = pos;
|
||||
|
||||
result = make_range(pos1, pos2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static b32
|
||||
get_timestamp_string_at_cursor(Application_Links *app, Buffer_ID buffer, i32 start_pos, i32 *timestamp_start, i32 *timestamp_end){
|
||||
Range range = get_timestamp_string_at_cursor(app, buffer, start_pos);
|
||||
*timestamp_start = range.start;
|
||||
*timestamp_end = range.end;
|
||||
return(range_size(range) > 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
struct Miblo_Timestamp{
|
||||
i32 second;
|
||||
i32 minute;
|
||||
|
@ -264,21 +135,17 @@ timestamp_to_string(Arena *arena, Miblo_Timestamp t){
|
|||
}
|
||||
|
||||
struct Miblo_Timestamp_Info{
|
||||
union{
|
||||
Range range;
|
||||
i32 start;
|
||||
i32 end;
|
||||
};
|
||||
Range_i64 range;
|
||||
Miblo_Timestamp time;
|
||||
};
|
||||
|
||||
static b32
|
||||
get_timestamp_at_cursor(Application_Links *app, Buffer_ID buffer, i32 pos, Miblo_Timestamp_Info *info){
|
||||
get_timestamp_at_cursor(Application_Links *app, Buffer_ID buffer, i64 pos, Miblo_Timestamp_Info *info){
|
||||
b32 result = false;
|
||||
|
||||
Scratch_Block scratch(app);
|
||||
|
||||
Range time_stamp_range = get_timestamp_string_at_cursor(app, buffer, pos);
|
||||
Range_i64 time_stamp_range = enclose_pos_base10_colon(app, buffer, pos);
|
||||
if (range_size(time_stamp_range) > 0){
|
||||
String_Const_u8 string = push_buffer_range(app, scratch, buffer, time_stamp_range);
|
||||
if (string.size > 0){
|
||||
|
@ -294,49 +161,39 @@ get_timestamp_at_cursor(Application_Links *app, Buffer_ID buffer, i32 pos, Miblo
|
|||
|
||||
b32 success = false;
|
||||
|
||||
umem i = 0;
|
||||
umem number_start[3];
|
||||
umem number_end[3];
|
||||
for (i32 k = 0; k < 3; ++k){
|
||||
number_start[k] = i;
|
||||
for (; i <= string.size; ++i){
|
||||
if (i == string.size || string.str[i] == ':'){
|
||||
number_end[k] = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
++i;
|
||||
if (i >= time_stamp_range.one_past_last){
|
||||
break;
|
||||
Range_i64 number[3];
|
||||
i32 k = 0;
|
||||
number[0].min = 0;
|
||||
for (i64 i = 0; i < (i64)string.size; i += 1){
|
||||
if (string.str[i] == ':'){
|
||||
number[k].max = i;
|
||||
k += 1;
|
||||
number[k].min = i + 1;
|
||||
}
|
||||
}
|
||||
number[k].max = (i64)string.size;
|
||||
|
||||
if (count_colons == 2){
|
||||
String_Const_u8 hour_str = SCu8(string.str + number_start[0],
|
||||
string.str + number_end[0]);
|
||||
String_Const_u8 hour_str = string_substring(string, number[0]);
|
||||
t.hour = (i32)string_to_integer(hour_str, 10);
|
||||
|
||||
if (number_end[1] - number_start[1] == 2){
|
||||
String_Const_u8 minute_str = SCu8(string.str + number_start[1],
|
||||
string.str + number_end[1]);
|
||||
if (range_size(number[1]) == 2){
|
||||
String_Const_u8 minute_str = string_substring(string, number[1]);
|
||||
t.minute = (i32)string_to_integer(minute_str, 10);
|
||||
if (number_end[2] - number_start[2] == 2){
|
||||
String_Const_u8 second_str = SCu8(string.str + number_start[2],
|
||||
string.str + number_end[2]);
|
||||
if (range_size(number[2]) == 2){
|
||||
String_Const_u8 second_str = string_substring(string, number[2]);
|
||||
t.second = (i32)string_to_integer(second_str, 10);
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (number_end[0] - number_start[0] == 2 || number_end[0] - number_start[0] == 1){
|
||||
String_Const_u8 minute_str = SCu8(string.str + number_start[0],
|
||||
string.str + number_end[0]);
|
||||
if (range_size(number[0]) == 2 || range_size(number[0]) == 1){
|
||||
String_Const_u8 minute_str = string_substring(string, number[0]);
|
||||
t.minute = (i32)string_to_integer(minute_str, 10);
|
||||
|
||||
if (number_end[1] - number_start[1] == 2){
|
||||
String_Const_u8 second_str = SCu8(string.str + number_start[2],
|
||||
string.str + number_end[2]);
|
||||
if (range_size(number[1]) == 2){
|
||||
String_Const_u8 second_str = string_substring(string, number[1]);
|
||||
t.second = (i32)string_to_integer(second_str, 10);
|
||||
success = true;
|
||||
}
|
||||
|
@ -359,7 +216,7 @@ static void
|
|||
miblo_time_stamp_alter(Application_Links *app, i32 unit_type, i32 amt){
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
|
||||
Miblo_Timestamp_Info timestamp = {};
|
||||
if (get_timestamp_at_cursor(app, buffer, pos, ×tamp)){
|
||||
|
@ -367,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);
|
||||
String_Const_u8 str = timestamp_to_string(scratch, inc_timestamp);
|
||||
buffer_replace_range(app, buffer, timestamp.range, str);
|
||||
view_set_cursor(app, view, seek_pos(timestamp.start + (i32)str.size - 1), true);
|
||||
view_set_cursor(app, view, seek_pos(timestamp.range.start + str.size - 1), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ find_scope_get_token_type(u32 flags, Cpp_Token_Type token_type){
|
|||
}
|
||||
|
||||
static b32
|
||||
find_scope_top(Application_Links *app, Buffer_ID buffer, i32 start_pos, u32 flags, i32 *end_pos_out){
|
||||
find_scope_top(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){
|
||||
Cpp_Get_Token_Result get_result = {};
|
||||
b32 success = false;
|
||||
i32 position = 0;
|
||||
|
@ -91,7 +91,7 @@ find_scope_top(Application_Links *app, Buffer_ID buffer, i32 start_pos, u32 flag
|
|||
}
|
||||
|
||||
static b32
|
||||
find_scope_bottom(Application_Links *app, Buffer_ID buffer, i32 start_pos, u32 flags, i32 *end_pos_out){
|
||||
find_scope_bottom(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){
|
||||
Cpp_Get_Token_Result get_result = {};
|
||||
b32 success = false;
|
||||
i32 position = 0;
|
||||
|
@ -142,10 +142,10 @@ find_scope_bottom(Application_Links *app, Buffer_ID buffer, i32 start_pos, u32 f
|
|||
}
|
||||
|
||||
static b32
|
||||
find_next_scope(Application_Links *app, Buffer_ID buffer, i32 start_pos, u32 flags, i32 *end_pos_out){
|
||||
find_next_scope(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){
|
||||
Cpp_Get_Token_Result get_result = {};
|
||||
b32 success = 0;
|
||||
i32 position = 0;
|
||||
i64 position = 0;
|
||||
if (get_token_from_pos(app, buffer, start_pos, &get_result)){
|
||||
i32 token_index = get_result.token_index + 1;
|
||||
if (token_index >= 0){
|
||||
|
@ -208,10 +208,10 @@ find_next_scope(Application_Links *app, Buffer_ID buffer, i32 start_pos, u32 fla
|
|||
}
|
||||
|
||||
static b32
|
||||
find_prev_scope(Application_Links *app, Buffer_ID buffer, i32 start_pos, u32 flags, i32 *end_pos_out){
|
||||
find_prev_scope(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){
|
||||
Cpp_Get_Token_Result get_result = {};
|
||||
b32 success = false;
|
||||
i32 position = 0;
|
||||
i64 position = 0;
|
||||
if (get_token_from_pos(app, buffer, start_pos, &get_result)){
|
||||
i32 token_index = get_result.token_index - 1;
|
||||
if (token_index >= 0){
|
||||
|
@ -274,9 +274,9 @@ find_prev_scope(Application_Links *app, Buffer_ID buffer, i32 start_pos, u32 fla
|
|||
}
|
||||
|
||||
static b32
|
||||
find_scope_range(Application_Links *app, Buffer_ID buffer, i32 start_pos, Range *range_out, u32 flags){
|
||||
find_scope_range(Application_Links *app, Buffer_ID buffer, i64 start_pos, Range_i64 *range_out, u32 flags){
|
||||
b32 result = false;
|
||||
Range range = {};
|
||||
Range_i64 range = {};
|
||||
if (find_scope_top(app, buffer, start_pos, FindScope_Parent|flags, &range.start)){
|
||||
if (find_scope_bottom(app, buffer, start_pos, FindScope_Parent|FindScope_EndOfToken|flags, &range.end)){
|
||||
*range_out = range;
|
||||
|
@ -287,8 +287,8 @@ find_scope_range(Application_Links *app, Buffer_ID buffer, i32 start_pos, Range
|
|||
}
|
||||
|
||||
static void
|
||||
view_set_to_region(Application_Links *app, View_ID view, i32 major_pos, i32 minor_pos, f32 normalized_threshold){
|
||||
Range range = make_range(major_pos, minor_pos);
|
||||
view_set_to_region(Application_Links *app, View_ID view, i64 major_pos, i64 minor_pos, f32 normalized_threshold){
|
||||
Range_i64 range = Ii64(major_pos, minor_pos);
|
||||
b32 bottom_major = false;
|
||||
if (major_pos == range.max){
|
||||
bottom_major = true;
|
||||
|
@ -339,8 +339,8 @@ CUSTOM_DOC("Finds the scope enclosed by '{' '}' surrounding the cursor and puts
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
Range range = {};
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Range_i64 range = {};
|
||||
if (find_scope_range(app, buffer, pos, &range, FindScope_Brace)){
|
||||
view_set_cursor(app, view, seek_pos(range.first), true);
|
||||
view_set_mark(app, view, seek_pos(range.end));
|
||||
|
@ -354,10 +354,10 @@ CUSTOM_DOC("Finds the first scope started by '{' after the cursor and puts the c
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i32 start_pos = pos;
|
||||
i32 top = 0;
|
||||
i32 bottom = 0;
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
i64 start_pos = pos;
|
||||
i64 top = 0;
|
||||
i64 bottom = 0;
|
||||
if (find_next_scope(app, buffer, start_pos, FindScope_Brace, &top)){
|
||||
if (find_scope_bottom(app, buffer, top, FindScope_EndOfToken|FindScope_Brace, &bottom)){
|
||||
view_set_cursor(app, view, seek_pos(top), true);
|
||||
|
@ -373,10 +373,10 @@ CUSTOM_DOC("Finds the first scope started by '{' before the cursor and puts the
|
|||
{
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i32 start_pos = pos;
|
||||
i32 top = 0;
|
||||
i32 bottom = 0;
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
i64 start_pos = pos;
|
||||
i64 top = 0;
|
||||
i64 bottom = 0;
|
||||
if (find_prev_scope(app, buffer, start_pos, FindScope_Brace, &top)){
|
||||
if (find_scope_bottom(app, buffer, top, FindScope_EndOfToken|FindScope_Brace, &bottom)){
|
||||
view_set_cursor(app, view, seek_pos(top), true);
|
||||
|
@ -392,12 +392,9 @@ place_begin_and_end_on_own_lines(Application_Links *app, char *begin, char *end)
|
|||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
|
||||
Range lines = {};
|
||||
Range range = get_view_range(app, view);
|
||||
lines.min = get_line_number_from_pos(app, buffer, range.min);
|
||||
lines.max = get_line_number_from_pos(app, buffer, range.max);
|
||||
range.min = get_line_start_pos(app, buffer, lines.min);
|
||||
range.max = get_line_end_pos(app, buffer, lines.max);
|
||||
Range_i64 range = get_view_range(app, view);
|
||||
Range_i64 lines = get_line_range_from_pos_range(app, buffer, range);
|
||||
range = get_pos_range_from_line_range(app, buffer, lines);
|
||||
|
||||
Scratch_Block scratch(app);
|
||||
|
||||
|
@ -408,8 +405,8 @@ place_begin_and_end_on_own_lines(Application_Links *app, char *begin, char *end)
|
|||
String_Const_u8 begin_str = {};
|
||||
String_Const_u8 end_str = {};
|
||||
|
||||
umem min_adjustment = 0;
|
||||
umem max_adjustment = 0;
|
||||
i64 min_adjustment = 0;
|
||||
i64 max_adjustment = 0;
|
||||
|
||||
if (min_line_blank){
|
||||
begin_str = push_u8_stringf(scratch, "\n%s", begin);
|
||||
|
@ -427,32 +424,19 @@ place_begin_and_end_on_own_lines(Application_Links *app, char *begin, char *end)
|
|||
}
|
||||
|
||||
max_adjustment += begin_str.size;
|
||||
Range new_pos = make_range(range.min + (i32)min_adjustment, range.max + (i32)max_adjustment);
|
||||
|
||||
i32 cursor_pos = view_get_cursor_pos(app, view);
|
||||
i32 mark_pos = 0;
|
||||
|
||||
if (cursor_pos == range.min){
|
||||
cursor_pos = new_pos.min;
|
||||
mark_pos = new_pos.max;
|
||||
}
|
||||
else{
|
||||
cursor_pos = new_pos.max;
|
||||
mark_pos = new_pos.min;
|
||||
}
|
||||
Range_i64 new_pos = Ii64(range.min + min_adjustment, range.max + max_adjustment);
|
||||
|
||||
History_Group group = history_group_begin(app, buffer);
|
||||
buffer_replace_range(app, buffer, make_range(range.min), begin_str);
|
||||
buffer_replace_range(app, buffer, make_range(range.max + (i32)begin_str.size), end_str);
|
||||
buffer_replace_range(app, buffer, Ii64(range.min), begin_str);
|
||||
buffer_replace_range(app, buffer, Ii64(range.max + begin_str.size), end_str);
|
||||
history_group_end(group);
|
||||
|
||||
view_set_cursor(app, view, seek_pos(cursor_pos), true);
|
||||
view_set_mark(app, view, seek_pos(mark_pos));
|
||||
set_view_range(app, view, new_pos);
|
||||
}
|
||||
else{
|
||||
String_Const_u8 str = push_u8_stringf(scratch, "%s\n\n%s", begin, end);
|
||||
buffer_replace_range(app, buffer, range, str);
|
||||
i32 center_pos = range.min + (i32)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_mark(app, view, seek_pos(center_pos));
|
||||
}
|
||||
|
@ -470,11 +454,7 @@ CUSTOM_DOC("Deletes the braces surrounding the currently selected scope. Leaves
|
|||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
|
||||
i32 view_cursor_pos = view_get_cursor_pos(app, view);
|
||||
i32 view_mark_pos = view_get_mark_pos(app, view);
|
||||
|
||||
Range range = make_range(view_cursor_pos, view_mark_pos);
|
||||
|
||||
Range_i64 range = get_view_range(app, view);
|
||||
if (buffer_get_char(app, buffer, range.min) == '{' &&
|
||||
buffer_get_char(app, buffer, range.max - 1) == '}'){
|
||||
i32 top_len = 1;
|
||||
|
@ -489,13 +469,13 @@ CUSTOM_DOC("Deletes the braces surrounding the currently selected scope. Leaves
|
|||
Buffer_Edit edits[2];
|
||||
edits[0].str_start = 0;
|
||||
edits[0].len = 0;
|
||||
edits[0].start = range.min + 1 - top_len;
|
||||
edits[0].end = range.min + 1;
|
||||
edits[0].start = (i32)(range.min + 1 - top_len);
|
||||
edits[0].end = (i32)(range.min + 1);
|
||||
|
||||
edits[1].str_start = 0;
|
||||
edits[1].len = 0;
|
||||
edits[1].start = range.max - 1;
|
||||
edits[1].end = range.max - 1 + bot_len;
|
||||
edits[1].start = (i32)(range.max - 1);
|
||||
edits[1].end = (i32)(range.max - 1 + bot_len);
|
||||
|
||||
buffer_batch_edit(app, buffer, 0, edits, 2);
|
||||
}
|
||||
|
@ -661,10 +641,10 @@ make_statement_parser(Application_Links *app, Buffer_ID buffer, i32 token_index)
|
|||
}
|
||||
|
||||
static b32
|
||||
find_whole_statement_down(Application_Links *app, Buffer_ID buffer, i32 pos, i32 *start_out, i32 *end_out){
|
||||
find_whole_statement_down(Application_Links *app, Buffer_ID buffer, i64 pos, i64 *start_out, i64 *end_out){
|
||||
b32 result = false;
|
||||
i32 start = pos;
|
||||
i32 end = start;
|
||||
i64 start = pos;
|
||||
i64 end = start;
|
||||
|
||||
Cpp_Get_Token_Result get_result = {};
|
||||
if (get_token_from_pos(app, buffer, pos, &get_result)){
|
||||
|
@ -693,11 +673,7 @@ CUSTOM_DOC("If a scope is currently selected, and a statement or block statement
|
|||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
|
||||
i32 view_cursor_pos = view_get_cursor_pos(app, view);
|
||||
i32 view_mark_pos = view_get_mark_pos(app, view);
|
||||
|
||||
Range range = make_range(view_cursor_pos, view_mark_pos);
|
||||
|
||||
Range_i64 range = get_view_range(app, view);
|
||||
if (buffer_get_char(app, buffer, range.min) == '{' &&
|
||||
buffer_get_char(app, buffer, range.max - 1) == '}'){
|
||||
Scratch_Block scratch(app);
|
||||
|
@ -728,12 +704,12 @@ CUSTOM_DOC("If a scope is currently selected, and a statement or block statement
|
|||
Buffer_Edit edits[2];
|
||||
edits[0].str_start = 0;
|
||||
edits[0].len = (i32)edit_str.size;
|
||||
edits[0].start = range.max - 1;
|
||||
edits[0].end = range.max - 1;
|
||||
edits[0].start = (i32)(range.max - 1);
|
||||
edits[0].end = (i32)(range.max - 1);
|
||||
edits[1].str_start = 0;
|
||||
edits[1].len = 0;
|
||||
edits[1].start = range.start;
|
||||
edits[1].end = range.end;
|
||||
edits[1].start = (i32)(range.start);
|
||||
edits[1].end = (i32)(range.end);
|
||||
buffer_batch_edit(app, buffer, (char*)edit_str.str, edits, 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ search_hit_add(Heap *heap, Table *hits, String_Space *space, String_Const_u8 str
|
|||
//
|
||||
|
||||
static void
|
||||
seek_potential_match(Application_Links *app, Search_Range *range, Search_Key key, Search_Match *result, Seek_Potential_Match_Direction direction, i32 start_pos, i32 end_pos){
|
||||
seek_potential_match(Application_Links *app, Search_Range *range, Search_Key key, Search_Match *result, Seek_Potential_Match_Direction direction, i64 start_pos, i64 end_pos){
|
||||
b32 case_insensitive = ((range->flags & SearchFlag_CaseInsensitive) != 0);
|
||||
b32 forward = (direction == SeekPotentialMatch_Forward);
|
||||
#define OptFlag(b,f) ((b)?(f):(0))
|
||||
|
@ -175,14 +175,14 @@ seek_potential_match(Application_Links *app, Search_Range *range, Search_Key key
|
|||
| OptFlag(!forward, BufferSeekString_Backward);
|
||||
result->buffer = range->buffer;
|
||||
|
||||
i32 best_pos = -1;
|
||||
i64 best_pos = -1;
|
||||
if (forward){
|
||||
best_pos = end_pos;
|
||||
}
|
||||
|
||||
for (i32 i = 0; i < key.count; ++i){
|
||||
String_Const_u8 word = key.words[i];
|
||||
i32 new_pos = -1;
|
||||
i64 new_pos = -1;
|
||||
buffer_seek_string(app, result->buffer, start_pos, end_pos, range->start, word, &new_pos, flags);
|
||||
|
||||
if (new_pos >= 0){
|
||||
|
@ -199,7 +199,7 @@ seek_potential_match(Application_Links *app, Search_Range *range, Search_Key key
|
|||
}
|
||||
}
|
||||
|
||||
result->start = best_pos;
|
||||
result->start = (i32)best_pos;
|
||||
}
|
||||
|
||||
static i32
|
||||
|
@ -247,7 +247,7 @@ match_check(Application_Links *app, Search_Range *range, i32 *pos, Search_Match
|
|||
{
|
||||
u8 prev = buffer_get_char(app, result.buffer, result.start - 1);
|
||||
if (!character_is_alpha_numeric_unicode(prev)){
|
||||
result.end = scan(app, boundary_alpha_numeric_unicode, result.buffer, Scan_Forward, result.start);
|
||||
result.end = (i32)scan(app, boundary_alpha_numeric_unicode, result.buffer, Scan_Forward, result.start);
|
||||
if (result.end <= end_pos){
|
||||
result.found_match = true;
|
||||
found_match = FindResult_FoundMatch;
|
||||
|
@ -650,7 +650,7 @@ list_identifier__parameters(Application_Links *app, Heap *heap, b32 substrings,
|
|||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||
if (buffer != 0){
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Scratch_Block scratch(app);
|
||||
String_Const_u8 str = get_token_or_word_under_pos(app, scratch, buffer, pos);
|
||||
if (str.size > 0){
|
||||
|
@ -662,13 +662,11 @@ list_identifier__parameters(Application_Links *app, Heap *heap, b32 substrings,
|
|||
static void
|
||||
list_selected_range__parameters(Application_Links *app, Heap *heap, b32 substrings, b32 case_insensitive, View_ID default_target_view){
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Arena *scratch = context_get_arena(app);
|
||||
Temp_Memory temp = begin_temp(scratch);
|
||||
String_Const_u8 str = push_string_in_view_range(app, scratch, view);
|
||||
Scratch_Block scratch(app);
|
||||
String_Const_u8 str = push_view_range_string(app, scratch, view);
|
||||
if (str.size > 0){
|
||||
list_single__parameters(app, heap, str, substrings, case_insensitive, default_target_view);
|
||||
}
|
||||
end_temp(temp);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -767,7 +765,7 @@ CUSTOM_DOC("Reads a token or word under the cursor and lists all locations of st
|
|||
{
|
||||
View_ID target_view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer = view_get_buffer(app, target_view, AccessProtected);
|
||||
i32 pos = view_get_cursor_pos(app, target_view);
|
||||
i64 pos = view_get_cursor_pos(app, target_view);
|
||||
Scratch_Block scratch(app);
|
||||
String_Const_u8 str = get_token_or_word_under_pos(app, scratch, buffer, pos);
|
||||
if (str.size > 0){
|
||||
|
@ -803,9 +801,9 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with
|
|||
do_init = true;
|
||||
}
|
||||
|
||||
i32 word_end = 0;
|
||||
i32 word_start = 0;
|
||||
i32 cursor_pos = 0;
|
||||
i64 word_end = 0;
|
||||
i64 word_start = 0;
|
||||
i64 cursor_pos = 0;
|
||||
umem size = 0;
|
||||
|
||||
if (do_init){
|
||||
|
@ -817,7 +815,7 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with
|
|||
|
||||
char space[1024];
|
||||
Stream_Chunk chunk = {};
|
||||
if (init_stream_chunk(&chunk, app, buffer, cursor_pos, space, sizeof(space))){
|
||||
if (init_stream_chunk(&chunk, app, buffer, (i32)cursor_pos, space, sizeof(space))){
|
||||
i32 still_looping = true;
|
||||
do{
|
||||
for (; cursor_pos >= chunk.start; --cursor_pos){
|
||||
|
@ -845,7 +843,7 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with
|
|||
complete_state.initialized = true;
|
||||
Search_Key key = {};
|
||||
search_key_alloc(&global_heap, &key, &size, 1);
|
||||
buffer_read_range(app, buffer, word_start, word_end, (char*)key.words[0].str);
|
||||
buffer_read_range(app, buffer, Ii64(word_start, word_end), (char*)key.words[0].str);
|
||||
key.words[0].size = size;
|
||||
|
||||
search_iter_init(&complete_state.iter, key);
|
||||
|
@ -860,7 +858,7 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with
|
|||
ranges[0].buffer = buffer;
|
||||
ranges[0].start = 0;
|
||||
ranges[0].size = (i32)buffer_get_size(app, buffer);
|
||||
ranges[0].mid_start = word_start;
|
||||
ranges[0].mid_start = (i32)word_start;
|
||||
ranges[0].mid_size = (i32)size;
|
||||
|
||||
Buffer_ID buffer_it = 0;
|
||||
|
@ -885,8 +883,8 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with
|
|||
String_Const_u8 word = complete_state.iter.key.words[0];
|
||||
search_hit_add(&global_heap, &complete_state.hits, &complete_state.str, word);
|
||||
|
||||
complete_state.word_start = word_start;
|
||||
complete_state.word_end = word_end;
|
||||
complete_state.word_start = (i32)word_start;
|
||||
complete_state.word_end = (i32)word_end;
|
||||
}
|
||||
else{
|
||||
word_start = complete_state.word_start;
|
||||
|
@ -897,22 +895,18 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with
|
|||
// NOTE(allen): Iterate through matches.
|
||||
if (size > 0){
|
||||
for (;;){
|
||||
i32 match_size = 0;
|
||||
Search_Match match = search_next_match(app, &complete_state.set, &complete_state.iter);
|
||||
|
||||
if (match.found_match){
|
||||
match_size = match.end - match.start;
|
||||
i32 match_size = match.end - match.start;
|
||||
Arena *scratch = context_get_arena(app);
|
||||
Scratch_Block temp_auto_closer(scratch);
|
||||
char *spare = push_array(scratch, char, match_size);
|
||||
|
||||
buffer_read_range(app, match.buffer, match.start, match.end, spare);
|
||||
|
||||
if (search_hit_add(&global_heap, &complete_state.hits, &complete_state.str, spare, match_size)){
|
||||
buffer_replace_range(app, buffer, make_range(word_start, word_end), SCu8(spare, match_size));
|
||||
String_Const_u8 spare = push_buffer_range(app, scratch, match.buffer, Ii64(match.start, match.end));
|
||||
if (search_hit_add(&global_heap, &complete_state.hits, &complete_state.str, (char*)spare.str, (i32)spare.size)){
|
||||
buffer_replace_range(app, buffer, Ii64(word_start, word_end), spare);
|
||||
view_set_cursor(app, view, seek_pos(word_start + match_size), true);
|
||||
|
||||
complete_state.word_end = word_start + match_size;
|
||||
complete_state.word_end = (i32)(word_start + match_size);
|
||||
complete_state.set.ranges[0].mid_size = match_size;
|
||||
break;
|
||||
}
|
||||
|
@ -925,11 +919,11 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with
|
|||
String_Const_u8 word = complete_state.iter.key.words[0];
|
||||
search_hit_add(&global_heap, &complete_state.hits, &complete_state.str, word);
|
||||
|
||||
match_size = (i32)word.size;
|
||||
buffer_replace_range(app, buffer, make_range(word_start, word_end), word);
|
||||
i32 match_size = (i32)word.size;
|
||||
buffer_replace_range(app, buffer, Ii64(word_start, word_end), word);
|
||||
view_set_cursor(app, view, seek_pos(word_start + match_size), true);
|
||||
|
||||
complete_state.word_end = word_start + match_size;
|
||||
complete_state.word_end = (i32)(word_start + match_size);
|
||||
complete_state.set.ranges[0].mid_size = match_size;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
internal void
|
||||
seek_pos_of_textual_line(Application_Links *app, Side side){
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer_id = view_get_buffer(app, view, AccessProtected);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i32 new_pos = get_line_side_pos_from_pos(app, buffer_id, pos, side);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
i64 new_pos = get_line_side_pos_from_pos(app, buffer, pos, side);
|
||||
view_set_cursor(app, view, seek_pos(new_pos), true);
|
||||
no_mark_snap_to_cursor_if_shift(app, view);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ seek_pos_of_textual_line(Application_Links *app, Side side){
|
|||
internal void
|
||||
seek_pos_of_visual_line(Application_Links *app, Side side){
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
i32 pos = view_get_cursor_pos(app, view);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Full_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos));
|
||||
f32 y = cursor.wrapped_y;
|
||||
f32 x = (side == Side_Min)?(0.f):(max_f32);
|
||||
|
|
6
4ed.cpp
6
4ed.cpp
|
@ -42,15 +42,11 @@ app_launch_coroutine(System_Functions *system, Application_Links *app, Coroutine
|
|||
|
||||
internal Coroutine_Head*
|
||||
app_resume_coroutine(System_Functions *system, Application_Links *app, Coroutine_Type type, Coroutine_Head *co, void *in, void *out){
|
||||
Coroutine_Head *result = 0;
|
||||
|
||||
App_Coroutine_State prev_state = get_state(app);
|
||||
|
||||
app->current_coroutine = co;
|
||||
app->type_coroutine = type;
|
||||
result = system->resume_coroutine(co, in, out);
|
||||
Coroutine_Head *result = system->resume_coroutine(co, in, out);
|
||||
restore_state(app, prev_state);
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
|
|
@ -311,7 +311,7 @@ DOC_SEE(Access_Flag)
|
|||
|
||||
// TODO(allen): redocument
|
||||
API_EXPORT b32
|
||||
Buffer_Read_Range(Application_Links *app, Buffer_ID buffer_id, i32 start, i32 one_past_last, char *out)
|
||||
Buffer_Read_Range(Application_Links *app, Buffer_ID buffer_id, Range_i64 range, char *out)
|
||||
/*
|
||||
DOC_PARAM(buffer, This parameter specifies the buffer to read.)
|
||||
DOC_PARAM(start, This parameter specifies absolute position of the first character in the read range.)
|
||||
|
@ -327,9 +327,9 @@ DOC_SEE(4coder_Buffer_Positioning_System)
|
|||
Editing_File *file = imp_get_file(models, buffer_id);
|
||||
b32 result = false;
|
||||
if (api_check_buffer(file)){
|
||||
i32 size = buffer_size(&file->state.buffer);
|
||||
if (0 <= start && start <= one_past_last && one_past_last <= size){
|
||||
buffer_stringify(&file->state.buffer, start, one_past_last, out);
|
||||
i64 size = buffer_size(&file->state.buffer);
|
||||
if (0 <= range.min && range.min <= range.max && range.max <= size){
|
||||
buffer_stringify(&file->state.buffer, (i32)range.min, (i32)range.max, out);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ DOC_SEE(4coder_Buffer_Positioning_System)
|
|||
|
||||
// TODO(allen): redocument
|
||||
API_EXPORT b32
|
||||
Buffer_Replace_Range(Application_Links *app, Buffer_ID buffer_id, Range range, String_Const_u8 string)
|
||||
Buffer_Replace_Range(Application_Links *app, Buffer_ID buffer_id, Range_i64 range, String_Const_u8 string)
|
||||
/*
|
||||
DOC_PARAM(buffer, This parameter specifies the buffer to edit.)
|
||||
DOC_PARAM(start, This parameter specifies absolute position of the first character in the replace range.)
|
||||
|
@ -356,12 +356,11 @@ DOC_SEE(4coder_Buffer_Positioning_System)
|
|||
Models *models = (Models*)app->cmd_context;
|
||||
Editing_File *file = imp_get_file(models, buffer_id);
|
||||
b32 result = false;
|
||||
i32 size = 0;
|
||||
if (api_check_buffer(file)){
|
||||
size = buffer_size(&file->state.buffer);
|
||||
i64 size = buffer_size(&file->state.buffer);
|
||||
if (0 <= range.first && range.first <= range.one_past_last && range.one_past_last <= size){
|
||||
Edit_Behaviors behaviors = {};
|
||||
edit_single(models->system, models, file, range, string, behaviors);
|
||||
edit_single(models->system, models, file, Ii32((i32)range.min, (i32)range.max), string, behaviors);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
@ -531,18 +530,18 @@ Buffer_Get_Access_Flags(Application_Links *app, Buffer_ID buffer_id){
|
|||
return(result);
|
||||
}
|
||||
|
||||
API_EXPORT u64
|
||||
API_EXPORT i64
|
||||
Buffer_Get_Size(Application_Links *app, Buffer_ID buffer_id){
|
||||
Models *models = (Models*)app->cmd_context;
|
||||
Editing_File *file = imp_get_file(models, buffer_id);
|
||||
u64 result = 0;
|
||||
i64 result = 0;
|
||||
if (api_check_buffer(file)){
|
||||
result = buffer_size(&file->state.buffer);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
API_EXPORT u64
|
||||
API_EXPORT i64
|
||||
Buffer_Get_Line_Count(Application_Links *app, Buffer_ID buffer_id){
|
||||
Models *models = (Models*)app->cmd_context;
|
||||
Editing_File *file = imp_get_file(models, buffer_id);
|
||||
|
@ -1125,8 +1124,8 @@ Buffer_Reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag fl
|
|||
vptrs[vptr_count] = view_it;
|
||||
File_Edit_Positions edit_pos = view_get_edit_pos(view_it);
|
||||
Full_Cursor cursor = file_compute_cursor(system, view_it->file, seek_pos(edit_pos.cursor_pos));
|
||||
line_numbers[vptr_count] = cursor.line;
|
||||
column_numbers[vptr_count] = cursor.character;
|
||||
line_numbers[vptr_count] = (i32)cursor.line;
|
||||
column_numbers[vptr_count] = (i32)cursor.character;
|
||||
view_it->file = models->scratch_buffer;
|
||||
++vptr_count;
|
||||
}
|
||||
|
@ -1325,11 +1324,11 @@ View_Get_Buffer(Application_Links *app, View_ID view_id, Access_Flag access){
|
|||
return(result);
|
||||
}
|
||||
|
||||
API_EXPORT i32
|
||||
API_EXPORT i64
|
||||
View_Get_Cursor_Pos(Application_Links *app, View_ID view_id){
|
||||
Models *models = (Models*)app->cmd_context;
|
||||
View *view = imp_get_view(models, view_id);
|
||||
i32 result = 0;
|
||||
i64 result = 0;
|
||||
if (api_check_view(view)){
|
||||
File_Edit_Positions edit_pos = view_get_edit_pos(view);
|
||||
result = edit_pos.cursor_pos;
|
||||
|
@ -1337,11 +1336,11 @@ View_Get_Cursor_Pos(Application_Links *app, View_ID view_id){
|
|||
return(result);
|
||||
}
|
||||
|
||||
API_EXPORT i32
|
||||
API_EXPORT i64
|
||||
View_Get_Mark_Pos(Application_Links *app, View_ID view_id){
|
||||
Models *models = (Models*)app->cmd_context;
|
||||
View *view = imp_get_view(models, view_id);
|
||||
i32 result = 0;;
|
||||
i64 result = 0;;
|
||||
if (api_check_view(view)){
|
||||
result = view->mark;
|
||||
}
|
||||
|
@ -1900,7 +1899,7 @@ DOC_SEE(Set_Buffer_Flag)
|
|||
|
||||
// TODO(allen): redocument
|
||||
API_EXPORT b32
|
||||
View_Post_Fade(Application_Links *app, View_ID view_id, float seconds, i32 start, i32 end, int_color color)
|
||||
View_Post_Fade(Application_Links *app, View_ID view_id, f32 seconds, Range_i64 range, int_color color)
|
||||
/*
|
||||
DOC_PARAM(view, The view parameter specifies the view onto which the fade effect shall be posted.)
|
||||
DOC_PARAM(seconds, This parameter specifies the number of seconds the fade effect should last.)
|
||||
|
@ -1914,9 +1913,9 @@ DOC_SEE(int_color)
|
|||
View *view = imp_get_view(models, view_id);
|
||||
b32 result = false;
|
||||
if (api_check_view(view)){
|
||||
i32 size = end - start;
|
||||
i64 size = range_size(range);
|
||||
if (size > 0){
|
||||
view_post_paste_effect(view, seconds, start, size, color|0xFF000000);
|
||||
view_post_paste_effect(view, seconds, (i32)range.start, (i32)size, color|0xFF000000);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
@ -3878,14 +3877,13 @@ Text_Layout_Layout_Point_To_Buffer_Point(Application_Links *app, Text_Layout_ID
|
|||
return(result);
|
||||
}
|
||||
|
||||
API_EXPORT b32
|
||||
Text_Layout_Get_On_Screen_Range(Application_Links *app, Text_Layout_ID text_layout_id, Range *on_screen_range_out){
|
||||
API_EXPORT Range_i64
|
||||
Text_Layout_Get_On_Screen_Range(Application_Links *app, Text_Layout_ID text_layout_id){
|
||||
Models *models = (Models*)app->cmd_context;
|
||||
Text_Layout layout = {};
|
||||
b32 result = false;
|
||||
Range_i64 result = {};
|
||||
if (text_layout_get(&models->text_layouts, text_layout_id, &layout)){
|
||||
*on_screen_range_out = layout.on_screen_range;
|
||||
result = true;
|
||||
result = Ii64(layout.on_screen_range.min, layout.on_screen_range.max);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
@ -4016,7 +4014,7 @@ Compute_Render_Layout(Application_Links *app, View_ID view_id, Buffer_ID buffer_
|
|||
end_pos = state.i;
|
||||
}
|
||||
|
||||
Range range = {render_cursor.pos, end_pos};
|
||||
Range range = Ii32((i32)render_cursor.pos, (i32)end_pos);
|
||||
|
||||
// TODO(allen):
|
||||
view->render.view_rect = view->panel->rect_inner;
|
||||
|
@ -4111,8 +4109,7 @@ Get_View_Visible_Range(Application_Links *app, View_ID view_id){
|
|||
Full_Cursor min_cursor = view_get_render_cursor(models->system, view);
|
||||
Buffer_Seek seek = seek_unwrapped_xy(0.f, min_cursor.wrapped_y + view_height + line_height, false);
|
||||
Full_Cursor max_cursor = view_compute_cursor(app, view_id, seek);
|
||||
result.min = min_cursor.pos;
|
||||
result.max = max_cursor.pos;
|
||||
result = Ii32((i32)min_cursor.pos, (i32)max_cursor.pos);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
|
|
@ -1273,7 +1273,7 @@ buffer_cursor_seek(Buffer_Cursor_Seek_State *S_ptr, Buffer_Cursor_Seek_Params pa
|
|||
{
|
||||
params.seek.pos = clamp(0, params.seek.pos, S.size);
|
||||
|
||||
line_index = buffer_get_line_number(params.buffer, params.seek.pos);
|
||||
line_index = buffer_get_line_number(params.buffer, (i32)params.seek.pos);
|
||||
}break;
|
||||
|
||||
case buffer_seek_character_pos:
|
||||
|
@ -1282,12 +1282,12 @@ buffer_cursor_seek(Buffer_Cursor_Seek_State *S_ptr, Buffer_Cursor_Seek_Params pa
|
|||
i32 max_character = params.character_starts[line_count] - 1;
|
||||
params.seek.pos = clamp(0, params.seek.pos, max_character);
|
||||
|
||||
line_index = buffer_get_line_index_from_character_pos(params.character_starts, params.seek.pos, 0, params.buffer->line_count);
|
||||
line_index = buffer_get_line_index_from_character_pos(params.character_starts, (i32)params.seek.pos, 0, params.buffer->line_count);
|
||||
}break;
|
||||
|
||||
case buffer_seek_line_char:
|
||||
{
|
||||
line_index = params.seek.line - 1;
|
||||
line_index = (i32)params.seek.line - 1;
|
||||
line_index = clamp_bot(0, line_index);
|
||||
}break;
|
||||
|
||||
|
@ -1327,8 +1327,8 @@ buffer_cursor_seek(Buffer_Cursor_Seek_State *S_ptr, Buffer_Cursor_Seek_Params pa
|
|||
// non-virtual character of the line.
|
||||
if (params.virtual_white){
|
||||
S_stop.status = BLStatus_NeedLineShift;
|
||||
S_stop.line_index = S.next_cursor.line-1;
|
||||
S_stop.wrap_line_index = S.next_cursor.wrap_line-1;
|
||||
S_stop.line_index = (i32)S.next_cursor.line - 1;
|
||||
S_stop.wrap_line_index = (i32)S.next_cursor.wrap_line - 1;
|
||||
DrYield(1, S_stop);
|
||||
|
||||
S.next_cursor.unwrapped_x += line_shift;
|
||||
|
@ -1336,7 +1336,7 @@ buffer_cursor_seek(Buffer_Cursor_Seek_State *S_ptr, Buffer_Cursor_Seek_Params pa
|
|||
|
||||
S.stream.use_termination_character = 1;
|
||||
S.stream.terminator = '\n';
|
||||
if (buffer_stringify_loop(&S.stream, params.buffer, S.next_cursor.pos, S.size)){
|
||||
if (buffer_stringify_loop(&S.stream, params.buffer, (i32)S.next_cursor.pos, S.size)){
|
||||
do{
|
||||
for (; S.next_cursor.pos < S.stream.end; ++S.next_cursor.pos){
|
||||
u8 ch = (u8)S.stream.data[S.next_cursor.pos];
|
||||
|
@ -1404,7 +1404,7 @@ buffer_cursor_seek(Buffer_Cursor_Seek_State *S_ptr, Buffer_Cursor_Seek_Params pa
|
|||
}
|
||||
|
||||
// Main seek loop
|
||||
S.i = S.next_cursor.pos;
|
||||
S.i = (i32)S.next_cursor.pos;
|
||||
|
||||
S.stream = null_buffer_stream;
|
||||
S.stream.use_termination_character = 1;
|
||||
|
@ -1437,8 +1437,8 @@ buffer_cursor_seek(Buffer_Cursor_Seek_State *S_ptr, Buffer_Cursor_Seek_Params pa
|
|||
|
||||
if (params.virtual_white){
|
||||
S_stop.status = BLStatus_NeedLineShift;
|
||||
S_stop.line_index = S.next_cursor.line-1;
|
||||
S_stop.wrap_line_index = S.next_cursor.wrap_line-1;
|
||||
S_stop.line_index = (i32)S.next_cursor.line - 1;
|
||||
S_stop.wrap_line_index = (i32)S.next_cursor.wrap_line - 1;
|
||||
DrYield(2, S_stop);
|
||||
}
|
||||
|
||||
|
@ -1456,8 +1456,8 @@ buffer_cursor_seek(Buffer_Cursor_Seek_State *S_ptr, Buffer_Cursor_Seek_Params pa
|
|||
|
||||
if (S.step.i >= S.wrap_unit_end){
|
||||
S_stop.status = BLStatus_NeedWrapDetermination;
|
||||
S_stop.line_index = S.next_cursor.line-1;
|
||||
S_stop.wrap_line_index = S.next_cursor.wrap_line-1;
|
||||
S_stop.line_index = (i32)S.next_cursor.line - 1;
|
||||
S_stop.wrap_line_index = (i32)S.next_cursor.wrap_line - 1;
|
||||
S_stop.pos = S.step.i;
|
||||
S_stop.x = S.next_cursor.wrapped_x;
|
||||
DrYield(4, S_stop);
|
||||
|
@ -1470,8 +1470,8 @@ buffer_cursor_seek(Buffer_Cursor_Seek_State *S_ptr, Buffer_Cursor_Seek_Params pa
|
|||
++S.next_cursor.wrap_line;
|
||||
if (params.virtual_white){
|
||||
S_stop.status = BLStatus_NeedWrapLineShift;
|
||||
S_stop.line_index = S.next_cursor.line-1;
|
||||
S_stop.wrap_line_index = S.next_cursor.wrap_line-1;
|
||||
S_stop.line_index = (i32)S.next_cursor.line - 1;
|
||||
S_stop.wrap_line_index = (i32)S.next_cursor.wrap_line - 1;
|
||||
DrYield(3, S_stop);
|
||||
}
|
||||
|
||||
|
@ -1681,8 +1681,8 @@ buffer_render_data(Buffer_Render_State *S_ptr, Buffer_Render_Params params, f32
|
|||
S.shift_y += params.start_cursor.unwrapped_y;
|
||||
}
|
||||
|
||||
S.line = params.start_cursor.line - 1;
|
||||
S.wrap_line = params.start_cursor.wrap_line - 1;
|
||||
S.line = (i32)params.start_cursor.line - 1;
|
||||
S.wrap_line = (i32)params.start_cursor.wrap_line - 1;
|
||||
|
||||
if (params.virtual_white){
|
||||
S_stop.status = BLStatus_NeedLineShift;
|
||||
|
@ -1708,7 +1708,7 @@ buffer_render_data(Buffer_Render_State *S_ptr, Buffer_Render_Params params, f32
|
|||
|
||||
S.first_of_the_line = true;
|
||||
S.first_of_the_wrap = true;
|
||||
S.i = params.start_cursor.pos;
|
||||
S.i = (i32)params.start_cursor.pos;
|
||||
if (buffer_stringify_loop(&S.stream, params.buffer, S.i, S.size)){
|
||||
do{
|
||||
for (; S.i < S.stream.end; ++S.i){
|
||||
|
|
|
@ -29,8 +29,8 @@ edit_pre_state_change(System_Functions *system, Heap *heap, Models *models, Edit
|
|||
if (view->file == file){
|
||||
Full_Cursor render_cursor = view_get_render_cursor(system, view);
|
||||
Full_Cursor target_cursor = view_get_render_cursor_target(system, view);
|
||||
view->temp_view_top_left_pos = render_cursor.pos;
|
||||
view->temp_view_top_left_target_pos = target_cursor.pos;
|
||||
view->temp_view_top_left_pos = (i32)render_cursor.pos;
|
||||
view->temp_view_top_left_target_pos = (i32)target_cursor.pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,8 +132,8 @@ edit_fix_markers(System_Functions *system, Models *models, Editing_File *file, E
|
|||
View *view = panel->view;
|
||||
if (view->file == file){
|
||||
File_Edit_Positions edit_pos = view_get_edit_pos(view);
|
||||
write_cursor_with_index(cursors, &cursor_count, edit_pos.cursor_pos);
|
||||
write_cursor_with_index(cursors, &cursor_count, view->mark);
|
||||
write_cursor_with_index(cursors, &cursor_count, (i32)edit_pos.cursor_pos);
|
||||
write_cursor_with_index(cursors, &cursor_count, (i32)view->mark);
|
||||
write_cursor_with_index(cursors, &cursor_count, view->temp_view_top_left_pos);
|
||||
write_cursor_with_index(cursors, &cursor_count, view->temp_view_top_left_target_pos);
|
||||
}
|
||||
|
|
|
@ -225,11 +225,11 @@ file_compute_partial_cursor(Editing_File *file, Buffer_Seek seek){
|
|||
switch (seek.type){
|
||||
case buffer_seek_pos:
|
||||
{
|
||||
result = buffer_partial_from_pos(&file->state.buffer, seek.pos);
|
||||
result = buffer_partial_from_pos(&file->state.buffer, (i32)seek.pos);
|
||||
}break;
|
||||
case buffer_seek_line_char:
|
||||
{
|
||||
result = buffer_partial_from_line_character(&file->state.buffer, seek.line, seek.character);
|
||||
result = buffer_partial_from_line_character(&file->state.buffer, (i32)seek.line, (i32)seek.character);
|
||||
}break;
|
||||
// TODO(allen): do(support buffer_seek_character_pos and character_pos coordiantes in partial cursor system)
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ enum{
|
|||
struct File_Edit_Positions{
|
||||
Edit_Pos_Set_Type last_set_type;
|
||||
GUI_Scroll_Vars scroll;
|
||||
i32 cursor_pos;
|
||||
i64 cursor_pos;
|
||||
};
|
||||
|
||||
// TODO(allen): do(replace Text_Effect with markers over time)
|
||||
|
|
12
4ed_view.cpp
12
4ed_view.cpp
|
@ -247,7 +247,7 @@ view_move_cursor_to_view(System_Functions *system, Models *models, View *view, G
|
|||
}
|
||||
Buffer_Seek seek = seek_xy(preferred_x, cursor_y, false, file->settings.unwrapped_lines);
|
||||
cursor = file_compute_cursor(system, file, seek);
|
||||
*pos_in_out = cursor.pos;
|
||||
*pos_in_out = (i32)cursor.pos;
|
||||
result = true;
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ view_set_preferred_x_to_current_position(System_Functions *system, View *view){
|
|||
internal void
|
||||
view_set_cursor(System_Functions *system, Models *models, View *view, Full_Cursor cursor, b32 set_preferred_x){
|
||||
File_Edit_Positions edit_pos = view_get_edit_pos(view);
|
||||
file_edit_positions_set_cursor(&edit_pos, cursor.pos);
|
||||
file_edit_positions_set_cursor(&edit_pos, (i32)cursor.pos);
|
||||
if (set_preferred_x){
|
||||
view_set_preferred_x(view, cursor);
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ view_set_scroll(System_Functions *system, Models *models, View *view, GUI_Scroll
|
|||
File_Edit_Positions edit_pos = view_get_edit_pos(view);
|
||||
file_edit_positions_set_scroll(&edit_pos, scroll, view_compute_max_target_y(models, view));
|
||||
view_set_edit_pos(view, edit_pos);
|
||||
i32 pos = edit_pos.cursor_pos;
|
||||
i32 pos = (i32)edit_pos.cursor_pos;
|
||||
if (view_move_cursor_to_view(system, models, view, edit_pos.scroll, &pos, view->preferred_x)){
|
||||
Full_Cursor cursor = file_compute_cursor(system, view->file, seek_pos(pos));
|
||||
edit_pos.cursor_pos = cursor.pos;
|
||||
|
@ -307,7 +307,7 @@ view_set_scroll(System_Functions *system, Models *models, View *view, GUI_Scroll
|
|||
internal void
|
||||
view_set_cursor_and_scroll(Models *models, View *view, Full_Cursor cursor, b32 set_preferred_x, GUI_Scroll_Vars scroll){
|
||||
File_Edit_Positions edit_pos = view_get_edit_pos(view);
|
||||
file_edit_positions_set_cursor(&edit_pos, cursor.pos);
|
||||
file_edit_positions_set_cursor(&edit_pos, (i32)cursor.pos);
|
||||
if (set_preferred_x){
|
||||
view_set_preferred_x(view, cursor);
|
||||
}
|
||||
|
@ -887,7 +887,7 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v
|
|||
|
||||
i32 *line_starts = file->state.buffer.line_starts;
|
||||
i32 line_count = file->state.buffer.line_count;
|
||||
i32 line_scan_index = render_cursor.line - 1;
|
||||
i32 line_scan_index = (i32)render_cursor.line - 1;
|
||||
i32 first_byte_index_of_next_line = 0;
|
||||
if (line_scan_index + 1 < line_count){
|
||||
first_byte_index_of_next_line = line_starts[line_scan_index + 1];
|
||||
|
@ -901,7 +901,7 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v
|
|||
if (wrap_count > 0 && wrap_starts[wrap_count - 1] == buffer_size(&file->state.buffer)){
|
||||
wrap_count -= 1;
|
||||
}
|
||||
i32 wrap_scan_index = render_cursor.wrap_line - render_cursor.line;
|
||||
i32 wrap_scan_index = (i32)render_cursor.wrap_line - (i32)render_cursor.line;
|
||||
i32 first_byte_index_of_next_wrap = 0;
|
||||
if (wrap_scan_index + 1 < wrap_count){
|
||||
first_byte_index_of_next_wrap = wrap_starts[wrap_scan_index + 1];
|
||||
|
|
|
@ -22,7 +22,7 @@ struct View{
|
|||
Lifetime_Object *lifetime_object;
|
||||
|
||||
File_Edit_Positions edit_pos_;
|
||||
i32 mark;
|
||||
i64 mark;
|
||||
f32 preferred_x;
|
||||
|
||||
i32 temp_view_top_left_pos;
|
||||
|
|
Loading…
Reference in New Issue