From 04836b2618c1f13a603ab4f8bc5b1e45cdc00046 Mon Sep 17 00:00:00 2001 From: xolatile Date: Tue, 31 Oct 2023 09:40:50 -0400 Subject: [PATCH] Fixed one bug, still one left to go... --- xource.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/xource.c b/xource.c index aeb2a46..74b938b 100644 --- a/xource.c +++ b/xource.c @@ -19,8 +19,6 @@ It is distributed in the hope that it will be useful or harmful, it really depen #define BACKSPACE (0X7F) int main (int argc, char * * argv) { - char * separators = ".,:;<=>+-*/%!&~^?|()[]{}'\" \t\r\n"; - char * keywords [] = { "register", "volatile", "auto", "const", "static", "extern", "if", "else", "do", "while", "for", "continue", "switch", "case", "default", "break", @@ -39,7 +37,7 @@ int main (int argc, char * * argv) { return (-1); } - syntax_define_separators (separators); + syntax_define_separators (".,:;<=>+-*/%!&~^?|()[]{}'\" \t\r\n"); syntax_define_range ("/*", "*/", '\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 (); do { - char status_bar [] = " Xource : C = Xolatile's text editor"; - int offset, select, length; 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); } @@ -131,7 +133,7 @@ int main (int argc, char * * argv) { ++cursor; } else if (curses_character == ARROW_LEFT) { --cursor; - } else if ((curses_character >= ' ') && (curses_character <= '~')) { + } else if (character_is_visible (curses_character)) { file_list_insert_character (curses_character, cursor); ++cursor; } else {