From bd5569a389e9c1072158afe6cf62790d86f5939f Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Mon, 17 Jul 2017 19:03:38 -0400 Subject: [PATCH] fixed jump to todo bug --- 4coder_helper/4coder_jump_parsing.h | 33 ++++++++++++++++------------- 4ed.cpp | 3 +-- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/4coder_helper/4coder_jump_parsing.h b/4coder_helper/4coder_jump_parsing.h index d374d854..202a3419 100644 --- a/4coder_helper/4coder_jump_parsing.h +++ b/4coder_helper/4coder_jump_parsing.h @@ -24,46 +24,48 @@ struct Name_Based_Jump_Location{ }; static bool32 -ms_style_verify(String line, int32_t paren_pos){ +ms_style_verify(String line, int32_t left_paren_pos, int32_t right_paren_pos){ int32_t result = false; - String line_part = substr_tail(line, paren_pos); + String line_part = substr_tail(line, right_paren_pos); if (match_part_sc(line_part, ") : ")){ result = true; } else if (match_part_sc(line_part, "): ")){ result = true; } + if (result){ + String number = substr(line, left_paren_pos, right_paren_pos - left_paren_pos); + if (!str_is_int_s(number)){ + result = false; + } + } return(result); } static bool32 parse_jump_location(String line, Name_Based_Jump_Location *location, int32_t *colon_char, bool32 *is_sub_error){ bool32 result = false; + *is_sub_error = (line.str[0] == ' '); int32_t whitespace_length = 0; - String original_line = line; line = skip_chop_whitespace(line, &whitespace_length); int32_t colon_pos = 0; bool32 is_ms_style = false; - *is_sub_error = false; - if (original_line.str[0] == ' '){ - *is_sub_error = true; - } - - int32_t paren_pos = find_s_char(line, 0, ')'); - while (!is_ms_style && paren_pos < line.size){ - if (ms_style_verify(line, paren_pos)){ + int32_t left_paren_pos = find_s_char(line, 0, '('); + int32_t right_paren_pos = find_s_char(line, left_paren_pos, ')'); + while (!is_ms_style && right_paren_pos < line.size){ + if (ms_style_verify(line, left_paren_pos, right_paren_pos)){ is_ms_style = true; - colon_pos = find_s_char(line, paren_pos, ':'); + colon_pos = find_s_char(line, right_paren_pos, ':'); if (colon_pos < line.size){ String location_str = substr(line, 0, colon_pos); location_str = skip_chop_whitespace(location_str); - int32_t close_pos = paren_pos; - int32_t open_pos = rfind_s_char(location_str, close_pos, '('); + int32_t close_pos = right_paren_pos; + int32_t open_pos = left_paren_pos; if (0 < open_pos && open_pos < location_str.size){ String file = substr(location_str, 0, open_pos); @@ -100,7 +102,8 @@ parse_jump_location(String line, Name_Based_Jump_Location *location, int32_t *co } } else{ - paren_pos = find_s_char(line, paren_pos+1, ')'); + left_paren_pos = find_s_char(line, left_paren_pos + 1, '('); + right_paren_pos = find_s_char(line, left_paren_pos, ')'); } } diff --git a/4ed.cpp b/4ed.cpp index 06be0098..69fca0e9 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -1360,7 +1360,6 @@ App_Step_Sig(app_step){ // NOTE(allen): OS clipboard event handling String clipboard = input->clipboard; - if (clipboard.str){ String *dest =working_set_next_clipboard_string(&models->mem.general, &models->working_set, clipboard.size); dest->size = eol_convert_in(dest->str, clipboard.str, clipboard.size); @@ -1567,7 +1566,7 @@ App_Step_Sig(app_step){ } } - for (u32 i = 0; i < proc_free_count; ++i){ + for (i32 i = proc_free_count - 1; i >= 0; ++i){ cli_list_free_proc(list, procs_to_free[i]); }