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
93fec636
Commit
93fec636
authored
Mar 12, 2021
by
Huw Davies
Committed by
Alexandre Julliard
Mar 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: Handle EM_GETTEXTRANGE's unicode conversion in the host.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6a173bec
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
6 deletions
+43
-6
editor.c
dlls/riched20/editor.c
+2
-3
editor.c
dlls/riched20/tests/editor.c
+2
-2
txthost.c
dlls/riched20/txthost.c
+38
-0
editor.c
dlls/riched32/tests/editor.c
+1
-1
No files found.
dlls/riched20/editor.c
View file @
93fec636
...
...
@@ -4014,15 +4014,14 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
int
nEnd
=
rng
->
chrg
.
cpMax
;
int
textlength
=
ME_GetTextLength
(
editor
);
TRACE
(
"EM_GETTEXTRANGE min=%d max=%d unicode=%d textlength=%d
\n
"
,
rng
->
chrg
.
cpMin
,
rng
->
chrg
.
cpMax
,
unicode
,
textlength
);
TRACE
(
"EM_GETTEXTRANGE min = %d max = %d textlength = %d
\n
"
,
rng
->
chrg
.
cpMin
,
rng
->
chrg
.
cpMax
,
textlength
);
if
(
nStart
<
0
)
return
0
;
if
((
nStart
==
0
&&
nEnd
==
-
1
)
||
nEnd
>
textlength
)
nEnd
=
textlength
;
if
(
nStart
>=
nEnd
)
return
0
;
cursor_from_char_ofs
(
editor
,
nStart
,
&
start
);
return
ME_GetTextRange
(
editor
,
rng
->
lpstrText
,
&
start
,
nEnd
-
nStart
,
unicode
);
return
ME_GetTextRange
(
editor
,
rng
->
lpstrText
,
&
start
,
nEnd
-
nStart
,
TRUE
);
}
case
EM_GETLINE
:
{
...
...
dlls/riched20/tests/editor.c
View file @
93fec636
...
...
@@ -1790,8 +1790,8 @@ static void test_EM_GETTEXTRANGE(void)
textRange
.
chrg
.
cpMin
=
4
;
textRange
.
chrg
.
cpMax
=
8
;
result
=
SendMessageA
(
hwndRichEdit
,
EM_GETTEXTRANGE
,
0
,
(
LPARAM
)
&
textRange
);
todo_wine
ok
(
result
==
5
,
"EM_GETTEXTRANGE returned %ld
\n
"
,
result
);
todo_wine
ok
(
!
strcmp
(
"ef
\x8e\xf0
g"
,
buffer
),
"EM_GETTEXTRANGE filled %s
\n
"
,
buffer
);
ok
(
result
==
5
,
"EM_GETTEXTRANGE returned %ld
\n
"
,
result
);
ok
(
!
strcmp
(
"ef
\x8e\xf0
g"
,
buffer
),
"EM_GETTEXTRANGE filled %s
\n
"
,
buffer
);
}
DestroyWindow
(
hwndRichEdit
);
...
...
dlls/riched20/txthost.c
View file @
93fec636
...
...
@@ -753,6 +753,39 @@ static BOOL create_windowed_editor( HWND hwnd, CREATESTRUCTW *create, BOOL emula
return
TRUE
;
}
static
HRESULT
get_text_rangeA
(
struct
host
*
host
,
TEXTRANGEA
*
rangeA
,
LRESULT
*
res
)
{
TEXTRANGEW
range
;
HRESULT
hr
;
unsigned
int
count
;
LRESULT
len
;
*
res
=
0
;
if
(
rangeA
->
chrg
.
cpMin
<
0
)
return
S_OK
;
ITextServices_TxSendMessage
(
host
->
text_srv
,
WM_GETTEXTLENGTH
,
0
,
0
,
&
len
);
range
.
chrg
=
rangeA
->
chrg
;
if
((
range
.
chrg
.
cpMin
==
0
&&
range
.
chrg
.
cpMax
==
-
1
)
||
range
.
chrg
.
cpMax
>
len
)
range
.
chrg
.
cpMax
=
len
;
if
(
range
.
chrg
.
cpMin
>=
range
.
chrg
.
cpMax
)
return
S_OK
;
count
=
range
.
chrg
.
cpMax
-
range
.
chrg
.
cpMin
+
1
;
range
.
lpstrText
=
heap_alloc
(
count
*
sizeof
(
WCHAR
)
);
if
(
!
range
.
lpstrText
)
return
E_OUTOFMEMORY
;
hr
=
ITextServices_TxSendMessage
(
host
->
text_srv
,
EM_GETTEXTRANGE
,
0
,
(
LPARAM
)
&
range
,
&
len
);
if
(
hr
==
S_OK
&&
len
)
{
if
(
!
host
->
emulate_10
)
count
=
INT_MAX
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
range
.
lpstrText
,
-
1
,
rangeA
->
lpstrText
,
count
,
NULL
,
NULL
);
if
(
!
host
->
emulate_10
)
*
res
=
len
-
1
;
else
{
*
res
=
count
-
1
;
rangeA
->
lpstrText
[
*
res
]
=
'\0'
;
}
}
heap_free
(
range
.
lpstrText
);
return
hr
;
}
static
LRESULT
RichEditWndProc_common
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wparam
,
LPARAM
lparam
,
BOOL
unicode
)
{
...
...
@@ -822,6 +855,11 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
hr
=
ITextServices_TxSendMessage
(
host
->
text_srv
,
EM_GETTEXTLENGTHEX
,
(
WPARAM
)
&
params
,
0
,
&
res
);
break
;
}
case
EM_GETTEXTRANGE
:
if
(
unicode
)
hr
=
ITextServices_TxSendMessage
(
host
->
text_srv
,
msg
,
wparam
,
lparam
,
&
res
);
else
hr
=
get_text_rangeA
(
host
,
(
TEXTRANGEA
*
)
lparam
,
&
res
);
break
;
case
WM_PAINT
:
{
HDC
hdc
;
...
...
dlls/riched32/tests/editor.c
View file @
93fec636
...
...
@@ -584,7 +584,7 @@ static void test_EM_GETTEXTRANGE(void)
textRange
.
chrg
.
cpMax
=
8
;
result
=
SendMessageA
(
hwndRichEdit
,
EM_GETTEXTRANGE
,
0
,
(
LPARAM
)
&
textRange
);
ok
(
result
==
4
,
"EM_GETTEXTRANGE returned %ld
\n
"
,
result
);
todo_wine
ok
(
!
strcmp
(
"ef
\x8e\xf0
"
,
buffer
),
"EM_GETTEXTRANGE filled %s
\n
"
,
buffer
);
ok
(
!
strcmp
(
"ef
\x8e\xf0
"
,
buffer
),
"EM_GETTEXTRANGE filled %s
\n
"
,
buffer
);
}
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