Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3a805d28
Commit
3a805d28
authored
Jul 28, 2008
by
Dustin Brody
Committed by
Alexandre Julliard
Jul 29, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: EM_SETTEXTTEX obeys ST_SELECTION with RTF inputs.
parent
12a61402
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
9 deletions
+78
-9
editor.c
dlls/riched20/editor.c
+1
-1
editor.c
dlls/riched20/tests/editor.c
+77
-8
No files found.
dlls/riched20/editor.c
View file @
3a805d28
...
@@ -2308,7 +2308,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
...
@@ -2308,7 +2308,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
style
=
ME_GetSelectionInsertStyle
(
editor
);
style
=
ME_GetSelectionInsertStyle
(
editor
);
ME_InternalDeleteText
(
editor
,
from
,
to
-
from
);
ME_InternalDeleteText
(
editor
,
from
,
to
-
from
);
if
(
pStruct
->
codepage
!=
1200
&&
lParam
&&
!
strncmp
((
char
*
)
lParam
,
"{
\\
rtf"
,
5
))
if
(
pStruct
->
codepage
!=
1200
&&
lParam
&&
!
strncmp
((
char
*
)
lParam
,
"{
\\
rtf"
,
5
))
ME_StreamInRTFString
(
editor
,
0
,
(
char
*
)
lParam
);
ME_StreamInRTFString
(
editor
,
1
,
(
char
*
)
lParam
);
else
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
style
);
else
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
style
);
ME_ReleaseStyle
(
style
);
ME_ReleaseStyle
(
style
);
...
...
dlls/riched20/tests/editor.c
View file @
3a805d28
...
@@ -3180,6 +3180,12 @@ static void test_EM_SETTEXTEX(void)
...
@@ -3180,6 +3180,12 @@ static void test_EM_SETTEXTEX(void)
WCHAR
TestItem1
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
WCHAR
TestItem1
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
'S'
,
'o'
,
'm'
,
'e'
,
'S'
,
'o'
,
'm'
,
'e'
,
'T'
,
'e'
,
'x'
,
't'
,
0
};
'T'
,
'e'
,
'x'
,
't'
,
0
};
WCHAR
TestItem1alt
[]
=
{
'T'
,
'T'
,
'e'
,
's'
,
't'
,
'S'
,
'o'
,
'm'
,
'e'
,
'T'
,
'e'
,
'x'
,
't'
,
't'
,
'S'
,
'o'
,
'm'
,
'e'
,
'T'
,
'e'
,
'x'
,
't'
,
0
};
WCHAR
TestItem2
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
WCHAR
TestItem2
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
'S'
,
'o'
,
'm'
,
'e'
,
'S'
,
'o'
,
'm'
,
'e'
,
'T'
,
'e'
,
'x'
,
't'
,
'T'
,
'e'
,
'x'
,
't'
,
...
@@ -3208,6 +3214,7 @@ static void test_EM_SETTEXTEX(void)
...
@@ -3208,6 +3214,7 @@ static void test_EM_SETTEXTEX(void)
' '
,
'\r'
,
0
};
' '
,
'\r'
,
0
};
#define MAX_BUF_LEN 1024
#define MAX_BUF_LEN 1024
WCHAR
buf
[
MAX_BUF_LEN
];
WCHAR
buf
[
MAX_BUF_LEN
];
char
bufACP
[
MAX_BUF_LEN
];
char
*
p
;
char
*
p
;
int
result
;
int
result
;
CHARRANGE
cr
;
CHARRANGE
cr
;
...
@@ -3227,7 +3234,7 @@ static void test_EM_SETTEXTEX(void)
...
@@ -3227,7 +3234,7 @@ static void test_EM_SETTEXTEX(void)
"EM_GETTEXTEX results not what was set by EM_SETTEXTEX
\n
"
);
"EM_GETTEXTEX results not what was set by EM_SETTEXTEX
\n
"
);
/* Unlike WM_SETTEXT/WM_GETTEXT pair, EM_SETTEXTEX/EM_GETTEXTEX does not
/* Unlike WM_SETTEXT/WM_GETTEXT pair, EM_SETTEXTEX/EM_GETTEXTEX does not
convert \r to \r\n on return
convert \r to \r\n on return
: !ST_SELECTION && Unicode && !\rtf
*/
*/
setText
.
codepage
=
1200
;
/* no constant for unicode */
setText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
codepage
=
1200
;
/* no constant for unicode */
...
@@ -3273,7 +3280,7 @@ static void test_EM_SETTEXTEX(void)
...
@@ -3273,7 +3280,7 @@ static void test_EM_SETTEXTEX(void)
"EM_GETTEXTEX results not what was set by EM_SETTEXTEX
\n
"
);
"EM_GETTEXTEX results not what was set by EM_SETTEXTEX
\n
"
);
/* \r\n pairs get changed into \r */
/* \r\n pairs get changed into \r
: !ST_SELECTION && Unicode && !\rtf
*/
setText
.
codepage
=
1200
;
/* no constant for unicode */
setText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
cb
=
MAX_BUF_LEN
;
getText
.
cb
=
MAX_BUF_LEN
;
...
@@ -3286,7 +3293,7 @@ static void test_EM_SETTEXTEX(void)
...
@@ -3286,7 +3293,7 @@ static void test_EM_SETTEXTEX(void)
ok
(
lstrcmpW
(
buf
,
TestItem3_after
)
==
0
,
ok
(
lstrcmpW
(
buf
,
TestItem3_after
)
==
0
,
"EM_SETTEXTEX did not convert properly
\n
"
);
"EM_SETTEXTEX did not convert properly
\n
"
);
/* \n also gets changed to \r */
/* \n also gets changed to \r
: !ST_SELECTION && Unicode && !\rtf
*/
setText
.
codepage
=
1200
;
/* no constant for unicode */
setText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
cb
=
MAX_BUF_LEN
;
getText
.
cb
=
MAX_BUF_LEN
;
...
@@ -3299,7 +3306,7 @@ static void test_EM_SETTEXTEX(void)
...
@@ -3299,7 +3306,7 @@ static void test_EM_SETTEXTEX(void)
ok
(
lstrcmpW
(
buf
,
TestItem3_after
)
==
0
,
ok
(
lstrcmpW
(
buf
,
TestItem3_after
)
==
0
,
"EM_SETTEXTEX did not convert properly
\n
"
);
"EM_SETTEXTEX did not convert properly
\n
"
);
/* \r\r\n gets changed into single space */
/* \r\r\n gets changed into single space
: !ST_SELECTION && Unicode && !\rtf
*/
setText
.
codepage
=
1200
;
/* no constant for unicode */
setText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
cb
=
MAX_BUF_LEN
;
getText
.
cb
=
MAX_BUF_LEN
;
...
@@ -3312,6 +3319,7 @@ static void test_EM_SETTEXTEX(void)
...
@@ -3312,6 +3319,7 @@ static void test_EM_SETTEXTEX(void)
ok
(
lstrcmpW
(
buf
,
TestItem4_after
)
==
0
,
ok
(
lstrcmpW
(
buf
,
TestItem4_after
)
==
0
,
"EM_SETTEXTEX did not convert properly
\n
"
);
"EM_SETTEXTEX did not convert properly
\n
"
);
/* !ST_SELECTION && Unicode && !\rtf */
result
=
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
result
=
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
NULL
);
(
WPARAM
)
&
setText
,
(
LPARAM
)
NULL
);
SendMessage
(
hwndRichEdit
,
EM_GETTEXTEX
,
(
WPARAM
)
&
getText
,
(
LPARAM
)
buf
);
SendMessage
(
hwndRichEdit
,
EM_GETTEXTEX
,
(
WPARAM
)
&
getText
,
(
LPARAM
)
buf
);
...
@@ -3321,14 +3329,14 @@ static void test_EM_SETTEXTEX(void)
...
@@ -3321,14 +3329,14 @@ static void test_EM_SETTEXTEX(void)
ok
(
lstrlenW
(
buf
)
==
0
,
ok
(
lstrlenW
(
buf
)
==
0
,
"EM_SETTEXTEX with NULL lParam should clear rich edit.
\n
"
);
"EM_SETTEXTEX with NULL lParam should clear rich edit.
\n
"
);
/* put some text back */
/* put some text back
: !ST_SELECTION && Unicode && !\rtf
*/
setText
.
flags
=
0
;
setText
.
flags
=
0
;
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
TestItem1
);
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
TestItem1
);
/* select some text */
/* select some text */
cr
.
cpMax
=
1
;
cr
.
cpMax
=
1
;
cr
.
cpMin
=
3
;
cr
.
cpMin
=
3
;
SendMessage
(
hwndRichEdit
,
EM_EXSETSEL
,
0
,
(
LPARAM
)
&
cr
);
SendMessage
(
hwndRichEdit
,
EM_EXSETSEL
,
0
,
(
LPARAM
)
&
cr
);
/* replace current selection */
/* replace current selection
: ST_SELECTION && Unicode && !\rtf
*/
setText
.
flags
=
ST_SELECTION
;
setText
.
flags
=
ST_SELECTION
;
result
=
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
result
=
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
NULL
);
(
WPARAM
)
&
setText
,
(
LPARAM
)
NULL
);
...
@@ -3337,14 +3345,14 @@ static void test_EM_SETTEXTEX(void)
...
@@ -3337,14 +3345,14 @@ static void test_EM_SETTEXTEX(void)
" with no text should return 0. Got %i
\n
"
,
" with no text should return 0. Got %i
\n
"
,
result
);
result
);
/* put some text back */
/* put some text back
: !ST_SELECTION && Unicode && !\rtf
*/
setText
.
flags
=
0
;
setText
.
flags
=
0
;
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
TestItem1
);
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
TestItem1
);
/* select some text */
/* select some text */
cr
.
cpMax
=
1
;
cr
.
cpMax
=
1
;
cr
.
cpMin
=
3
;
cr
.
cpMin
=
3
;
SendMessage
(
hwndRichEdit
,
EM_EXSETSEL
,
0
,
(
LPARAM
)
&
cr
);
SendMessage
(
hwndRichEdit
,
EM_EXSETSEL
,
0
,
(
LPARAM
)
&
cr
);
/* replace current selection */
/* replace current selection
: ST_SELECTION && Unicode && !\rtf
*/
setText
.
flags
=
ST_SELECTION
;
setText
.
flags
=
ST_SELECTION
;
result
=
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
result
=
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
TestItem1
);
(
WPARAM
)
&
setText
,
(
LPARAM
)
TestItem1
);
...
@@ -3369,6 +3377,7 @@ static void test_EM_SETTEXTEX(void)
...
@@ -3369,6 +3377,7 @@ static void test_EM_SETTEXTEX(void)
(
WPARAM
)(
SF_RTF
),
(
LPARAM
)
&
es
);
(
WPARAM
)(
SF_RTF
),
(
LPARAM
)
&
es
);
trace
(
"EM_STREAMOUT produced:
\n
%s
\n
"
,
(
char
*
)
buf
);
trace
(
"EM_STREAMOUT produced:
\n
%s
\n
"
,
(
char
*
)
buf
);
/* !ST_SELECTION && !Unicode && \rtf */
setText
.
codepage
=
CP_ACP
;
/* EM_STREAMOUT saved as ANSI string */
setText
.
codepage
=
CP_ACP
;
/* EM_STREAMOUT saved as ANSI string */
getText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
cb
=
MAX_BUF_LEN
;
getText
.
cb
=
MAX_BUF_LEN
;
...
@@ -3382,6 +3391,66 @@ static void test_EM_SETTEXTEX(void)
...
@@ -3382,6 +3391,66 @@ static void test_EM_SETTEXTEX(void)
ok
(
lstrcmpW
(
buf
,
TestItem1
)
==
0
,
ok
(
lstrcmpW
(
buf
,
TestItem1
)
==
0
,
"EM_GETTEXTEX results not what was set by EM_SETTEXTEX
\n
"
);
"EM_GETTEXTEX results not what was set by EM_SETTEXTEX
\n
"
);
/* The following test demonstrates that EM_SETTEXTEX supports RTF strings with a selection */
SendMessage
(
hwndRichEdit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
"TestSomeText"
);
/* TestItem1 */
p
=
(
char
*
)
buf
;
es
.
dwCookie
=
(
DWORD_PTR
)
&
p
;
es
.
dwError
=
0
;
es
.
pfnCallback
=
test_WM_SETTEXT_esCallback
;
memset
(
buf
,
0
,
sizeof
(
buf
));
SendMessage
(
hwndRichEdit
,
EM_STREAMOUT
,
(
WPARAM
)(
SF_RTF
),
(
LPARAM
)
&
es
);
trace
(
"EM_STREAMOUT produced:
\n
%s
\n
"
,
(
char
*
)
buf
);
/* select some text */
cr
.
cpMax
=
1
;
cr
.
cpMin
=
3
;
SendMessage
(
hwndRichEdit
,
EM_EXSETSEL
,
0
,
(
LPARAM
)
&
cr
);
/* ST_SELECTION && !Unicode && \rtf */
setText
.
codepage
=
CP_ACP
;
/* EM_STREAMOUT saved as ANSI string */
getText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
cb
=
MAX_BUF_LEN
;
getText
.
flags
=
GT_DEFAULT
;
getText
.
lpDefaultChar
=
NULL
;
getText
.
lpUsedDefChar
=
NULL
;
setText
.
flags
=
ST_SELECTION
;
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
buf
);
SendMessage
(
hwndRichEdit
,
EM_GETTEXTEX
,
(
WPARAM
)
&
getText
,
(
LPARAM
)
buf
);
ok
(
lstrcmpW
(
buf
,
TestItem1alt
)
==
0
,
"EM_GETTEXTEX results not what was set by EM_SETTEXTEX when"
" using ST_SELECTION on an RTF string and non-Unicode
\n
"
);
/* The following test demonstrates that EM_SETTEXTEX replacing a selection */
setText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
codepage
=
CP_ACP
;
getText
.
cb
=
MAX_BUF_LEN
;
setText
.
flags
=
0
;
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
TestItem1
);
/* TestItem1 */
SendMessage
(
hwndRichEdit
,
EM_GETTEXTEX
,
(
WPARAM
)
&
getText
,
(
LPARAM
)
bufACP
);
/* select some text */
cr
.
cpMax
=
1
;
cr
.
cpMin
=
3
;
SendMessage
(
hwndRichEdit
,
EM_EXSETSEL
,
0
,
(
LPARAM
)
&
cr
);
/* ST_SELECTION && !Unicode && !\rtf */
setText
.
codepage
=
CP_ACP
;
getText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
cb
=
MAX_BUF_LEN
;
getText
.
flags
=
GT_DEFAULT
;
getText
.
lpDefaultChar
=
NULL
;
getText
.
lpUsedDefChar
=
NULL
;
setText
.
flags
=
ST_SELECTION
;
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
bufACP
);
SendMessage
(
hwndRichEdit
,
EM_GETTEXTEX
,
(
WPARAM
)
&
getText
,
(
LPARAM
)
buf
);
ok
(
lstrcmpW
(
buf
,
TestItem1alt
)
==
0
,
"EM_GETTEXTEX results not what was set by EM_SETTEXTEX when"
" using ST_SELECTION and non-Unicode
\n
"
);
DestroyWindow
(
hwndRichEdit
);
DestroyWindow
(
hwndRichEdit
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment