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
58e83ebd
Commit
58e83ebd
authored
Nov 04, 2013
by
Huw Davies
Committed by
Alexandre Julliard
Nov 04, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Revert to the default paragraph style when all text is deleted.
parent
292612cf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
caret.c
dlls/riched20/caret.c
+5
-2
editor.c
dlls/riched20/tests/editor.c
+37
-0
No files found.
dlls/riched20/caret.c
View file @
58e83ebd
...
@@ -284,13 +284,15 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
...
@@ -284,13 +284,15 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
int
nChars
,
BOOL
bForce
)
int
nChars
,
BOOL
bForce
)
{
{
ME_Cursor
c
=
*
start
;
ME_Cursor
c
=
*
start
;
int
nOfs
=
ME_GetCursorOfs
(
start
);
int
nOfs
=
ME_GetCursorOfs
(
start
)
,
text_len
=
ME_GetTextLength
(
editor
)
;
int
shift
=
0
;
int
shift
=
0
;
int
totalChars
=
nChars
;
int
totalChars
=
nChars
;
ME_DisplayItem
*
start_para
;
ME_DisplayItem
*
start_para
;
BOOL
delete_all
=
FALSE
;
/* Prevent deletion past last end of paragraph run. */
/* Prevent deletion past last end of paragraph run. */
nChars
=
min
(
nChars
,
ME_GetTextLength
(
editor
)
-
nOfs
);
nChars
=
min
(
nChars
,
text_len
-
nOfs
);
if
(
nChars
==
text_len
)
delete_all
=
TRUE
;
start_para
=
c
.
pPara
;
start_para
=
c
.
pPara
;
if
(
!
bForce
)
if
(
!
bForce
)
...
@@ -424,6 +426,7 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
...
@@ -424,6 +426,7 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
continue
;
continue
;
}
}
}
}
if
(
delete_all
)
ME_SetDefaultParaFormat
(
start_para
->
member
.
para
.
pFmt
);
return
TRUE
;
return
TRUE
;
}
}
...
...
dlls/riched20/tests/editor.c
View file @
58e83ebd
...
@@ -7429,6 +7429,42 @@ static void test_WM_CREATE(void)
...
@@ -7429,6 +7429,42 @@ static void test_WM_CREATE(void)
DestroyWindow
(
rich_edit
);
DestroyWindow
(
rich_edit
);
}
}
/*******************************************************************
* Test that after deleting all of the text, the first paragraph
* format reverts to the default.
*/
static
void
test_reset_default_para_fmt
(
void
)
{
HWND
richedit
=
new_richeditW
(
NULL
);
PARAFORMAT2
fmt
;
WORD
def_align
,
new_align
;
memset
(
&
fmt
,
0
,
sizeof
(
fmt
)
);
fmt
.
cbSize
=
sizeof
(
PARAFORMAT2
);
fmt
.
dwMask
=
-
1
;
SendMessageA
(
richedit
,
EM_GETPARAFORMAT
,
0
,
(
LPARAM
)
&
fmt
);
def_align
=
fmt
.
wAlignment
;
new_align
=
(
def_align
==
PFA_LEFT
)
?
PFA_RIGHT
:
PFA_LEFT
;
simulate_typing_characters
(
richedit
,
"123"
);
SendMessageA
(
richedit
,
EM_SETSEL
,
0
,
-
1
);
fmt
.
dwMask
=
PFM_ALIGNMENT
;
fmt
.
wAlignment
=
new_align
;
SendMessageA
(
richedit
,
EM_SETPARAFORMAT
,
0
,
(
LPARAM
)
&
fmt
);
SendMessageA
(
richedit
,
EM_GETPARAFORMAT
,
0
,
(
LPARAM
)
&
fmt
);
ok
(
fmt
.
wAlignment
==
new_align
,
"got %d expect %d
\n
"
,
fmt
.
wAlignment
,
new_align
);
SendMessageA
(
richedit
,
EM_SETSEL
,
0
,
-
1
);
SendMessageA
(
richedit
,
WM_CUT
,
0
,
0
);
SendMessageA
(
richedit
,
EM_GETPARAFORMAT
,
0
,
(
LPARAM
)
&
fmt
);
ok
(
fmt
.
wAlignment
==
def_align
,
"got %d exppect %d
\n
"
,
fmt
.
wAlignment
,
def_align
);
DestroyWindow
(
richedit
);
}
START_TEST
(
editor
)
START_TEST
(
editor
)
{
{
BOOL
ret
;
BOOL
ret
;
...
@@ -7490,6 +7526,7 @@ START_TEST( editor )
...
@@ -7490,6 +7526,7 @@ START_TEST( editor )
test_EM_FINDWORDBREAK_A
();
test_EM_FINDWORDBREAK_A
();
test_enter
();
test_enter
();
test_WM_CREATE
();
test_WM_CREATE
();
test_reset_default_para_fmt
();
/* Set the environment variable WINETEST_RICHED20 to keep windows
/* Set the environment variable WINETEST_RICHED20 to keep windows
* responsive and open for 30 seconds. This is useful for debugging.
* responsive and open for 30 seconds. This is useful for debugging.
...
...
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