diff options
author | Guido van Rossum <guido@python.org> | 2002-09-29 00:25:51 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-09-29 00:25:51 (GMT) |
commit | bffa52f07fc73b3c8eb4b30e30e2417bc406d2ee (patch) | |
tree | a5fe735c4e0ca016924636adfe155445f84e6d3b /Lib/curses | |
parent | af7a302c78258d418eba57bc2f80e4dabd8bbe9a (diff) | |
download | cpython-bffa52f07fc73b3c8eb4b30e30e2417bc406d2ee.zip cpython-bffa52f07fc73b3c8eb4b30e30e2417bc406d2ee.tar.gz cpython-bffa52f07fc73b3c8eb4b30e30e2417bc406d2ee.tar.bz2 |
Whitespace normalization (get rid of tabs).
Diffstat (limited to 'Lib/curses')
-rw-r--r-- | Lib/curses/ascii.py | 75 | ||||
-rw-r--r-- | Lib/curses/textpad.py | 24 | ||||
-rw-r--r-- | Lib/curses/wrapper.py | 26 |
3 files changed, 62 insertions, 63 deletions
diff --git a/Lib/curses/ascii.py b/Lib/curses/ascii.py index 3c21169..b8ae6f3 100644 --- a/Lib/curses/ascii.py +++ b/Lib/curses/ascii.py @@ -1,41 +1,41 @@ """Constants and membership tests for ASCII characters""" -NUL = 0x00 # ^@ -SOH = 0x01 # ^A -STX = 0x02 # ^B -ETX = 0x03 # ^C -EOT = 0x04 # ^D -ENQ = 0x05 # ^E -ACK = 0x06 # ^F -BEL = 0x07 # ^G -BS = 0x08 # ^H -TAB = 0x09 # ^I -HT = 0x09 # ^I -LF = 0x0a # ^J -NL = 0x0a # ^J -VT = 0x0b # ^K -FF = 0x0c # ^L -CR = 0x0d # ^M -SO = 0x0e # ^N -SI = 0x0f # ^O -DLE = 0x10 # ^P -DC1 = 0x11 # ^Q -DC2 = 0x12 # ^R -DC3 = 0x13 # ^S -DC4 = 0x14 # ^T -NAK = 0x15 # ^U -SYN = 0x16 # ^V -ETB = 0x17 # ^W -CAN = 0x18 # ^X -EM = 0x19 # ^Y -SUB = 0x1a # ^Z -ESC = 0x1b # ^[ -FS = 0x1c # ^\ -GS = 0x1d # ^] -RS = 0x1e # ^^ -US = 0x1f # ^_ -SP = 0x20 # space -DEL = 0x7f # delete +NUL = 0x00 # ^@ +SOH = 0x01 # ^A +STX = 0x02 # ^B +ETX = 0x03 # ^C +EOT = 0x04 # ^D +ENQ = 0x05 # ^E +ACK = 0x06 # ^F +BEL = 0x07 # ^G +BS = 0x08 # ^H +TAB = 0x09 # ^I +HT = 0x09 # ^I +LF = 0x0a # ^J +NL = 0x0a # ^J +VT = 0x0b # ^K +FF = 0x0c # ^L +CR = 0x0d # ^M +SO = 0x0e # ^N +SI = 0x0f # ^O +DLE = 0x10 # ^P +DC1 = 0x11 # ^Q +DC2 = 0x12 # ^R +DC3 = 0x13 # ^S +DC4 = 0x14 # ^T +NAK = 0x15 # ^U +SYN = 0x16 # ^V +ETB = 0x17 # ^W +CAN = 0x18 # ^X +EM = 0x19 # ^Y +SUB = 0x1a # ^Z +ESC = 0x1b # ^[ +FS = 0x1c # ^\ +GS = 0x1d # ^] +RS = 0x1e # ^^ +US = 0x1f # ^_ +SP = 0x20 # space +DEL = 0x7f # delete controlnames = [ "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", @@ -53,7 +53,7 @@ def _ctoi(c): def isalnum(c): return isalpha(c) or isdigit(c) def isalpha(c): return isupper(c) or islower(c) -def isascii(c): return _ctoi(c) <= 127 # ? +def isascii(c): return _ctoi(c) <= 127 # ? def isblank(c): return _ctoi(c) in (8,32) def iscntrl(c): return _ctoi(c) <= 31 def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57 @@ -97,4 +97,3 @@ def unctrl(c): if bits & 0x80: return "!" + rep return rep - diff --git a/Lib/curses/textpad.py b/Lib/curses/textpad.py index ece425f..bfc270a 100644 --- a/Lib/curses/textpad.py +++ b/Lib/curses/textpad.py @@ -71,7 +71,7 @@ class Textbox: self.win.addch(ch) except curses.error: pass - elif ch == ascii.SOH: # ^a + elif ch == ascii.SOH: # ^a self.win.move(y, 0) elif ch in (ascii.STX,curses.KEY_LEFT, ascii.BS,curses.KEY_BACKSPACE): if x > 0: @@ -84,48 +84,48 @@ class Textbox: self.win.move(y-1, self.maxx) if ch in (ascii.BS, curses.KEY_BACKSPACE): self.win.delch() - elif ch == ascii.EOT: # ^d + elif ch == ascii.EOT: # ^d self.win.delch() - elif ch == ascii.ENQ: # ^e + elif ch == ascii.ENQ: # ^e if self.stripspaces: self.win.move(y, self._end_of_line(y)) else: self.win.move(y, self.maxx) - elif ch in (ascii.ACK, curses.KEY_RIGHT): # ^f + elif ch in (ascii.ACK, curses.KEY_RIGHT): # ^f if x < self.maxx: self.win.move(y, x+1) elif y == self.maxy: pass else: self.win.move(y+1, 0) - elif ch == ascii.BEL: # ^g + elif ch == ascii.BEL: # ^g return 0 - elif ch == ascii.NL: # ^j + elif ch == ascii.NL: # ^j if self.maxy == 0: return 0 elif y < self.maxy: self.win.move(y+1, 0) - elif ch == ascii.VT: # ^k + elif ch == ascii.VT: # ^k if x == 0 and self._end_of_line(y) == 0: self.win.deleteln() else: self.win.clrtoeol() - elif ch == ascii.FF: # ^l + elif ch == ascii.FF: # ^l self.win.refresh() - elif ch in (ascii.SO, curses.KEY_DOWN): # ^n + elif ch in (ascii.SO, curses.KEY_DOWN): # ^n if y < self.maxy: self.win.move(y+1, x) if x > self._end_of_line(y+1): self.win.move(y+1, self._end_of_line(y+1)) - elif ch == ascii.SI: # ^o + elif ch == ascii.SI: # ^o self.win.insertln() - elif ch in (ascii.DLE, curses.KEY_UP): # ^p + elif ch in (ascii.DLE, curses.KEY_UP): # ^p if y > 0: self.win.move(y-1, x) if x > self._end_of_line(y-1): self.win.move(y-1, self._end_of_line(y-1)) return 1 - + def gather(self): "Collect and return the contents of the window." result = "" diff --git a/Lib/curses/wrapper.py b/Lib/curses/wrapper.py index 51fb724..e725c5a 100644 --- a/Lib/curses/wrapper.py +++ b/Lib/curses/wrapper.py @@ -16,20 +16,20 @@ def wrapper(func, *rest): as its first argument, followed by any other arguments passed to wrapper(). """ - + res = None try: - # Initialize curses + # Initialize curses stdscr=curses.initscr() - - # Turn off echoing of keys, and enter cbreak mode, - # where no buffering is performed on keyboard input + + # Turn off echoing of keys, and enter cbreak mode, + # where no buffering is performed on keyboard input curses.noecho() curses.cbreak() - # In keypad mode, escape sequences for special keys - # (like the cursor keys) will be interpreted and - # a special value like curses.KEY_LEFT will be returned + # In keypad mode, escape sequences for special keys + # (like the cursor keys) will be interpreted and + # a special value like curses.KEY_LEFT will be returned stdscr.keypad(1) # Start color, too. Harmless if the terminal doesn't have @@ -43,21 +43,21 @@ def wrapper(func, *rest): res = apply(func, (stdscr,) + rest) except: - # In the event of an error, restore the terminal - # to a sane state. + # In the event of an error, restore the terminal + # to a sane state. stdscr.keypad(0) curses.echo() curses.nocbreak() curses.endwin() - + # Pass the exception upwards (exc_type, exc_value, exc_traceback) = sys.exc_info() raise exc_type, exc_value, exc_traceback else: - # Set everything back to normal + # Set everything back to normal stdscr.keypad(0) curses.echo() curses.nocbreak() - curses.endwin() # Terminate curses + curses.endwin() # Terminate curses return res |