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
12dd2d5d
Commit
12dd2d5d
authored
Nov 06, 2020
by
Huw Davies
Committed by
Alexandre Julliard
Nov 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Add next / prev run from cursor helpers.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3131f919
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
62 deletions
+70
-62
editor.c
dlls/riched20/editor.c
+1
-1
editor.h
dlls/riched20/editor.h
+2
-3
list.c
dlls/riched20/list.c
+0
-45
run.c
dlls/riched20/run.c
+66
-12
writer.c
dlls/riched20/writer.c
+1
-1
No files found.
dlls/riched20/editor.c
View file @
12dd2d5d
...
...
@@ -5423,7 +5423,7 @@ static BOOL ME_FindNextURLCandidate(ME_TextEditor *editor,
}
cursor
.
nOffset
=
0
;
if
(
!
ME_NextRun
(
&
cursor
.
pPara
,
&
cursor
.
pRun
,
TRUE
))
if
(
!
cursor_next_run
(
&
cursor
,
TRUE
))
goto
done
;
}
...
...
dlls/riched20/editor.h
View file @
12dd2d5d
...
...
@@ -67,8 +67,6 @@ void ME_CharFormatFromLogFont(HDC hDC, const LOGFONTW *lf, CHARFORMAT2W *fmt) DE
/* list.c */
void
ME_InsertBefore
(
ME_DisplayItem
*
diWhere
,
ME_DisplayItem
*
diWhat
)
DECLSPEC_HIDDEN
;
void
ME_Remove
(
ME_DisplayItem
*
diWhere
)
DECLSPEC_HIDDEN
;
BOOL
ME_NextRun
(
ME_DisplayItem
**
para
,
ME_DisplayItem
**
run
,
BOOL
all_para
)
DECLSPEC_HIDDEN
;
BOOL
ME_PrevRun
(
ME_DisplayItem
**
para
,
ME_DisplayItem
**
run
,
BOOL
all_para
)
DECLSPEC_HIDDEN
;
ME_DisplayItem
*
ME_FindItemBack
(
ME_DisplayItem
*
di
,
ME_DIType
nTypeOrClass
)
DECLSPEC_HIDDEN
;
ME_DisplayItem
*
ME_FindItemFwd
(
ME_DisplayItem
*
di
,
ME_DIType
nTypeOrClass
)
DECLSPEC_HIDDEN
;
ME_DisplayItem
*
ME_FindItemBackOrHere
(
ME_DisplayItem
*
di
,
ME_DIType
nTypeOrClass
)
DECLSPEC_HIDDEN
;
...
...
@@ -126,7 +124,8 @@ static inline ME_DisplayItem *row_get_di( ME_Row *row )
/* run.c */
void
cursor_from_char_ofs
(
ME_TextEditor
*
editor
,
int
char_ofs
,
ME_Cursor
*
cursor
)
DECLSPEC_HIDDEN
;
BOOL
cursor_next_run
(
ME_Cursor
*
cursor
,
BOOL
all_para
)
DECLSPEC_HIDDEN
;
BOOL
cursor_prev_run
(
ME_Cursor
*
cursor
,
BOOL
all_para
)
DECLSPEC_HIDDEN
;
int
run_char_ofs
(
ME_Run
*
run
,
int
ofs
)
DECLSPEC_HIDDEN
;
ME_Run
*
run_create
(
ME_Style
*
s
,
int
nFlags
)
DECLSPEC_HIDDEN
;
ME_Run
*
run_insert
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
,
...
...
dlls/riched20/list.c
View file @
12dd2d5d
...
...
@@ -63,51 +63,6 @@ static BOOL ME_DITypesEqual(ME_DIType type, ME_DIType nTypeOrClass)
}
}
/* Modifies run pointer to point to the next run.
* If all_para is FALSE constrain the search to the current para,
* otherwise modify the paragraph pointer if moving into the next paragraph.
*
* Returns TRUE if next run is found, otherwise returns FALSE. */
BOOL
ME_NextRun
(
ME_DisplayItem
**
para
,
ME_DisplayItem
**
run
,
BOOL
all_para
)
{
ME_DisplayItem
*
p
=
(
*
run
)
->
next
;
while
(
p
->
type
!=
diTextEnd
)
{
if
(
p
->
type
==
diParagraph
)
{
if
(
!
all_para
)
return
FALSE
;
*
para
=
p
;
}
else
if
(
p
->
type
==
diRun
)
{
*
run
=
p
;
return
TRUE
;
}
p
=
p
->
next
;
}
return
FALSE
;
}
/* Modifies run pointer to point to the previous run.
* If all_para is FALSE constrain the search to the current para,
* otherwise modify the paragraph pointer if moving into the previous paragraph.
*
* Returns TRUE if previous run is found, otherwise returns FALSE. */
BOOL
ME_PrevRun
(
ME_DisplayItem
**
para
,
ME_DisplayItem
**
run
,
BOOL
all_para
)
{
ME_DisplayItem
*
p
=
(
*
run
)
->
prev
;
while
(
p
->
type
!=
diTextStart
)
{
if
(
p
->
type
==
diParagraph
)
{
if
(
!
all_para
)
return
FALSE
;
if
(
para
&&
p
->
member
.
para
.
prev_para
->
type
==
diParagraph
)
*
para
=
p
->
member
.
para
.
prev_para
;
}
else
if
(
p
->
type
==
diRun
)
{
*
run
=
p
;
return
TRUE
;
}
p
=
p
->
prev
;
}
return
FALSE
;
}
ME_DisplayItem
*
ME_FindItemBack
(
ME_DisplayItem
*
di
,
ME_DIType
nTypeOrClass
)
{
if
(
!
di
)
...
...
dlls/riched20/run.c
View file @
12dd2d5d
...
...
@@ -27,42 +27,96 @@ WINE_DEFAULT_DEBUG_CHANNEL(richedit);
WINE_DECLARE_DEBUG_CHANNEL
(
richedit_check
);
WINE_DECLARE_DEBUG_CHANNEL
(
richedit_lists
);
BOOL
cursor_next_run
(
ME_Cursor
*
cursor
,
BOOL
all_para
)
{
ME_DisplayItem
*
p
=
cursor
->
pRun
->
next
;
while
(
p
->
type
!=
diTextEnd
)
{
if
(
p
->
type
==
diParagraph
&&
!
all_para
)
return
FALSE
;
else
if
(
p
->
type
==
diRun
)
{
cursor
->
pRun
=
p
;
cursor
->
pPara
=
para_get_di
(
cursor
->
pRun
->
member
.
run
.
para
);
cursor
->
nOffset
=
0
;
return
TRUE
;
}
p
=
p
->
next
;
}
return
FALSE
;
}
BOOL
cursor_prev_run
(
ME_Cursor
*
cursor
,
BOOL
all_para
)
{
ME_DisplayItem
*
p
=
cursor
->
pRun
->
prev
;
while
(
p
->
type
!=
diTextStart
)
{
if
(
p
->
type
==
diParagraph
&&
!
all_para
)
return
FALSE
;
else
if
(
p
->
type
==
diRun
)
{
cursor
->
pRun
=
p
;
cursor
->
pPara
=
para_get_di
(
cursor
->
pRun
->
member
.
run
.
para
);
cursor
->
nOffset
=
0
;
return
TRUE
;
}
p
=
p
->
prev
;
}
return
FALSE
;
}
ME_Run
*
run_next
(
ME_Run
*
run
)
{
ME_DisplayItem
*
item
=
run_get_di
(
run
);
ME_Cursor
cursor
;
cursor
.
pRun
=
run_get_di
(
run
);
cursor
.
pPara
=
para_get_di
(
run
->
para
);
cursor
.
nOffset
=
0
;
if
(
ME_NextRun
(
NULL
,
&
item
,
FALSE
))
return
&
item
->
member
.
run
;
if
(
cursor_next_run
(
&
cursor
,
FALSE
))
return
&
cursor
.
pRun
->
member
.
run
;
return
NULL
;
}
ME_Run
*
run_prev
(
ME_Run
*
run
)
{
ME_
DisplayItem
*
item
=
run_get_di
(
run
)
;
ME_
Cursor
cursor
;
if
(
ME_PrevRun
(
NULL
,
&
item
,
FALSE
))
return
&
item
->
member
.
run
;
cursor
.
pRun
=
run_get_di
(
run
);
cursor
.
pPara
=
para_get_di
(
run
->
para
);
cursor
.
nOffset
=
0
;
if
(
cursor_prev_run
(
&
cursor
,
FALSE
))
return
&
cursor
.
pRun
->
member
.
run
;
return
NULL
;
}
ME_Run
*
run_next_all_paras
(
ME_Run
*
run
)
{
ME_DisplayItem
*
item
=
run_get_di
(
run
),
*
dummy
=
para_get_di
(
run
->
para
);
ME_Cursor
cursor
;
cursor
.
pRun
=
run_get_di
(
run
);
cursor
.
pPara
=
para_get_di
(
run
->
para
);
cursor
.
nOffset
=
0
;
if
(
ME_NextRun
(
&
dummy
,
&
item
,
TRUE
))
return
&
item
->
member
.
run
;
if
(
cursor_next_run
(
&
cursor
,
TRUE
))
return
&
cursor
.
pRun
->
member
.
run
;
return
NULL
;
}
ME_Run
*
run_prev_all_paras
(
ME_Run
*
run
)
{
ME_DisplayItem
*
item
=
run_get_di
(
run
),
*
dummy
=
para_get_di
(
run
->
para
);
ME_Cursor
cursor
;
cursor
.
pRun
=
run_get_di
(
run
);
cursor
.
pPara
=
para_get_di
(
run
->
para
);
cursor
.
nOffset
=
0
;
if
(
ME_PrevRun
(
&
dummy
,
&
item
,
TRUE
))
return
&
item
->
member
.
run
;
if
(
cursor_prev_run
(
&
cursor
,
TRUE
))
return
&
cursor
.
pRun
->
member
.
run
;
return
NULL
;
}
...
...
dlls/riched20/writer.c
View file @
12dd2d5d
...
...
@@ -1107,7 +1107,7 @@ static BOOL ME_StreamOutRTF(ME_TextEditor *editor, ME_OutStream *pStream,
return
FALSE
;
cursor
.
nOffset
=
0
;
}
}
while
(
cursor
.
pRun
!=
endCur
.
pRun
&&
ME_NextRun
(
&
cursor
.
pPara
,
&
cursor
.
pRun
,
TRUE
));
}
while
(
cursor
.
pRun
!=
endCur
.
pRun
&&
cursor_next_run
(
&
cursor
,
TRUE
));
if
(
!
ME_StreamOutMove
(
pStream
,
"}
\0
"
,
2
))
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