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
586e31a1
Commit
586e31a1
authored
Oct 13, 2020
by
Huw Davies
Committed by
Alexandre Julliard
Oct 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Use the run and para helpers in the cursor movement functions.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
468609ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
67 deletions
+54
-67
caret.c
dlls/riched20/caret.c
+54
-67
No files found.
dlls/riched20/caret.c
View file @
586e31a1
...
...
@@ -671,7 +671,7 @@ int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs, BO
{
/* new offset in the same paragraph */
do
{
cursor
->
pRun
=
ME_FindItemBack
(
cursor
->
pRun
,
diRun
);
cursor
->
pRun
=
run_get_di
(
run_prev
(
&
cursor
->
pRun
->
member
.
run
)
);
}
while
(
cursor
->
nOffset
<
cursor
->
pRun
->
member
.
run
.
nCharOfs
);
cursor
->
nOffset
-=
cursor
->
pRun
->
member
.
run
.
nCharOfs
;
return
nRelOfs
;
...
...
@@ -688,27 +688,29 @@ int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs, BO
/* new offset in a previous paragraph */
do
{
cursor
->
pPara
=
cursor
->
pPara
->
member
.
para
.
prev_para
;
cursor
->
pPara
=
para_get_di
(
para_prev
(
&
cursor
->
pPara
->
member
.
para
)
)
;
}
while
(
cursor
->
nOffset
<
cursor
->
pPara
->
member
.
para
.
nCharOfs
);
cursor
->
nOffset
-=
cursor
->
pPara
->
member
.
para
.
nCharOfs
;
cursor
->
pRun
=
ME_FindItemBack
(
cursor
->
pPara
->
member
.
para
.
next_para
,
diRun
);
cursor
->
pRun
=
run_get_di
(
para_end_run
(
&
cursor
->
pPara
->
member
.
para
)
);
while
(
cursor
->
nOffset
<
cursor
->
pRun
->
member
.
run
.
nCharOfs
)
{
cursor
->
pRun
=
ME_FindItemBack
(
cursor
->
pRun
,
diRun
);
cursor
->
pRun
=
run_get_di
(
run_prev
(
&
cursor
->
pRun
->
member
.
run
)
);
}
cursor
->
nOffset
-=
cursor
->
pRun
->
member
.
run
.
nCharOfs
;
}
else
if
(
cursor
->
nOffset
>=
cursor
->
pRun
->
member
.
run
.
len
)
{
ME_DisplayItem
*
next_para
;
}
else
if
(
cursor
->
nOffset
>=
cursor
->
pRun
->
member
.
run
.
len
)
{
ME_Paragraph
*
next_para
;
int
new_offset
;
new_offset
=
ME_GetCursorOfs
(
cursor
);
next_para
=
cursor
->
pPara
->
member
.
para
.
next_para
;
if
(
new_offset
<
next_para
->
member
.
para
.
nCharOfs
)
next_para
=
para_next
(
&
cursor
->
pPara
->
member
.
para
)
;
if
(
new_offset
<
next_para
->
nCharOfs
)
{
/* new offset in the same paragraph */
do
{
cursor
->
nOffset
-=
cursor
->
pRun
->
member
.
run
.
len
;
cursor
->
pRun
=
ME_FindItemFwd
(
cursor
->
pRun
,
diRun
);
cursor
->
pRun
=
run_get_di
(
run_next
(
&
cursor
->
pRun
->
member
.
run
)
);
}
while
(
cursor
->
nOffset
>=
cursor
->
pRun
->
member
.
run
.
len
);
return
nRelOfs
;
}
...
...
@@ -723,16 +725,16 @@ int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs, BO
/* new offset in a following paragraph */
do
{
cursor
->
pPara
=
next_para
;
next_para
=
next_para
->
member
.
para
.
next_para
;
}
while
(
new_offset
>=
next_para
->
member
.
para
.
nCharOfs
);
cursor
->
pPara
=
para_get_di
(
next_para
)
;
next_para
=
para_next
(
next_para
)
;
}
while
(
new_offset
>=
next_para
->
nCharOfs
);
cursor
->
nOffset
=
new_offset
-
cursor
->
pPara
->
member
.
para
.
nCharOfs
;
cursor
->
pRun
=
ME_FindItemFwd
(
cursor
->
pPara
,
diRun
);
cursor
->
pRun
=
run_get_di
(
para_first_run
(
&
cursor
->
pPara
->
member
.
para
)
);
while
(
cursor
->
nOffset
>=
cursor
->
pRun
->
member
.
run
.
len
)
{
cursor
->
nOffset
-=
cursor
->
pRun
->
member
.
run
.
len
;
cursor
->
pRun
=
ME_FindItemFwd
(
cursor
->
pRun
,
diRun
);
cursor
->
pRun
=
run_get_di
(
run_next
(
&
cursor
->
pRun
->
member
.
run
)
);
}
}
/* else new offset is in the same run */
return
nRelOfs
;
...
...
@@ -742,8 +744,8 @@ int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs, BO
BOOL
ME_MoveCursorWords
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
,
int
nRelOfs
)
{
ME_
DisplayItem
*
pRun
=
cursor
->
pRun
,
*
pOtherR
un
;
ME_
DisplayItem
*
pPara
=
cursor
->
pP
ara
;
ME_
Run
*
run
=
&
cursor
->
pRun
->
member
.
run
,
*
other_r
un
;
ME_
Paragraph
*
para
=
&
cursor
->
pPara
->
member
.
p
ara
;
int
nOffset
=
cursor
->
nOffset
;
if
(
nRelOfs
==
-
1
)
...
...
@@ -751,40 +753,33 @@ ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
/* Backward movement */
while
(
TRUE
)
{
nOffset
=
ME_CallWordBreakProc
(
editor
,
get_text
(
&
pRun
->
member
.
run
,
0
),
pRun
->
member
.
run
.
len
,
nOffset
,
WB_MOVEWORDLEFT
);
if
(
nOffset
)
break
;
pOtherRun
=
ME_FindItemBack
(
pRun
,
diRunOrParagraph
);
if
(
pOtherRun
->
type
==
diRun
)
nOffset
=
ME_CallWordBreakProc
(
editor
,
get_text
(
run
,
0
),
run
->
len
,
nOffset
,
WB_MOVEWORDLEFT
);
if
(
nOffset
)
break
;
other_run
=
run_prev
(
run
);
if
(
other_run
)
{
if
(
ME_CallWordBreakProc
(
editor
,
get_text
(
&
pOtherRun
->
member
.
run
,
0
),
pOtherRun
->
member
.
run
.
len
,
pOtherRun
->
member
.
run
.
len
-
1
,
WB_ISDELIMITER
)
&&
!
(
pRun
->
member
.
run
.
nFlags
&
MERF_ENDPARA
)
&&
!
(
cursor
->
pRun
==
pRun
&&
cursor
->
nOffset
==
0
)
&&
!
ME_CallWordBreakProc
(
editor
,
get_text
(
&
pRun
->
member
.
run
,
0
),
pRun
->
member
.
run
.
len
,
0
,
WB_ISDELIMITER
))
if
(
ME_CallWordBreakProc
(
editor
,
get_text
(
other_run
,
0
),
other_run
->
len
,
other_run
->
len
-
1
,
WB_ISDELIMITER
)
&&
!
(
run
->
nFlags
&
MERF_ENDPARA
)
&&
!
(
&
cursor
->
pRun
->
member
.
run
==
run
&&
cursor
->
nOffset
==
0
)
&&
!
ME_CallWordBreakProc
(
editor
,
get_text
(
run
,
0
),
run
->
len
,
0
,
WB_ISDELIMITER
))
break
;
pRun
=
pOtherR
un
;
nOffset
=
pOtherRun
->
member
.
run
.
len
;
run
=
other_r
un
;
nOffset
=
other_run
->
len
;
}
else
if
(
pOtherRun
->
type
==
diParagraph
)
else
{
if
(
cursor
->
pRun
==
pR
un
&&
cursor
->
nOffset
==
0
)
if
(
&
cursor
->
pRun
->
member
.
run
==
r
un
&&
cursor
->
nOffset
==
0
)
{
p
Para
=
pOtherRun
;
p
ara
=
run
->
para
;
/* Skip empty start of table row paragraph */
if
(
p
Para
->
member
.
para
.
prev_para
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
)
p
Para
=
pPara
->
member
.
para
.
prev_para
;
if
(
p
ara_prev
(
para
)
->
nFlags
&
MEPF_ROWSTART
)
p
ara
=
para_prev
(
para
)
;
/* Paragraph breaks are treated as separate words */
if
(
p
Para
->
member
.
para
.
prev_para
->
type
==
diTextStart
)
if
(
p
ara_get_di
(
para_prev
(
para
)
)
->
type
==
diTextStart
)
return
FALSE
;
p
Run
=
ME_FindItemBack
(
pPara
,
diRun
);
pPara
=
pPara
->
member
.
para
.
prev_para
;
p
ara
=
para_prev
(
para
);
run
=
para_end_run
(
para
)
;
}
break
;
}
...
...
@@ -797,43 +792,35 @@ ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
while
(
TRUE
)
{
if
(
last_delim
&&
!
ME_CallWordBreakProc
(
editor
,
get_text
(
&
pRun
->
member
.
run
,
0
),
pRun
->
member
.
run
.
len
,
nOffset
,
WB_ISDELIMITER
))
break
;
nOffset
=
ME_CallWordBreakProc
(
editor
,
get_text
(
&
pRun
->
member
.
run
,
0
),
pRun
->
member
.
run
.
len
,
nOffset
,
WB_MOVEWORDRIGHT
);
if
(
nOffset
<
pRun
->
member
.
run
.
len
)
if
(
last_delim
&&
!
ME_CallWordBreakProc
(
editor
,
get_text
(
run
,
0
),
run
->
len
,
nOffset
,
WB_ISDELIMITER
))
break
;
pOtherRun
=
ME_FindItemFwd
(
pRun
,
diRunOrParagraphOrEnd
);
if
(
pOtherRun
->
type
==
diRun
)
nOffset
=
ME_CallWordBreakProc
(
editor
,
get_text
(
run
,
0
),
run
->
len
,
nOffset
,
WB_MOVEWORDRIGHT
);
if
(
nOffset
<
run
->
len
)
break
;
other_run
=
run_next
(
run
);
if
(
other_run
)
{
last_delim
=
ME_CallWordBreakProc
(
editor
,
get_text
(
&
pRun
->
member
.
run
,
0
),
pRun
->
member
.
run
.
len
,
nOffset
-
1
,
WB_ISDELIMITER
);
pRun
=
pOtherRun
;
last_delim
=
ME_CallWordBreakProc
(
editor
,
get_text
(
run
,
0
),
run
->
len
,
nOffset
-
1
,
WB_ISDELIMITER
);
run
=
other_run
;
nOffset
=
0
;
}
else
if
(
pOtherRun
->
type
==
diParagraph
)
else
{
if
(
pOtherRun
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
)
pOtherRun
=
pOtherRun
->
member
.
para
.
next_para
;
if
(
cursor
->
pRun
==
pRun
)
{
pPara
=
pOtherRun
;
pRun
=
ME_FindItemFwd
(
pPara
,
diRun
);
para
=
para_next
(
para
);
if
(
para_get_di
(
para
)
->
type
==
diTextEnd
)
{
if
(
&
cursor
->
pRun
->
member
.
run
==
run
)
return
FALSE
;
nOffset
=
0
;
break
;
}
nOffset
=
0
;
break
;
}
else
/* diTextEnd */
{
if
(
cursor
->
pRun
==
pRun
)
return
FALSE
;
if
(
para
->
nFlags
&
MEPF_ROWSTART
)
para
=
para_next
(
para
);
if
(
&
cursor
->
pRun
->
member
.
run
==
run
)
run
=
para_first_run
(
para
);
nOffset
=
0
;
break
;
}
}
}
cursor
->
pPara
=
p
Para
;
cursor
->
pRun
=
pRun
;
cursor
->
pPara
=
p
ara_get_di
(
para
)
;
cursor
->
pRun
=
run_get_di
(
run
)
;
cursor
->
nOffset
=
nOffset
;
return
TRUE
;
}
...
...
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