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
7dd98bb9
Commit
7dd98bb9
authored
Jun 13, 2007
by
Lei Zhang
Committed by
Alexandre Julliard
Jun 14, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Improve cut/copy/paste behavior of password edit boxes.
parent
881f5925
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
2 deletions
+56
-2
edit.c
dlls/user32/edit.c
+8
-2
edit.c
dlls/user32/tests/edit.c
+48
-0
No files found.
dlls/user32/edit.c
View file @
7dd98bb9
...
...
@@ -4021,14 +4021,15 @@ static void EDIT_WM_Char(EDITSTATE *es, WCHAR c)
}
break
;
case
0x03
:
/* ^C */
SendMessageW
(
es
->
hwndSelf
,
WM_COPY
,
0
,
0
);
if
(
!
(
es
->
style
&
ES_PASSWORD
))
SendMessageW
(
es
->
hwndSelf
,
WM_COPY
,
0
,
0
);
break
;
case
0x16
:
/* ^V */
if
(
!
(
es
->
style
&
ES_READONLY
))
SendMessageW
(
es
->
hwndSelf
,
WM_PASTE
,
0
,
0
);
break
;
case
0x18
:
/* ^X */
if
(
!
(
es
->
style
&
ES_READONLY
))
if
(
!
(
(
es
->
style
&
ES_READONLY
)
||
(
es
->
style
&
ES_PASSWORD
)
))
SendMessageW
(
es
->
hwndSelf
,
WM_CUT
,
0
,
0
);
break
;
...
...
@@ -4949,6 +4950,11 @@ static void EDIT_WM_Paste(EDITSTATE *es)
EDIT_EM_ReplaceSel
(
es
,
TRUE
,
src
,
TRUE
,
TRUE
);
GlobalUnlock
(
hsrc
);
}
else
if
(
es
->
style
&
ES_PASSWORD
)
{
/* clear selected text in password edit box even with empty clipboard */
const
WCHAR
empty_strW
[]
=
{
0
};
EDIT_EM_ReplaceSel
(
es
,
TRUE
,
empty_strW
,
TRUE
,
TRUE
);
}
CloseClipboard
();
}
...
...
dlls/user32/tests/edit.c
View file @
7dd98bb9
...
...
@@ -1003,6 +1003,53 @@ static void test_text_position(void)
test_text_position_style
(
ES_MULTILINE
|
ES_AUTOHSCROLL
|
ES_AUTOVSCROLL
);
}
static
void
test_espassword
(
void
)
{
HWND
hwEdit
;
MSG
msMessage
;
LONG
r
;
char
buffer
[
1024
];
const
char
*
password
=
"secret"
;
msMessage
.
message
=
WM_KEYDOWN
;
hwEdit
=
create_editcontrol
(
ES_PASSWORD
,
0
);
r
=
get_edit_style
(
hwEdit
);
ok
(
r
==
ES_PASSWORD
,
"Wrong style expected 0x%x got: 0x%x
\n
"
,
ES_PASSWORD
,
r
);
/* set text */
r
=
SendMessage
(
hwEdit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
password
);
ok
(
r
==
TRUE
,
"Expected: %d, got: %d
\n
"
,
TRUE
,
r
);
/* select all, cut (ctrl-x) */
SendMessage
(
hwEdit
,
EM_SETSEL
,
0
,
-
1
);
SendMessage
(
hwEdit
,
WM_CHAR
,
24
,
0
);
/* get text */
r
=
SendMessage
(
hwEdit
,
WM_GETTEXT
,
1024
,
(
LPARAM
)
buffer
);
ok
(
r
==
strlen
(
password
),
"Expected: %d, got: %d
\n
"
,
strlen
(
password
),
r
);
ok
(
strcmp
(
buffer
,
password
)
==
0
,
"expected %s, got %s
\n
"
,
password
,
buffer
);
r
=
OpenClipboard
(
hwEdit
);
ok
(
r
==
TRUE
,
"expected %d, got %d
\n
"
,
TRUE
,
r
);
r
=
EmptyClipboard
();
ok
(
r
==
TRUE
,
"expected %d, got %d
\n
"
,
TRUE
,
r
);
r
=
CloseClipboard
();
ok
(
r
==
TRUE
,
"expected %d, got %d
\n
"
,
TRUE
,
r
);
/* select all, copy (ctrl-c) and paste (ctrl-v) */
SendMessage
(
hwEdit
,
EM_SETSEL
,
0
,
-
1
);
SendMessage
(
hwEdit
,
WM_CHAR
,
3
,
0
);
SendMessage
(
hwEdit
,
WM_CHAR
,
22
,
0
);
/* get text */
buffer
[
0
]
=
0
;
r
=
SendMessage
(
hwEdit
,
WM_GETTEXT
,
1024
,
(
LPARAM
)
buffer
);
ok
(
r
==
0
,
"Expected: 0, got: %d
\n
"
,
r
);
ok
(
strcmp
(
buffer
,
""
)
==
0
,
"expected empty string, got %s
\n
"
,
buffer
);
DestroyWindow
(
hwEdit
);
}
static
BOOL
RegisterWindowClasses
(
void
)
{
WNDCLASSA
test2
;
...
...
@@ -1068,6 +1115,7 @@ START_TEST(edit)
test_margins
();
test_margins_font_change
();
test_text_position
();
test_espassword
();
UnregisterWindowClasses
();
}
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