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
d10256f3
Commit
d10256f3
authored
Apr 24, 2008
by
Alex Villacís Lasso
Committed by
Alexandre Julliard
Apr 24, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Implement ignoring of last \par for EM_STREAMIN - 1.0 emulation.
parent
7148f92c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
10 deletions
+53
-10
editor.c
dlls/riched20/editor.c
+6
-5
editor.c
dlls/riched32/tests/editor.c
+47
-5
No files found.
dlls/riched20/editor.c
View file @
d10256f3
...
@@ -1105,12 +1105,13 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
...
@@ -1105,12 +1105,13 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
if
(
stripLastCR
)
{
if
(
stripLastCR
)
{
int
newfrom
,
newto
;
int
newfrom
,
newto
;
ME_GetSelection
(
editor
,
&
newfrom
,
&
newto
);
ME_GetSelection
(
editor
,
&
newfrom
,
&
newto
);
if
(
newto
>
to
)
{
if
(
newto
>
to
+
(
editor
->
bEmulateVersion10
?
1
:
0
))
{
WCHAR
lastchar
=
'\0'
;
WCHAR
lastchar
[
3
]
=
{
'\0'
,
'\0'
};
int
linebreakSize
=
editor
->
bEmulateVersion10
?
2
:
1
;
ME_GetTextW
(
editor
,
&
lastchar
,
newto
-
1
,
1
,
0
);
ME_GetTextW
(
editor
,
lastchar
,
newto
-
linebreakSize
,
linebreakSize
,
0
);
if
(
lastchar
==
'\r'
)
{
if
(
lastchar
[
0
]
==
'\r'
&&
(
lastchar
[
1
]
==
'\n'
||
lastchar
[
1
]
==
'\0'
)
)
{
ME_InternalDeleteText
(
editor
,
newto
-
1
,
1
);
ME_InternalDeleteText
(
editor
,
newto
-
linebreakSize
,
linebreakSize
);
}
}
}
}
}
}
...
...
dlls/riched32/tests/editor.c
View file @
d10256f3
...
@@ -179,6 +179,10 @@ static void test_EM_STREAMIN(void)
...
@@ -179,6 +179,10 @@ static void test_EM_STREAMIN(void)
EDITSTREAM
es
;
EDITSTREAM
es
;
char
buffer
[
1024
]
=
{
0
};
char
buffer
[
1024
]
=
{
0
};
const
char
*
streamText0
=
"{
\\
rtf1 TestSomeText}"
;
const
char
*
streamText0a
=
"{
\\
rtf1 TestSomeText
\\
par}"
;
const
char
*
streamText0b
=
"{
\\
rtf1 TestSomeText
\\
par
\\
par}"
;
const
char
*
streamText1
=
const
char
*
streamText1
=
"{
\\
rtf1
\\
ansi
\\
ansicpg1252
\\
deff0
\\
deflang12298{
\\
fonttbl{
\\
f0
\\
fswiss
\\
fprq2
\\
fcharset0 System;}}
\r\n
"
\
"{
\\
rtf1
\\
ansi
\\
ansicpg1252
\\
deff0
\\
deflang12298{
\\
fonttbl{
\\
f0
\\
fswiss
\\
fprq2
\\
fcharset0 System;}}
\r\n
"
\
"
\\
viewkind4
\\
uc1
\\
pard
\\
f0
\\
fs17 TestSomeText
\\
par
\r\n
"
\
"
\\
viewkind4
\\
uc1
\\
pard
\\
f0
\\
fs17 TestSomeText
\\
par
\r\n
"
\
...
@@ -196,6 +200,48 @@ static void test_EM_STREAMIN(void)
...
@@ -196,6 +200,48 @@ static void test_EM_STREAMIN(void)
const
char
*
streamText3
=
"RichEdit1"
;
const
char
*
streamText3
=
"RichEdit1"
;
/* Minimal test without \par at the end */
es
.
dwCookie
=
(
DWORD_PTR
)
&
streamText0
;
es
.
dwError
=
0
;
es
.
pfnCallback
=
test_EM_STREAMIN_esCallback
;
SendMessage
(
hwndRichEdit
,
EM_STREAMIN
,
(
WPARAM
)(
SF_RTF
),
(
LPARAM
)
&
es
);
result
=
SendMessage
(
hwndRichEdit
,
WM_GETTEXT
,
1024
,
(
LPARAM
)
buffer
);
ok
(
result
==
12
,
"EM_STREAMIN: Test 0 returned %ld, expected 12
\n
"
,
result
);
result
=
strcmp
(
buffer
,
"TestSomeText"
);
ok
(
result
==
0
,
"EM_STREAMIN: Test 0 set wrong text: Result: %s
\n
"
,
buffer
);
/* Native richedit 2.0 ignores last \par */
es
.
dwCookie
=
(
DWORD_PTR
)
&
streamText0a
;
es
.
dwError
=
0
;
es
.
pfnCallback
=
test_EM_STREAMIN_esCallback
;
SendMessage
(
hwndRichEdit
,
EM_STREAMIN
,
(
WPARAM
)(
SF_RTF
),
(
LPARAM
)
&
es
);
result
=
SendMessage
(
hwndRichEdit
,
WM_GETTEXT
,
1024
,
(
LPARAM
)
buffer
);
ok
(
result
==
12
,
"EM_STREAMIN: Test 0-a returned %ld, expected 12
\n
"
,
result
);
result
=
strcmp
(
buffer
,
"TestSomeText"
);
ok
(
result
==
0
,
"EM_STREAMIN: Test 0-a set wrong text: Result: %s
\n
"
,
buffer
);
/* Native richedit 2.0 ignores last \par, next-to-last \par appears */
es
.
dwCookie
=
(
DWORD_PTR
)
&
streamText0b
;
es
.
dwError
=
0
;
es
.
pfnCallback
=
test_EM_STREAMIN_esCallback
;
SendMessage
(
hwndRichEdit
,
EM_STREAMIN
,
(
WPARAM
)(
SF_RTF
),
(
LPARAM
)
&
es
);
result
=
SendMessage
(
hwndRichEdit
,
WM_GETTEXT
,
1024
,
(
LPARAM
)
buffer
);
ok
(
result
==
14
,
"EM_STREAMIN: Test 0-b returned %ld, expected 14
\n
"
,
result
);
result
=
strcmp
(
buffer
,
"TestSomeText
\r\n
"
);
ok
(
result
==
0
,
"EM_STREAMIN: Test 0-b set wrong text: Result: %s
\n
"
,
buffer
);
es
.
dwCookie
=
(
DWORD_PTR
)
&
streamText1
;
es
.
dwCookie
=
(
DWORD_PTR
)
&
streamText1
;
es
.
dwError
=
0
;
es
.
dwError
=
0
;
es
.
pfnCallback
=
test_EM_STREAMIN_esCallback
;
es
.
pfnCallback
=
test_EM_STREAMIN_esCallback
;
...
@@ -203,15 +249,11 @@ static void test_EM_STREAMIN(void)
...
@@ -203,15 +249,11 @@ static void test_EM_STREAMIN(void)
(
WPARAM
)(
SF_RTF
),
(
LPARAM
)
&
es
);
(
WPARAM
)(
SF_RTF
),
(
LPARAM
)
&
es
);
result
=
SendMessage
(
hwndRichEdit
,
WM_GETTEXT
,
1024
,
(
LPARAM
)
buffer
);
result
=
SendMessage
(
hwndRichEdit
,
WM_GETTEXT
,
1024
,
(
LPARAM
)
buffer
);
todo_wine
{
ok
(
result
==
12
,
ok
(
result
==
12
,
"EM_STREAMIN: Test 1 returned %ld, expected 12
\n
"
,
result
);
"EM_STREAMIN: Test 1 returned %ld, expected 12
\n
"
,
result
);
}
result
=
strcmp
(
buffer
,
"TestSomeText"
);
result
=
strcmp
(
buffer
,
"TestSomeText"
);
todo_wine
{
ok
(
result
==
0
,
ok
(
result
==
0
,
"EM_STREAMIN: Test 1 set wrong text: Result: %s
\n
"
,
buffer
);
"EM_STREAMIN: Test 1 set wrong text: Result: %s
\n
"
,
buffer
);
}
es
.
dwCookie
=
(
DWORD_PTR
)
&
streamText2
;
es
.
dwCookie
=
(
DWORD_PTR
)
&
streamText2
;
...
@@ -236,7 +278,7 @@ static void test_EM_STREAMIN(void)
...
@@ -236,7 +278,7 @@ static void test_EM_STREAMIN(void)
result
=
SendMessage
(
hwndRichEdit
,
WM_GETTEXT
,
1024
,
(
LPARAM
)
buffer
);
result
=
SendMessage
(
hwndRichEdit
,
WM_GETTEXT
,
1024
,
(
LPARAM
)
buffer
);
todo_wine
{
todo_wine
{
ok
(
result
==
0
,
ok
(
result
==
0
,
"EM_STREAMIN: Test 3 returned %ld, expected
9
\n
"
,
result
);
"EM_STREAMIN: Test 3 returned %ld, expected
0
\n
"
,
result
);
}
}
todo_wine
{
todo_wine
{
ok
(
strlen
(
buffer
)
==
0
,
ok
(
strlen
(
buffer
)
==
0
,
...
...
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