Python prompt_toolkit.keys.Keys.Backspace() Examples
The following are 2
code examples of prompt_toolkit.keys.Keys.Backspace().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
prompt_toolkit.keys.Keys
, or try the search function
.
Example #1
Source File: keybinding.py From crash with Apache License 2.0 | 6 votes |
def bind_keys(buf, key_bindings): handle = key_bindings.add @handle('c-d') def exit_(event): event.app.exit(exception=EOFError, style='class:exiting') @handle('c-c') def interrupt_(event): event.app.exit(exception=KeyboardInterrupt, style='class:aborting') @handle('c-z') def suspend_(event): event.app.suspend_to_background() @handle(Keys.Tab, filter=mk_filter(buf, _is_start_of_multiline)) def on_tab(event): event.cli.current_buffer.insert_text(' ' * TAB_WIDTH) @handle(Keys.Backspace, filter=mk_filter(buf, _line_ends_with_tab)) def on_backspace(event): event.cli.current_buffer.delete_before_cursor(TAB_WIDTH)
Example #2
Source File: test_keybinding.py From crash with Apache License 2.0 | 5 votes |
def test_bindings(self): kb = KeyBindings() bind_keys(Buffer(), kb) self.assertTrue('on_backspace' in handlers_for_key(kb, Keys.Backspace)) self.assertTrue('on_tab' in handlers_for_key(kb, Keys.Tab))