Fix indention in editor(1).

This commit is contained in:
Alexandros Alexandrou 2018-03-11 18:10:09 +02:00
parent 9380ed82ac
commit 82b98b4899
5 changed files with 19 additions and 19 deletions

View File

@ -235,8 +235,8 @@ void editor_type_exit_select_right(struct editor* editor)
{ {
size_t column, row; size_t column, row;
row_column_biggest(editor->cursor_row, editor->cursor_column, row_column_biggest(editor->cursor_row, editor->cursor_column,
editor->select_row, editor->select_column, editor->select_row, editor->select_column,
&column, &row); &column, &row);
editor_cursor_set(editor, column, row); editor_cursor_set(editor, column, row);
return; return;
} }
@ -409,7 +409,7 @@ void editor_type_control_select_up(struct editor* editor)
void editor_type_down(struct editor* editor) void editor_type_down(struct editor* editor)
{ {
editor_type_exit_select_right(editor); editor_type_exit_select_right(editor);
if ( editor->cursor_row+1 == editor->lines_used ) if ( editor->cursor_row+1 == editor->lines_used )
{ {
editor_cursor_column_set(editor, editor->lines[editor->cursor_row].used); editor_cursor_column_set(editor, editor->lines[editor->cursor_row].used);
return; return;
@ -423,7 +423,7 @@ void editor_type_down(struct editor* editor)
void editor_type_select_down(struct editor* editor) void editor_type_select_down(struct editor* editor)
{ {
if ( editor->select_row+1 == editor->lines_used ) if ( editor->select_row+1 == editor->lines_used )
{ {
editor_select_column_set(editor, editor->lines[editor->select_row].used); editor_select_column_set(editor, editor->lines[editor->select_row].used);
return; return;

View File

@ -34,7 +34,7 @@ size_t editor_select_column_set(struct editor* editor, size_t x)
if ( rx < editor->page_x_offset ) if ( rx < editor->page_x_offset )
editor->page_x_offset = rx; editor->page_x_offset = rx;
if ( editor->page_x_offset + editor->viewport_width <= rx ) if ( editor->page_x_offset + editor->viewport_width <= rx )
editor->page_x_offset = rx + 1- editor->viewport_width; editor->page_x_offset = rx + 1 - editor->viewport_width;
} }
return editor->select_column = x; return editor->select_column = x;
} }
@ -46,7 +46,7 @@ size_t editor_select_row_set(struct editor* editor, size_t y)
if ( y < editor->page_y_offset ) if ( y < editor->page_y_offset )
editor->page_y_offset = y; editor->page_y_offset = y;
if ( editor->page_y_offset + editor->viewport_height <= y ) if ( editor->page_y_offset + editor->viewport_height <= y )
editor->page_y_offset = y + 1- editor->viewport_height; editor->page_y_offset = y + 1 - editor->viewport_height;
} }
return editor->select_row = y; return editor->select_row = y;
} }

View File

@ -33,15 +33,15 @@ enum language language_of_path(const char* path)
size_t path_length = strlen(path); size_t path_length = strlen(path);
if ( 2 <= path_length && if ( 2 <= path_length &&
(!strcmp(path+path_length-2, ".c") || (!strcmp(path+path_length-2, ".c") ||
!strcmp(path+path_length-2, ".h")) ) !strcmp(path+path_length-2, ".h")) )
return LANGUAGE_C_CXX; return LANGUAGE_C_CXX;
if ( 4 <= path_length && if ( 4 <= path_length &&
(!strcmp(path+path_length-4, ".c++") || (!strcmp(path+path_length-4, ".c++") ||
!strcmp(path+path_length-4, ".h++") || !strcmp(path+path_length-4, ".h++") ||
!strcmp(path+path_length-4, ".cxx") || !strcmp(path+path_length-4, ".cxx") ||
!strcmp(path+path_length-4, ".hxx") || !strcmp(path+path_length-4, ".hxx") ||
!strcmp(path+path_length-4, ".cpp") || !strcmp(path+path_length-4, ".cpp") ||
!strcmp(path+path_length-4, ".hpp")) ) !strcmp(path+path_length-4, ".hpp")) )
return LANGUAGE_C_CXX; return LANGUAGE_C_CXX;
if ( (5 <= path_length && !strcmp(path+path_length-5, ".diff")) || if ( (5 <= path_length && !strcmp(path+path_length-5, ".diff")) ||
(6 <= path_length && !strcmp(path+path_length-6, ".patch")) ) (6 <= path_length && !strcmp(path+path_length-6, ".patch")) )
@ -111,7 +111,7 @@ static size_t recognize_constant(const wchar_t* string, size_t string_length)
string[result] == L'L') ) string[result] == L'L') )
result++; result++;
else if ( result < string_length && (string[result] == L'f' || else if ( result < string_length && (string[result] == L'f' ||
string[result] == L'F') ) string[result] == L'F') )
result++; result++;
} }
else else
@ -120,10 +120,10 @@ static size_t recognize_constant(const wchar_t* string, size_t string_length)
string[result] == L'U') ) string[result] == L'U') )
result++; result++;
if ( result < string_length && (string[result] == L'l' || if ( result < string_length && (string[result] == L'l' ||
string[result] == L'L') ) string[result] == L'L') )
result++; result++;
if ( result < string_length && (string[result] == L'l' || if ( result < string_length && (string[result] == L'l' ||
string[result] == L'L') ) string[result] == L'L') )
result++; result++;
} }
return result; return result;

View File

@ -311,9 +311,9 @@ void editor_input_process(struct editor_input* editor_input,
if ( full_match ) if ( full_match )
{ {
editor_emulate_kbkey(editor, editor_emulate_kbkey(editor,
terminal_sequences[match].kbkey, terminal_sequences[match].kbkey,
terminal_sequences[match].control, terminal_sequences[match].control,
terminal_sequences[match].shift); terminal_sequences[match].shift);
memmove(editor_input->termseq, memmove(editor_input->termseq,
editor_input->termseq + match_size, editor_input->termseq + match_size,
editor_input->termseq_used - match_size); editor_input->termseq_used - match_size);

View File

@ -76,7 +76,7 @@ void row_column_smallest(size_t ra, size_t ca, size_t rb, size_t cb,
__attribute__((unused)) __attribute__((unused))
static inline static inline
void row_column_biggest(size_t ra, size_t ca, size_t rb, size_t cb, void row_column_biggest(size_t ra, size_t ca, size_t rb, size_t cb,
size_t* row, size_t* column) size_t* row, size_t* column)
{ {
if ( is_row_column_lt(ra, ca, rb, cb) ) if ( is_row_column_lt(ra, ca, rb, cb) )
*row = rb, *column = cb; *row = rb, *column = cb;