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
c92bb271
Commit
c92bb271
authored
Aug 12, 2009
by
Dylan Smith
Committed by
Alexandre Julliard
Aug 12, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: Use ME_Cursor instead of offsets for ME_GetTextRange.
parent
2da0d8e9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
editor.c
dlls/riched20/editor.c
+19
-18
No files found.
dlls/riched20/editor.c
View file @
c92bb271
...
...
@@ -1916,18 +1916,16 @@ static int ME_GetTextEx(ME_TextEditor *editor, GETTEXTEX *ex, LPARAM pText)
}
static
int
ME_GetTextRange
(
ME_TextEditor
*
editor
,
WCHAR
*
strText
,
int
nS
tart
,
int
nLen
,
BOOL
unicode
)
const
ME_Cursor
*
s
tart
,
int
nLen
,
BOOL
unicode
)
{
ME_Cursor
start
;
if
(
!
strText
)
return
0
;
ME_CursorFromCharOfs
(
editor
,
nStart
,
&
start
);
if
(
unicode
)
{
return
ME_GetTextW
(
editor
,
strText
,
INT_MAX
,
&
start
,
nLen
,
0
);
return
ME_GetTextW
(
editor
,
strText
,
INT_MAX
,
start
,
nLen
,
0
);
}
else
{
int
nChars
;
WCHAR
*
p
=
ALLOC_N_OBJ
(
WCHAR
,
nLen
+
1
);
if
(
!
p
)
return
0
;
nChars
=
ME_GetTextW
(
editor
,
p
,
nLen
,
&
start
,
nLen
,
0
);
nChars
=
ME_GetTextW
(
editor
,
p
,
nLen
,
start
,
nLen
,
0
);
WideCharToMultiByte
(
CP_ACP
,
0
,
p
,
nChars
+
1
,
(
char
*
)
strText
,
nLen
+
1
,
NULL
,
NULL
);
FREE_OBJ
(
p
);
...
...
@@ -3566,10 +3564,10 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
return
ME_GetTextEx
(
editor
,
(
GETTEXTEX
*
)
wParam
,
lParam
);
case
EM_GETSELTEXT
:
{
int
from
,
to
;
ME_
GetSelectionOfs
(
editor
,
&
from
,
&
to
)
;
int
nFrom
,
nTo
,
nStartCur
=
ME_GetSelectionOfs
(
editor
,
&
nFrom
,
&
nTo
)
;
ME_
Cursor
*
from
=
&
editor
->
pCursors
[
nStartCur
]
;
return
ME_GetTextRange
(
editor
,
(
WCHAR
*
)
lParam
,
from
,
to
-
f
rom
,
unicode
);
nTo
-
nF
rom
,
unicode
);
}
case
EM_GETSCROLLPOS
:
{
...
...
@@ -3586,17 +3584,20 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
case
EM_GETTEXTRANGE
:
{
TEXTRANGEW
*
rng
=
(
TEXTRANGEW
*
)
lParam
;
int
start
=
rng
->
chrg
.
cpMin
;
int
end
=
rng
->
chrg
.
cpMax
;
ME_Cursor
start
;
int
nStart
=
rng
->
chrg
.
cpMin
;
int
nEnd
=
rng
->
chrg
.
cpMax
;
int
textlength
=
ME_GetTextLength
(
editor
);
TRACE
(
"EM_GETTEXTRANGE min=%d max=%d unicode=%d emul1.0=%d length=%d
\n
"
,
rng
->
chrg
.
cpMin
,
rng
->
chrg
.
cpMax
,
unicode
,
editor
->
bEmulateVersion10
,
ME_GetTextLength
(
editor
));
if
(
start
<
0
)
return
0
;
if
((
start
==
0
&&
end
==
-
1
)
||
end
>
textlength
)
end
=
textlength
;
if
(
start
>=
end
)
return
0
;
return
ME_GetTextRange
(
editor
,
rng
->
lpstrText
,
start
,
end
-
start
,
unicode
);
TRACE
(
"EM_GETTEXTRANGE min=%d max=%d unicode=%d textlength=%d
\n
"
,
rng
->
chrg
.
cpMin
,
rng
->
chrg
.
cpMax
,
unicode
,
textlength
);
if
(
nStart
<
0
)
return
0
;
if
((
nStart
==
0
&&
nEnd
==
-
1
)
||
nEnd
>
textlength
)
nEnd
=
textlength
;
if
(
nStart
>=
nEnd
)
return
0
;
ME_CursorFromCharOfs
(
editor
,
nStart
,
&
start
);
return
ME_GetTextRange
(
editor
,
rng
->
lpstrText
,
&
start
,
nEnd
-
nStart
,
unicode
);
}
case
EM_GETLINE
:
{
...
...
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