minor cleanup of the code presentation stuff

master
Allen Webster 2016-10-05 21:38:08 -04:00
parent 39699b2d9f
commit 2053d0df47
4 changed files with 33 additions and 7 deletions

View File

@ -1493,7 +1493,7 @@ CUSTOM_COMMAND_SIG(seek_whitespace_down){
true); true);
} }
CUSTOM_COMMAND_SIG(seek_end_of_line){ CUSTOM_COMMAND_SIG(seek_end_of_textual_line){
uint32_t access = AccessProtected; uint32_t access = AccessProtected;
View_Summary view = get_active_view(app, access); View_Summary view = get_active_view(app, access);
Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); Buffer_Summary buffer = get_buffer(app, view.buffer_id, access);
@ -1502,7 +1502,7 @@ CUSTOM_COMMAND_SIG(seek_end_of_line){
view_set_cursor(app, &view, seek_pos(new_pos), true); view_set_cursor(app, &view, seek_pos(new_pos), true);
} }
CUSTOM_COMMAND_SIG(seek_beginning_of_line){ CUSTOM_COMMAND_SIG(seek_beginning_of_textual_line){
uint32_t access = AccessProtected; uint32_t access = AccessProtected;
View_Summary view = get_active_view(app, access); View_Summary view = get_active_view(app, access);
Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); Buffer_Summary buffer = get_buffer(app, view.buffer_id, access);
@ -1511,6 +1511,28 @@ CUSTOM_COMMAND_SIG(seek_beginning_of_line){
view_set_cursor(app, &view, seek_pos(new_pos), true); view_set_cursor(app, &view, seek_pos(new_pos), true);
} }
CUSTOM_COMMAND_SIG(seek_beginning_of_line){
View_Summary view = get_active_view(app, AccessProtected);
float y = view.cursor.wrapped_y;
if (view.unwrapped_lines){
y = view.cursor.unwrapped_y;
}
view_set_cursor(app, &view, seek_xy(0, y, 1, view.unwrapped_lines), 1);
}
CUSTOM_COMMAND_SIG(seek_end_of_line){
View_Summary view = get_active_view(app, AccessProtected);
float y = view.cursor.wrapped_y;
if (view.unwrapped_lines){
y = view.cursor.unwrapped_y;
}
view_set_cursor(app, &view, seek_xy(100000.f, y, 1, view.unwrapped_lines), 1);
}
// TODO(allen): REDUCE DUPLICATION! // TODO(allen): REDUCE DUPLICATION!
static int32_t static int32_t
buffer_seek_whitespace_right(Application_Links *app, Buffer_Summary *buffer, int32_t pos){ buffer_seek_whitespace_right(Application_Links *app, Buffer_Summary *buffer, int32_t pos){

View File

@ -1138,6 +1138,7 @@ wrap_state_consume_token(Code_Wrap_State *state, i32 fixed_end_point){
}break; }break;
case CPP_TOKEN_PARENTHESE_OPEN: case CPP_TOKEN_PARENTHESE_OPEN:
case CPP_TOKEN_BRACKET_OPEN:
{ {
++state->paren_top; ++state->paren_top;
@ -1151,6 +1152,7 @@ wrap_state_consume_token(Code_Wrap_State *state, i32 fixed_end_point){
}break; }break;
case CPP_TOKEN_PARENTHESE_CLOSE: case CPP_TOKEN_PARENTHESE_CLOSE:
case CPP_TOKEN_BRACKET_CLOSE:
{ {
--state->paren_top; --state->paren_top;
@ -1221,7 +1223,7 @@ file_measure_wraps(Models *models, Editing_File *file, f32 font_height, f32 *adv
switch (stop.status){ switch (stop.status){
case BLStatus_NeedWrapDetermination: case BLStatus_NeedWrapDetermination:
{ {
if (use_tokens){ if (use_tokens && 0){
Code_Wrap_Step step = wrap_state_consume_token(&wrap_state, -1); Code_Wrap_Step step = wrap_state_consume_token(&wrap_state, -1);
wrap_unit_end = step.position_end; wrap_unit_end = step.position_end;
@ -5359,10 +5361,9 @@ draw_file_loaded(View *view, i32_Rect rect, b32 is_active, Render_Target *target
if (token_i < token_array.count){ if (token_i < token_array.count){
if (ind >= token_array.tokens[token_i].start){ if (ind >= token_array.tokens[token_i].start){
while (ind >= token_array.tokens[token_i].start){ for (;ind >= token_array.tokens[token_i].start && token_i < token_array.count; ++token_i){
main_color = *style_get_color(style, token_array.tokens[token_i]); main_color = *style_get_color(style, token_array.tokens[token_i]);
current_token = token_array.tokens[token_i]; current_token = token_array.tokens[token_i];
++token_i;
} }
} }
else if (ind >= current_token.start + current_token.size){ else if (ind >= current_token.start + current_token.size){

View File

@ -162,14 +162,15 @@
; [X] get horizontal scrolling to work in line wrap mode ; [X] get horizontal scrolling to work in line wrap mode
; [X] word level wrapping ; [X] word level wrapping
; [X] ability to toggle virtual white space ; [X] ability to toggle virtual white space
; [X] home/end should go to the beginning/end of the visual line not the textual line
; [] command for setting wrap positions in views directly ; [] command for setting wrap positions in views directly
; [] ability to see the wrap position as a number/line and adjust graphically ; [] ability to see the wrap position as a number/line and adjust graphically
; [] home/end should go to the beginning/end of the visual line not the textual line
; [] code level wrapping ; [] code level wrapping
; [X] handle basic scope indents ; [X] handle basic scope indents
; [X] handle parentheses ; [X] handle parentheses
; [X] handle preprocessor ; [X] handle preprocessor
; [X] unify wrap rule parsing and indent rule parsing ; [X] unify wrap rule parsing and indent rule parsing
; [X] handle square brackets
; [] smarter wrap rule ; [] smarter wrap rule
; [] handle unclosed statements ; [] handle unclosed statements
; [] handle comments ; [] handle comments

View File

@ -1043,7 +1043,9 @@ buffer_cursor_seek(Buffer_Cursor_Seek_State *S_ptr, Buffer_Cursor_Seek_Params pa
goto buffer_cursor_seek_end; goto buffer_cursor_seek_end;
} }
if (py >= y){
S.this_cursor = S.prev_cursor; S.this_cursor = S.prev_cursor;
}
goto buffer_cursor_seek_end; goto buffer_cursor_seek_end;
} }
} }