Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding moderately crappy ctrl x support
  • Loading branch information
FoxLisk committed Jan 25, 2015
1 parent 8728fc3 commit 9e7ee87
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pudb/debugger.py
Expand Up @@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-

from __future__ import division
import re
import urwid
import bdb
import sys
Expand Down Expand Up @@ -1482,6 +1483,17 @@ def cmdline_start_of_line(w, size, key):
def cmdline_end_of_line(w, size, key):
self.cmdline_edit.edit_pos = len(self.cmdline_edit.edit_text)

def cmdline_del_word(w, size, key):
text = self.cmdline_edit.edit_text
matches = list(re.finditer(r'(\.|\s+)', text))
if not matches:
self.cmdline_edit.edit_text = ''
self.cmdline_edit.edit_pos = 0
return
pos = matches[-1].start()
self.cmdline_edit.edit_text = text[:pos]
self.cmdline_edit.edit_pos = pos

def toggle_cmdline_focus(w, size, key):
self.columns.set_focus(self.lhs_col)
if self.lhs_col.get_focus() is self.cmdline_sigwrap:
Expand All @@ -1499,6 +1511,7 @@ def toggle_cmdline_focus(w, size, key):
self.cmdline_edit_sigwrap.listen("ctrl d", toggle_cmdline_focus)
self.cmdline_edit_sigwrap.listen("ctrl a", cmdline_start_of_line)
self.cmdline_edit_sigwrap.listen("ctrl e", cmdline_end_of_line)
self.cmdline_edit_sigwrap.listen("ctrl w", cmdline_del_word)

self.top.listen("ctrl x", toggle_cmdline_focus)

Expand Down

0 comments on commit 9e7ee87

Please sign in to comment.