SendMsg(2446, bytes, 0);
}
+// Find the position of a column on a line taking into account tabs and
+// multi-byte characters. If beyond end of line, return line end position.
+int wxStyledTextCtrl::FindColumn(int line, int column) {
+ return SendMsg(2456, line, column);
+}
+
// Start notifying the container of all key presses and commands.
void wxStyledTextCtrl::StartRecord() {
SendMsg(3001, 0, 0);
void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
- // On (some?) non-US keyboards the AltGr key is required to enter some
+ // On (some?) non-US PC keyboards the AltGr key is required to enter some
// common characters. It comes to us as both Alt and Ctrl down so we need
// to let the char through in that case, otherwise if only ctrl or only
// alt let's skip it.
#endif
bool skip = ((ctrl || alt) && ! (ctrl && alt));
- int key = evt.GetKeyCode();
-
-// printf("OnChar key:%d consumed:%d ctrl:%d alt:%d skip:%d\n",
-// key, m_lastKeyDownConsumed, ctrl, alt, skip);
-
- if ( (key <= WXK_START || key > WXK_COMMAND) &&
- !m_lastKeyDownConsumed && !skip) {
- m_swx->DoAddChar(key);
- return;
+ if (!m_lastKeyDownConsumed && !skip) {
+#if wxUSE_UNICODE
+ int key = evt.GetUnicodeKey();
+ bool keyOk = true;
+
+ // if the unicode key code is not really a unicode character (it may
+ // be a function key or etc., the platforms appear to always give us a
+ // small value in this case) then fallback to the ascii key code but
+ // don't do anything for function keys or etc.
+ if (key <= 255) {
+ key = evt.GetKeyCode();
+ keyOk = (key <= 255);
+ }
+ if (keyOk) {
+ m_swx->DoAddChar(key);
+ return;
+ }
+#else
+ int key = evt.GetKeyCode();
+ if (key <= WXK_START || key > WXK_COMMAND) {
+ m_swx->DoAddChar(key);
+ return;
+ }
+#endif
}
+
evt.Skip();
}
void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
- int key = evt.GetKeyCode();
- bool shift = evt.ShiftDown(),
- ctrl = evt.ControlDown(),
- alt = evt.AltDown(),
- meta = evt.MetaDown();
-
- int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, meta, &m_lastKeyDownConsumed);
-
-// printf("KeyDn key:%d shift:%d ctrl:%d alt:%d processed:%d consumed:%d\n",
-// key, shift, ctrl, alt, processed, m_lastKeyDownConsumed);
-
+ int processed = m_swx->DoKeyDown(evt, &m_lastKeyDownConsumed);
if (!processed && !m_lastKeyDownConsumed)
evt.Skip();
}