| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 93cfe58 commit 84d581a
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -967,7 +967,8 @@ def p_key(self, key): | |||
| 967 | 967 | return "" | |
| 968 | 968 | ||
| 969 | 969 | elif key in key_dispatch[config.clear_screen_key]: | |
| 970 | - self.s_hist = [self.s_hist[-1]] | ||
| 970 | + # clear all but current line | ||
| 971 | + self.screen_hist = [self.screen_hist[-1]] | ||
| 971 | 972 | self.highlighted_paren = None | |
| 972 | 973 | self.redraw() | |
| 973 | 974 | return "" | |
@@ -1099,7 +1100,7 @@ def prompt(self, more): | |||
| 1099 | 1100 | self.stdout_hist += self.ps1 | |
| 1100 | 1101 | else: | |
| 1101 | 1102 | self.stdout_hist += self.ps1.encode(getpreferredencoding()) | |
| 1102 | - self.s_hist.append( | ||
| 1103 | + self.screen_hist.append( | ||
| 1103 | 1104 | "\x01%s\x03%s\x04" | |
| 1104 | 1105 | % (self.config.color_scheme["prompt"], self.ps1) | |
| 1105 | 1106 | ) | |
@@ -1110,7 +1111,7 @@ def prompt(self, more): | |||
| 1110 | 1111 | self.stdout_hist += self.ps2 | |
| 1111 | 1112 | else: | |
| 1112 | 1113 | self.stdout_hist += self.ps2.encode(getpreferredencoding()) | |
| 1113 | - self.s_hist.append( | ||
| 1114 | + self.screen_hist.append( | ||
| 1114 | 1115 | "\x01%s\x03%s\x04" % (prompt_more_color, self.ps2) | |
| 1115 | 1116 | ) | |
| 1116 | 1117 | ||
@@ -1128,15 +1129,15 @@ def push(self, s, insert_into_history=True): | |||
| 1128 | 1129 | curses.raw(True) | |
| 1129 | 1130 | ||
| 1130 | 1131 | def redraw(self): | |
| 1131 | - """Redraw the screen.""" | ||
| 1132 | + """Redraw the screen using screen_hist""" | ||
| 1132 | 1133 | self.scr.erase() | |
| 1133 | - for k, s in enumerate(self.s_hist): | ||
| 1134 | + for k, s in enumerate(self.screen_hist): | ||
| 1134 | 1135 | if not s: | |
| 1135 | 1136 | continue | |
| 1136 | 1137 | self.iy, self.ix = self.scr.getyx() | |
| 1137 | 1138 | for i in s.split("\x04"): | |
| 1138 | 1139 | self.echo(i, redraw=False) | |
| 1139 | - if k < len(self.s_hist) - 1: | ||
| 1140 | + if k < len(self.screen_hist) - 1: | ||
| 1140 | 1141 | self.scr.addstr("\n") | |
| 1141 | 1142 | self.iy, self.ix = self.scr.getyx() | |
| 1142 | 1143 | self.print_line(self.s) | |
@@ -1175,7 +1176,7 @@ def repl(self): | |||
| 1175 | 1176 | return self.exit_value | |
| 1176 | 1177 | ||
| 1177 | 1178 | self.history.append(inp) | |
| 1178 | - self.s_hist[-1] += self.f_string | ||
| 1179 | + self.screen_hist[-1] += self.f_string | ||
| 1179 | 1180 | if py3: | |
| 1180 | 1181 | self.stdout_hist += inp + "\n" | |
| 1181 | 1182 | else: | |
@@ -1234,7 +1235,7 @@ def reevaluate(self): | |||
| 1234 | 1235 | self.f_string = "" | |
| 1235 | 1236 | self.buffer = [] | |
| 1236 | 1237 | self.scr.erase() | |
| 1237 | - self.s_hist = [] | ||
| 1238 | + self.screen_hist = [] | ||
| 1238 | 1239 | # Set cursor position to -1 to prevent paren matching | |
| 1239 | 1240 | self.cpos = -1 | |
| 1240 | 1241 | ||
@@ -1247,7 +1248,7 @@ def reevaluate(self): | |||
| 1247 | 1248 | else: | |
| 1248 | 1249 | self.stdout_hist += line.encode(getpreferredencoding()) + "\n" | |
| 1249 | 1250 | self.print_line(line) | |
| 1250 | - self.s_hist[-1] += self.f_string | ||
| 1251 | + self.screen_hist[-1] += self.f_string | ||
| 1251 | 1252 | # I decided it was easier to just do this manually | |
| 1252 | 1253 | # than to make the print_line and history stuff more flexible. | |
| 1253 | 1254 | self.scr.addstr("\n") | |
@@ -1288,7 +1289,7 @@ def write(self, s): | |||
| 1288 | 1289 | self.stdout_hist += t | |
| 1289 | 1290 | ||
| 1290 | 1291 | self.echo(s) | |
| 1291 | - self.s_hist.append(s.rstrip()) | ||
| 1292 | + self.screen_hist.append(s.rstrip()) | ||
| 1292 | 1293 | ||
| 1293 | 1294 | def show_list( | |
| 1294 | 1295 | self, items, arg_pos, topline=None, formatter=None, current_item=None | |
@@ -1551,7 +1552,7 @@ def send_current_line_to_editor(self): | |||
| 1551 | 1552 | self.stdout_hist += line.encode(getpreferredencoding()) + "\n" | |
| 1552 | 1553 | self.history.append(line) | |
| 1553 | 1554 | self.print_line(line) | |
| 1554 | - self.s_hist[-1] += self.f_string | ||
| 1555 | + self.screen_hist[-1] += self.f_string | ||
| 1555 | 1556 | self.scr.addstr("\n") | |
| 1556 | 1557 | self.more = self.push(line) | |
| 1557 | 1558 | self.prompt(self.more) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -447,7 +447,9 @@ def __init__(self, interp, config): | |||
| 447 | 447 | self.rl_history = History( | |
| 448 | 448 | duplicates=config.hist_duplicates, hist_size=config.hist_length | |
| 449 | 449 | ) | |
| 450 | - self.s_hist = [] | ||
| 450 | + # all input and output, stored as old style format strings | ||
| 451 | + # (\x01, \x02, ...) for cli.py | ||
| 452 | + self.screen_hist = [] | ||
| 451 | 453 | self.history = [] # commands executed since beginning of session | |
| 452 | 454 | self.redo_stack = [] | |
| 453 | 455 | self.evaluating = False | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -908,7 +908,6 @@ def reevaluate(self): | |||
| 908 | 908 | self.f_string = "" | |
| 909 | 909 | self.buffer = [] | |
| 910 | 910 | self.scr.erase() | |
| 911 | - self.s_hist = [] | ||
| 912 | 911 | # Set cursor position to -1 to prevent paren matching | |
| 913 | 912 | self.cpos = -1 | |
| 914 | 913 | ||
@@ -923,7 +922,6 @@ def reevaluate(self): | |||
| 923 | 922 | line.encode(locale.getpreferredencoding()) + "\n" | |
| 924 | 923 | ) | |
| 925 | 924 | self.print_line(line) | |
| 926 | - self.s_hist[-1] += self.f_string | ||
| 927 | 925 | # I decided it was easier to just do this manually | |
| 928 | 926 | # than to make the print_line and history stuff more flexible. | |
| 929 | 927 | self.scr.addstr("\n") | |
@@ -964,7 +962,6 @@ def write(self, s): | |||
| 964 | 962 | self.stdout_hist += t | |
| 965 | 963 | ||
| 966 | 964 | self.echo(s) | |
| 967 | - self.s_hist.append(s.rstrip()) | ||
| 968 | 965 | ||
| 969 | 966 | def push(self, s, insert_into_history=True): | |
| 970 | 967 | # Restore the original SIGINT handler. This is needed to be able | |
@@ -1013,7 +1010,6 @@ def prompt(self, more): | |||
| 1013 | 1010 | self.current_output = None | |
| 1014 | 1011 | # XXX is this the right place? | |
| 1015 | 1012 | self.rl_history.reset() | |
| 1016 | - # XXX what is s_hist? | ||
| 1017 | 1013 | ||
| 1018 | 1014 | # We need the caption to use unicode as urwid normalizes later | |
| 1019 | 1015 | # input to be the same type, using ascii as encoding. If the | |
@@ -1074,7 +1070,6 @@ def handle_input(self, event): | |||
| 1074 | 1070 | inp = self.edit.get_edit_text() | |
| 1075 | 1071 | self.history.append(inp) | |
| 1076 | 1072 | self.edit.make_readonly() | |
| 1077 | - # XXX what is this s_hist thing? | ||
| 1078 | 1073 | if py3: | |
| 1079 | 1074 | self.stdout_hist += inp | |
| 1080 | 1075 | else: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments