Add option to not store duplicate input in command history for legacy mode.
This commit is contained in:
parent
b1439274c6
commit
1391f20658
|
@ -168,7 +168,8 @@ DEFAULT_PREFS = {
|
||||||
"downloaded_width":13,
|
"downloaded_width":13,
|
||||||
"uploaded_width":13,
|
"uploaded_width":13,
|
||||||
"owner_width":10,
|
"owner_width":10,
|
||||||
"disable_three_dots": False
|
"disable_three_dots": False,
|
||||||
|
"ignore_duplicate_lines": False
|
||||||
}
|
}
|
||||||
|
|
||||||
column_pref_names = ["queue","name","size","state",
|
column_pref_names = ["queue","name","size","state",
|
||||||
|
@ -461,7 +462,7 @@ class AllTorrents(BaseMode, component.Component):
|
||||||
if arg and True in arg[0]:
|
if arg and True in arg[0]:
|
||||||
self.stdscr.clear()
|
self.stdscr.clear()
|
||||||
if not self.legacy_mode:
|
if not self.legacy_mode:
|
||||||
self.legacy_mode = Legacy(self.stdscr,self.encoding)
|
self.legacy_mode = Legacy(self.stdscr,self.config,self.encoding)
|
||||||
component.get("ConsoleUI").set_mode(self.legacy_mode)
|
component.get("ConsoleUI").set_mode(self.legacy_mode)
|
||||||
self.legacy_mode.refresh()
|
self.legacy_mode.refresh()
|
||||||
curses.curs_set(2)
|
curses.curs_set(2)
|
||||||
|
|
|
@ -54,7 +54,7 @@ LINES_BUFFER_SIZE = 5000
|
||||||
INPUT_HISTORY_SIZE = 500
|
INPUT_HISTORY_SIZE = 500
|
||||||
|
|
||||||
class Legacy(BaseMode):
|
class Legacy(BaseMode):
|
||||||
def __init__(self, stdscr, encoding=None):
|
def __init__(self, stdscr, console_config, encoding=None):
|
||||||
|
|
||||||
self.batch_write = False
|
self.batch_write = False
|
||||||
self.lines = []
|
self.lines = []
|
||||||
|
@ -79,6 +79,8 @@ class Legacy(BaseMode):
|
||||||
# Get a handle to the main console
|
# Get a handle to the main console
|
||||||
self.console = component.get("ConsoleUI")
|
self.console = component.get("ConsoleUI")
|
||||||
|
|
||||||
|
self.console_config = console_config
|
||||||
|
|
||||||
# show the cursor
|
# show the cursor
|
||||||
curses.curs_set(2)
|
curses.curs_set(2)
|
||||||
|
|
||||||
|
@ -118,7 +120,14 @@ class Legacy(BaseMode):
|
||||||
# Remove the oldest input history if the max history size
|
# Remove the oldest input history if the max history size
|
||||||
# is reached.
|
# is reached.
|
||||||
del self.input_history[0]
|
del self.input_history[0]
|
||||||
self.input_history.append(self.input)
|
if self.console_config["ignore_duplicate_lines"]:
|
||||||
|
if len(self.input_history) > 0:
|
||||||
|
if self.input_history[-1] != self.input:
|
||||||
|
self.input_history.append(self.input)
|
||||||
|
else:
|
||||||
|
self.input_history.append(self.input)
|
||||||
|
else:
|
||||||
|
self.input_history.append(self.input)
|
||||||
self.input_history_index = len(self.input_history)
|
self.input_history_index = len(self.input_history)
|
||||||
self.input = ""
|
self.input = ""
|
||||||
self.input_incomplete = ""
|
self.input_incomplete = ""
|
||||||
|
|
|
@ -312,6 +312,7 @@ class InterfacePane(BasePane):
|
||||||
BasePane.__init__(self,offset,parent,width)
|
BasePane.__init__(self,offset,parent,width)
|
||||||
self.add_header("General")
|
self.add_header("General")
|
||||||
self.add_checked_input("disable_three_dots","Do not append three dots symbol when trimming columns",parent.console_config["disable_three_dots"])
|
self.add_checked_input("disable_three_dots","Do not append three dots symbol when trimming columns",parent.console_config["disable_three_dots"])
|
||||||
|
self.add_checked_input("ignore_duplicate_lines","Do not store duplicate input in history",parent.console_config["ignore_duplicate_lines"])
|
||||||
self.add_header("Columns To Display")
|
self.add_header("Columns To Display")
|
||||||
for cpn in deluge.ui.console.modes.alltorrents.column_pref_names:
|
for cpn in deluge.ui.console.modes.alltorrents.column_pref_names:
|
||||||
pn = "show_%s"%cpn
|
pn = "show_%s"%cpn
|
||||||
|
|
Loading…
Reference in New Issue