mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
"i" shortcut to insert for KVEditor.
This commit is contained in:
parent
2b6bedac0e
commit
d41095c35e
@ -486,7 +486,7 @@ class ConsoleMaster(flow.FlowMaster):
|
|||||||
('offset', 'dark cyan', 'default'),
|
('offset', 'dark cyan', 'default'),
|
||||||
|
|
||||||
# KV Editor
|
# KV Editor
|
||||||
('focusfield', 'white', 'dark blue'),
|
('focusfield', 'black', 'light gray'),
|
||||||
('editfield', 'black', 'light cyan'),
|
('editfield', 'black', 'light cyan'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -82,12 +82,18 @@ class KVWalker(urwid.ListWalker):
|
|||||||
self.focus = min(len(self.lst)-1, self.focus)
|
self.focus = min(len(self.lst)-1, self.focus)
|
||||||
self._modified()
|
self._modified()
|
||||||
|
|
||||||
def add(self):
|
def _insert(self, pos):
|
||||||
self.focus = min(self.focus +1, len(self.lst))
|
self.focus = pos
|
||||||
self.lst.insert(self.focus, ("", ""))
|
self.lst.insert(self.focus, ("", ""))
|
||||||
self.focus_col = 0
|
self.focus_col = 0
|
||||||
self.start_edit()
|
self.start_edit()
|
||||||
|
|
||||||
|
def insert(self):
|
||||||
|
return self._insert(self.focus)
|
||||||
|
|
||||||
|
def add(self):
|
||||||
|
return self._insert(min(self.focus + 1, len(self.lst)))
|
||||||
|
|
||||||
def start_edit(self):
|
def start_edit(self):
|
||||||
self.editing = KVItem(self.focus_col, True, self.maxk, *self.lst[self.focus])
|
self.editing = KVItem(self.focus_col, True, self.maxk, *self.lst[self.focus])
|
||||||
self._modified()
|
self._modified()
|
||||||
@ -179,6 +185,8 @@ class KVEditor(common.WWrap):
|
|||||||
self.walker.tab_next()
|
self.walker.tab_next()
|
||||||
elif key == "a":
|
elif key == "a":
|
||||||
self.walker.add()
|
self.walker.add()
|
||||||
|
elif key == "i":
|
||||||
|
self.walker.insert()
|
||||||
elif key == "d":
|
elif key == "d":
|
||||||
self.walker.delete_focus()
|
self.walker.delete_focus()
|
||||||
elif key in ["enter", "e"]:
|
elif key in ["enter", "e"]:
|
||||||
|
Loading…
Reference in New Issue
Block a user