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
14044d93
Commit
14044d93
authored
Oct 07, 2020
by
Huw Davies
Committed by
Alexandre Julliard
Oct 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Simplify SplitByBacktracking().
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5dc422d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
18 deletions
+13
-18
wrap.c
dlls/riched20/wrap.c
+13
-18
No files found.
dlls/riched20/wrap.c
View file @
14044d93
...
@@ -498,7 +498,7 @@ static ME_DisplayItem *ME_MaximizeSplit(ME_WrapContext *wc, ME_DisplayItem *p, i
...
@@ -498,7 +498,7 @@ static ME_DisplayItem *ME_MaximizeSplit(ME_WrapContext *wc, ME_DisplayItem *p, i
static
ME_DisplayItem
*
ME_SplitByBacktracking
(
ME_WrapContext
*
wc
,
ME_DisplayItem
*
p
,
int
loc
)
static
ME_DisplayItem
*
ME_SplitByBacktracking
(
ME_WrapContext
*
wc
,
ME_DisplayItem
*
p
,
int
loc
)
{
{
ME_DisplayItem
*
piter
=
p
,
*
pp
;
ME_DisplayItem
*
new_run
;
int
i
,
idesp
,
len
;
int
i
,
idesp
,
len
;
ME_Run
*
run
=
&
p
->
member
.
run
;
ME_Run
*
run
=
&
p
->
member
.
run
;
...
@@ -509,9 +509,8 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
...
@@ -509,9 +509,8 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
if
(
i
)
{
if
(
i
)
{
/* don't split words */
/* don't split words */
i
=
reverse_find_whitespace
(
get_text
(
run
,
0
),
i
);
i
=
reverse_find_whitespace
(
get_text
(
run
,
0
),
i
);
pp
=
ME_MaximizeSplit
(
wc
,
p
,
i
);
new_run
=
ME_MaximizeSplit
(
wc
,
p
,
i
);
if
(
pp
)
if
(
new_run
)
return
new_run
;
return
pp
;
}
}
TRACE
(
"Must backtrack to split at: %s
\n
"
,
debugstr_run
(
&
p
->
member
.
run
));
TRACE
(
"Must backtrack to split at: %s
\n
"
,
debugstr_run
(
&
p
->
member
.
run
));
if
(
wc
->
pLastSplittableRun
)
if
(
wc
->
pLastSplittableRun
)
...
@@ -528,20 +527,16 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
...
@@ -528,20 +527,16 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
ME_UpdateRunFlags
(
wc
->
context
->
editor
,
run
);
ME_UpdateRunFlags
(
wc
->
context
->
editor
,
run
);
assert
((
wc
->
pLastSplittableRun
->
member
.
run
.
nFlags
&
MERF_SPLITTABLE
));
assert
((
wc
->
pLastSplittableRun
->
member
.
run
.
nFlags
&
MERF_SPLITTABLE
));
p
iter
=
wc
->
pLastSplittableRun
;
p
=
wc
->
pLastSplittableRun
;
run
=
&
p
iter
->
member
.
run
;
run
=
&
p
->
member
.
run
;
len
=
run
->
len
;
len
=
run
->
len
;
/* don't split words */
/* don't split words */
i
=
reverse_find_whitespace
(
get_text
(
run
,
0
),
len
);
i
=
reverse_find_whitespace
(
get_text
(
run
,
0
),
len
);
if
(
i
==
len
)
if
(
i
==
len
)
i
=
reverse_find_non_whitespace
(
get_text
(
run
,
0
),
len
);
i
=
reverse_find_non_whitespace
(
get_text
(
run
,
0
),
len
);
if
(
i
)
{
new_run
=
split_run_extents
(
wc
,
p
,
i
);
ME_DisplayItem
*
piter2
=
split_run_extents
(
wc
,
piter
,
i
);
wc
->
pt
=
new_run
->
member
.
run
.
pt
;
wc
->
pt
=
piter2
->
member
.
run
.
pt
;
return
new_run
;
return
piter2
;
}
/* splittable = must have whitespaces */
assert
(
0
==
"Splittable, but no whitespaces"
);
}
}
else
else
{
{
...
@@ -553,24 +548,24 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
...
@@ -553,24 +548,24 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
TRACE
(
"Backtracking failed, trying desperate: %s
\n
"
,
debugstr_run
(
&
p
->
member
.
run
));
TRACE
(
"Backtracking failed, trying desperate: %s
\n
"
,
debugstr_run
(
&
p
->
member
.
run
));
/* OK, no better idea, so assume we MAY split words if we can split at all*/
/* OK, no better idea, so assume we MAY split words if we can split at all*/
if
(
idesp
)
if
(
idesp
)
return
split_run_extents
(
wc
,
p
iter
,
idesp
);
return
split_run_extents
(
wc
,
p
,
idesp
);
else
else
if
(
wc
->
pRowStart
&&
p
iter
!=
wc
->
pRowStart
)
if
(
wc
->
pRowStart
&&
p
!=
wc
->
pRowStart
)
{
{
/* don't need to break current run, because it's possible to split
/* don't need to break current run, because it's possible to split
before this run */
before this run */
wc
->
bOverflown
=
TRUE
;
wc
->
bOverflown
=
TRUE
;
return
p
iter
;
return
p
;
}
}
else
else
{
{
/* split point inside first character - no choice but split after that char */
/* split point inside first character - no choice but split after that char */
if
(
len
!=
1
)
{
if
(
len
!=
1
)
{
/* the run is more than 1 char, so we may split */
/* the run is more than 1 char, so we may split */
return
split_run_extents
(
wc
,
p
iter
,
1
);
return
split_run_extents
(
wc
,
p
,
1
);
}
}
/* the run is one char, can't split it */
/* the run is one char, can't split it */
return
p
iter
;
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