Sped up function lister

This commit is contained in:
Allen Webster 2018-12-09 17:31:30 -08:00
parent cb85505390
commit a51863f492
13 changed files with 306 additions and 2717 deletions

View File

@ -178,15 +178,13 @@ snippet_lister__parameterized(Application_Links *app, Snippet_Array snippet_arra
int32_t option_count = snippet_array.count;
Lister_Option *options = push_array(arena, Lister_Option, option_count);
for (int32_t i = 0; i < snippet_array.count; i += 1){
options[i].string = snippet_array.snippets[i].name;
options[i].status = snippet_array.snippets[i].text;
options[i].string = make_string_slowly(snippet_array.snippets[i].name);
options[i].status = make_string_slowly(snippet_array.snippets[i].text);
options[i].user_data = IntAsPtr(i);
}
begin_integrated_lister__basic_list(app, "Snippet:", activate_snippet,
&snippet_array, sizeof(snippet_array),
options, option_count,
0,
&view);
options, option_count, 0, &view);
end_temp_memory(temp);
}

View File

@ -10,6 +10,43 @@
// iterating tokens is now.
//
static Buffered_Write_Stream
make_buffered_write_stream(Buffer_ID output_buffer_id, Partition *buffering_arena){
Buffered_Write_Stream stream = {};
stream.output_buffer_id = output_buffer_id;
stream.buffering_arena = buffering_arena;
stream.buffer = push_array(buffering_arena, char, 0);
return(stream);
}
static void
buffered_write_stream_flush(Application_Links *app, Buffered_Write_Stream *stream){
Buffer_Summary buffer = get_buffer(app, stream->output_buffer_id, AccessProtected);
int32_t buffer_size = (int32_t)(push_array(stream->buffering_arena, char, 0) - stream->buffer);
buffer_replace_range(app, &buffer, buffer.size, buffer.size, stream->buffer, buffer_size);
stream->buffering_arena->pos -= buffer_size;
}
static void
buffered_write_stream_write(Application_Links *app, Buffered_Write_Stream *stream, String text){
for (;text.size > 0;){
char *buffered = push_array(stream->buffering_arena, char, text.size);
if (buffered != 0){
memcpy(buffered, text.str, text.size);
text.size = 0;
}
else{
int32_t partial_size = partition_remaining(stream->buffering_arena);
buffered = push_array(stream->buffering_arena, char, partial_size);
Assert(partial_size < text.size);
memcpy(buffered, text.str, partial_size);
text.size -= partial_size;
text.str += partial_size;
buffered_write_stream_flush(app, stream);
}
}
}
static Get_Positions_Results
get_function_positions(Application_Links *app, Buffer_Summary *buffer, int32_t token_index, Function_Positions *positions_array, int32_t positions_max){
Get_Positions_Results result = {};
@ -143,26 +180,17 @@ get_function_positions(Application_Links *app, Buffer_Summary *buffer, int32_t t
}
static void
print_positions(Application_Links *app, Buffer_Summary *buffer, Function_Positions *positions_array, int32_t positions_count, Buffer_Summary *output_buffer, Partition *part){
Temp_Memory temp = begin_temp_memory(part);
Partition extra_memory_ = partition_sub_part(part, (4<<10));
Partition *extra_memory = &extra_memory_;
char *str_ptr = (char*)partition_current(part);
int32_t part_size = 0;
print_positions_buffered(Application_Links *app, Buffer_Summary *buffer, Function_Positions *positions_array, int32_t positions_count, Buffered_Write_Stream *stream){
String buffer_name = make_string(buffer->buffer_name, buffer->buffer_name_len);
int32_t size = output_buffer->size;
for (int32_t i = 0; i < positions_count; ++i){
Function_Positions *positions = &positions_array[i];
Temp_Memory extra_temp = begin_temp_memory(extra_memory);
int32_t local_index = positions->sig_start_index;
int32_t end_index = positions->sig_end_index;
int32_t open_paren_pos = positions->open_paren_pos;
int32_t line_number = buffer_get_line_number(app, buffer, open_paren_pos);
Assert(end_index > local_index);
@ -170,105 +198,60 @@ print_positions(Application_Links *app, Buffer_Summary *buffer, Function_Positio
Cpp_Token sig_chunk[sig_chunk_size];
Stream_Tokens sig_stream = {};
if (init_stream_tokens(&sig_stream, app, buffer, local_index, sig_chunk, sig_chunk_size)){
buffered_write_stream_write(app, stream, buffer_name);
buffered_write_stream_write(app, stream, make_lit_string(":"));
{
char space[64];
String integer_string = make_fixed_width_string(space);
append_int_to_str(&integer_string, line_number);
buffered_write_stream_write(app, stream, integer_string);
}
buffered_write_stream_write(app, stream, make_lit_string(": "));
bool32 still_looping = false;
do{
Cpp_Token prev_token = {};
for (; local_index < sig_stream.end; ++local_index){
Cpp_Token *token = &sig_stream.tokens[local_index];
if (!(token->flags & CPP_TFLAG_PP_BODY) && token->type != CPP_TOKEN_COMMENT){
bool32 delete_space_before = false;
bool32 space_after = false;
switch (token->type){
case CPP_TOKEN_PARENTHESE_OPEN:
case CPP_TOKEN_PARENTHESE_CLOSE:
{
delete_space_before = true;
}break;
case CPP_TOKEN_IDENTIFIER:
case CPP_TOKEN_STAR:
{
space_after = true;
}break;
case CPP_TOKEN_COMMA:
{
delete_space_before = true;
space_after = true;
}break;
if ((token->flags & CPP_TFLAG_PP_BODY) == 0 && token->type != CPP_TOKEN_COMMENT){
char space[2 << 10];
int32_t token_size = token->size;
if (token_size > sizeof(space)){
token_size = sizeof(space);
}
buffer_read_range(app, buffer, token->start, token->start + token_size, space);
if (token->flags & CPP_TFLAG_IS_KEYWORD){
space_after = true;
}
bool32 insert_space = (/**/
(prev_token.type == CPP_TOKEN_IDENTIFIER ||
prev_token.type == CPP_TOKEN_STAR ||
prev_token.type == CPP_TOKEN_COMMA ||
(prev_token.flags & CPP_TFLAG_IS_KEYWORD) != 0
) &&
!(token->type == CPP_TOKEN_PARENTHESE_OPEN ||
token->type == CPP_TOKEN_PARENTHESE_CLOSE ||
token->type == CPP_TOKEN_COMMA
)
);
if (delete_space_before){
int32_t pos = extra_memory->pos - 1;
char *base = ((char*)(extra_memory->base));
if (pos >= 0 && base[pos] == ' '){
extra_memory->pos = pos;
}
}
char *token_str = push_array(extra_memory, char, token->size + space_after);
if (token_str != 0){
buffer_read_range(app, buffer, token->start, token->start + token->size, token_str);
if (space_after){
token_str[token->size] = ' ';
}
}
else{
goto finish_print;
if (insert_space){
buffered_write_stream_write(app, stream, make_lit_string(" "));
}
buffered_write_stream_write(app, stream, make_string(space, token_size));
prev_token = *token;
}
if (local_index == end_index){
goto finish_print;
goto doublebreak;
}
}
still_looping = forward_stream_tokens(&sig_stream);
}while(still_looping);
doublebreak:;
finish_print:;
{
int32_t sig_size = extra_memory->pos;
String sig = make_string(extra_memory->base, sig_size);
int32_t line_number = buffer_get_line_number(app, buffer, open_paren_pos);
int32_t line_number_len = int_to_str_size(line_number);
int32_t append_len = buffer_name.size + 1 + line_number_len + 1 + 1 + sig_size + 1;
char *out_space = push_array(part, char, append_len);
if (out_space == 0){
buffer_replace_range(app, output_buffer, size, size, str_ptr, part_size);
size += part_size;
end_temp_memory(temp);
temp = begin_temp_memory(part);
part_size = 0;
out_space = push_array(part, char, append_len);
}
part_size += append_len;
String out = make_string(out_space, 0, append_len);
append(&out, buffer_name);
append(&out, ':');
append_int_to_str(&out, line_number);
append(&out, ':');
append(&out, ' ');
append(&out, sig);
append(&out, '\n');
}
buffered_write_stream_write(app, stream, make_lit_string("\n"));
}
end_temp_memory(extra_temp);
}
buffer_replace_range(app, output_buffer, size, size, str_ptr, part_size);
end_temp_memory(temp);
}
static void
@ -291,6 +274,8 @@ list_all_functions(Application_Links *app, Partition *part, Buffer_Summary *opti
int32_t positions_max = (4<<10)/sizeof(Function_Positions);
Function_Positions *positions_array = push_array(part, Function_Positions, positions_max);
Buffered_Write_Stream buffered_write_stream = make_buffered_write_stream(decls_buffer.buffer_id, part);
for (Buffer_Summary buffer_it = get_buffer_first(app, AccessAll);
buffer_it.exists;
get_buffer_next(app, &buffer_it, AccessAll)){
@ -312,7 +297,8 @@ list_all_functions(Application_Links *app, Partition *part, Buffer_Summary *opti
token_index = get_positions_results.next_token_index;
still_looping = get_positions_results.still_looping;
print_positions(app, &buffer, positions_array, positions_count, &decls_buffer, part);
print_positions_buffered(app, &buffer, positions_array, positions_count, &buffered_write_stream);
//print_positions(app, &buffer, positions_array, positions_count, &decls_buffer, part);
}while(still_looping);
if (optional_target_buffer != 0){
@ -320,6 +306,8 @@ list_all_functions(Application_Links *app, Partition *part, Buffer_Summary *opti
}
}
buffered_write_stream_flush(app, &buffered_write_stream);
View_Summary view = get_active_view(app, AccessAll);
view_set_buffer(app, &view, decls_buffer.buffer_id, 0);

View File

@ -19,6 +19,12 @@ struct Get_Positions_Results{
bool32 still_looping;
};
struct Buffered_Write_Stream{
Buffer_ID output_buffer_id;
Partition *buffering_arena;
char *buffer;
};
#endif
// BOTTOM

View File

@ -270,7 +270,7 @@ static Command_Metadata fcoder_metacmd_table[228] = {
{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1060 },
{ PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 203 },
{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 484 },
{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 938 },
{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 935 },
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 26 },
{ PROC_LINKS(cursor_mark_swap, 0), "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 96 },
{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 35 },
@ -311,18 +311,18 @@ static Command_Metadata fcoder_metacmd_table[228] = {
{ PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 81 },
{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 562 },
{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 540 },
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 751 },
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 856 },
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 884 },
{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 822 },
{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 732 },
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 748 },
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 853 },
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 881 },
{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 819 },
{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 729 },
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1538 },
{ PROC_LINKS(kill_rect, 0), "kill_rect", 9, "Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.", 93, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 26 },
{ PROC_LINKS(left_adjust_view, 0), "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 133 },
{ PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 355 },
{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 361 },
{ 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, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 332 },
{ 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, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 342 },
{ PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 343 },
{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 349 },
{ 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, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 320 },
{ 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, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 330 },
{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\4coder_search.cpp", 29, 769 },
{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "w:\\4ed\\code\\4coder_search.cpp", 29, 783 },
{ PROC_LINKS(list_all_locations_of_identifier, 0), "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\4coder_search.cpp", 29, 797 },
@ -375,7 +375,7 @@ static Command_Metadata fcoder_metacmd_table[228] = {
{ PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 573 },
{ PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1067 },
{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1074 },
{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder theme selector list.", 37, "w:\\4ed\\code\\4coder_lists.cpp", 28, 900 },
{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder theme selector list.", 37, "w:\\4ed\\code\\4coder_lists.cpp", 28, 897 },
{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1445 },
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1600 },
{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 57 },
@ -449,7 +449,7 @@ static Command_Metadata fcoder_metacmd_table[228] = {
{ PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 493 },
{ PROC_LINKS(snipe_token_or_word, 0), "snipe_token_or_word", 19, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1270 },
{ PROC_LINKS(snipe_token_or_word_right, 0), "snipe_token_or_word_right", 25, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1276 },
{ PROC_LINKS(snippet_lister, 0), "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 193 },
{ PROC_LINKS(snippet_lister, 0), "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 191 },
{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 234 },
{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1505 },
{ PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 391 },

View File

@ -81,8 +81,8 @@ open_jump_lister(Application_Links *app, Partition *scratch, Heap *heap,
managed_object_load_data(app, stored_jumps, i, 1, &stored);
String line = {};
read_line(app, scratch, &list_buffer, stored.list_line, &line);
options[i].string = line.str;
options[i].status = 0;
options[i].string = line;
memset(&options[i].status, 0, sizeof(options[i].status));
options[i].user_data = IntAsPtr(i);
int32_t aligned_size = line.size + 1 + 7;
aligned_size = aligned_size - aligned_size%8;

File diff suppressed because it is too large Load Diff

View File

@ -354,10 +354,7 @@ begin_integrated_lister__basic_list(Application_Links *app, char *query_string,
init_lister_state(state, heap, arena_size);
lister_first_init(&state->arena, &state->lister, user_data, user_data_size);
for (int32_t i = 0; i < option_count; i += 1){
lister_add_item(&state->arena, &state->lister,
make_string_slowly(options[i].string),
make_string_slowly(options[i].status),
options[i].user_data, 0);
lister_add_item(&state->arena, &state->lister, options[i].string, options[i].status, options[i].user_data, 0);
}
lister_set_query_string(&state->lister, query_string);
state->lister.handlers = lister_get_default_handlers();
@ -946,8 +943,8 @@ CUSTOM_DOC("Opens an interactive list of all registered commands.")
int32_t option_count = command_one_past_last_id;
Lister_Option *options = push_array(arena, Lister_Option, option_count);
for (int32_t i = 0; i < command_one_past_last_id; i += 1){
options[i].string = fcoder_metacmd_table[i].name;
options[i].status = fcoder_metacmd_table[i].description;
options[i].string = make_string_slowly(fcoder_metacmd_table[i].name);
options[i].status = make_string_slowly(fcoder_metacmd_table[i].description);
options[i].user_data = (void*)fcoder_metacmd_table[i].proc;
}
begin_integrated_lister__basic_list(app, "Command:", activate_command, 0, 0,

View File

@ -1539,10 +1539,8 @@ CUSTOM_DOC("Open a lister of all commands in the currently loaded project.")
int32_t option_count = current_project.command_array.count;
Lister_Option *options = push_array(arena, Lister_Option, option_count);
for (int32_t i = 0; i < current_project.command_array.count; i += 1){
String string = string_push_copy(arena, current_project.command_array.commands[i].name);
String status = string_push_copy(arena, current_project.command_array.commands[i].cmd);
options[i].string = string.str;
options[i].status = status.str;
options[i].string = string_push_copy(arena, current_project.command_array.commands[i].name);
options[i].status = string_push_copy(arena, current_project.command_array.commands[i].cmd);
options[i].user_data = IntAsPtr(i);
}
begin_integrated_lister__basic_list(app, "Command:", activate_project_command, 0, 0,

View File

@ -86,8 +86,8 @@ struct Lister_State{
////////////////////////////////
struct Lister_Option{
char *string;
char *status;
String string;
String status;
void *user_data;
};

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
1
0
119
122

View File

@ -34,7 +34,7 @@ FSTRING_BEGIN
#endif
#if !defined(FSTRING_GUARD)
#define literal(s) (s), (sizeof(s)-1)
#define literal(s) (s), (sizeof(s) - 1)
typedef struct String{
char *str;
@ -2128,9 +2128,11 @@ DOC_PARAM(part, A partition on which the string will be allocated.)
DOC_PARAM(size, The number of bytes to allocated for the new string.)
DOC_RETURN(If successfull returns an empty string with capacity equal to the size parameter, otherwise returns a null string.)*/{
String result = {};
result.str = push_array(part, char, size);
if (result.str != 0){
result.memory_size = size;
if (size > 0){
result.str = push_array(part, char, size);
if (result.str != 0){
result.memory_size = size;
}
}
return(result);
}
@ -2141,11 +2143,13 @@ DOC_PARAM(part, A partition on which the string will be allocated.)
DOC_PARAM(str, The source string to copy into the new string. The copy includes a null terminator whther or not the source does.)
DOC_RETURN(If successfull returns a string copy of str, otherwise returns a null string.)*/{
String result = {};
result.str = push_array(part, char, str.size + 1);
if (result.str != 0){
result.memory_size = str.size + 1;
copy(&result, str);
result.str[result.size] = 0;
if (str.str != 0){
result.str = push_array(part, char, str.size + 1);
if (result.str != 0){
result.memory_size = str.size + 1;
copy(&result, str);
result.str[result.size] = 0;
}
}
return(result);
}

View File

@ -14,8 +14,8 @@
[x] High CPU usage in listers (endless animation bug)
[x] Panel resizing doesn't work
[x] On windows file lister: /foo/bar.txt
[] Notepad like mode clicking to new view doesn't snap the mark
[] Notepad like mode replacing text with cursor at end of selection in middle of long file
[x] Notepad like mode clicking to new view doesn't snap the mark
[x] Notepad like mode replacing text with cursor at end of selection in middle of long file
[] Tab when no valid completions in open file lister
[] Graphics problem (fonts not rendering)
[] Texture binding changes too often problem.