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
75eef418
Commit
75eef418
authored
Jul 29, 2010
by
Dylan Smith
Committed by
Alexandre Julliard
Jul 30, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: Return correct values when EM_SETTEXTMODE fails.
The checks for the text length and invalid parameters needed to be swapped, and the code could be easily simplified.
parent
428e8a5a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
25 deletions
+21
-25
editor.c
dlls/riched20/editor.c
+14
-24
editor.c
dlls/riched20/tests/editor.c
+7
-1
No files found.
dlls/riched20/editor.c
View file @
75eef418
...
...
@@ -4316,35 +4316,25 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
return
editor
->
mode
;
case
EM_SETTEXTMODE
:
{
LRESULT
ret
;
int
mask
=
0
;
int
changes
=
0
;
GETTEXTLENGTHEX
how
;
/* CR/LF conversion required in 2.0 mode, verbatim in 1.0 mode */
how
.
flags
=
GTL_CLOSE
|
(
editor
->
bEmulateVersion10
?
0
:
GTL_USECRLF
)
|
GTL_NUMCHARS
;
how
.
codepage
=
unicode
?
1200
:
CP_ACP
;
ret
=
ME_GetTextLengthEx
(
editor
,
&
how
);
if
(
!
ret
)
if
(
ME_GetTextLength
(
editor
))
return
E_UNEXPECTED
;
/* Check for mutually exclusive flags in adjacent bits of wParam */
if
((
wParam
&
(
TM_RICHTEXT
|
TM_MULTILEVELUNDO
|
TM_MULTICODEPAGE
))
&
(
wParam
&
(
TM_PLAINTEXT
|
TM_SINGLELEVELUNDO
|
TM_SINGLECODEPAGE
))
<<
1
)
return
E_INVALIDARG
;
if
(
wParam
&
(
TM_RICHTEXT
|
TM_PLAINTEXT
))
{
/*Check for valid wParam*/
if
((((
wParam
&
TM_RICHTEXT
)
&&
((
wParam
&
TM_PLAINTEXT
)
<<
1
)))
||
(((
wParam
&
TM_MULTILEVELUNDO
)
&&
((
wParam
&
TM_SINGLELEVELUNDO
)
<<
1
)))
||
(((
wParam
&
TM_MULTICODEPAGE
)
&&
((
wParam
&
TM_SINGLECODEPAGE
)
<<
1
))))
return
1
;
else
{
if
(
wParam
&
(
TM_RICHTEXT
|
TM_PLAINTEXT
))
{
mask
|=
(
TM_RICHTEXT
|
TM_PLAINTEXT
);
changes
|=
(
wParam
&
(
TM_RICHTEXT
|
TM_PLAINTEXT
));
}
/*FIXME: Currently no support for undo level and code page options*/
editor
->
mode
=
(
editor
->
mode
&
(
~
mask
))
|
changes
;
return
0
;
}
mask
|=
TM_RICHTEXT
|
TM_PLAINTEXT
;
changes
|=
wParam
&
(
TM_RICHTEXT
|
TM_PLAINTEXT
);
}
return
ret
;
/* FIXME: Currently no support for undo level and code page options */
editor
->
mode
=
(
editor
->
mode
&
~
mask
)
|
changes
;
return
0
;
}
case
EM_SETPASSWORDCHAR
:
{
...
...
dlls/riched20/tests/editor.c
View file @
75eef418
...
...
@@ -1053,6 +1053,11 @@ static void test_EM_SETTEXTMODE(void)
CHARRANGE
cr
;
int
rc
=
0
;
/*Attempt to use mutually exclusive modes*/
rc
=
SendMessage
(
hwndRichEdit
,
EM_SETTEXTMODE
,
(
WPARAM
)
TM_PLAINTEXT
|
TM_RICHTEXT
,
0
);
ok
(
rc
==
E_INVALIDARG
,
"EM_SETTEXTMODE: using mutually exclusive mode flags - returned: %x
\n
"
,
rc
);
/*Test that EM_SETTEXTMODE fails if text exists within the control*/
/*Insert text into the control*/
...
...
@@ -1060,7 +1065,8 @@ static void test_EM_SETTEXTMODE(void)
/*Attempt to change the control to plain text mode*/
rc
=
SendMessage
(
hwndRichEdit
,
EM_SETTEXTMODE
,
(
WPARAM
)
TM_PLAINTEXT
,
0
);
ok
(
rc
!=
0
,
"EM_SETTEXTMODE: changed text mode in control containing text - returned: %d
\n
"
,
rc
);
ok
(
rc
==
E_UNEXPECTED
,
"EM_SETTEXTMODE: changed text mode in control containing text - returned: %x
\n
"
,
rc
);
/*Test that EM_SETTEXTMODE does not allow rich edit text to be pasted.
If rich text is pasted, it should have the same formatting as the rest
...
...
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