Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (27 sloc) 786 Bytes
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