git » msnlib » commit 724c84d

Handle Ctrl+W.

author Alberto Bertogli
2005-04-12 18:32:16 UTC
committer Alberto Bertogli
2005-04-12 18:32:16 UTC
parent 2549bdce506082de3d8f20aa8ef59eeb0e7a9170

Handle Ctrl+W.

msn +10 -0

diff --git a/msn b/msn
index 0b66820..13872e4 100644
--- a/msn
+++ b/msn
@@ -637,6 +637,16 @@ def stdin_read():
 			inbuf = ''
 			redraw_cli()
 
+		elif ord(char) == 23:				# ^W
+			inbuf = inbuf[:-1]
+			inbuf = inbuf.rstrip()
+			pos = inbuf.rfind(' ')
+			if pos > 0:
+				inbuf = inbuf[:pos].rstrip() + ' '
+			else:
+				inbuf = ''
+			redraw_cli()
+
 		elif char == '\t':				# tab
 			p = inbuf.split()