My favorites | Sign in
Project Home Downloads Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions

Issue 22 attachment: issue_22.diff (1.7 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
diff -r 46fbd2301a4f -r cff246af5a7c pnwtl/textview.cpp
--- a/pnwtl/textview.cpp Tue May 10 19:16:27 2011 +0200
+++ b/pnwtl/textview.cpp Tue May 10 21:00:57 2011 +0200
@@ -963,6 +963,27 @@
return ret;
}

+HRESULT CTextView::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+ if(wParam & MK_CONTROL)
+ {
+ long pos = PositionFromPointClose(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
+ if(pos < 0)
+ return DefWindowProc(uMsg, wParam, lParam);
+
+ int wordStart = WordStartPosition(pos, true);
+ int wordEnd = WordEndPosition(pos, true);
+
+ SetSelectionStart(wordStart);
+ SetSelectionEnd(wordEnd);
+
+ bHandled = TRUE;
+ return 0;
+ }
+ else
+ return DefWindowProc(uMsg, wParam, lParam);
+}
+
HRESULT CTextView::OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
bHandled = false;
diff -r 46fbd2301a4f -r cff246af5a7c pnwtl/textview.h
--- a/pnwtl/textview.h Tue May 10 19:16:27 2011 +0200
+++ b/pnwtl/textview.h Tue May 10 21:00:57 2011 +0200
@@ -49,6 +49,7 @@
MESSAGE_HANDLER(WM_CHAR, OnChar)
MESSAGE_HANDLER(WM_VSCROLL, OnVScroll)
MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel)
+ MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)

COMMAND_ID_HANDLER(ID_EDIT_INDENT, OnIndent)
COMMAND_ID_HANDLER(ID_EDIT_UNINDENT, OnUnindent)
@@ -140,6 +141,7 @@
HRESULT OnChar(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
HRESULT OnVScroll(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
HRESULT OnMouseWheel(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
+ HRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);

////////////////////////////////////////////////////////////////
// Command Handlers
Powered by Google Project Hosting