]> git.mdlowis.com Git - archive/afm.git/commitdiff
Working multi-char input handling
authorMichael D. Lowis <mike.lowis@gentex.com>
Fri, 25 Jul 2014 16:00:27 +0000 (12:00 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Fri, 25 Jul 2014 16:00:27 +0000 (12:00 -0400)
Gemfile.lock
Rakefile
modules/data-structures
source/input.c
source/screen.c

index 7248244077934ab529df446b3c6361cf46e190a0..1539f10063745135e7253a3de0176d3643107336 100644 (file)
@@ -8,6 +8,7 @@ GEM
 
 PLATFORMS
   ruby
+  x86-mingw32
 
 DEPENDENCIES
   rake
index 882e11b5f62c0b45facea45249c77e7a3cd98fad..24413c251879760600990e3e3eca82f725982b88 100644 (file)
--- 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 }
index cca2c832d0ae12a494564acb35922796dcc901ea..f5df85596a66ff4eebf6d77d4ee1f215d391d5a1 160000 (submodule)
@@ -1 +1 @@
-Subproject commit cca2c832d0ae12a494564acb35922796dcc901ea
+Subproject commit f5df85596a66ff4eebf6d77d4ee1f215d391d5a1
index 5fa9fe7f0c92ad59661c9b05d39cf5490349ef8e..58d4f1ad3073ad107c1f1d8349a1b1074afe6de9 100644 (file)
@@ -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';
index 26206de491103ffde7317f5cb4c72ae8ba5a3b3f..337f311caefb0050753d8b95a79bdc2de1ef01fc 100644 (file)
@@ -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;
     }