changeset 36:a672f0142d27

Added command repetition
author unexist
date Fri, 22 Jan 2010 18:32:18 +0100
parents 485e694f9656
children 8215e3fcbb6f
files subtly/browser.rb subtly/gtk.rb subtly/webkit.rb
diffstat 3 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/subtly/browser.rb	Fri Jan 22 16:44:19 2010 +0100
+++ b/subtly/browser.rb	Fri Jan 22 18:32:18 2010 +0100
@@ -33,6 +33,7 @@
       @keys     = {}
       @keychain = ""
       @jumpbuf  = ""
+      @times    = ""
 
       # Create widgets
       @win      = Subtly::Gtk::Window.new
@@ -282,16 +283,29 @@
 
               @input.text = ":open %s" % [ @keys[@keychain.to_sym].gsub("%s", @jumpbuf) ]
             else
-              @keychain << event[:string]
+              # Check for numbers
+              if(event[:string].match(/[0-9]/))
+                @times << event[:string]
+              else
+                @keychain << event[:string]
+              end
 
+              # Find command
               if(@keys.include?(@keychain.to_sym))
                 # Check if command is a jump
                 if("_" == event[:string])
-                  @mode = :jump
+                  @mode       = :jump
                   @input.text = ":open %s" % [ @keys[@keychain.to_sym].gsub("%s", @jumpbuf) ]
                 else
-                  commands(@keys[@keychain.to_sym])
+                  time = Integer(@times) rescue 1
+
+                  # Repeat command
+                  (0..time).each do 
+                    commands(@keys[@keychain.to_sym])
+                  end
+
                   @keychain = ""
+                  @times    = ""
                 end
               end
           end 
--- a/subtly/gtk.rb	Fri Jan 22 16:44:19 2010 +0100
+++ b/subtly/gtk.rb	Fri Jan 22 18:32:18 2010 +0100
@@ -393,12 +393,11 @@
         page  = Subtly::Gtk::Scrolled.ffi_get_vadjust_page_size(vadjust)
 
         # Calculation
-        percent = pos * 100
-        value   = lower * percent / 100
+        value = lower * pos
 
-        puts value
+        puts Subtly::Gtk::Scrolled.ffi_get_vadjust_value(vadjust)
 
-        Subtly::Gtk::Scrolled.ffi_set_vadjust_value(vadjust, value)
+        Subtly::Gtk::Scrolled.ffi_set_vadjust_value(vadjust, value.to_f)
       end
 
       ## vadjust
--- a/subtly/webkit.rb	Fri Jan 22 16:44:19 2010 +0100
+++ b/subtly/webkit.rb	Fri Jan 22 18:32:18 2010 +0100
@@ -60,7 +60,7 @@
     def title
       Subtly::Webkit.ffi_get_title(@widget)
     end
- 
+
     ## back
     # Step back in browser history
     #