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
dc643495
Commit
dc643495
authored
Mar 15, 2021
by
Huw Davies
Committed by
Alexandre Julliard
Mar 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Handle EM_GETSELTEXT's unicode conversion in the host.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e4c38944
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
23 deletions
+25
-23
editor.c
dlls/riched20/editor.c
+6
-18
editor.c
dlls/riched20/tests/editor.c
+2
-2
txthost.c
dlls/riched20/txthost.c
+14
-0
editor.c
dlls/riched32/tests/editor.c
+3
-3
No files found.
dlls/riched20/editor.c
View file @
dc643495
...
...
@@ -2132,22 +2132,11 @@ static int ME_GetTextEx(ME_TextEditor *editor, GETTEXTEX *ex, LPARAM pText)
}
}
static
int
ME_GetTextRange
(
ME_TextEditor
*
editor
,
WCHAR
*
strText
,
const
ME_Cursor
*
start
,
int
nLen
,
BOOL
unicode
)
static
int
get_text_range
(
ME_TextEditor
*
editor
,
WCHAR
*
buffer
,
const
ME_Cursor
*
start
,
int
len
)
{
if
(
!
strText
)
return
0
;
if
(
unicode
)
{
return
ME_GetTextW
(
editor
,
strText
,
INT_MAX
,
start
,
nLen
,
FALSE
,
FALSE
);
}
else
{
int
nChars
;
WCHAR
*
p
=
heap_alloc
((
nLen
+
1
)
*
sizeof
(
*
p
));
if
(
!
p
)
return
0
;
nChars
=
ME_GetTextW
(
editor
,
p
,
nLen
,
start
,
nLen
,
FALSE
,
FALSE
);
WideCharToMultiByte
(
CP_ACP
,
0
,
p
,
nChars
+
1
,
(
char
*
)
strText
,
nLen
+
1
,
NULL
,
NULL
);
heap_free
(
p
);
return
nChars
;
}
if
(
!
buffer
)
return
0
;
return
ME_GetTextW
(
editor
,
buffer
,
INT_MAX
,
start
,
len
,
FALSE
,
FALSE
);
}
int
set_selection
(
ME_TextEditor
*
editor
,
int
to
,
int
from
)
...
...
@@ -3991,8 +3980,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
{
int
nFrom
,
nTo
,
nStartCur
=
ME_GetSelectionOfs
(
editor
,
&
nFrom
,
&
nTo
);
ME_Cursor
*
from
=
&
editor
->
pCursors
[
nStartCur
];
return
ME_GetTextRange
(
editor
,
(
WCHAR
*
)
lParam
,
from
,
nTo
-
nFrom
,
unicode
);
return
get_text_range
(
editor
,
(
WCHAR
*
)
lParam
,
from
,
nTo
-
nFrom
);
}
case
EM_GETSCROLLPOS
:
{
...
...
@@ -4021,7 +4009,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
if
(
nStart
>=
nEnd
)
return
0
;
cursor_from_char_ofs
(
editor
,
nStart
,
&
start
);
return
ME_GetTextRange
(
editor
,
rng
->
lpstrText
,
&
start
,
nEnd
-
nStart
,
TRUE
);
return
get_text_range
(
editor
,
rng
->
lpstrText
,
&
start
,
nEnd
-
nStart
);
}
case
EM_GETLINE
:
{
...
...
dlls/riched20/tests/editor.c
View file @
dc643495
...
...
@@ -1828,8 +1828,8 @@ static void test_EM_GETSELTEXT(void)
SendMessageA
(
hwndRichEdit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
"abcdef
\x8e\xf0
ghijk"
);
SendMessageA
(
hwndRichEdit
,
EM_SETSEL
,
4
,
8
);
result
=
SendMessageA
(
hwndRichEdit
,
EM_GETSELTEXT
,
0
,
(
LPARAM
)
buffer
);
todo_wine
ok
(
result
==
5
,
"EM_GETSELTEXT returned %ld
\n
"
,
result
);
todo_wine
ok
(
!
strcmp
(
"ef
\x8e\xf0
g"
,
buffer
),
"EM_GETSELTEXT filled %s
\n
"
,
buffer
);
ok
(
result
==
5
,
"EM_GETSELTEXT returned %ld
\n
"
,
result
);
ok
(
!
strcmp
(
"ef
\x8e\xf0
g"
,
buffer
),
"EM_GETSELTEXT filled %s
\n
"
,
buffer
);
}
DestroyWindow
(
hwndRichEdit
);
...
...
dlls/riched20/txthost.c
View file @
dc643495
...
...
@@ -902,6 +902,20 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
else
hr
=
get_lineA
(
host
->
text_srv
,
wparam
,
lparam
,
&
res
);
break
;
case
EM_GETSELTEXT
:
{
TEXTRANGEA
range
;
if
(
unicode
)
hr
=
ITextServices_TxSendMessage
(
host
->
text_srv
,
msg
,
wparam
,
lparam
,
&
res
);
else
{
ITextServices_TxSendMessage
(
host
->
text_srv
,
EM_EXGETSEL
,
0
,
(
LPARAM
)
&
range
.
chrg
,
&
res
);
range
.
lpstrText
=
(
char
*
)
lparam
;
range
.
lpstrText
[
0
]
=
'\0'
;
hr
=
get_text_rangeA
(
host
,
&
range
,
&
res
);
}
break
;
}
case
WM_GETTEXT
:
{
GETTEXTEX
params
;
...
...
dlls/riched32/tests/editor.c
View file @
dc643495
...
...
@@ -623,7 +623,7 @@ static void test_EM_GETSELTEXT(void)
SendMessageA
(
hwndRichEdit
,
EM_SETSEL
,
4
,
8
);
result
=
SendMessageA
(
hwndRichEdit
,
EM_GETSELTEXT
,
0
,
(
LPARAM
)
buffer
);
ok
(
result
==
4
,
"EM_GETSELTEXT returned %ld
\n
"
,
result
);
todo_wine
ok
(
!
strcmp
(
"ef
\x8e\xf0
"
,
buffer
),
"EM_GETSELTEXT filled %s
\n
"
,
buffer
);
ok
(
!
strcmp
(
"ef
\x8e\xf0
"
,
buffer
),
"EM_GETSELTEXT filled %s
\n
"
,
buffer
);
}
DestroyWindow
(
hwndRichEdit
);
...
...
@@ -1362,7 +1362,7 @@ static void test_EM_EXSETSEL(void)
result
=
SendMessageA
(
hwndRichEdit
,
EM_EXSETSEL
,
0
,
(
LPARAM
)
&
cr
);
todo_wine
ok
(
result
==
7
,
"EM_EXSETSEL return %ld expected 7
\n
"
,
result
);
result
=
SendMessageA
(
hwndRichEdit
,
EM_GETSELTEXT
,
sizeof
(
bufA
),
(
LPARAM
)
bufA
);
todo_wine
ok
(
!
strcmp
(
bufA
,
"ef
\x8e\xf0
"
),
"EM_GETSELTEXT return incorrect string
\n
"
);
ok
(
!
strcmp
(
bufA
,
"ef
\x8e\xf0
"
),
"EM_GETSELTEXT return incorrect string
\n
"
);
SendMessageA
(
hwndRichEdit
,
EM_EXGETSEL
,
0
,
(
LPARAM
)
&
cr
);
ok
(
cr
.
cpMin
==
4
,
"Selection start incorrectly: %d expected 4
\n
"
,
cr
.
cpMin
);
ok
(
cr
.
cpMax
==
8
,
"Selection end incorrectly: %d expected 8
\n
"
,
cr
.
cpMax
);
...
...
@@ -1421,7 +1421,7 @@ static void test_EM_SETSEL(void)
result
=
SendMessageA
(
hwndRichEdit
,
EM_SETSEL
,
4
,
8
);
todo_wine
ok
(
result
==
7
,
"EM_SETSEL return %ld expected 7
\n
"
,
result
);
result
=
SendMessageA
(
hwndRichEdit
,
EM_GETSELTEXT
,
sizeof
(
buffA
),
(
LPARAM
)
buffA
);
todo_wine
ok
(
!
strcmp
(
buffA
,
"ef
\x8e\xf0
"
),
"EM_GETSELTEXT return incorrect string
\n
"
);
ok
(
!
strcmp
(
buffA
,
"ef
\x8e\xf0
"
),
"EM_GETSELTEXT return incorrect string
\n
"
);
result
=
SendMessageA
(
hwndRichEdit
,
EM_GETSEL
,
(
WPARAM
)
&
sel_start
,
(
LPARAM
)
&
sel_end
);
ok
(
sel_start
==
4
,
"Selection start incorrectly: %d expected 4
\n
"
,
sel_start
);
ok
(
sel_end
==
8
,
"Selection end incorrectly: %d expected 8
\n
"
,
sel_end
);
...
...
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