fixed auto indent on save bug caused by reorganizing custom layer, fixed lexer crash bug
This commit is contained in:
parent
537f83ab69
commit
ce3c06d908
|
@ -320,14 +320,13 @@ OPEN_FILE_HOOK_SIG(default_file_save){
|
|||
Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll);
|
||||
Assert(buffer.exists);
|
||||
|
||||
#if defined(FCODER_AUTO_INDENT_CPP)
|
||||
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){
|
||||
buffer_auto_indent(app, &global_part, &buffer, 0, buffer.size, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// no meaning for return
|
||||
return(0);
|
||||
|
|
|
@ -283,28 +283,30 @@ cpp__table_match(Cpp_Keyword_Table *table, char *s, u32_4tech s_len, u32_4tech *
|
|||
|
||||
b32_4tech result = false;
|
||||
u32_4tech max = table->max;
|
||||
u32_4tech first_index = hash % max;
|
||||
u32_4tech index = first_index;
|
||||
for (;;){
|
||||
u64_4tech *keyword_ptr = keywords + index;
|
||||
if (*keyword_ptr == 0){
|
||||
break;
|
||||
}
|
||||
|
||||
u32_4tech *str_len = (u32_4tech*)(*keyword_ptr + base);
|
||||
char *str = (char*)(str_len + 2);
|
||||
if (cpp__match(str, *str_len, s, s_len)){
|
||||
*item_ptr_out = (u32_4tech*)(*keyword_ptr + base);
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
++index;
|
||||
if (index >= max){
|
||||
index = 0;
|
||||
}
|
||||
if (index == first_index){
|
||||
break;
|
||||
if (max > 0){
|
||||
u32_4tech first_index = hash % max;
|
||||
u32_4tech index = first_index;
|
||||
for (;;){
|
||||
u64_4tech *keyword_ptr = keywords + index;
|
||||
if (*keyword_ptr == 0){
|
||||
break;
|
||||
}
|
||||
|
||||
u32_4tech *str_len = (u32_4tech*)(*keyword_ptr + base);
|
||||
char *str = (char*)(str_len + 2);
|
||||
if (cpp__match(str, *str_len, s, s_len)){
|
||||
*item_ptr_out = (u32_4tech*)(*keyword_ptr + base);
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
++index;
|
||||
if (index >= max){
|
||||
index = 0;
|
||||
}
|
||||
if (index == first_index){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue