improve the work-flow of jump to error a little more

master
Allen Webster 2016-06-29 13:16:08 -04:00
parent 92c08a13f4
commit 69d617d406
9 changed files with 3146 additions and 3110 deletions

View File

@ -6,7 +6,7 @@ body { background: #FAFAFA; color: #0D0D0D; }
h1,h2,h3,h4 { color: #309030; margin: 0; }
h4 { font-size: 1.1em; }
a { color: #309030; text-decoration: none; }
a:visited { color: #007070; }
a:visited { color: #A0C050; }
a:hover { background: #E0FFD0; }
ul { list-style: none; padding: 0; margin: 0; }
li { padding-left: 1em;text-indent: -.7em;}

52
4ed.cpp
View File

@ -320,16 +320,16 @@ COMMAND_DECL(center_view){
f32 y = 0, h = 0;
if (view->file_data.unwrapped_lines){
y = view->recent->cursor.unwrapped_y;
y = view->recent.cursor.unwrapped_y;
}
else{
y = view->recent->cursor.wrapped_y;
y = view->recent.cursor.wrapped_y;
}
h = view_file_height(view);
y = clamp_bottom(0.f, y - h*.5f);
view->recent->scroll.target_y = ROUND32(y);
view->recent.scroll.target_y = ROUND32(y);
}
COMMAND_DECL(left_adjust_view){
@ -338,14 +338,14 @@ COMMAND_DECL(left_adjust_view){
f32 x = 0;
if (view->file_data.unwrapped_lines){
x = view->recent->cursor.unwrapped_x;
x = view->recent.cursor.unwrapped_x;
}
else{
x = view->recent->cursor.wrapped_x;
x = view->recent.cursor.wrapped_x;
}
x = clamp_bottom(0.f, x - 30.f);
view->recent->scroll.target_x = ROUND32(x);
view->recent.scroll.target_x = ROUND32(x);
}
COMMAND_DECL(set_cursor){
@ -416,7 +416,7 @@ COMMAND_DECL(word_complete){
}
if (do_init){
word_end = view->recent->cursor.pos;
word_end = view->recent.cursor.pos;
word_start = word_end;
cursor_pos = word_end - 1;
@ -678,17 +678,17 @@ COMMAND_DECL(toggle_line_wrap){
if (view->file_data.unwrapped_lines){
view->file_data.unwrapped_lines = 0;
file->settings.unwrapped_lines = 0;
view->recent->scroll.target_x = 0;
view->recent->cursor = view_compute_cursor_from_pos(
view, view->recent->cursor.pos);
view->recent->preferred_x = view->recent->cursor.wrapped_x;
view->recent.scroll.target_x = 0;
view->recent.cursor = view_compute_cursor_from_pos(
view, view->recent.cursor.pos);
view->recent.preferred_x = view->recent.cursor.wrapped_x;
}
else{
view->file_data.unwrapped_lines = 1;
file->settings.unwrapped_lines = 1;
view->recent->cursor =
view_compute_cursor_from_pos(view, view->recent->cursor.pos);
view->recent->preferred_x = view->recent->cursor.unwrapped_x;
view->recent.cursor =
view_compute_cursor_from_pos(view, view->recent.cursor.pos);
view->recent.preferred_x = view->recent.cursor.unwrapped_x;
}
view_set_relative_scrolling(view, scrolling);
}
@ -718,7 +718,7 @@ case_change_range(System_Functions *system,
Mem_Options *mem, View *view, Editing_File *file,
u8 a, u8 z, u8 char_delta){
#if BUFFER_EXPERIMENT_SCALPEL <= 0
Range range = make_range(view->recent->cursor.pos, view->recent->mark);
Range range = make_range(view->recent.cursor.pos, view->recent.mark);
if (range.start < range.end){
Edit_Step step = {};
step.type = ED_NORMAL;
@ -929,13 +929,13 @@ COMMAND_DECL(page_down){
REQ_READABLE_VIEW(view);
i32 height = CEIL32(view_file_height(view));
i32 max_target_y = view->recent->scroll.max_y;
i32 max_target_y = view->recent.scroll.max_y;
view->recent->scroll.target_y =
clamp_top(view->recent->scroll.target_y + height, max_target_y);
view->recent.scroll.target_y =
clamp_top(view->recent.scroll.target_y + height, max_target_y);
view->recent->cursor =
view_compute_cursor_from_xy(view, 0, view->recent->scroll.target_y + (height - view->line_height)*.5f);
view->recent.cursor =
view_compute_cursor_from_xy(view, 0, view->recent.scroll.target_y + (height - view->line_height)*.5f);
}
COMMAND_DECL(page_up){
@ -943,11 +943,11 @@ COMMAND_DECL(page_up){
i32 height = CEIL32(view_file_height(view));
view->recent->scroll.target_y =
clamp_bottom(0, view->recent->scroll.target_y - height);
view->recent.scroll.target_y =
clamp_bottom(0, view->recent.scroll.target_y - height);
view->recent->cursor =
view_compute_cursor_from_xy(view, 0, view->recent->scroll.target_y + (height - view->line_height)*.5f);
view->recent.cursor =
view_compute_cursor_from_xy(view, 0, view->recent.scroll.target_y + (height - view->line_height)*.5f);
}
COMMAND_DECL(open_color_tweaker){
@ -1162,7 +1162,7 @@ app_hardcode_styles(Models *models){
file_info_style.bar_color = 0xFF888888;
file_info_style.bar_active_color = 0xFF666666;
file_info_style.base_color = 0xFF000000;
file_info_style.pop1_color = 0xFF4444AA;
file_info_style.pop1_color = 0xFF1050F0;
file_info_style.pop2_color = 0xFFFF0000;
style->main.file_info_style = file_info_style;
++style;
@ -2207,7 +2207,7 @@ App_Step_Sig(app_step){
if (panel->view->file_data.file){
// TODO(allen): How to set the cursor of a file on the first frame?
view_compute_cursor_from_line_pos(panel->view, models->settings.initial_line, 1);
view_move_view_to_cursor(panel->view, &panel->view->recent->scroll);
view_move_view_to_cursor(panel->view, &panel->view->recent.scroll);
}
}
#endif

View File

@ -67,9 +67,9 @@ fill_view_summary(View_Summary *view, View *vptr, Live_Views *live_set, Working_
view->buffer_id = buffer_id;
view->mark = view_compute_cursor_from_pos(vptr, vptr->recent->mark);
view->cursor = vptr->recent->cursor;
view->preferred_x = vptr->recent->preferred_x;
view->mark = view_compute_cursor_from_pos(vptr, vptr->recent.mark);
view->cursor = vptr->recent.cursor;
view->preferred_x = vptr->recent.preferred_x;
view->file_region = vptr->file_region;
view->scroll_vars = *vptr->current_scroll;
@ -1193,12 +1193,12 @@ DOC_SEE(Buffer_Seek)
if (seek.type == buffer_seek_line_char && seek.character <= 0){
seek.character = 1;
}
vptr->recent->cursor = view_compute_cursor(vptr, seek);
vptr->recent.cursor = view_compute_cursor(vptr, seek);
if (set_preferred_x){
vptr->recent->preferred_x = view_get_cursor_x(vptr);
vptr->recent.preferred_x = view_get_cursor_x(vptr);
}
fill_view_summary(view, vptr, cmd);
file->state.cursor_pos = vptr->recent->cursor.pos;
file->state.cursor_pos = vptr->recent.cursor.pos;
}
}
@ -1225,10 +1225,10 @@ DOC_SEE(Buffer_Seek)
result = true;
if (seek.type != buffer_seek_pos){
cursor = view_compute_cursor(vptr, seek);
vptr->recent->mark = cursor.pos;
vptr->recent.mark = cursor.pos;
}
else{
vptr->recent->mark = seek.pos;
vptr->recent.mark = seek.pos;
}
fill_view_summary(view, vptr, cmd);
}

View File

@ -232,7 +232,7 @@ struct View{
i32_Rect file_region;
i32_Rect scroll_region;
Recent_File_Data recent[16];
Recent_File_Data recent;
GUI_Scroll_Vars *current_scroll;
@ -1499,7 +1499,7 @@ view_get_cursor_pos(View *view){
result = view->file_data.temp_highlight.pos;
}
else{
result = view->recent->cursor.pos;
result = view->recent.cursor.pos;
}
return result;
}
@ -1512,7 +1512,7 @@ view_get_cursor_x(View *view){
cursor = &view->file_data.temp_highlight;
}
else{
cursor = &view->recent->cursor;
cursor = &view->recent.cursor;
}
if (view->file_data.unwrapped_lines){
result = cursor->unwrapped_x;
@ -1529,7 +1529,7 @@ view_get_cursor_y(View *view){
f32 result;
if (view->file_data.show_temp_highlight) cursor = &view->file_data.temp_highlight;
else cursor = &view->recent->cursor;
else cursor = &view->recent.cursor;
if (view->file_data.unwrapped_lines) result = cursor->unwrapped_y;
else result = cursor->wrapped_y;
@ -1594,8 +1594,8 @@ view_move_cursor_to_view(View *view, GUI_Scroll_Vars scroll){
else{
cursor_y -= line_height;
}
view->recent->cursor =
view_compute_cursor_from_xy(view, view->recent->preferred_x, cursor_y);
view->recent.cursor =
view_compute_cursor_from_xy(view, view->recent.preferred_x, cursor_y);
}
}
@ -1660,53 +1660,23 @@ view_set_file(View *view, Editing_File *file, Models *models){
view->file_data.file = file;
if (file){
u64 unique_buffer_id = file->unique_buffer_id;
Recent_File_Data *recent = view->recent;
Recent_File_Data temp_recent = {0};
i32 i = 0;
i32 max = ArrayCount(view->recent)-1;
b32 found_recent_entry = 0;
view->file_data.unwrapped_lines = file->settings.unwrapped_lines;
for (; i < max; ++i, ++recent){
if (recent->unique_buffer_id == unique_buffer_id){
temp_recent = *recent;
memmove(view->recent+1, view->recent, sizeof(*recent)*i);
view->recent[0] = temp_recent;
found_recent_entry = 1;
break;
}
}
u64 unique_buffer_id = file->unique_buffer_id;
Recent_File_Data *recent = &view->recent;
if (found_recent_entry){
if (file_is_ready(file)){
view_measure_wraps(&models->mem.general, view);
view->recent->cursor = view_compute_cursor_from_pos(view, view->recent->cursor.pos);
view->recent->scroll.max_y = view_compute_max_target_y(view);
view_move_view_to_cursor(view, &view->recent->scroll);
}
}
else{
i = 15;
recent = view->recent + i;
memmove(view->recent+1, view->recent, sizeof(*recent)*i);
view->recent[0] = recent_file_data_zero();
recent = view->recent;
view->recent = recent_file_data_zero();
recent->unique_buffer_id = unique_buffer_id;
if (file_is_ready(file)){
view_measure_wraps(&models->mem.general, view);
view->recent->cursor = view_compute_cursor_from_pos(view, file->state.cursor_pos);
view->recent->scroll.max_y = view_compute_max_target_y(view);
view->recent.cursor = view_compute_cursor_from_pos(view, file->state.cursor_pos);
view->recent.scroll.max_y = view_compute_max_target_y(view);
view_move_view_to_cursor(view, &view->recent->scroll);
view_move_view_to_cursor(view, &view->recent.scroll);
view->reinit_scrolling = 1;
}
}
}
}
struct Relative_Scrolling{
@ -1718,24 +1688,24 @@ internal Relative_Scrolling
view_get_relative_scrolling(View *view){
Relative_Scrolling result;
f32 cursor_y = view_get_cursor_y(view);
result.scroll_y = cursor_y - view->recent->scroll.scroll_y;
result.target_y = cursor_y - view->recent->scroll.target_y;
result.scroll_y = cursor_y - view->recent.scroll.scroll_y;
result.target_y = cursor_y - view->recent.scroll.target_y;
return(result);
}
internal void
view_set_relative_scrolling(View *view, Relative_Scrolling scrolling){
f32 cursor_y = view_get_cursor_y(view);
view->recent->scroll.scroll_y = cursor_y - scrolling.scroll_y;
view->recent->scroll.target_y =
view->recent.scroll.scroll_y = cursor_y - scrolling.scroll_y;
view->recent.scroll.target_y =
ROUND32(clamp_bottom(0.f, cursor_y - scrolling.target_y));
}
inline void
view_cursor_move(View *view, Full_Cursor cursor){
view->recent->cursor = cursor;
view->recent->preferred_x = view_get_cursor_x(view);
view->file_data.file->state.cursor_pos = view->recent->cursor.pos;
view->recent.cursor = cursor;
view->recent.preferred_x = view_get_cursor_x(view);
view->file_data.file->state.cursor_pos = view->recent.cursor.pos;
view->file_data.show_temp_highlight = 0;
}
@ -1987,9 +1957,9 @@ file_edit_cursor_fix(System_Functions *system,
view = panel->view;
if (view->file_data.file == file){
view_measure_wraps(general, view);
write_cursor_with_index(cursors, &cursor_count, view->recent->cursor.pos);
write_cursor_with_index(cursors, &cursor_count, view->recent->mark - 1);
write_cursor_with_index(cursors, &cursor_count, view->recent->scroll_i - 1);
write_cursor_with_index(cursors, &cursor_count, view->recent.cursor.pos);
write_cursor_with_index(cursors, &cursor_count, view->recent.mark - 1);
write_cursor_with_index(cursors, &cursor_count, view->recent.scroll_i - 1);
}
}
@ -2011,24 +1981,26 @@ file_edit_cursor_fix(System_Functions *system,
view = panel->view;
if (view && view->file_data.file == file){
view_cursor_move(view, cursors[cursor_count++].pos);
view->recent->preferred_x = view_get_cursor_x(view);
view->recent.preferred_x = view_get_cursor_x(view);
view->recent->mark = cursors[cursor_count++].pos + 1;
view->recent.mark = cursors[cursor_count++].pos + 1;
i32 new_scroll_i = cursors[cursor_count++].pos + 1;
if (view->recent->scroll_i != new_scroll_i){
view->recent->scroll_i = new_scroll_i;
temp_cursor = view_compute_cursor_from_pos(view, view->recent->scroll_i);
y_offset = MOD(view->recent->scroll.scroll_y, view->line_height);
if (view->recent.scroll_i != new_scroll_i){
view->recent.scroll_i = new_scroll_i;
temp_cursor = view_compute_cursor_from_pos(view, view->recent.scroll_i);
y_offset = MOD(view->recent.scroll.scroll_y, view->line_height);
if (view->file_data.unwrapped_lines){
y_position = temp_cursor.unwrapped_y + y_offset;
view->recent->scroll.target_y += ROUND32(y_position - view->recent->scroll.scroll_y);
view->recent->scroll.scroll_y = y_position;
view->recent.scroll.target_y +=
ROUND32(y_position - view->recent.scroll.scroll_y);
view->recent.scroll.scroll_y = y_position;
}
else{
y_position = temp_cursor.wrapped_y + y_offset;
view->recent->scroll.target_y += ROUND32(y_position - view->recent->scroll.scroll_y);
view->recent->scroll.scroll_y = y_position;
view->recent.scroll.target_y +=
ROUND32(y_position - view->recent.scroll.scroll_y);
view->recent.scroll.scroll_y = y_position;
}
}
}
@ -2267,7 +2239,7 @@ view_undo_redo(System_Functions *system,
file_do_single_edit(system, models, file, spec, hist_normal);
view_cursor_move(view, step.edit.start + step.edit.len);
view->recent->mark = view->recent->cursor.pos;
view->recent.mark = view->recent.cursor.pos;
Style *style = main_style(models);
view_post_paste_effect(view, 0.333f, step.edit.start, step.edit.len,
@ -2399,7 +2371,7 @@ view_history_step(System_Functions *system, Models *models, View *view, History_
view_cursor_move(view, step.edit.start + step.edit.len);
break;
}
view->recent->mark = view->recent->cursor.pos;
view->recent.mark = view->recent.cursor.pos;
}
else{
TentativeAssert(spec.step.special_type == 1);
@ -2564,8 +2536,11 @@ view_clean_whitespace(System_Functions *system, Models *models, View *view){
char *inv_str = (char*)part->base + part->pos;
Edit_Spec spec =
file_compute_whitespace_edit(mem, file, view->recent->cursor.pos, edits, str_base, str_size,
inverse_array, inv_str, part->max - part->pos, edit_count);
file_compute_whitespace_edit(mem, file,
view->recent.cursor.pos,
edits, str_base, str_size,
inverse_array, inv_str,
part->max - part->pos, edit_count);
file_do_white_batch_edit(system, models, view->file_data.file, spec, hist_normal);
}
@ -3056,8 +3031,8 @@ remeasure_file_view(System_Functions *system, View *view){
Relative_Scrolling relative = view_get_relative_scrolling(view);
view_measure_wraps(&view->persistent.models->mem.general, view);
if (view->file_data.show_temp_highlight == 0){
view_cursor_move(view, view->recent->cursor.pos);
view->recent->preferred_x = view_get_cursor_x(view);
view_cursor_move(view, view->recent.cursor.pos);
view->recent.preferred_x = view_get_cursor_x(view);
}
view_set_relative_scrolling(view, relative);
}
@ -3114,8 +3089,8 @@ view_show_file(View *view){
view->map = get_map(view->persistent.models, mapid_global);
}
view->showing_ui = VUI_None;
view->current_scroll = &view->recent->scroll;
view->recent->scroll.max_y = view_compute_max_target_y(view);
view->current_scroll = &view->recent.scroll;
view->recent.scroll.max_y = view_compute_max_target_y(view);
view->changed_context_in_step = 1;
}
@ -3528,13 +3503,13 @@ view_reinit_scrolling(View *view){
target_y = clamp_bottom(0, FLOOR32(cursor_y - h*.5f));
}
view->recent->scroll.target_y = target_y;
view->recent->scroll.scroll_y = (f32)target_y;
view->recent->scroll.prev_target_y = -1000;
view->recent.scroll.target_y = target_y;
view->recent.scroll.scroll_y = (f32)target_y;
view->recent.scroll.prev_target_y = -1000;
view->recent->scroll.target_x = target_x;
view->recent->scroll.scroll_x = (f32)target_x;
view->recent->scroll.prev_target_x = -1000;
view->recent.scroll.target_x = target_x;
view->recent.scroll.scroll_x = (f32)target_x;
view->recent.scroll.prev_target_x = -1000;
}
enum CursorScroll_State{
@ -3597,14 +3572,14 @@ view_end_cursor_scroll_updates(View *view){
case CursorScroll_Cursor:
case CursorScroll_Cursor|CursorScroll_Scroll:
if (view->gui_target.did_file){
view->recent->scroll.max_y = view_compute_max_target_y(view);
view->recent.scroll.max_y = view_compute_max_target_y(view);
}
view_move_view_to_cursor(view, view->current_scroll);
gui_post_scroll_vars(&view->gui_target, view->current_scroll, view->scroll_region);
break;
case CursorScroll_Scroll:
view_move_cursor_to_view(view, view->recent->scroll);
view_move_cursor_to_view(view, view->recent.scroll);
gui_post_scroll_vars(&view->gui_target, view->current_scroll, view->scroll_region);
break;
}
@ -4073,11 +4048,11 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
scroll_context.id[1] = view->showing_ui;
scroll_context.id[0] = (u64)(view->file_data.file);
view->current_scroll = &view->recent->scroll;
view->current_scroll = &view->recent.scroll;
gui_get_scroll_vars(target, scroll_context,
&view->recent->scroll, &view->scroll_region);
&view->recent.scroll, &view->scroll_region);
gui_begin_scrollable(target, scroll_context, view->recent->scroll,
gui_begin_scrollable(target, scroll_context, view->recent.scroll,
delta, show_scrollbar);
gui_do_file(target);
gui_end_scrollable(target);
@ -4945,21 +4920,17 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
SHOW_GUI_BLANK(0);
SHOW_GUI_LINE(1, "recent file data");
{
i32 recent_index = 0;
Recent_File_Data *recent = view_ptr->recent + recent_index;
Recent_File_Data *recent = &view_ptr->recent;
{
SHOW_GUI_INT (2, h_align, "recent", recent_index);
SHOW_GUI_U64 (3, h_align, "absolute buffer id", recent->unique_buffer_id);
SHOW_GUI_BLANK (3);
SHOW_GUI_SCROLL(3, h_align, "scroll:", recent->scroll);
SHOW_GUI_BLANK (3);
SHOW_GUI_CURSOR(3, h_align, "cursor:", recent->cursor);
SHOW_GUI_BLANK (3);
SHOW_GUI_INT (3, h_align, "mark", recent->mark);
SHOW_GUI_FLOAT (3, h_align, "preferred_x", recent->preferred_x);
SHOW_GUI_INT (3, h_align, "scroll_i", recent->scroll_i);
}
SHOW_GUI_U64 (2, h_align, "absolute buffer id", recent->unique_buffer_id);
SHOW_GUI_BLANK (2);
SHOW_GUI_SCROLL(2, h_align, "scroll:", recent->scroll);
SHOW_GUI_BLANK (2);
SHOW_GUI_CURSOR(2, h_align, "cursor:", recent->cursor);
SHOW_GUI_BLANK (2);
SHOW_GUI_INT (2, h_align, "mark", recent->mark);
SHOW_GUI_FLOAT (2, h_align, "preferred_x", recent->preferred_x);
SHOW_GUI_INT (2, h_align, "scroll_i", recent->scroll_i);
}
SHOW_GUI_BLANK (0);
@ -5009,7 +4980,7 @@ internal f32
view_get_scroll_y(View *view){
f32 v;
if (view->showing_ui == VUI_None){
v = view->recent->scroll.scroll_y;
v = view->recent.scroll.scroll_y;
}
else{
v = view->gui_scroll.scroll_y;
@ -5344,8 +5315,8 @@ draw_file_loaded(View *view, i32_Rect rect, b32 is_active, Render_Target *target
Buffer_Render_Options opts = {};
f32 *wraps = view->file_data.line_wrap_y;
f32 scroll_x = view->recent->scroll.scroll_x;
f32 scroll_y = view->recent->scroll.scroll_y;
f32 scroll_x = view->recent.scroll.scroll_x;
f32 scroll_y = view->recent.scroll.scroll_y;
// NOTE(allen): For now we will temporarily adjust scroll_y to try
// to prevent the view moving around until floating sections are added
@ -5358,7 +5329,7 @@ draw_file_loaded(View *view, i32_Rect rect, b32 is_active, Render_Target *target
(f32)max_x,
advance_data, (f32)line_height);
view->recent->scroll_i = render_cursor.pos;
view->recent.scroll_i = render_cursor.pos;
buffer_get_render_data(&file->state.buffer, items, max, &count,
(f32)rect.x0, (f32)rect.y0,
@ -5380,7 +5351,7 @@ draw_file_loaded(View *view, i32_Rect rect, b32 is_active, Render_Target *target
at_cursor_color = style->main.at_highlight_color;
}
else{
cursor_begin = view->recent->cursor.pos;
cursor_begin = view->recent.cursor.pos;
cursor_end = cursor_begin + 1;
cursor_color = style->main.cursor_color;
at_cursor_color = style->main.at_cursor_color;
@ -5470,7 +5441,7 @@ draw_file_loaded(View *view, i32_Rect rect, b32 is_active, Render_Target *target
char_color = color_blend(char_color, fade_amount, fade_color);
if (ind == view->recent->mark && prev_ind != ind){
if (ind == view->recent.mark && prev_ind != ind){
draw_rectangle_outline(target, char_rect, mark_color);
}
if (item->glyphid != 0){
@ -5588,9 +5559,9 @@ draw_file_bar(Render_Target *target, View *view, Editing_File *file, i32_Rect re
char line_number_space[30];
String line_number = make_fixed_width_string(line_number_space);
append(&line_number, " L#");
append_int_to_str(&line_number, view->recent->cursor.line);
append_int_to_str(&line_number, view->recent.cursor.line);
append(&line_number, " C#");
append_int_to_str(&line_number, view->recent->cursor.character);
append_int_to_str(&line_number, view->recent.cursor.character);
intbar_draw_string(target, &bar, line_number, base_color);
@ -6214,7 +6185,7 @@ inline void
view_change_size(General_Memory *general, View *view){
if (view->file_data.file){
view_measure_wraps(general, view);
view->recent->cursor = view_compute_cursor_from_pos(view, view->recent->cursor.pos);
view->recent.cursor = view_compute_cursor_from_pos(view, view->recent.cursor.pos);
}
}
@ -6237,7 +6208,7 @@ live_set_alloc_view(Live_Views *live_set, Panel *panel, Models *models){
result.view->panel = panel;
result.view->persistent.models = models;
result.view->current_scroll = &result.view->recent->scroll;
result.view->current_scroll = &result.view->recent.scroll;
init_query_set(&result.view->query_set);

View File

@ -657,7 +657,7 @@ perform_doc_parse(String doc_string, Documentation *doc){
}
}
else{
printf("warning: invalid doc note %.*s\n", doc_note.size, doc_note.str);
fprintf(stderr, "warning: invalid doc note %.*s\n", doc_note.size, doc_note.str);
}
}
}while(keep_parsing);
@ -858,7 +858,7 @@ generate_custom_headers(){
function_set.name[sig_count] = string_zero();
function_set.args[sig_count] = string_zero();
// TODO(allen): get warning line numbers
printf("custom_api_spec.cpp(???) : generator warning : invalid function signature\n");
fprintf(stderr, "custom_api_spec.cpp(???) : generator warning : invalid function signature\n");
}
++sig_count;
}
@ -1000,10 +1000,12 @@ generate_custom_headers(){
#define BACK_COLOR "#FAFAFA"
#define TEXT_COLOR "#0D0D0D"
#define CODE_BACK "#DFDFDF"
#define POP_COLOR_1 "#309030"
#define POP_BACK_1 "#E0FFD0"
#define POP_COLOR_2 "#007070"
#define POP_COLOR_3 "#005000"
#define VISITED_LINK "#A0C050"
#define POP_COLOR_2 "#005000"
fprintf(file,
"<html lang=\"en-US\">\n"
@ -1032,7 +1034,7 @@ generate_custom_headers(){
"text-decoration: none; "
"}\n"
"a:visited { "
"color: " POP_COLOR_2 "; "
"color: " VISITED_LINK "; "
"}\n"
"a:hover { "
"background: " POP_BACK_1 "; "
@ -1050,7 +1052,7 @@ generate_custom_headers(){
"}\n"
"li:before { "
"content: \"4\"; "
"color: " POP_COLOR_3 "; "
"color: " POP_COLOR_2 "; "
"font-family:\"Webdings\"; "
"}\n"
@ -1138,7 +1140,7 @@ generate_custom_headers(){
if (function_set.doc_string[i].size == 0){
fprintf(file, "No documentation generated for this function, assume it is non-public.\n");
printf("warning: no documentation string for %.*s\n", name.size, name.str);
fprintf(stderr, "warning: no documentation string for %.*s\n", name.size, name.str);
}
#define DOC_HEAD_OPEN "<div style='margin-top: 3mm; margin-bottom: 3mm; color: "POP_COLOR_1";'><b><i>"
@ -1222,13 +1224,8 @@ int main(){
char *filename = 0;
filename = generate_keycode_enum();
printf("gen success: %s\n", filename);
filename = generate_style();
printf("gen success: %s\n", filename);
filename = generate_custom_headers();
printf("gen success: %s\n", filename);
}
// BOTTOM

View File

@ -1,4 +1,4 @@
Distribution Date: 24.6.2016 (dd.mm.yyyy)
Distribution Date: 29.6.2016 (dd.mm.yyyy)
Thank you for contributing to the 4coder project!

View File

@ -1,4 +1,4 @@
Distribution Date: 24.6.2016 (dd.mm.yyyy)
Distribution Date: 29.6.2016 (dd.mm.yyyy)
Thank you for contributing to the 4coder project!

View File

@ -13,6 +13,13 @@
// Basic Build Behavior
//
struct Prev_Jump{
int buffer_id;
int line;
};
static Prev_Jump prev_location = {0};
CUSTOM_COMMAND_SIG(build_in_build_panel){
Buffer_Summary buffer =
app->get_buffer_by_name(app, literal("*compilation*"), AccessAll);
@ -32,6 +39,8 @@ CUSTOM_COMMAND_SIG(build_in_build_panel){
app->set_active_view(app, &build_view);
exec_command(app, build_search);
app->set_active_view(app, &original_view);
prev_location = {0};
}
// TODO(allen): This is a bit nasty. I want a system for picking
@ -203,13 +212,16 @@ jump_to_location(Application_Links *app, View_Summary *view, Jump_Location *l){
}
static int
msvc_parse_error(String line, Jump_Location *location, int *colon_char){
msvc_parse_error(String line, Jump_Location *location,
int skip_sub_errors, int *colon_char){
int result = false;
int colon_pos = find(line, 0, ')');
colon_pos = find(line, colon_pos, ':');
if (colon_pos < line.size){
String location_str = substr(line, 0, colon_pos);
if (!(skip_sub_errors && location_str.str[0] == ' ')){
location_str = skip_chop_whitespace(location_str);
int paren_pos = find(location_str, 0, '(');
@ -233,6 +245,7 @@ msvc_parse_error(String line, Jump_Location *location, int *colon_char){
}
}
}
}
return(result);
}
@ -243,6 +256,7 @@ msvc_next_error(Application_Links *app,
void *memory, int memory_size,
Jump_Location *location,
int direction,
int skip_sub_errors,
int *colon_char){
int result = false;
@ -250,7 +264,7 @@ msvc_next_error(Application_Links *app,
String line_str = make_string(memory, 0, memory_size);
for (;;){
if (read_line(app, comp_out, line, &line_str)){
if (msvc_parse_error(line_str, location, colon_char)){
if (msvc_parse_error(line_str, location, skip_sub_errors, colon_char)){
result = true;
break;
}
@ -270,41 +284,96 @@ msvc_next_error(Application_Links *app,
return(result);
}
static void
msvc_goto_error(Application_Links *app, int direction){
static int
msvc_goto_error(Application_Links *app, int direction, int skip_sub_errors, Jump_Location *loc){
int result = false;
View_Summary active_view = app->get_active_view(app, AccessAll);
Jump_Location location = {0};
Buffer_Summary buffer = app->get_buffer_by_name(app, literal("*compilation*"), AccessAll);
if (buffer.exists){
View_Summary view = get_first_view_with_buffer(app, buffer.buffer_id);
int line = view.cursor.line;
int ms = app->memory_size/2;
Jump_Location location = {0};
location.file = make_string(app->memory, 0, ms);
void *m = (char*)app->memory + ms;
int colon_char = 0;
if (msvc_next_error(app, &view, &line, m, ms, &location, direction, &colon_char)){
if (msvc_next_error(app, &view, &line, m, ms, &location,
skip_sub_errors, direction, &colon_char)){
jump_to_location(app, &active_view, &location);
app->view_set_cursor(app, &view, seek_line_char(line, colon_char+1), true);
result = true;
if (loc){
*loc = location;
}
}
}
return(result);
}
static Prev_Jump
jump_location_store(Application_Links *app, Jump_Location loc){
Prev_Jump result = {0};
Buffer_Summary buffer =
app->get_buffer_by_name(app, loc.file.str, loc.file.size, AccessAll);
if (buffer.exists){
result.buffer_id = buffer.buffer_id;
result.line = loc.line;
}
return(result);
}
static int
skip_this_jump(Prev_Jump prev, Prev_Jump jump){
int result = false;
if (prev.buffer_id != 0 && prev.buffer_id == jump.buffer_id &&
prev.line == jump.line){
result = true;
}
return(result);
}
CUSTOM_COMMAND_SIG(msvc_goto_next_error){
msvc_goto_error(app, 1);
Jump_Location location = {0};
Prev_Jump jump = {0};
do{
if (msvc_goto_error(app, true, 1, &location)){
jump = jump_location_store(app, location);
}
else{
jump.buffer_id = 0;
}
}while(skip_this_jump(prev_location, jump));
prev_location = jump;
}
CUSTOM_COMMAND_SIG(msvc_goto_prev_error){
msvc_goto_error(app, -1);
Jump_Location location = {0};
Prev_Jump jump = {0};
do{
if (msvc_goto_error(app, true, -1, &location)){
jump = jump_location_store(app, location);
}
else{
jump.buffer_id = 0;
}
}while(skip_this_jump(prev_location, jump));
prev_location = jump;
}
CUSTOM_COMMAND_SIG(msvc_goto_first_error){
View_Summary active_view = app->get_active_view(app, AccessAll);
app->view_set_cursor(app, &active_view, seek_pos(0), true);
msvc_goto_error(app, 1);
Jump_Location location;
msvc_goto_error(app, true, 1, &location);
prev_location = jump_location_store(app, location);
}

View File

@ -943,11 +943,10 @@ Sys_CLI_Call_Sig(system_cli_call){
char *env_variables = 0;
char command_line[2048];
b32 success = 1;
String s = make_fixed_width_string(command_line);
copy(&s, make_lit_string("/C "));
append_partial(&s, script_name);
success = terminate_with_null(&s);
b32 success = terminate_with_null(&s);
if (success){
success = 0;