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
e4c38944
Commit
e4c38944
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_GETLINE's unicode conversion in the host.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1cd678d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
19 deletions
+36
-19
editor.c
dlls/riched20/editor.c
+5
-19
txthost.c
dlls/riched20/txthost.c
+31
-0
No files found.
dlls/riched20/editor.c
View file @
e4c38944
...
...
@@ -4030,11 +4030,9 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
const
unsigned
int
nMaxChars
=
*
(
WORD
*
)
lParam
;
unsigned
int
nCharsLeft
=
nMaxChars
;
char
*
dest
=
(
char
*
)
lParam
;
BOOL
wroteNull
=
FALSE
;
ME_Cursor
start
,
end
;
TRACE
(
"EM_GETLINE: row=%d, nMaxChars=%d (%s)
\n
"
,
(
int
)
wParam
,
nMaxChars
,
unicode
?
"Unicode"
:
"Ansi"
);
TRACE
(
"EM_GETLINE: row=%d, nMaxChars=%d
\n
"
,
(
int
)
wParam
,
nMaxChars
);
row
=
row_from_row_number
(
editor
,
wParam
);
if
(
row
==
NULL
)
return
0
;
...
...
@@ -4052,30 +4050,18 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
str
=
get_text
(
run
,
ofs
);
nCopy
=
min
(
nCharsLeft
,
len
);
if
(
unicode
)
memcpy
(
dest
,
str
,
nCopy
*
sizeof
(
WCHAR
));
else
nCopy
=
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
nCopy
,
dest
,
nCharsLeft
,
NULL
,
NULL
);
dest
+=
nCopy
*
(
unicode
?
sizeof
(
WCHAR
)
:
1
);
memcpy
(
dest
,
str
,
nCopy
*
sizeof
(
WCHAR
));
dest
+=
nCopy
*
sizeof
(
WCHAR
);
nCharsLeft
-=
nCopy
;
if
(
run
==
end
.
run
)
break
;
run
=
row_next_run
(
row
,
run
);
}
/* append line termination, space allowing */
if
(
nCharsLeft
>
0
)
{
if
(
unicode
)
*
((
WCHAR
*
)
dest
)
=
'\0'
;
else
*
dest
=
'\0'
;
nCharsLeft
--
;
wroteNull
=
TRUE
;
}
if
(
nCharsLeft
>
0
)
*
((
WCHAR
*
)
dest
)
=
'\0'
;
TRACE
(
"EM_GETLINE: got %u characters
\n
"
,
nMaxChars
-
nCharsLeft
);
return
nMaxChars
-
nCharsLeft
-
(
wroteNull
?
1
:
0
)
;
return
nMaxChars
-
nCharsLeft
;
}
case
EM_GETLINECOUNT
:
{
...
...
dlls/riched20/txthost.c
View file @
e4c38944
...
...
@@ -753,6 +753,32 @@ static BOOL create_windowed_editor( HWND hwnd, CREATESTRUCTW *create, BOOL emula
return
TRUE
;
}
static
HRESULT
get_lineA
(
ITextServices
*
text_srv
,
WPARAM
wparam
,
LPARAM
lparam
,
LRESULT
*
res
)
{
LRESULT
len
=
USHRT_MAX
;
WORD
sizeA
;
HRESULT
hr
;
WCHAR
*
buf
;
*
res
=
0
;
sizeA
=
*
(
WORD
*
)
lparam
;
*
(
WORD
*
)
lparam
=
0
;
if
(
!
sizeA
)
return
S_OK
;
buf
=
heap_alloc
(
len
*
sizeof
(
WCHAR
)
);
if
(
!
buf
)
return
E_OUTOFMEMORY
;
*
(
WORD
*
)
buf
=
len
;
hr
=
ITextServices_TxSendMessage
(
text_srv
,
EM_GETLINE
,
wparam
,
(
LPARAM
)
buf
,
&
len
);
if
(
hr
==
S_OK
&&
len
)
{
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
buf
,
len
,
(
char
*
)
lparam
,
sizeA
,
NULL
,
NULL
);
if
(
!
len
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
)
len
=
sizeA
;
if
(
len
<
sizeA
)
((
char
*
)
lparam
)[
len
]
=
'\0'
;
*
res
=
len
;
}
heap_free
(
buf
);
return
hr
;
}
static
HRESULT
get_text_rangeA
(
struct
host
*
host
,
TEXTRANGEA
*
rangeA
,
LRESULT
*
res
)
{
TEXTRANGEW
range
;
...
...
@@ -871,6 +897,11 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
}
break
;
}
case
EM_GETLINE
:
if
(
unicode
)
hr
=
ITextServices_TxSendMessage
(
host
->
text_srv
,
msg
,
wparam
,
lparam
,
&
res
);
else
hr
=
get_lineA
(
host
->
text_srv
,
wparam
,
lparam
,
&
res
);
break
;
case
WM_GETTEXT
:
{
GETTEXTEX
params
;
...
...
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