fix to highlight following rule

master
Allen Webster 2016-07-02 20:37:24 -04:00
parent 67306d87bd
commit 60d02c4f64
3 changed files with 16 additions and 16 deletions

View File

@ -922,15 +922,15 @@ isearch(Application_Links *app, int start_reversed){
View_Summary view = app->get_active_view(app, access);
Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, access);
User_Input in;
Query_Bar bar;
if (!buffer.exists) return;
Query_Bar bar = {0};
if (app->start_query_bar(app, &bar, 0) == 0) return;
int reverse = start_reversed;
int pos = view.cursor.pos;
int start_pos = pos;
Range match = make_range(pos, pos);
char bar_string_space[256];
@ -939,8 +939,9 @@ isearch(Application_Links *app, int start_reversed){
String isearch_str = make_lit_string("I-Search: ");
String rsearch_str = make_lit_string("Reverse-I-Search: ");
User_Input in = {0};
for (;;){
app->view_set_highlight(app, &view, match.start, match.end, 1);
app->view_set_highlight(app, &view, match.start, match.end, true);
// NOTE(allen): Change the bar's prompt to match the current direction.
if (reverse) bar.prompt = rsearch_str;
@ -1029,10 +1030,13 @@ isearch(Application_Links *app, int start_reversed){
}
}
}
app->view_set_highlight(app, &view, 0, 0, 0);
if (in.abort) return;
app->view_set_highlight(app, &view, 0, 0, false);
if (in.abort){
app->view_set_cursor(app, &view, seek_pos(start_pos), true);
return;
}
app->view_set_cursor(app, &view, seek_pos(match.min), 1);
app->view_set_cursor(app, &view, seek_pos(match.min), true);
}
CUSTOM_COMMAND_SIG(search){

View File

@ -122,6 +122,9 @@ imp_get_view(Command_Data *cmd, View_ID view_id){
view_id = view_id - 1;
if (view_id >= 0 && view_id < live_set->max){
vptr = live_set->views + view_id;
if (!vptr->in_use){
vptr = 0;
}
}
return(vptr);

View File

@ -1680,6 +1680,9 @@ view_set_temp_highlight(View *view, i32 pos, i32 end_pos){
view->file_data.temp_highlight = view_compute_cursor_from_pos(view, pos);
view->file_data.temp_highlight_end_pos = end_pos;
view->file_data.show_temp_highlight = 1;
view_set_cursor(view, view->file_data.temp_highlight,
false, view->file_data.unwrapped_lines);
}
inline void
@ -1715,16 +1718,6 @@ view_set_file(View *view, Editing_File *file, Models *models){
if (file_is_ready(file)){
view_measure_wraps(&models->mem.general, view);
#if 0
edit_pos->cursor = view_compute_cursor_from_pos(view, 0);
edit_pos->scroll.max_y = view_compute_max_target_y(view);
edit_pos->preferred_x = view_get_cursor_x(view);
view_move_view_to_cursor(view, &edit_pos->scroll, true);
view->reinit_scrolling = 1;
#endif
}
}
}