##// END OF EJS Templates
Tweak keybinds. Clean up duplicated code.
Gael Varoquaux -
Show More
@@ -123,6 +123,19 b' class ConsoleWidget(editwindow.EditWindow):'
123 # Also allow Ctrl Shift "=" for poor non US keyboard users.
123 # Also allow Ctrl Shift "=" for poor non US keyboard users.
124 self.CmdKeyAssign(ord('='), stc.STC_SCMOD_CTRL|stc.STC_SCMOD_SHIFT,
124 self.CmdKeyAssign(ord('='), stc.STC_SCMOD_CTRL|stc.STC_SCMOD_SHIFT,
125 stc.STC_CMD_ZOOMIN)
125 stc.STC_CMD_ZOOMIN)
126
127 self.CmdKeyAssign(stc.STC_KEY_PRIOR, stc.STC_SCMOD_SHIFT,
128 stc.STC_CMD_PAGEUP)
129
130 self.CmdKeyAssign(stc.STC_KEY_NEXT, stc.STC_SCMOD_SHIFT,
131 stc.STC_CMD_PAGEDOWN)
132
133 # Keys: we need to clear some of the keys the that don't play
134 # well with a console.
135 self.CmdKeyClear(ord('D'), stc.STC_SCMOD_CTRL)
136 self.CmdKeyClear(ord('L'), stc.STC_SCMOD_CTRL)
137 self.CmdKeyClear(ord('T'), stc.STC_SCMOD_CTRL)
138
126
139
127 self.SetEOLMode(stc.STC_EOL_CRLF)
140 self.SetEOLMode(stc.STC_EOL_CRLF)
128 self.SetWrapMode(stc.STC_WRAP_CHAR)
141 self.SetWrapMode(stc.STC_WRAP_CHAR)
@@ -292,6 +305,11 b' class ConsoleWidget(editwindow.EditWindow):'
292 last_word = last_word.split(breaker)[-1]
305 last_word = last_word.split(breaker)[-1]
293 self.AutoCompShow(len(last_word), " ".join(possibilities))
306 self.AutoCompShow(len(last_word), " ".join(possibilities))
294
307
308
309 def scroll_to_bottom(self):
310 maxrange = self.GetScrollRange(wx.VERTICAL)
311 self.ScrollLines(maxrange)
312
295
313
296 def _on_key_down(self, event, skip=True):
314 def _on_key_down(self, event, skip=True):
297 """ Key press callback used for correcting behavior for
315 """ Key press callback used for correcting behavior for
@@ -301,10 +319,10 b' class ConsoleWidget(editwindow.EditWindow):'
301 Return True if event as been catched.
319 Return True if event as been catched.
302 """
320 """
303 catched = False
321 catched = False
304 # Intercept annoying entries (eg: ctrl-D, ctrl-L)
322 if event.KeyCode == ord('L') and event.ControlDown() :
305 if event.KeyCode in (68, 76) and event.ControlDown() :
306 skip = False
323 skip = False
307 catched = True
324 catched = True
325 self.scroll_to_bottom()
308
326
309 if self.AutoCompActive():
327 if self.AutoCompActive():
310 event.Skip()
328 event.Skip()
@@ -203,5 +203,5 b" if __name__ == '__main__':"
203 frame.SetSize((660, 460))
203 frame.SetSize((660, 460))
204 self = frame.shell
204 self = frame.shell
205
205
206 # app.MainLoop()
206 app.MainLoop()
207
207
General Comments 0
You need to be logged in to leave comments. Login now