fixed the really tricky thing with the cursor positions
parent
42cab1b573
commit
245d61d6a6
18
4ed.cpp
18
4ed.cpp
|
@ -2885,15 +2885,27 @@ App_Step_Sig(app_step){
|
||||||
|
|
||||||
// NOTE(allen): post scroll vars back to the view's gui targets
|
// NOTE(allen): post scroll vars back to the view's gui targets
|
||||||
{
|
{
|
||||||
Panel *panel = 0, *used_panels = 0;
|
Panel *panel = 0, *used_panels = &models->layout.used_sentinel;
|
||||||
|
|
||||||
used_panels = &models->layout.used_sentinel;
|
|
||||||
for (dll_items(panel, used_panels)){
|
for (dll_items(panel, used_panels)){
|
||||||
Assert(panel->view);
|
Assert(panel->view);
|
||||||
view_end_cursor_scroll_updates(panel->view);
|
view_end_cursor_scroll_updates(panel->view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE(allen): on the first frame there should be no scrolling
|
||||||
|
if (input->first_step){
|
||||||
|
Panel *panel = 0, *used_panels = &models->layout.used_sentinel;
|
||||||
|
for (dll_items(panel, used_panels)){
|
||||||
|
View *view = panel->view;
|
||||||
|
GUI_Scroll_Vars *scroll_vars = &view->gui_scroll;
|
||||||
|
if (view->edit_pos){
|
||||||
|
scroll_vars = &view->edit_pos->scroll;
|
||||||
|
}
|
||||||
|
scroll_vars->scroll_x = (f32)scroll_vars->target_x;
|
||||||
|
scroll_vars->scroll_y = (f32)scroll_vars->target_y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE(allen): rendering
|
// NOTE(allen): rendering
|
||||||
{
|
{
|
||||||
begin_render_section(target, system);
|
begin_render_section(target, system);
|
||||||
|
|
|
@ -2018,8 +2018,8 @@ file_edit_cursor_fix(System_Functions *system,
|
||||||
view_measure_wraps(general, view);
|
view_measure_wraps(general, view);
|
||||||
Assert(view->edit_pos);
|
Assert(view->edit_pos);
|
||||||
write_cursor_with_index(cursors, &cursor_count, view->edit_pos->cursor.pos);
|
write_cursor_with_index(cursors, &cursor_count, view->edit_pos->cursor.pos);
|
||||||
write_cursor_with_index(cursors, &cursor_count, view->edit_pos->mark - 1);
|
write_cursor_with_index(cursors, &cursor_count, view->edit_pos->mark);
|
||||||
write_cursor_with_index(cursors, &cursor_count, view->edit_pos->scroll_i - 1);
|
write_cursor_with_index(cursors, &cursor_count, view->edit_pos->scroll_i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2048,8 +2048,8 @@ file_edit_cursor_fix(System_Functions *system,
|
||||||
|
|
||||||
GUI_Scroll_Vars scroll = view->edit_pos->scroll;
|
GUI_Scroll_Vars scroll = view->edit_pos->scroll;
|
||||||
|
|
||||||
view->edit_pos->mark = cursors[cursor_count++].pos + 1;
|
view->edit_pos->mark = cursors[cursor_count++].pos;
|
||||||
i32 new_scroll_i = cursors[cursor_count++].pos + 1;
|
i32 new_scroll_i = cursors[cursor_count++].pos;
|
||||||
if (view->edit_pos->scroll_i != new_scroll_i){
|
if (view->edit_pos->scroll_i != new_scroll_i){
|
||||||
view->edit_pos->scroll_i = new_scroll_i;
|
view->edit_pos->scroll_i = new_scroll_i;
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
*
|
*
|
||||||
* 24.10.2015
|
* 24.10.2015
|
||||||
*
|
*
|
||||||
* Buffer data object
|
|
||||||
* type - Golden Array
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TOP
|
// TOP
|
||||||
|
|
|
@ -174,7 +174,7 @@ buffer_update_cursors(Cursor_With_Index *sorted_positions, int count, int start,
|
||||||
shift_amount = (len - (end - start));
|
shift_amount = (len - (end - start));
|
||||||
|
|
||||||
position = sorted_positions + count - 1;
|
position = sorted_positions + count - 1;
|
||||||
for (; position >= sorted_positions && position->pos >= end; --position) position->pos += shift_amount;
|
for (; position >= sorted_positions && position->pos > end; --position) position->pos += shift_amount;
|
||||||
for (; position >= sorted_positions && position->pos >= start; --position) position->pos = start;
|
for (; position >= sorted_positions && position->pos >= start; --position) position->pos = start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ buffer_batch_edit_update_cursors(Cursor_With_Index *sorted_positions, int count,
|
||||||
position->pos += shift_amount;
|
position->pos += shift_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; position->pos < end && position < end_position; ++position){
|
for (; position->pos <= end && position < end_position; ++position){
|
||||||
position->pos = start + shift_amount;
|
position->pos = start + shift_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue