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
6650abcd
Commit
6650abcd
authored
Oct 19, 2005
by
Krzysztof Foltman
Committed by
Alexandre Julliard
Oct 19, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Bugfix in EM_GETTEXTEX
- Additional traces helpful in diagnosing similar (text retrieval-related) bugs.
parent
658a5420
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
editor.c
dlls/riched20/editor.c
+19
-11
No files found.
dlls/riched20/editor.c
View file @
6650abcd
...
...
@@ -1565,16 +1565,19 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
}
else
{
LPWSTR
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
nCount
+
1
)
*
sizeof
(
WCHAR
));
DWORD
buflen
=
ex
->
cb
;
LRESULT
rc
;
DWORD
flags
=
0
;
buflen
=
ME_GetTextW
(
editor
,
buffer
,
nStart
,
nCount
,
ex
->
flags
&
GT_USECRLF
);
rc
=
WideCharToMultiByte
(
ex
->
codepage
,
flags
,
buffer
,
buflen
,
(
LPSTR
)
lParam
,
ex
->
cb
,
ex
->
lpDefaultChar
,
ex
->
lpUsedDefaultChar
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
rc
;
/* potentially each char may be a CR, why calculate the exact value with O(N) when
we can just take a bigger buffer? :) */
int
crlfmul
=
(
ex
->
flags
&
GT_USECRLF
)
?
2
:
1
;
LPWSTR
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
crlfmul
*
nCount
+
1
)
*
sizeof
(
WCHAR
));
DWORD
buflen
=
ex
->
cb
;
LRESULT
rc
;
DWORD
flags
=
0
;
buflen
=
ME_GetTextW
(
editor
,
buffer
,
nStart
,
nCount
,
ex
->
flags
&
GT_USECRLF
);
rc
=
WideCharToMultiByte
(
ex
->
codepage
,
flags
,
buffer
,
buflen
,
(
LPSTR
)
lParam
,
ex
->
cb
,
ex
->
lpDefaultChar
,
ex
->
lpUsedDefaultChar
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
rc
;
}
}
case
EM_GETSELTEXT
:
...
...
@@ -1590,6 +1593,9 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
case
EM_GETTEXTRANGE
:
{
TEXTRANGEW
*
rng
=
(
TEXTRANGEW
*
)
lParam
;
TRACE
(
"EM_GETTEXTRANGE min=%ld max=%ld unicode=%d emul1.0=%d length=%d
\n
"
,
rng
->
chrg
.
cpMin
,
rng
->
chrg
.
cpMax
,
IsWindowUnicode
(
hWnd
),
editor
->
bEmulateVersion10
,
ME_GetTextLength
(
editor
));
if
(
IsWindowUnicode
(
hWnd
))
return
ME_GetTextW
(
editor
,
rng
->
lpstrText
,
rng
->
chrg
.
cpMin
,
rng
->
chrg
.
cpMax
-
rng
->
chrg
.
cpMin
,
editor
->
bEmulateVersion10
);
else
...
...
@@ -2037,12 +2043,12 @@ int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int nStart, int nChars, in
{
ME_DisplayItem
*
item
=
ME_FindItemAtOffset
(
editor
,
diRun
,
nStart
,
&
nStart
);
int
nWritten
=
0
;
WCHAR
*
pStart
=
buffer
;
if
(
!
item
)
{
*
buffer
=
L'\0'
;
return
0
;
}
assert
(
item
);
if
(
nStart
)
{
...
...
@@ -2086,12 +2092,14 @@ int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int nStart, int nChars, in
if
(
!
nChars
)
{
TRACE
(
"nWritten=%d, actual=%d
\n
"
,
nWritten
,
buffer
-
pStart
);
*
buffer
=
L'\0'
;
return
nWritten
;
}
item
=
ME_FindItemFwd
(
item
,
diRun
);
}
*
buffer
=
L'\0'
;
TRACE
(
"nWritten=%d, actual=%d
\n
"
,
nWritten
,
buffer
-
pStart
);
return
nWritten
;
}
...
...
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