From: Michael D. Lowis Date: Fri, 25 Jul 2014 16:00:27 +0000 (-0400) Subject: Working multi-char input handling X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=2a8e22f1f7f95edd9b4d982c4a9df945ad412c37;p=archive%2Fafm.git Working multi-char input handling --- diff --git a/Gemfile.lock b/Gemfile.lock index 7248244..1539f10 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,6 +8,7 @@ GEM PLATFORMS ruby + x86-mingw32 DEPENDENCIES rake diff --git a/Rakefile b/Rakefile index 882e11b..24413c2 100644 --- a/Rakefile +++ b/Rakefile @@ -22,8 +22,8 @@ end Env = Rscons::Environment.new do |env| env['CPPPATH'] += Dir['modules/data-structures/source/**/'] #env['CFLAGS'] += ['-Wall'] - env['CFLAGS'] += ['-Werror', '-pedantic', '--std=c99'] - env['CFLAGS'] += ['-D_GNU_SOURCE', '-D_XOPEN_SOURCE=700'] + env['CFLAGS'] += ['-Werror', '-pedantic', '--std=gnu99'] + #env['CFLAGS'] += ['-D_GNU_SOURCE', '-D_XOPEN_SOURCE=700'] env['LIBS'] = ['ncurses'] end at_exit { Env.process } diff --git a/modules/data-structures b/modules/data-structures index cca2c83..f5df855 160000 --- a/modules/data-structures +++ b/modules/data-structures @@ -1 +1 @@ -Subproject commit cca2c832d0ae12a494564acb35922796dcc901ea +Subproject commit f5df85596a66ff4eebf6d77d4ee1f215d391d5a1 diff --git a/source/input.c b/source/input.c index 5fa9fe7..58d4f1a 100644 --- a/source/input.c +++ b/source/input.c @@ -14,6 +14,7 @@ typedef struct { static void handle_aardvark(void) { state_set_aardvark_mode(!state_get_aardvark_mode()); + state_set_screen_dirty(true); } static void handle_quit(void) { @@ -21,15 +22,15 @@ static void handle_quit(void) { } static void handle_next(void) { - workdir_next(state_get_focused_frame()->workdir); + //workdir_next(state_get_focused_frame()->workdir); } static void handle_prev(void) { - workdir_prev(state_get_focused_frame()->workdir); + //workdir_prev(state_get_focused_frame()->workdir); } static void handle_cd(void) { - workdir_cd(state_get_focused_frame()->workdir); + //workdir_cd(state_get_focused_frame()->workdir); } static binding_t Default_Bindings[] = { @@ -78,7 +79,7 @@ void input_handle_key(char ch) { more_matches = true; } /* If the current string matches exactly then execute it's handler */ - else if (0 == strcmp(Key_Buffer, seq)) + if (0 == strcmp(Key_Buffer, seq)) { binding.callback(); Key_Buffer[0] = '\0'; diff --git a/source/screen.c b/source/screen.c index 26206de..337f311 100644 --- a/source/screen.c +++ b/source/screen.c @@ -29,7 +29,7 @@ static frame_t* master_frame(void){ void screen_init(void) { Screen_List = list_new(); list_push_back(Screen_List, screen_frame_new()); - Focused_Frame = master_frame(); + //Focused_Frame = master_frame(); } void screen_deinit(void) { @@ -52,14 +52,16 @@ void screen_update(void) { void screen_open(void) { list_push_back(Screen_List, screen_frame_new()); + state_set_screen_dirty(true); } void screen_close(void) { int num_frames = list_size(Screen_List); if(num_frames > 1){ list_delete(Screen_List, 0); - Focused_Frame = master_frame(); + //Focused_Frame = master_frame(); } + state_set_screen_dirty(true); } static void screen_place_windows(void) { @@ -74,7 +76,7 @@ static void screen_place_windows(void) { mvwin(p_frame->p_win, 0, 0); wresize(p_frame->p_win, lines, (num_frames > 1) ? cols/2 : cols); wclear(p_frame->p_win); - screen_frame_draw_files(p_frame); + //screen_frame_draw_files(p_frame); box(p_frame->p_win, 0 , 0); wrefresh(p_frame->p_win); @@ -91,7 +93,7 @@ static void screen_place_windows(void) { mvwin(p_frame->p_win, pos, cols/2); wresize(p_frame->p_win, height, cols/2); wclear(p_frame->p_win); - screen_frame_draw_files(p_frame); + //screen_frame_draw_files(p_frame); wmove(p_frame->p_win, 1, 1); box(p_frame->p_win, 0 , 0); wrefresh(p_frame->p_win); @@ -105,17 +107,18 @@ static void screen_place_windows(void) { static frame_t* screen_frame_new(void) { frame_t* p_frame = (frame_t*)mem_allocate(sizeof(frame_t),&screen_frame_free); p_frame->p_win = newwin(1, 1, 0, 0); - char* path = Focused_Frame->workdir->path; - p_frame->workdir = workdir_new(path); + //char* path = Focused_Frame->workdir->path; + //p_frame->workdir = workdir_new("."); return p_frame; } static void screen_frame_free(void* p_frame_ptr) { frame_t* p_frame = (frame_t*)p_frame_ptr; + wclear(p_frame->p_win); wborder(p_frame->p_win, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); wrefresh(p_frame->p_win); delwin(p_frame->p_win); - if(p_frame->workdir) mem_release(p_frame->workdir); + //if(p_frame->workdir) mem_release(p_frame->workdir); } void screen_frame_draw_files(frame_t* frame){ @@ -128,15 +131,15 @@ void screen_frame_draw_files(frame_t* frame){ wattroff(frame->p_win, A_UNDERLINE); //list files while (i < vec_size(frame->workdir->vfiles)){ - if(frame == Focused_Frame && i == frame->workdir->idx){ - wattron(frame->p_win, A_STANDOUT); - wattron(frame->p_win, A_BOLD); - } + //if(frame == Focused_Frame && i == frame->workdir->idx){ + // wattron(frame->p_win, A_STANDOUT); + // wattron(frame->p_win, A_BOLD); + //} mvwaddnstr(frame->p_win, FrameTopBuffer+i-frame->workdir->top_index, 1, vec_at(frame->workdir->vfiles, i), cols-2); - if(frame == Focused_Frame && i == frame->workdir->idx){ - wattroff(frame->p_win, A_STANDOUT); - wattroff(frame->p_win, A_BOLD); - } + //if(frame == Focused_Frame && i == frame->workdir->idx){ + // wattroff(frame->p_win, A_STANDOUT); + // wattroff(frame->p_win, A_BOLD); + //} i++; if((FrameTopBuffer+i-frame->workdir->top_index+FrameBotBuffer) > rows) break; }