Add workaround for tabbing out of SubsTextEditCtrl
wxStyledTextCtrl eats the tabs, so handle them in SubsTextEditCtrl::OnKeyDown() Originally committed to SVN as r6881.
This commit is contained in:
parent
571752a955
commit
3a81e80aa5
2 changed files with 11 additions and 1 deletions
|
@ -166,6 +166,8 @@ SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxSize wsize, long style, a
|
|||
|
||||
using namespace std::tr1;
|
||||
|
||||
Bind(wxEVT_CHAR_HOOK, &SubsTextEditCtrl::OnKeyDown, this);
|
||||
|
||||
Bind(wxEVT_COMMAND_MENU_SELECTED, bind(&SubsTextEditCtrl::Cut, this), EDIT_MENU_CUT);
|
||||
Bind(wxEVT_COMMAND_MENU_SELECTED, bind(&SubsTextEditCtrl::Copy, this), EDIT_MENU_COPY);
|
||||
Bind(wxEVT_COMMAND_MENU_SELECTED, bind(&SubsTextEditCtrl::Paste, this), EDIT_MENU_PASTE);
|
||||
|
@ -199,7 +201,6 @@ SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxSize wsize, long style, a
|
|||
OPT_SUB("App/Call Tips", &SubsTextEditCtrl::UpdateCallTip, this, ref(evt));
|
||||
}
|
||||
|
||||
|
||||
SubsTextEditCtrl::~SubsTextEditCtrl() {
|
||||
}
|
||||
|
||||
|
@ -224,6 +225,14 @@ void SubsTextEditCtrl::OnLoseFocus(wxFocusEvent &event) {
|
|||
event.Skip();
|
||||
}
|
||||
|
||||
void SubsTextEditCtrl::OnKeyDown(wxKeyEvent &event) {
|
||||
// Workaround for wxSTC eating tabs.
|
||||
if (event.GetKeyCode() == WXK_TAB) {
|
||||
Navigate(event.ShiftDown() ? wxNavigationKeyEvent::IsBackward : wxNavigationKeyEvent::IsForward);
|
||||
}
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
enum {
|
||||
STYLE_NORMAL = 0,
|
||||
STYLE_COMMENT,
|
||||
|
|
|
@ -84,6 +84,7 @@ class SubsTextEditCtrl : public ScintillaTextCtrl {
|
|||
void OnSetDicLanguage(wxCommandEvent &event);
|
||||
void OnSetThesLanguage(wxCommandEvent &event);
|
||||
void OnLoseFocus(wxFocusEvent &event);
|
||||
void OnKeyDown(wxKeyEvent &event);
|
||||
|
||||
void SetSyntaxStyle(int id, wxFont &font, std::string const& name);
|
||||
void Subscribe(std::string const& name);
|
||||
|
|
Loading…
Reference in a new issue