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
c7873afb
Commit
c7873afb
authored
May 04, 2008
by
Alex Villacís Lasso
Committed by
Alexandre Julliard
Jun 19, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: Insertion style must NOT be cleared unless selection actually changed.
parent
d2900a53
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
2 deletions
+113
-2
caret.c
dlls/riched20/caret.c
+2
-2
editor.c
dlls/riched20/tests/editor.c
+111
-0
No files found.
dlls/riched20/caret.c
View file @
c7873afb
...
...
@@ -1316,8 +1316,6 @@ void ME_SendSelChange(ME_TextEditor *editor)
{
SELCHANGE
sc
;
ME_ClearTempStyle
(
editor
);
if
(
!
(
editor
->
nEventMask
&
ENM_SELCHANGE
))
return
;
...
...
@@ -1336,6 +1334,8 @@ void ME_SendSelChange(ME_TextEditor *editor)
(
sc
.
seltyp
&
SEL_MULTICHAR
)
?
"SEL_MULTICHAR"
:
""
);
if
(
sc
.
chrg
.
cpMin
!=
editor
->
notified_cr
.
cpMin
||
sc
.
chrg
.
cpMax
!=
editor
->
notified_cr
.
cpMax
)
{
ME_ClearTempStyle
(
editor
);
editor
->
notified_cr
=
sc
.
chrg
;
SendMessageW
(
GetParent
(
editor
->
hWnd
),
WM_NOTIFY
,
sc
.
nmhdr
.
idFrom
,
(
LPARAM
)
&
sc
);
}
...
...
dlls/riched20/tests/editor.c
View file @
c7873afb
...
...
@@ -414,6 +414,7 @@ static void test_EM_SETCHARFORMAT(void)
0
};
int
i
;
CHARRANGE
cr
;
/* Invalid flags, CHARFORMAT2 structure blanked out */
memset
(
&
cf2
,
0
,
sizeof
(
cf2
));
...
...
@@ -639,6 +640,116 @@ static void test_EM_SETCHARFORMAT(void)
DestroyWindow
(
hwndRichEdit
);
}
/* Effects applied on an empty selection should take effect when selection is
replaced with text */
hwndRichEdit
=
new_richedit
(
NULL
);
SendMessage
(
hwndRichEdit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
"wine"
);
SendMessage
(
hwndRichEdit
,
EM_SETSEL
,
2
,
2
);
/* Empty selection */
memset
(
&
cf2
,
0
,
sizeof
(
CHARFORMAT2
));
cf2
.
cbSize
=
sizeof
(
CHARFORMAT2
);
cf2
.
dwMask
=
CFM_BOLD
;
cf2
.
dwEffects
=
CFE_BOLD
;
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf2
);
/* Selection is now nonempty */
SendMessage
(
hwndRichEdit
,
EM_REPLACESEL
,
0
,
(
LPARAM
)
"newi"
);
memset
(
&
cf2
,
0
,
sizeof
(
CHARFORMAT2
));
cf2
.
cbSize
=
sizeof
(
CHARFORMAT2
);
SendMessage
(
hwndRichEdit
,
EM_SETSEL
,
2
,
6
);
SendMessage
(
hwndRichEdit
,
EM_GETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf2
);
ok
(((
cf2
.
dwMask
&
CFM_BOLD
)
==
CFM_BOLD
),
"%d, cf2.dwMask == 0x%08x expected mask 0x%08x
\n
"
,
i
,
cf2
.
dwMask
,
CFM_BOLD
);
ok
((
cf2
.
dwEffects
&
CFE_BOLD
)
==
CFE_BOLD
,
"%d, cf2.dwEffects == 0x%08x expected effect 0x%08x
\n
"
,
i
,
cf2
.
dwEffects
,
CFE_BOLD
);
/* Set two effects on an empty selection */
SendMessage
(
hwndRichEdit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
"wine"
);
SendMessage
(
hwndRichEdit
,
EM_SETSEL
,
2
,
2
);
/* Empty selection */
memset
(
&
cf2
,
0
,
sizeof
(
CHARFORMAT2
));
cf2
.
cbSize
=
sizeof
(
CHARFORMAT2
);
cf2
.
dwMask
=
CFM_BOLD
;
cf2
.
dwEffects
=
CFE_BOLD
;
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf2
);
cf2
.
dwMask
=
CFM_ITALIC
;
cf2
.
dwEffects
=
CFE_ITALIC
;
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf2
);
/* Selection is now nonempty */
SendMessage
(
hwndRichEdit
,
EM_REPLACESEL
,
0
,
(
LPARAM
)
"newi"
);
memset
(
&
cf2
,
0
,
sizeof
(
CHARFORMAT2
));
cf2
.
cbSize
=
sizeof
(
CHARFORMAT2
);
SendMessage
(
hwndRichEdit
,
EM_SETSEL
,
2
,
6
);
SendMessage
(
hwndRichEdit
,
EM_GETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf2
);
ok
(((
cf2
.
dwMask
&
(
CFM_BOLD
|
CFM_ITALIC
))
==
(
CFM_BOLD
|
CFM_ITALIC
)),
"%d, cf2.dwMask == 0x%08x expected mask 0x%08x
\n
"
,
i
,
cf2
.
dwMask
,
(
CFM_BOLD
|
CFM_ITALIC
));
ok
((
cf2
.
dwEffects
&
(
CFE_BOLD
|
CFE_ITALIC
))
==
(
CFE_BOLD
|
CFE_ITALIC
),
"%d, cf2.dwEffects == 0x%08x expected effect 0x%08x
\n
"
,
i
,
cf2
.
dwEffects
,
(
CFE_BOLD
|
CFE_ITALIC
));
/* Setting the (empty) selection to exactly the same place as before should
NOT clear the insertion style! */
SendMessage
(
hwndRichEdit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
"wine"
);
SendMessage
(
hwndRichEdit
,
EM_SETSEL
,
2
,
2
);
/* Empty selection */
memset
(
&
cf2
,
0
,
sizeof
(
CHARFORMAT2
));
cf2
.
cbSize
=
sizeof
(
CHARFORMAT2
);
cf2
.
dwMask
=
CFM_BOLD
;
cf2
.
dwEffects
=
CFE_BOLD
;
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf2
);
/* Empty selection in same place, insert style should NOT be forgotten here. */
SendMessage
(
hwndRichEdit
,
EM_SETSEL
,
2
,
2
);
/* Selection is now nonempty */
SendMessage
(
hwndRichEdit
,
EM_REPLACESEL
,
0
,
(
LPARAM
)
"newi"
);
memset
(
&
cf2
,
0
,
sizeof
(
CHARFORMAT2
));
cf2
.
cbSize
=
sizeof
(
CHARFORMAT2
);
SendMessage
(
hwndRichEdit
,
EM_SETSEL
,
2
,
6
);
SendMessage
(
hwndRichEdit
,
EM_GETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf2
);
ok
(((
cf2
.
dwMask
&
CFM_BOLD
)
==
CFM_BOLD
),
"%d, cf2.dwMask == 0x%08x expected mask 0x%08x
\n
"
,
i
,
cf2
.
dwMask
,
CFM_BOLD
);
ok
((
cf2
.
dwEffects
&
CFE_BOLD
)
==
CFE_BOLD
,
"%d, cf2.dwEffects == 0x%08x expected effect 0x%08x
\n
"
,
i
,
cf2
.
dwEffects
,
CFE_BOLD
);
/* Ditto with EM_EXSETSEL */
SendMessage
(
hwndRichEdit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
"wine"
);
cr
.
cpMin
=
2
;
cr
.
cpMax
=
2
;
SendMessage
(
hwndRichEdit
,
EM_EXSETSEL
,
0
,
(
LPARAM
)
&
cr
);
/* Empty selection */
memset
(
&
cf2
,
0
,
sizeof
(
CHARFORMAT2
));
cf2
.
cbSize
=
sizeof
(
CHARFORMAT2
);
cf2
.
dwMask
=
CFM_BOLD
;
cf2
.
dwEffects
=
CFE_BOLD
;
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf2
);
/* Empty selection in same place, insert style should NOT be forgotten here. */
cr
.
cpMin
=
2
;
cr
.
cpMax
=
2
;
SendMessage
(
hwndRichEdit
,
EM_EXSETSEL
,
0
,
(
LPARAM
)
&
cr
);
/* Empty selection */
/* Selection is now nonempty */
SendMessage
(
hwndRichEdit
,
EM_REPLACESEL
,
0
,
(
LPARAM
)
"newi"
);
memset
(
&
cf2
,
0
,
sizeof
(
CHARFORMAT2
));
cf2
.
cbSize
=
sizeof
(
CHARFORMAT2
);
cr
.
cpMin
=
2
;
cr
.
cpMax
=
6
;
SendMessage
(
hwndRichEdit
,
EM_EXSETSEL
,
0
,
(
LPARAM
)
&
cr
);
/* Empty selection */
SendMessage
(
hwndRichEdit
,
EM_GETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf2
);
ok
(((
cf2
.
dwMask
&
CFM_BOLD
)
==
CFM_BOLD
),
"%d, cf2.dwMask == 0x%08x expected mask 0x%08x
\n
"
,
i
,
cf2
.
dwMask
,
CFM_BOLD
);
ok
((
cf2
.
dwEffects
&
CFE_BOLD
)
==
CFE_BOLD
,
"%d, cf2.dwEffects == 0x%08x expected effect 0x%08x
\n
"
,
i
,
cf2
.
dwEffects
,
CFE_BOLD
);
DestroyWindow
(
hwndRichEdit
);
}
static
void
test_EM_SETTEXTMODE
(
void
)
...
...
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