Fixed one bug, still one left to go...

This commit is contained in:
Ognjen Milan Robovic 2023-10-31 09:40:50 -04:00
parent 048dc14e65
commit 04836b2618

View File

@ -19,8 +19,6 @@ It is distributed in the hope that it will be useful or harmful, it really depen
#define BACKSPACE (0X7F) #define BACKSPACE (0X7F)
int main (int argc, char * * argv) { int main (int argc, char * * argv) {
char * separators = ".,:;<=>+-*/%!&~^?|()[]{}'\" \t\r\n";
char * keywords [] = { char * keywords [] = {
"register", "volatile", "auto", "const", "static", "extern", "if", "else", "register", "volatile", "auto", "const", "static", "extern", "if", "else",
"do", "while", "for", "continue", "switch", "case", "default", "break", "do", "while", "for", "continue", "switch", "case", "default", "break",
@ -39,7 +37,7 @@ int main (int argc, char * * argv) {
return (-1); return (-1);
} }
syntax_define_separators (separators); syntax_define_separators (".,:;<=>+-*/%!&~^?|()[]{}'\" \t\r\n");
syntax_define_range ("/*", "*/", '\0', COLOUR_GREY, EFFECT_BOLD); syntax_define_range ("/*", "*/", '\0', COLOUR_GREY, EFFECT_BOLD);
syntax_define_range ("//", "\n", '\0', COLOUR_GREY, EFFECT_BOLD); syntax_define_range ("//", "\n", '\0', COLOUR_GREY, EFFECT_BOLD);
@ -55,15 +53,19 @@ int main (int argc, char * * argv) {
curses_configure (); curses_configure ();
do { do {
char status_bar [] = " Xource : C = Xolatile's text editor";
int offset, select, length; int offset, select, length;
curses_render_background (' ', COLOUR_WHITE, EFFECT_NORMAL); curses_render_background (' ', COLOUR_WHITE, EFFECT_NORMAL);
curses_render_string (status_bar, COLOUR_WHITE, EFFECT_REVERSE, 0, 0); length = 0;
curses_render_string (file_list_name [file_list_active], COLOUR_WHITE, EFFECT_REVERSE, length, 0);
length += string_length (file_list_name [file_list_active]);
curses_render_string (" -- ", COLOUR_WHITE, EFFECT_REVERSE, length, 0);
length += 4;
curses_render_string (number_to_string (file_list_size [file_list_active]), COLOUR_WHITE, EFFECT_REVERSE, length, 0);
length += string_length (number_to_string (file_list_size [file_list_active]));
for (offset = string_length (status_bar); offset != curses_screen_width; ++offset) { for (offset = length; offset != curses_screen_width; ++offset) {
curses_render_string (" ", COLOUR_WHITE, EFFECT_REVERSE, offset, 0); curses_render_string (" ", COLOUR_WHITE, EFFECT_REVERSE, offset, 0);
} }
@ -131,7 +133,7 @@ int main (int argc, char * * argv) {
++cursor; ++cursor;
} else if (curses_character == ARROW_LEFT) { } else if (curses_character == ARROW_LEFT) {
--cursor; --cursor;
} else if ((curses_character >= ' ') && (curses_character <= '~')) { } else if (character_is_visible (curses_character)) {
file_list_insert_character (curses_character, cursor); file_list_insert_character (curses_character, cursor);
++cursor; ++cursor;
} else { } else {