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
b4babc16
Commit
b4babc16
authored
Jan 16, 2009
by
Dylan Smith
Committed by
Alexandre Julliard
Jan 19, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: EM_SETTEXTEX detects ascii richtext with Unicode codepage.
parent
16477845
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
23 deletions
+36
-23
editor.c
dlls/riched20/editor.c
+35
-21
editor.c
dlls/riched20/tests/editor.c
+1
-2
No files found.
dlls/riched20/editor.c
View file @
b4babc16
...
...
@@ -3208,42 +3208,56 @@ static LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
{
LPWSTR
wszText
;
SETTEXTEX
*
pStruct
=
(
SETTEXTEX
*
)
wParam
;
size_t
len
;
size_t
len
=
0
;
int
from
,
to
;
ME_Style
*
style
;
BOOL
bRtf
,
bUnicode
,
bSelection
;
int
oldModify
=
editor
->
nModifyStep
;
if
(
!
pStruct
)
return
0
;
/* If we detect ascii rtf at the start of the string,
* we know it isn't unicode. */
bRtf
=
(
lParam
&&
(
!
strncmp
((
char
*
)
lParam
,
"{
\\
rtf"
,
5
)
||
!
strncmp
((
char
*
)
lParam
,
"{
\\
urtf}"
,
6
)));
bUnicode
=
!
bRtf
&&
pStruct
->
codepage
==
1200
;
TRACE
(
"EM_SETTEXTEX - %s, flags %d, cp %d
\n
"
,
pStruct
->
codepage
==
1200
?
debugstr_w
((
LPCWSTR
)
lParam
)
:
debugstr_a
((
LPCSTR
)
lParam
),
bUnicode
?
debugstr_w
((
LPCWSTR
)
lParam
)
:
debugstr_a
((
LPCSTR
)
lParam
),
pStruct
->
flags
,
pStruct
->
codepage
);
/* FIXME: make use of pStruct->codepage in the to unicode translation */
wszText
=
lParam
?
ME_ToUnicode
(
pStruct
->
codepage
==
1200
,
(
void
*
)
lParam
)
:
NULL
;
len
=
wszText
?
lstrlenW
(
wszText
)
:
0
;
if
(
pStruct
->
flags
&
ST_SELECTION
)
{
bSelection
=
(
pStruct
->
flags
&
ST_SELECTION
)
!=
0
;
if
(
bSelection
)
{
ME_GetSelection
(
editor
,
&
from
,
&
to
);
style
=
ME_GetSelectionInsertStyle
(
editor
);
ME_InternalDeleteText
(
editor
,
from
,
to
-
from
,
FALSE
);
if
(
pStruct
->
codepage
!=
1200
&&
lParam
&&
(
!
strncmp
((
char
*
)
lParam
,
"{
\\
rtf"
,
5
)
||
!
strncmp
((
char
*
)
lParam
,
"{
\\
urtf}"
,
6
)))
ME_StreamInRTFString
(
editor
,
1
,
(
char
*
)
lParam
);
else
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
style
);
ME_ReleaseStyle
(
style
);
}
else
{
ME_InternalDeleteText
(
editor
,
0
,
ME_GetTextLength
(
editor
),
FALSE
);
style
=
editor
->
pBuffer
->
pDefaultStyle
;
}
if
(
editor
->
AutoURLDetect_bEnable
)
ME_UpdateSelectionLinkAttribute
(
editor
);
if
(
bRtf
)
{
ME_StreamInRTFString
(
editor
,
bSelection
,
(
char
*
)
lParam
);
if
(
bSelection
)
{
/* FIXME: The length returned is doesn't include the rtf control
* characters, only the actual text. */
len
=
lParam
?
strlen
((
char
*
)
lParam
)
:
0
;
}
}
else
{
/* FIXME: make use of pStruct->codepage in the to unicode translation */
wszText
=
lParam
?
ME_ToUnicode
(
bUnicode
,
(
void
*
)
lParam
)
:
NULL
;
len
=
wszText
?
lstrlenW
(
wszText
)
:
0
;
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
style
);
}
else
{
ME_InternalDeleteText
(
editor
,
0
,
ME_GetTextLength
(
editor
),
FALSE
);
if
(
pStruct
->
codepage
!=
1200
&&
lParam
&&
(
!
strncmp
((
char
*
)
lParam
,
"{
\\
rtf"
,
5
)
||
!
strncmp
((
char
*
)
lParam
,
"{
\\
urtf}"
,
6
)))
ME_StreamInRTFString
(
editor
,
0
,
(
char
*
)
lParam
);
else
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
editor
->
pBuffer
->
pDefaultStyle
);
len
=
1
;
if
(
editor
->
AutoURLDetect_bEnable
)
ME_UpdateLinkAttribute
(
editor
,
0
,
-
1
);
if
(
bSelection
)
{
ME_ReleaseStyle
(
style
);
if
(
editor
->
AutoURLDetect_bEnable
)
ME_UpdateSelectionLinkAttribute
(
editor
);
}
else
{
len
=
1
;
if
(
editor
->
AutoURLDetect_bEnable
)
ME_UpdateLinkAttribute
(
editor
,
0
,
-
1
);
}
ME_CommitUndo
(
editor
);
if
(
!
(
pStruct
->
flags
&
ST_KEEPUNDO
))
...
...
dlls/riched20/tests/editor.c
View file @
b4babc16
...
...
@@ -3576,8 +3576,7 @@ static void test_EM_SETTEXTEX(void)
result
=
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
"{
\\
rtf not unicode}"
);
todo_wine
ok
(
result
==
11
,
"EM_SETTEXTEX incorrectly returned %d
\n
"
,
result
);
SendMessage
(
hwndRichEdit
,
EM_GETTEXTEX
,
(
WPARAM
)
&
getText
,
(
LPARAM
)
bufACP
);
todo_wine
ok
(
lstrcmpA
(
bufACP
,
"not unicode"
)
==
0
,
"'%s' != 'not unicode'
\n
"
,
bufACP
);
ok
(
lstrcmpA
(
bufACP
,
"not unicode"
)
==
0
,
"'%s' != 'not unicode'
\n
"
,
bufACP
);
/* The following test demonstrates that EM_SETTEXTEX supports RTF strings with a selection */
SendMessage
(
hwndRichEdit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
"TestSomeText"
);
/* TestItem1 */
...
...
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