Notepad-like mode crash bug fixes

This commit is contained in:
Allen Webster 2020-05-01 06:52:22 -07:00
parent 2d1d69e2c9
commit 5561704e2e
2 changed files with 19 additions and 7 deletions

View File

@ -281,11 +281,11 @@ get_indentation_array(Application_Links *app, Arena *arena, Buffer_ID buffer, Ra
} }
#define EMIT(N) \ #define EMIT(N) \
Stmnt(if (lines.first <= line_it){shifted_indentations[line_it]=N;} \ Stmnt(if (lines.first <= line_it){shifted_indentations[line_it]=N;} \
if (line_it == lines.end){goto finished;} \ if (line_it == lines.end){goto finished;} \
actual_indent = N; ) actual_indent = N; )
i64 line_it = line_last_indented; i64 line_it = line_last_indented;
if (lines.first <= line_cache.where_token_starts){ if (lines.first <= line_cache.where_token_starts){
for (;line_it < line_cache.where_token_starts;){ for (;line_it < line_cache.where_token_starts;){
line_it += 1; line_it += 1;
@ -454,10 +454,21 @@ CUSTOM_DOC("Inserts text and auto-indents the line on which the cursor sits if a
if (do_auto_indent){ if (do_auto_indent){
View_ID view = get_active_view(app, Access_ReadWriteVisible); View_ID view = get_active_view(app, Access_ReadWriteVisible);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible); Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
Range_i64 pos = {}; Range_i64 pos = {};
pos.min = view_get_cursor_pos(app, view); if (view_has_highlighted_range(app, view)){
pos = get_view_range(app, view);
}
else{
pos.min = pos.max = view_get_cursor_pos(app, view);
}
write_text_input(app); write_text_input(app);
pos.max= view_get_cursor_pos(app, view);
i64 end_pos = view_get_cursor_pos(app, view);
pos.min = Min(pos.min, end_pos);
pos.max = Max(pos.max, end_pos);
auto_indent_buffer(app, buffer, pos, 0); auto_indent_buffer(app, buffer, pos, 0);
move_past_lead_whitespace(app, view, buffer); move_past_lead_whitespace(app, view, buffer);
} }

View File

@ -5,6 +5,7 @@
+ Fix: when generated/metadata* files are missing buildsuper still succeeds + Fix: when generated/metadata* files are missing buildsuper still succeeds
+ Fix: mac does not hang opening multiple files + Fix: mac does not hang opening multiple files
+ Fix: line number margin performance + Fix: line number margin performance
+ Fix: crash in notepade like mode when replacing a highlighted range in a parsed file
4.1.4 4.1.4
+ MAJOR: The clipboard history is now a fully custom layer implemented system. Users maintaining a customization layer should try to update their call sites to the old clipboard API. #define FCODER_TRANSITION_TO 4001004 to disable the transitional function wrappers when you are ready to make the transition. + MAJOR: The clipboard history is now a fully custom layer implemented system. Users maintaining a customization layer should try to update their call sites to the old clipboard API. #define FCODER_TRANSITION_TO 4001004 to disable the transitional function wrappers when you are ready to make the transition.