projects
/
rainbowstream.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add `tweet_mode='extended'` to `search` call
[rainbowstream.git]
/
rainbowstream
/
interactive.py
diff --git
a/rainbowstream/interactive.py
b/rainbowstream/interactive.py
index 47a257633a68a8685e68d18014d5ae5bd9ce5f10..76755e8c21adf85dfc2fddb4835f1889021081b1 100644
(file)
--- a/
rainbowstream/interactive.py
+++ b/
rainbowstream/interactive.py
@@
-1,5
+1,4
@@
import readline
import readline
-import rlcompleter
import os.path
from .config import *
import os.path
from .config import *
@@
-28,22
+27,24
@@
class RainbowCompleter(object):
words = origline.split()
if not words:
words = origline.split()
if not words:
- self.current_candidates = sorted(
self.options.keys()
)
+ self.current_candidates = sorted(
[c for c in self.options]
)
else:
try:
if begin == 0:
else:
try:
if begin == 0:
- candidates = self.options.keys()
+ candidates = [c for c in self.options]
+ elif words[-1] in self.options[words[0]]:
+ candidates = []
else:
first = words[0]
candidates = self.options[first]
if being_completed:
else:
first = words[0]
candidates = self.options[first]
if being_completed:
- self.current_candidates = [
w for w in candidates
-
if w.startswith(being_completed)
]
+ self.current_candidates = [w for w in candidates
+
if w.startswith(being_completed)
]
else:
self.current_candidates = candidates
else:
self.current_candidates = candidates
- except (KeyError, IndexError)
, err
:
+ except (KeyError, IndexError):
self.current_candidates = []
try:
self.current_candidates = []
try:
@@
-67,15
+68,20
@@
def read_history():
"""
Read history file
"""
"""
Read history file
"""
- if os.path.isfile(HISTORY_FILENAME):
- readline.read_history_file(HISTORY_FILENAME)
+ try:
+ readline.read_history_file(c['HISTORY_FILENAME'])
+ except:
+ pass
def save_history():
"""
Save history to file
"""
def save_history():
"""
Save history to file
"""
- readline.write_history_file(HISTORY_FILENAME)
+ try:
+ readline.write_history_file(c['HISTORY_FILENAME'])
+ except:
+ pass
def init_interactive_shell(d):
def init_interactive_shell(d):
@@
-83,12
+89,8
@@
def init_interactive_shell(d):
Init the rainbow shell
"""
readline.set_completer(RainbowCompleter(d).complete)
Init the rainbow shell
"""
readline.set_completer(RainbowCompleter(d).complete)
- readline.parse_and_bind('set editing-mode vi')
- readline.parse_and_bind("set input-meta on")
- readline.parse_and_bind("set convert-meta off")
- readline.parse_and_bind("set output-meta on")
+ readline.parse_and_bind('set skip-completed-text on')
if 'libedit' in readline.__doc__:
readline.parse_and_bind("bind ^I rl_complete")
else:
readline.parse_and_bind("tab: complete")
if 'libedit' in readline.__doc__:
readline.parse_and_bind("bind ^I rl_complete")
else:
readline.parse_and_bind("tab: complete")
-