Module: Readline
- Defined in:
- lib/readline.rb
Defined Under Namespace
Classes: History
Constant Summary collapse
- FILENAME_COMPLETION_PROC =
filename_completion_proc_call
Proc.new do |text| # p = FFI::Readline.completion_matches(text) do |word, state| # puts word # puts word_p.read_string # puts state # p = FFI::Readline.filename_completion_function(word_p, state) # nil # p = ::FFI::MemoryPointer.new :pointer # p.put_string("hoge") # p # nil # end # return nil if p.null? r = Dir.glob(text + "*") p r r end
- USERNAME_COMPLETION_PROC =
username_completion_proc_call
Proc.new do |text| [] end
- VERSION =
"#{library_version} (FFI wrapper #{ReadelineFFI::VERSION})"
- HISTORY =
History.new
Class Method Summary collapse
- .basic_quote_characters ⇒ Object
- .basic_quote_characters=(str) ⇒ Object
- .basic_word_break_characters ⇒ Object
- .basic_word_break_characters=(str) ⇒ Object
- .completer_quote_characters ⇒ Object
- .completer_quote_characters=(str) ⇒ Object
- .completer_word_break_characters ⇒ Object
- .completer_word_break_characters=(str) ⇒ Object
- .completion_append_character ⇒ Object
- .completion_append_character=(str) ⇒ Object
- .completion_case_fold ⇒ Object
- .completion_case_fold=(bool) ⇒ Object
- .completion_proc ⇒ Object
- .completion_proc=(proc) ⇒ Object
- .emacs_editing_mode ⇒ Object
- .filename_quote_characters ⇒ Object
- .filename_quote_characters=(str) ⇒ Object
- .readline(prompt = "", history = nil) ⇒ Object
- .refresh_line ⇒ Object
- .vi_editing_mode ⇒ Object
Class Method Details
.basic_quote_characters ⇒ Object
236 237 238 239 |
# File 'lib/readline.rb', line 236 def self.basic_quote_characters p = FFI::Readline.basic_quote_characters p.null? ? nil : p.read_string end |
.basic_quote_characters=(str) ⇒ Object
230 231 232 233 234 |
# File 'lib/readline.rb', line 230 def self.basic_quote_characters=(str) return nil unless str FFI::Readline.basic_quote_characters = ::FFI::MemoryPointer.from_string(str) HISTORY end |
.basic_word_break_characters ⇒ Object
201 202 203 204 |
# File 'lib/readline.rb', line 201 def self.basic_word_break_characters p = FFI::Readline.basic_word_break_characters p.null? ? nil : p.read_string end |
.basic_word_break_characters=(str) ⇒ Object
196 197 198 199 |
# File 'lib/readline.rb', line 196 def self.basic_word_break_characters=(str) return nil unless str FFI::Readline.basic_word_break_characters = ::FFI::MemoryPointer.from_string(str) end |
.completer_quote_characters ⇒ Object
246 247 248 249 |
# File 'lib/readline.rb', line 246 def self.completer_quote_characters p = FFI::Readline.completer_quote_characters p.null? ? nil : p.read_string end |
.completer_quote_characters=(str) ⇒ Object
241 242 243 244 |
# File 'lib/readline.rb', line 241 def self.completer_quote_characters=(str) return nil unless str FFI::Readline.completer_quote_characters = ::FFI::MemoryPointer.from_string(str) end |
.completer_word_break_characters ⇒ Object
225 226 227 228 |
# File 'lib/readline.rb', line 225 def self.completer_word_break_characters p = FFI::Readline.completer_word_break_characters p.null? ? nil : p.read_string end |
.completer_word_break_characters=(str) ⇒ Object
220 221 222 223 |
# File 'lib/readline.rb', line 220 def self.completer_word_break_characters=(str) return nil unless str FFI::Readline.completer_word_break_characters = ::FFI::MemoryPointer.from_string(str) end |
.completion_append_character ⇒ Object
214 215 216 217 218 |
# File 'lib/readline.rb', line 214 def self.completion_append_character ch = FFI::Readline.completion_append_character return nil if ch == 0 ch.chr end |
.completion_append_character=(str) ⇒ Object
206 207 208 209 210 211 212 |
# File 'lib/readline.rb', line 206 def self.completion_append_character=(str) if str FFI::Readline.completion_append_character = str[0] else FFI::Readline.completion_append_character = 0 end end |
.completion_case_fold ⇒ Object
274 275 276 |
# File 'lib/readline.rb', line 274 def self.completion_case_fold @completion_case_fold end |
.completion_case_fold=(bool) ⇒ Object
270 271 272 |
# File 'lib/readline.rb', line 270 def self.completion_case_fold=(bool) @completion_case_fold = bool end |
.completion_proc ⇒ Object
266 267 268 |
# File 'lib/readline.rb', line 266 def self.completion_proc @completion_proc end |
.completion_proc=(proc) ⇒ Object
261 262 263 264 |
# File 'lib/readline.rb', line 261 def self.completion_proc=(proc) raise ArgumentError, "argument must respond to `call'" unless proc.respond_to? :call @completion_proc = proc end |
.emacs_editing_mode ⇒ Object
283 284 285 286 |
# File 'lib/readline.rb', line 283 def self.emacs_editing_mode FFI::Readline.editing_mode = 1 nil end |
.filename_quote_characters ⇒ Object
256 257 258 259 |
# File 'lib/readline.rb', line 256 def self.filename_quote_characters p = FFI::Readline.filename_quote_characters p.null? ? nil : p.read_string end |
.filename_quote_characters=(str) ⇒ Object
251 252 253 254 |
# File 'lib/readline.rb', line 251 def self.filename_quote_characters=(str) return nil unless str FFI::Readline.completer_quote_characters = ::FFI::MemoryPointer.from_string(str) end |
.readline(prompt = "", history = nil) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/readline.rb', line 89 def readline( prompt = "", history = nil) raise TypeError unless STDIN.kind_of? IO raise TypeError unless STDOUT.kind_of? IO # TODO: STDOUT,STDIN connected in rl_outstream, rl_instream # FFI::Readline.instream # FFI::Readline.outstream r = FFI::Readline.readline(prompt) if history FFI::Readline.add_history(r) end r.taint end |
.refresh_line ⇒ Object
288 289 290 |
# File 'lib/readline.rb', line 288 def self.refresh_line() FFI::Readline.refresh_line(0, 0) end |
.vi_editing_mode ⇒ Object
278 279 280 281 |
# File 'lib/readline.rb', line 278 def self.vi_editing_mode FFI::Readline.editing_mode = 0 nil end |