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
b730efc9
Commit
b730efc9
authored
Feb 05, 2013
by
Huw Davies
Committed by
Alexandre Julliard
Feb 05, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Pass character ptrs to the whitespace finding functions.
parent
872a2ad0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
35 deletions
+41
-35
string.c
dlls/riched20/string.c
+0
-27
wrap.c
dlls/riched20/wrap.c
+41
-8
No files found.
dlls/riched20/string.c
View file @
b730efc9
...
...
@@ -121,33 +121,6 @@ void ME_StrDeleteV(ME_String *s, int nVChar, int nChars)
s
->
nLen
-=
nChars
;
}
int
ME_FindNonWhitespaceV
(
const
ME_String
*
s
,
int
nVChar
)
{
int
i
;
for
(
i
=
nVChar
;
i
<
s
->
nLen
&&
ME_IsWSpace
(
s
->
szData
[
i
]);
i
++
)
;
return
i
;
}
/* note: returns offset of the first trailing whitespace */
int
ME_ReverseFindNonWhitespaceV
(
const
ME_String
*
s
,
int
nVChar
)
{
int
i
;
for
(
i
=
nVChar
;
i
>
0
&&
ME_IsWSpace
(
s
->
szData
[
i
-
1
]);
i
--
)
;
return
i
;
}
/* note: returns offset of the first trailing nonwhitespace */
int
ME_ReverseFindWhitespaceV
(
const
ME_String
*
s
,
int
nVChar
)
{
int
i
;
for
(
i
=
nVChar
;
i
>
0
&&
!
ME_IsWSpace
(
s
->
szData
[
i
-
1
]);
i
--
)
;
return
i
;
}
static
int
ME_WordBreakProc
(
LPWSTR
s
,
INT
start
,
INT
len
,
INT
code
)
{
...
...
dlls/riched20/wrap.c
View file @
b730efc9
...
...
@@ -206,13 +206,46 @@ static void ME_WrapSizeRun(ME_WrapContext *wc, ME_DisplayItem *p)
wc
->
nRow
?
wc
->
nLeftMargin
:
wc
->
nFirstMargin
,
&
p
->
member
.
run
);
}
static
int
find_non_whitespace
(
const
WCHAR
*
s
,
int
len
,
int
start
)
{
int
i
;
for
(
i
=
start
;
i
<
len
&&
ME_IsWSpace
(
s
[
i
]
);
i
++
)
;
return
i
;
}
/* note: these two really return the first matching offset (starting from EOS)+1
* in other words, an offset of the first trailing white/black */
/* note: returns offset of the first trailing whitespace */
static
int
reverse_find_non_whitespace
(
const
WCHAR
*
s
,
int
start
)
{
int
i
;
for
(
i
=
start
;
i
>
0
&&
ME_IsWSpace
(
s
[
i
-
1
]
);
i
--
)
;
return
i
;
}
/* note: returns offset of the first trailing nonwhitespace */
static
int
reverse_find_whitespace
(
const
WCHAR
*
s
,
int
start
)
{
int
i
;
for
(
i
=
start
;
i
>
0
&&
!
ME_IsWSpace
(
s
[
i
-
1
]
);
i
--
)
;
return
i
;
}
static
ME_DisplayItem
*
ME_MaximizeSplit
(
ME_WrapContext
*
wc
,
ME_DisplayItem
*
p
,
int
i
)
{
ME_DisplayItem
*
pp
,
*
piter
=
p
;
int
j
;
if
(
!
i
)
return
NULL
;
j
=
ME_ReverseFindNonWhitespaceV
(
p
->
member
.
run
.
strText
,
i
);
j
=
reverse_find_non_whitespace
(
get_text
(
&
p
->
member
.
run
,
0
)
,
i
);
if
(
j
>
0
)
{
pp
=
ME_SplitRun
(
wc
,
piter
,
j
);
wc
->
pt
.
x
+=
piter
->
member
.
run
.
nWidth
;
...
...
@@ -232,8 +265,8 @@ static ME_DisplayItem *ME_MaximizeSplit(ME_WrapContext *wc, ME_DisplayItem *p, i
}
if
(
piter
->
member
.
run
.
nFlags
&
MERF_ENDWHITE
)
{
i
=
ME_ReverseFindNonWhitespaceV
(
piter
->
member
.
run
.
strText
,
piter
->
member
.
run
.
len
);
i
=
reverse_find_non_whitespace
(
get_text
(
&
piter
->
member
.
run
,
0
)
,
piter
->
member
.
run
.
len
);
pp
=
ME_SplitRun
(
wc
,
piter
,
i
);
wc
->
pt
=
pp
->
member
.
run
.
pt
;
return
pp
;
...
...
@@ -261,7 +294,7 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
assert
(
i
<
len
);
if
(
i
)
{
/* don't split words */
i
=
ME_ReverseFindWhitespaceV
(
run
->
strText
,
i
);
i
=
reverse_find_whitespace
(
get_text
(
run
,
0
),
i
);
pp
=
ME_MaximizeSplit
(
wc
,
p
,
i
);
if
(
pp
)
return
pp
;
...
...
@@ -285,9 +318,9 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
run
=
&
piter
->
member
.
run
;
len
=
run
->
len
;
/* don't split words */
i
=
ME_ReverseFindWhitespaceV
(
run
->
strText
,
len
);
i
=
reverse_find_whitespace
(
get_text
(
run
,
0
),
len
);
if
(
i
==
len
)
i
=
ME_ReverseFindNonWhitespaceV
(
run
->
strText
,
len
);
i
=
reverse_find_non_whitespace
(
get_text
(
run
,
0
),
len
);
if
(
i
)
{
ME_DisplayItem
*
piter2
=
ME_SplitRun
(
wc
,
piter
,
i
);
wc
->
pt
=
piter2
->
member
.
run
.
pt
;
...
...
@@ -357,7 +390,7 @@ static ME_DisplayItem *ME_WrapHandleRun(ME_WrapContext *wc, ME_DisplayItem *p)
if
(
run
->
nFlags
&
MERF_STARTWHITE
)
{
/* try to split the run at the first non-white char */
int
black
;
black
=
ME_FindNonWhitespaceV
(
run
->
strText
,
0
);
black
=
find_non_whitespace
(
get_text
(
run
,
0
),
run
->
len
,
0
);
if
(
black
)
{
wc
->
bOverflown
=
FALSE
;
pp
=
ME_SplitRun
(
wc
,
p
,
black
);
...
...
@@ -410,7 +443,7 @@ static ME_DisplayItem *ME_WrapHandleRun(ME_WrapContext *wc, ME_DisplayItem *p)
if
(
run
->
nFlags
&
MERF_ENDWHITE
)
{
/* we aren't sure if it's *really* necessary, it's a good start however */
int
black
=
ME_ReverseFindNonWhitespaceV
(
run
->
strText
,
len
);
int
black
=
reverse_find_non_whitespace
(
get_text
(
run
,
0
),
len
);
ME_SplitRun
(
wc
,
p
,
black
);
/* handle both parts again */
return
p
;
...
...
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