简单的文本框编辑小部件,带有类似emacs的键绑定
texteditpad的Python项目详细描述
文本编辑板
简单的文本框编辑小部件,带有类似于keybindings的emacs。提供 比curses.textpad例程更丰富的功能,并打算替换 它。
用法
deftest_editbox(stdscr):ncols,nlines=9,4uly,ulx=15,20stdscr.addstr(uly-2,ulx,"Use Ctrl-G to end editing.")win=curses.newwin(nlines,ncols,uly,ulx)stdscr.refresh()returntexteditpad.Textbox(win).edit()text=curses.wrapper(test_editbox)print'Contents of text box:'printtext
命令
使用窗口对象的内部编辑小部件。支持 遵循类似于密钥绑定的emacs:
Command | Description |
---|---|
Ctrl-A | Go to left edge of window. |
Ctrl-B | Cursor left, wrapping to previous line if appropriate. |
Ctrl-D | Delete character under cursor. |
Ctrl-E | Go to right edge or end of line |
Ctrl-F | Cursor right, wrapping to next line when appropriate. |
Ctrl-G | Terminate, returning the window contents. |
Ctrl-H | Delete character backward. |
Ctrl-I | Toggle insert/overwrite modes. |
Ctrl-K | If line is blank, delete it, otherwise clear to end of line. |
Ctrl-L | Refresh screen. |
Ctrl-N | Cursor down; move down one line. |
Ctrl-O | Insert a blank line at cursor location. |
Ctrl-P | Cursor up; move up one line. |