Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 31 lines (27 sloc) 0.786 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
diff --git a/lib/termtter/system_extensions.rb b/lib/termtter/system_extensions.rb
index aee63b2..36bf56d 100644
--- a/lib/termtter/system_extensions.rb
+++ b/lib/termtter/system_extensions.rb
@@ -22,6 +22,9 @@ module Readline
   ffi_lib(pathes.find { |path| File.exist?(path) })
 
   attach_function :rl_refresh_line, [:int, :int], :int
+ attach_function :rl_delete_text, [:int, :int], :int
+ attach_function :rl_set_prompt, [:string], :int
+ attach_variable :rl_end, :int
   attach_variable :rl_line_buffer, :string
 
   class << self
@@ -32,6 +35,15 @@ module Readline
     def line_buffer
       rl_line_buffer
     end
+
+ def delete_text
+ e = rl_end
+ rl_delete_text(0, e) if e > 0
+ end
+
+ def set_prompt(s)
+ rl_set_prompt(s)
+ end
   end
 end
 
Something went wrong with that request. Please try again.