Browse Source

tw.prune.action: enable echo, clear screen after action

The MMGen Project 2 years ago
parent
commit
ab24c482a1
2 changed files with 14 additions and 7 deletions
  1. 8 1
      mmgen/tw/prune.py
  2. 6 6
      mmgen/tw/view.py

+ 8 - 1
mmgen/tw/prune.py

@@ -12,10 +12,11 @@
 tw.prune: Tracking wallet pruned listaddresses class for the MMGen suite
 """
 
-from ..util import msg,rmsg,ymsg
+from ..util import msg,msg_r,rmsg,ymsg
 from ..color import red,green,gray,yellow
 from ..obj import ListItemAttr
 from .addresses import TwAddresses
+from .view import CUR_HOME,ERASE_ALL
 
 class TwAddressesPrune(TwAddresses):
 
@@ -156,10 +157,16 @@ class TwAddressesPrune(TwAddresses):
 				else:
 					e.tag = True
 
+			if parent.scroll:
+				msg_r(CUR_HOME + ERASE_ALL)
+
 		def a_unprune(self,parent):
 			for addrnum in self.get_addrnums(parent,'unprune'):
 				parent.disp_data[addrnum-1].tag = False
 
+			if parent.scroll:
+				msg_r(CUR_HOME + ERASE_ALL)
+
 		def a_clear_prune_list(self,parent):
 			for d in parent.data:
 				d.tag = False

+ 6 - 6
mmgen/tw/view.py

@@ -551,6 +551,9 @@ class TwView(MMGenObject,metaclass=AsyncInit):
 
 			action = self.key_mappings[reply]
 
+			if scroll and action.startswith('a_'): # 'a_' actions may require line input
+				term.set('echo')
+
 			if hasattr(self.action,action):
 				if action.startswith('m_'): # scrolling actions
 					self.use_cached = True
@@ -558,17 +561,14 @@ class TwView(MMGenObject,metaclass=AsyncInit):
 			elif action.startswith('s_'): # put here to allow overriding by action method
 				self.do_sort(action[2:])
 			elif hasattr(self.item_action,action):
-				if scroll:
-					term.set('echo') # item actions may require user input
 				await self.item_action().run(self,action)
-				if scroll:
-					term.set('noecho')
 			elif action == 'a_quit':
 				msg('')
-				if scroll:
-					term.set('echo')
 				return self.disp_data
 
+			if scroll and action.startswith('a_'):
+				term.set('noecho')
+
 	@property
 	def blank_prompt(self):
 		return CUR_HOME + CUR_DOWN(self.term_height - self.prompt_height) + ERASE_ALL