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
de8a059d
Commit
de8a059d
authored
Oct 10, 2011
by
Aric Stewart
Committed by
Alexandre Julliard
Oct 11, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Use uniscribe ScriptBreak to handle edit control linebreaking.
parent
ef5f3c16
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
59 deletions
+58
-59
Makefile.in
dlls/user32/Makefile.in
+1
-1
edit.c
dlls/user32/edit.c
+57
-58
No files found.
dlls/user32/Makefile.in
View file @
de8a059d
...
...
@@ -2,7 +2,7 @@ EXTRADEFS = -D_USER32_ -D_WINABLE_
MODULE
=
user32.dll
IMPORTLIB
=
user32
IMPORTS
=
gdi32 version advapi32
DELAYIMPORTS
=
imm32
DELAYIMPORTS
=
imm32
usp10
C_SRCS
=
\
button.c
\
...
...
dlls/user32/edit.c
View file @
de8a059d
...
...
@@ -53,6 +53,7 @@
#include "winnt.h"
#include "win.h"
#include "imm.h"
#include "usp10.h"
#include "wine/unicode.h"
#include "controls.h"
#include "user_private.h"
...
...
@@ -153,6 +154,10 @@ typedef struct
*/
UINT
composition_len
;
/* length of composition, 0 == no composition */
int
composition_start
;
/* the character position for the composition */
/*
* Uniscribe Data
*/
SCRIPT_LOGATTR
*
logAttr
;
}
EDITSTATE
;
...
...
@@ -247,6 +252,14 @@ static HBRUSH EDIT_NotifyCtlColor(EDITSTATE *es, HDC hdc)
}
static
inline
UINT
get_text_length
(
EDITSTATE
*
es
)
{
if
(
es
->
text_length
==
(
UINT
)
-
1
)
es
->
text_length
=
strlenW
(
es
->
text
);
return
es
->
text_length
;
}
/*********************************************************************
*
* EDIT_WordBreakProc
...
...
@@ -256,61 +269,51 @@ static HBRUSH EDIT_NotifyCtlColor(EDITSTATE *es, HDC hdc)
* allows to be called without linebreaks between s[0] up to
* s[count - 1]. Remember it is only called
* internally, so we can decide this for ourselves.
* Additional we will always be breaking the full string.
*
*/
static
INT
EDIT_WordBreakProc
(
LPWSTR
s
,
INT
index
,
INT
count
,
INT
action
)
static
INT
EDIT_WordBreakProc
(
EDITSTATE
*
es
,
LPWSTR
s
,
INT
index
,
INT
count
,
INT
action
)
{
INT
ret
=
0
;
INT
ret
=
0
;
TRACE
(
"s=%p, index=%d, count=%d, action=%d
\n
"
,
s
,
index
,
count
,
action
);
TRACE
(
"s=%p, index=%d, count=%d, action=%d
\n
"
,
s
,
index
,
count
,
action
);
if
(
!
s
)
return
0
;
if
(
!
s
)
return
0
;
switch
(
action
)
{
case
WB_LEFT
:
if
(
!
count
)
break
;
if
(
index
)
index
--
;
if
(
s
[
index
]
==
' '
)
{
while
(
index
&&
(
s
[
index
]
==
' '
))
index
--
;
if
(
index
)
{
while
(
index
&&
(
s
[
index
]
!=
' '
))
index
--
;
if
(
s
[
index
]
==
' '
)
index
++
;
}
}
else
{
while
(
index
&&
(
s
[
index
]
!=
' '
))
index
--
;
if
(
s
[
index
]
==
' '
)
index
++
;
}
ret
=
index
;
break
;
case
WB_RIGHT
:
if
(
!
count
)
break
;
if
(
index
)
index
--
;
if
(
s
[
index
]
==
' '
)
while
((
index
<
count
)
&&
(
s
[
index
]
==
' '
))
index
++
;
else
{
while
(
s
[
index
]
&&
(
s
[
index
]
!=
' '
)
&&
(
index
<
count
))
index
++
;
while
((
s
[
index
]
==
' '
)
&&
(
index
<
count
))
index
++
;
}
ret
=
index
;
break
;
case
WB_ISDELIMITER
:
ret
=
(
s
[
index
]
==
' '
);
break
;
default:
ERR
(
"unknown action code, please report !
\n
"
);
break
;
}
return
ret
;
if
(
!
es
->
logAttr
)
{
SCRIPT_ANALYSIS
psa
;
memset
(
&
psa
,
0
,
sizeof
(
SCRIPT_ANALYSIS
));
psa
.
eScript
=
SCRIPT_UNDEFINED
;
es
->
logAttr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
SCRIPT_LOGATTR
)
*
get_text_length
(
es
));
ScriptBreak
(
es
->
text
,
get_text_length
(
es
),
&
psa
,
es
->
logAttr
);
}
switch
(
action
)
{
case
WB_LEFT
:
if
(
index
)
index
--
;
while
(
index
&&
!
es
->
logAttr
[
index
].
fSoftBreak
)
index
--
;
ret
=
index
;
break
;
case
WB_RIGHT
:
if
(
!
count
)
break
;
while
(
s
[
index
]
&&
index
<
count
&&
!
es
->
logAttr
[
index
].
fSoftBreak
)
index
++
;
ret
=
index
;
break
;
case
WB_ISDELIMITER
:
ret
=
es
->
logAttr
[
index
].
fWhiteSpace
;
break
;
default:
ERR
(
"unknown action code, please report !
\n
"
);
break
;
}
return
ret
;
}
...
...
@@ -357,7 +360,7 @@ static INT EDIT_CallWordBreakProc(EDITSTATE *es, INT start, INT index, INT count
}
}
else
ret
=
EDIT_WordBreakProc
(
es
->
text
+
start
,
index
,
count
,
action
)
;
ret
=
EDIT_WordBreakProc
(
es
,
es
->
text
,
index
+
start
,
count
+
start
,
action
)
-
start
;
return
ret
;
}
...
...
@@ -642,14 +645,6 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta
ReleaseDC
(
es
->
hwndSelf
,
dc
);
}
static
inline
UINT
get_text_length
(
EDITSTATE
*
es
)
{
if
(
es
->
text_length
==
(
UINT
)
-
1
)
es
->
text_length
=
strlenW
(
es
->
text
);
return
es
->
text_length
;
}
/*********************************************************************
*
* EDIT_GetPasswordPointer_SL
...
...
@@ -1086,6 +1081,9 @@ static void EDIT_GetLineRect(EDITSTATE *es, INT line, INT scol, INT ecol, LPRECT
static
inline
void
text_buffer_changed
(
EDITSTATE
*
es
)
{
es
->
text_length
=
(
UINT
)
-
1
;
HeapFree
(
GetProcessHeap
(),
0
,
es
->
logAttr
);
es
->
logAttr
=
NULL
;
}
/*********************************************************************
...
...
@@ -4318,6 +4316,7 @@ cleanup:
HeapFree
(
GetProcessHeap
(),
0
,
es
->
first_line_def
);
HeapFree
(
GetProcessHeap
(),
0
,
es
->
undo_text
);
if
(
es
->
hloc32W
)
LocalFree
(
es
->
hloc32W
);
HeapFree
(
GetProcessHeap
(),
0
,
es
->
logAttr
);
HeapFree
(
GetProcessHeap
(),
0
,
es
);
return
FALSE
;
}
...
...
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