hi,

as you know raggle doesnt notice if a terminal is resized. Well, today i
was bored and played around with some code. So, what i've got working
is, that raggle notices a terminal resize and puts itself to the proper
size , but the user input gets quite slow. Attached, you can find the
patch (tested with xterm). I think the input gets slow because of the
two loops, however, see yourself.

bye,
    - michael
--- /usr/bin/raggle     2004-12-15 00:17:57.000000000 +0100
+++ raggle      2005-02-12 03:12:32.000000000 +0100
@@ -3174,9 +3174,12 @@
 ##
 # Ugly
 # -- richlowe 2003-07-01
-def setup_win
+def setup_win (refresh)
       # initialize screen & keyboard
-    Ncurses::initscr
+    
+    if refresh == 0
+        Ncurses::initscr
+    end
     Ncurses::raw if $config['use_raw_mode']
     Ncurses::keypad Ncurses::stdscr, 1
     Ncurses::noecho if $config['use_noecho']
@@ -3274,7 +3277,7 @@
     feed['site'] = chan.link
     feed['image'] = chan.image
     feed['updated'] = t.to_i
-
+      
     # Note: last_modified is slightly different than modified,
     # because we're using it as a token, not as a timestamp
     # -- paul
@@ -3347,6 +3350,7 @@
 #######################################################################
 
 def main
+
   # expand the default config hash
   expand_config
 
@@ -3443,8 +3447,8 @@
 
   # Draw windows and such.
   # (unless we're running as a daemon)
-  setup_win unless $config['run_http_server'] || $config['run_drb_server']
-  
+  setup_win 0 unless $config['run_http_server'] || $config['run_drb_server']
+
   # load feed cache
   load_feed_cache if $config['load_feed_cache'] &&
     test(?e, $config['feed_cache_path'])
@@ -3554,27 +3558,33 @@
     else # ncurses interface
       # main input loop
       timeout = $config['input_select_timeout']
-      $done = false
-      until $done
-        # handle keyboard input
-        r = select [$stdin], nil, nil, timeout
-        if r && r.size > 0
-          c = Ncurses::getch
-          $config['keys'][c].call($wins[$a_win],c) \
-            if $config['keys'].has_key? c
-        end
-        
-        # refresh window contents if there's been a feed update
-        if $update_wins
-          $update_wins = false
-          populate_feed_win
-          # wins.each { |win| win.draw_items }
+    
+   $done = false
+   until $done
+        if ((ch = Ncurses::getch()) != Ncurses::ERR)
+            if (ch == Ncurses::KEY_RESIZE) 
+                Ncurses::endwin
+                setup_win 1 unless $config['run_http_server'] || 
$config['run_drb_server']
+                window_size_changed = true;
+            else
+                # handle keyboard input
+                r = select [$stdin], nil, nil, timeout
+                if r && r.size > 0
+                    c = Ncurses::getch
+                    $config['keys'][c].call($wins[$a_win],c) \
+                        if $config['keys'].has_key? c
+                end
+                if $update_wins
+                  $update_wins = false
+                  populate_feed_win
+                  # wins.each { |win| win.draw_items }
+                end
+                set_status $new_status if $new_status != $status
+            end
         end
-        
-        set_status $new_status if $new_status != $status
-      end
+   end
     end
-    
+ 
     # clean up screen on exit (unless running HTTP server)
     Ncurses::endwin unless $config['run_http_server'] ||
                            $config['run_drb_server']
@@ -3609,7 +3619,7 @@
     destroy_cache_lock if $config['use_cache_lock'] && $config['cache_lock']
     
     $stdout.puts $config['msg_thanks']
-  end
+ end
 end
 
 ##################

Attachment: signature.asc
Description: Digital signature

Reply via email to