Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
88214a58
Commit
88214a58
authored
Jan 21, 2014
by
Jactry Zeng
Committed by
Alexandre Julliard
Jan 27, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Add UTF8 support for EM_SETTEXTEX.
parent
eb8f4751
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
editor.c
dlls/riched20/editor.c
+12
-4
editor.c
dlls/riched20/tests/editor.c
+4
-4
No files found.
dlls/riched20/editor.c
View file @
88214a58
...
...
@@ -3329,8 +3329,9 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
SETTEXTEX
*
pStruct
=
(
SETTEXTEX
*
)
wParam
;
int
from
,
to
,
len
;
ME_Style
*
style
;
BOOL
bRtf
,
bUnicode
,
bSelection
;
BOOL
bRtf
,
bUnicode
,
bSelection
,
bUTF8
;
int
oldModify
=
editor
->
nModifyStep
;
static
const
char
utf8_bom
[]
=
{
0xef
,
0xbb
,
0xbf
};
if
(
!
pStruct
)
return
0
;
...
...
@@ -3339,6 +3340,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
bRtf
=
(
lParam
&&
(
!
strncmp
((
char
*
)
lParam
,
"{
\\
rtf"
,
5
)
||
!
strncmp
((
char
*
)
lParam
,
"{
\\
urtf"
,
6
)));
bUnicode
=
!
bRtf
&&
pStruct
->
codepage
==
CP_UNICODE
;
bUTF8
=
(
lParam
&&
(
!
strncmp
((
char
*
)
lParam
,
utf8_bom
,
3
)));
TRACE
(
"EM_SETTEXTEX - %s, flags %d, cp %d
\n
"
,
bUnicode
?
debugstr_w
((
LPCWSTR
)
lParam
)
:
debugstr_a
((
LPCSTR
)
lParam
),
...
...
@@ -3364,9 +3366,15 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
len
=
lParam
?
strlen
((
char
*
)
lParam
)
:
0
;
}
}
else
{
wszText
=
ME_ToUnicode
(
pStruct
->
codepage
,
(
void
*
)
lParam
,
&
len
);
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
style
);
ME_EndToUnicode
(
pStruct
->
codepage
,
wszText
);
if
(
bUTF8
&&
!
bUnicode
)
{
wszText
=
ME_ToUnicode
(
CP_UTF8
,
(
void
*
)(
lParam
+
3
),
&
len
);
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
style
);
ME_EndToUnicode
(
CP_UTF8
,
wszText
);
}
else
{
wszText
=
ME_ToUnicode
(
pStruct
->
codepage
,
(
void
*
)
lParam
,
&
len
);
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
style
);
ME_EndToUnicode
(
pStruct
->
codepage
,
wszText
);
}
}
if
(
bSelection
)
{
...
...
dlls/riched20/tests/editor.c
View file @
88214a58
...
...
@@ -3901,17 +3901,17 @@ static void test_EM_SETTEXTEX(void)
setText
.
codepage
=
CP_ACP
;
SendMessageA
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
"
\xef\xbb\xbf
TestUTF8WithBOM"
);
result
=
SendMessageA
(
hwndRichEdit
,
WM_GETTEXT
,
1024
,
(
LPARAM
)
bufACP
);
todo_wine
ok
(
result
==
15
,
"EM_SETTEXTEX: Test UTF8 with BOM returned %d, expected 15
\n
"
,
result
);
ok
(
result
==
15
,
"EM_SETTEXTEX: Test UTF8 with BOM returned %d, expected 15
\n
"
,
result
);
result
=
strcmp
(
bufACP
,
"TestUTF8WithBOM"
);
todo_wine
ok
(
result
==
0
,
"EM_SETTEXTEX: Test UTF8 with BOM set wrong text: Result: %s
\n
"
,
bufACP
);
ok
(
result
==
0
,
"EM_SETTEXTEX: Test UTF8 with BOM set wrong text: Result: %s
\n
"
,
bufACP
);
setText
.
flags
=
0
;
setText
.
codepage
=
CP_UTF8
;
SendMessageA
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
"
\xef\xbb\xbf
TestUTF8WithBOM"
);
result
=
SendMessageA
(
hwndRichEdit
,
WM_GETTEXT
,
1024
,
(
LPARAM
)
bufACP
);
todo_wine
ok
(
result
==
15
,
"EM_SETTEXTEX: Test UTF8 with BOM returned %d, expected 15
\n
"
,
result
);
ok
(
result
==
15
,
"EM_SETTEXTEX: Test UTF8 with BOM returned %d, expected 15
\n
"
,
result
);
result
=
strcmp
(
bufACP
,
"TestUTF8WithBOM"
);
todo_wine
ok
(
result
==
0
,
"EM_SETTEXTEX: Test UTF8 with BOM set wrong text: Result: %s
\n
"
,
bufACP
);
ok
(
result
==
0
,
"EM_SETTEXTEX: Test UTF8 with BOM set wrong text: Result: %s
\n
"
,
bufACP
);
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