示例#1
0
    get_history_length = rl.get_history_length
    get_history_item = rl.get_history_item
    get_line_buffer = rl.get_line_buffer
    set_completer = rl.set_completer
    get_completer = rl.get_completer
    get_begidx = rl.get_begidx
    get_endidx = rl.get_endidx

    redisplay = rl.redisplay

    set_completer_delims = rl.set_completer_delims
    set_history_length = rl.set_history_length
    set_pre_input_hook = rl.set_pre_input_hook
    set_startup_hook = rl.set_startup_hook

    callback_handler_install = rl.callback_handler_install
    callback_handler_remove = rl.callback_handler_remove
    callback_read_char = rl.callback_read_char

    console.install_readline(rl.readline)
except Exception:
    raise

# Why.
# __all__.append("rl")

end_time = time.perf_counter()
logging.debug("Readline setup complete. %d" % (end_time - start))

del (end_time, start, rl)
示例#2
0
文件: __main__.py 项目: sspiff/narvi
			readline.add_history(v)
	def clear_values(self):
		self._values = []
		readline.clear_history()
class NoCompleter(object):
	def set_values(self, values):
		pass
	def clear_values(self):
		pass
#
try:
	if platform.system().lower() == 'windows':
		from pyreadline.rlmain import Readline
		import pyreadline.console as console
		readline = Readline()
		console.install_readline(readline.readline)
	else:
		import readline
except:
	completer = NoCompleter()
	readline = None
else:
	completer = PromptCompleter()
	readline.set_completer(completer.complete)
	#
	if 'libedit' in readline.__doc__:
		readline.parse_and_bind('bind ^I rl_complete')
		readline.parse_and_bind('bind ^F em-inc-search-prev')
		readline.parse_and_bind('bind ^R em-inc-search-next')
		# hack for the equivalent of set_completer_delims():
		import ctypes