Some minor changes, still no signal system...
This commit is contained in:
parent
767d6efbfb
commit
2a1a6e4644
55
xource.c
55
xource.c
@ -11,59 +11,56 @@
|
||||
#include <xolatile/xurses.c>
|
||||
|
||||
static int cursor = 0;
|
||||
static int cursor_x = 0;
|
||||
static int cursor_y = 0;
|
||||
|
||||
static void render_status_bar (int colour) {
|
||||
char status_bar [] = "Xource : C = Xolatile's text editor";
|
||||
char status_bar [] = " Xource : C = Xolatile's text editor";
|
||||
|
||||
int offset;
|
||||
|
||||
curses_render_string_limit (status_bar, string_length (status_bar), COLOUR_WHITE, EFFECT_REVERSE, 0, 0);
|
||||
curses_render_string (status_bar, colour, EFFECT_REVERSE, 0, 0);
|
||||
|
||||
for (offset = string_length (status_bar); offset != curses_screen_width; ++offset) {
|
||||
curses_render_string_limit (" ", 1, colour, EFFECT_REVERSE, offset, 0);
|
||||
curses_render_string (" ", colour, EFFECT_REVERSE, offset, 0);
|
||||
}
|
||||
|
||||
for (offset = 1; offset != curses_screen_height; ++offset) {
|
||||
curses_render_string (string_realign (number_to_string (offset), 4, ' '), colour, EFFECT_REVERSE, 0, offset);
|
||||
}
|
||||
}
|
||||
|
||||
static void render_source_code (void) {
|
||||
int offset;
|
||||
|
||||
int index = 0;
|
||||
int select = 0;
|
||||
int length = 0;
|
||||
int line = 0;
|
||||
|
||||
int cursor_x = 0;
|
||||
int cursor_y = 1;
|
||||
cursor_x = 5;
|
||||
cursor_y = 1;
|
||||
|
||||
curses_realign_x = 5;
|
||||
curses_realign_y = 0;
|
||||
|
||||
for (offset = 0; file_list_data [file_list_active] [offset] != '\0'; offset += length) {
|
||||
if (line >= curses_screen_height - 1) {
|
||||
if (cursor_y > curses_screen_height - 2) {
|
||||
break;
|
||||
}
|
||||
|
||||
index = syntax_select (& file_list_data [file_list_active] [offset], & length);
|
||||
select = syntax_select (& file_list_data [file_list_active] [offset], & length);
|
||||
|
||||
if (index >= syntax_count) {
|
||||
curses_render_string_limit (& file_list_data [file_list_active] [offset], length, COLOUR_WHITE, EFFECT_NORMAL, cursor_x, cursor_y);
|
||||
if (select >= syntax_count) {
|
||||
curses_render_string_point (& file_list_data [file_list_active] [offset], length, COLOUR_WHITE, EFFECT_NORMAL, & cursor_x, & cursor_y);
|
||||
} else {
|
||||
curses_render_string_limit (& file_list_data [file_list_active] [offset], length, syntax_colour [index], syntax_effect [index], cursor_x, cursor_y);
|
||||
}
|
||||
|
||||
if (file_list_data [file_list_active] [offset + length - 1] == '\n') {
|
||||
cursor_x = 0;
|
||||
++cursor_y;
|
||||
++line;
|
||||
} else if (file_list_data [file_list_active] [offset] == '\t') {
|
||||
cursor_x += 8;
|
||||
} else {
|
||||
cursor_x += length;
|
||||
curses_render_string_point (& file_list_data [file_list_active] [offset], length, syntax_colour [select], syntax_effect [select], & cursor_x, & cursor_y);
|
||||
}
|
||||
}
|
||||
|
||||
/*if (line <= curses_screen_height - 1) {
|
||||
for (offset = 0; offset != curses_screen_height - 1 - line; ++offset) {
|
||||
curses_render_character ('~', COLOUR_WHITE, EFFECT_REVERSE, 0, cursor_y);
|
||||
++cursor_y;
|
||||
if (cursor_y < curses_screen_height) {
|
||||
for (offset = ++cursor_y; offset != curses_screen_height; ++offset) {
|
||||
curses_render_string (" ~", COLOUR_WHITE, EFFECT_REVERSE, 0, offset);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
static void append_character (char character) {
|
||||
@ -132,9 +129,9 @@ int main (int argc, char * * argv) {
|
||||
syntax_define_range ("#", "\n", '\\', COLOUR_PINK, EFFECT_NORMAL);
|
||||
syntax_define_range ("'", "'", '\\', COLOUR_PINK, EFFECT_BOLD);
|
||||
|
||||
syntax_define_operators (".,:;<=>+*-/%!&~^?|()[]{}", COLOUR_BLUE, EFFECT_BOLD);
|
||||
syntax_define_operators (".,:;<=>+*-/%!&~^?|()[]{}", COLOUR_YELLOW, EFFECT_NORMAL);
|
||||
|
||||
syntax_define_words (keywords, sizeof (keywords) / sizeof (keywords [0]), COLOUR_BLUE, EFFECT_NORMAL);
|
||||
syntax_define_words (keywords, sizeof (keywords) / sizeof (keywords [0]), COLOUR_YELLOW, EFFECT_BOLD);
|
||||
|
||||
syntax_define_default (1, COLOUR_RED, EFFECT_NORMAL, COLOUR_CYAN, EFFECT_BOLD);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user