fixed auto indent on save bug caused by reorganizing custom layer, fixed lexer crash bug

This commit is contained in:
Allen Webster 2018-05-12 00:20:37 -07:00
parent 537f83ab69
commit ce3c06d908
2 changed files with 26 additions and 25 deletions

View File

@ -320,14 +320,13 @@ OPEN_FILE_HOOK_SIG(default_file_save){
Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll); Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll);
Assert(buffer.exists); Assert(buffer.exists);
#if defined(FCODER_AUTO_INDENT_CPP)
int32_t is_virtual = 0; int32_t is_virtual = 0;
if (automatically_indent_text_on_save && buffer_get_setting(app, &buffer, BufferSetting_VirtualWhitespace, &is_virtual)){ if (global_config.automatically_indent_text_on_save &&
buffer_get_setting(app, &buffer, BufferSetting_VirtualWhitespace, &is_virtual)){
if (is_virtual){ if (is_virtual){
buffer_auto_indent(app, &global_part, &buffer, 0, buffer.size, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens); buffer_auto_indent(app, &global_part, &buffer, 0, buffer.size, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens);
} }
} }
#endif
// no meaning for return // no meaning for return
return(0); return(0);

View File

@ -283,6 +283,7 @@ cpp__table_match(Cpp_Keyword_Table *table, char *s, u32_4tech s_len, u32_4tech *
b32_4tech result = false; b32_4tech result = false;
u32_4tech max = table->max; u32_4tech max = table->max;
if (max > 0){
u32_4tech first_index = hash % max; u32_4tech first_index = hash % max;
u32_4tech index = first_index; u32_4tech index = first_index;
for (;;){ for (;;){
@ -307,6 +308,7 @@ cpp__table_match(Cpp_Keyword_Table *table, char *s, u32_4tech s_len, u32_4tech *
break; break;
} }
} }
}
return(result); return(result);
} }