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
a37147c0
Commit
a37147c0
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: Return a run ptr from the run creation function.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3cade70f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
74 deletions
+78
-74
editor.h
dlls/riched20/editor.h
+1
-1
para.c
dlls/riched20/para.c
+14
-15
run.c
dlls/riched20/run.c
+63
-58
No files found.
dlls/riched20/editor.h
View file @
a37147c0
...
...
@@ -120,7 +120,7 @@ ME_DisplayItem *ME_FindRowWithNumber(ME_TextEditor *editor, int nRow) DECLSPEC_H
int
ME_RowNumberFromCharOfs
(
ME_TextEditor
*
editor
,
int
nOfs
)
DECLSPEC_HIDDEN
;
/* run.c */
ME_
DisplayItem
*
ME_MakeRun
(
ME_Style
*
s
,
int
nFlags
)
DECLSPEC_HIDDEN
;
ME_
Run
*
run_create
(
ME_Style
*
s
,
int
nFlags
)
DECLSPEC_HIDDEN
;
ME_DisplayItem
*
ME_InsertRunAtCursor
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
,
ME_Style
*
style
,
const
WCHAR
*
str
,
int
len
,
int
flags
)
DECLSPEC_HIDDEN
;
void
ME_CheckCharOffsets
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
...
...
dlls/riched20/para.c
View file @
a37147c0
...
...
@@ -131,7 +131,7 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
HFONT
hf
;
ME_TextBuffer
*
text
=
editor
->
pBuffer
;
ME_DisplayItem
*
para
=
make_para
(
editor
);
ME_
DisplayItem
*
run
;
ME_
Run
*
run
;
ME_Style
*
style
;
int
eol_len
;
...
...
@@ -177,15 +177,14 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
eol_len
=
editor
->
bEmulateVersion10
?
2
:
1
;
para
->
member
.
para
.
text
=
ME_MakeStringN
(
cr_lf
,
eol_len
);
run
=
ME_MakeRun
(
style
,
MERF_ENDPARA
);
run
->
member
.
run
.
nCharOfs
=
0
;
run
->
member
.
run
.
len
=
eol_len
;
run
->
member
.
run
.
para
=
&
para
->
member
.
para
;
para
->
member
.
para
.
eop_run
=
&
run
->
member
.
run
;
run
=
run_create
(
style
,
MERF_ENDPARA
);
run
->
nCharOfs
=
0
;
run
->
len
=
eol_len
;
run
->
para
=
&
para
->
member
.
para
;
para
->
member
.
para
.
eop_run
=
run
;
ME_InsertBefore
(
text
->
pLast
,
para
);
ME_InsertBefore
(
text
->
pLast
,
run
);
ME_InsertBefore
(
text
->
pLast
,
run
_get_di
(
run
)
);
para
->
member
.
para
.
prev_para
=
text
->
pFirst
;
para
->
member
.
para
.
next_para
=
text
->
pLast
;
text
->
pFirst
->
member
.
para
.
next_para
=
para
;
...
...
@@ -523,7 +522,7 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run,
ME_DisplayItem
*
next_para
=
NULL
;
ME_DisplayItem
*
run_para
=
NULL
;
ME_DisplayItem
*
new_para
=
make_para
(
editor
);
ME_
DisplayItem
*
end_run
;
ME_
Run
*
end_run
;
int
ofs
,
i
;
ME_DisplayItem
*
pp
;
int
run_flags
=
MERF_ENDPARA
;
...
...
@@ -549,10 +548,10 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run,
new_para
->
member
.
para
.
text
=
ME_VSplitString
(
run_para
->
member
.
para
.
text
,
run
->
member
.
run
.
nCharOfs
);
end_run
=
ME_MakeRun
(
style
,
run_flags
);
ofs
=
end_run
->
member
.
run
.
nCharOfs
=
run
->
member
.
run
.
nCharOfs
;
end_run
->
member
.
run
.
len
=
eol_len
;
end_run
->
member
.
run
.
para
=
run
->
member
.
run
.
para
;
end_run
=
run_create
(
style
,
run_flags
);
ofs
=
end_run
->
nCharOfs
=
run
->
member
.
run
.
nCharOfs
;
end_run
->
len
=
eol_len
;
end_run
->
para
=
run
->
member
.
run
.
para
;
ME_AppendString
(
run_para
->
member
.
para
.
text
,
eol_str
,
eol_len
);
next_para
=
run_para
->
member
.
para
.
next_para
;
assert
(
next_para
==
ME_FindItemFwd
(
run_para
,
diParagraphOrEnd
));
...
...
@@ -592,11 +591,11 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run,
/* insert end run of the old paragraph, and new paragraph, into DI double linked list */
ME_InsertBefore
(
run
,
new_para
);
ME_InsertBefore
(
new_para
,
end_run
);
ME_InsertBefore
(
new_para
,
run_get_di
(
end_run
)
);
/* Fix up the paras' eop_run ptrs */
new_para
->
member
.
para
.
eop_run
=
run_para
->
member
.
para
.
eop_run
;
run_para
->
member
.
para
.
eop_run
=
&
end_run
->
member
.
run
;
run_para
->
member
.
para
.
eop_run
=
end_
run
;
if
(
!
editor
->
bEmulateVersion10
)
{
/* v4.1 */
if
(
paraFlags
&
(
MEPF_ROWSTART
|
MEPF_CELL
))
...
...
dlls/riched20/run.c
View file @
a37147c0
...
...
@@ -273,63 +273,67 @@ void run_join( ME_TextEditor *editor, ME_Run *run )
* Does the most basic job of splitting a run into two - it does not
* update the positions and extents.
*/
ME_DisplayItem
*
ME_SplitRunSimple
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
)
ME_DisplayItem
*
ME_SplitRunSimple
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
)
{
ME_DisplayItem
*
run
=
cursor
->
pRun
;
ME_DisplayItem
*
new_run
;
int
i
;
int
nOffset
=
cursor
->
nOffset
;
assert
(
!
(
run
->
member
.
run
.
nFlags
&
MERF_NONTEXT
));
new_run
=
ME_MakeRun
(
run
->
member
.
run
.
style
,
run
->
member
.
run
.
nFlags
&
MERF_SPLITMASK
);
new_run
->
member
.
run
.
nCharOfs
=
run
->
member
.
run
.
nCharOfs
+
nOffset
;
new_run
->
member
.
run
.
len
=
run
->
member
.
run
.
len
-
nOffset
;
new_run
->
member
.
run
.
para
=
run
->
member
.
run
.
para
;
run
->
member
.
run
.
len
=
nOffset
;
cursor
->
pRun
=
new_run
;
cursor
->
nOffset
=
0
;
ME_InsertBefore
(
run
->
next
,
new_run
);
ME_UpdateRunFlags
(
editor
,
&
run
->
member
.
run
);
ME_UpdateRunFlags
(
editor
,
&
new_run
->
member
.
run
);
for
(
i
=
0
;
i
<
editor
->
nCursors
;
i
++
)
{
if
(
editor
->
pCursors
[
i
].
pRun
==
run
&&
editor
->
pCursors
[
i
].
nOffset
>=
nOffset
)
{
editor
->
pCursors
[
i
].
pRun
=
new_run
;
editor
->
pCursors
[
i
].
nOffset
-=
nOffset
;
ME_Run
*
run
=
&
cursor
->
pRun
->
member
.
run
,
*
new_run
;
int
i
;
int
nOffset
=
cursor
->
nOffset
;
assert
(
!
(
run
->
nFlags
&
MERF_NONTEXT
)
);
new_run
=
run_create
(
run
->
style
,
run
->
nFlags
&
MERF_SPLITMASK
);
new_run
->
nCharOfs
=
run
->
nCharOfs
+
nOffset
;
new_run
->
len
=
run
->
len
-
nOffset
;
new_run
->
para
=
run
->
para
;
run
->
len
=
nOffset
;
cursor
->
pRun
=
run_get_di
(
new_run
);
cursor
->
nOffset
=
0
;
ME_InsertBefore
(
run_get_di
(
run
)
->
next
,
run_get_di
(
new_run
)
);
ME_UpdateRunFlags
(
editor
,
run
);
ME_UpdateRunFlags
(
editor
,
new_run
);
for
(
i
=
0
;
i
<
editor
->
nCursors
;
i
++
)
{
if
(
editor
->
pCursors
[
i
].
pRun
==
run_get_di
(
run
)
&&
editor
->
pCursors
[
i
].
nOffset
>=
nOffset
)
{
editor
->
pCursors
[
i
].
pRun
=
run_get_di
(
new_run
);
editor
->
pCursors
[
i
].
nOffset
-=
nOffset
;
}
}
}
para_mark_rewrap
(
editor
,
&
cursor
->
pPara
->
member
.
para
);
return
run
;
para_mark_rewrap
(
editor
,
run
->
para
);
return
run_get_di
(
run
);
}
/******************************************************************************
*
ME_MakeRun
*
run_create
*
* A helper function to create run structures quickly.
*/
ME_
DisplayItem
*
ME_MakeRun
(
ME_Style
*
s
,
int
nFlags
)
ME_
Run
*
run_create
(
ME_Style
*
s
,
int
flags
)
{
ME_DisplayItem
*
item
=
ME_MakeDI
(
diRun
);
item
->
member
.
run
.
style
=
s
;
item
->
member
.
run
.
reobj
=
NULL
;
item
->
member
.
run
.
nFlags
=
nFlags
;
item
->
member
.
run
.
nCharOfs
=
-
1
;
item
->
member
.
run
.
len
=
0
;
item
->
member
.
run
.
para
=
NULL
;
item
->
member
.
run
.
num_glyphs
=
0
;
item
->
member
.
run
.
max_glyphs
=
0
;
item
->
member
.
run
.
glyphs
=
NULL
;
item
->
member
.
run
.
vis_attrs
=
NULL
;
item
->
member
.
run
.
advances
=
NULL
;
item
->
member
.
run
.
offsets
=
NULL
;
item
->
member
.
run
.
max_clusters
=
0
;
item
->
member
.
run
.
clusters
=
NULL
;
ME_AddRefStyle
(
s
);
return
item
;
ME_DisplayItem
*
item
=
ME_MakeDI
(
diRun
);
ME_Run
*
run
=
&
item
->
member
.
run
;
if
(
!
item
)
return
NULL
;
ME_AddRefStyle
(
s
);
run
->
style
=
s
;
run
->
reobj
=
NULL
;
run
->
nFlags
=
flags
;
run
->
nCharOfs
=
-
1
;
run
->
len
=
0
;
run
->
para
=
NULL
;
run
->
num_glyphs
=
0
;
run
->
max_glyphs
=
0
;
run
->
glyphs
=
NULL
;
run
->
vis_attrs
=
NULL
;
run
->
advances
=
NULL
;
run
->
offsets
=
NULL
;
run
->
max_clusters
=
0
;
run
->
clusters
=
NULL
;
return
run
;
}
/******************************************************************************
...
...
@@ -343,7 +347,8 @@ ME_DisplayItem *
ME_InsertRunAtCursor
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
,
ME_Style
*
style
,
const
WCHAR
*
str
,
int
len
,
int
flags
)
{
ME_DisplayItem
*
pDI
,
*
insert_before
=
cursor
->
pRun
,
*
prev
;
ME_DisplayItem
*
insert_before
=
cursor
->
pRun
,
*
prev
;
ME_Run
*
run
;
if
(
cursor
->
nOffset
)
{
...
...
@@ -362,18 +367,18 @@ ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style,
add_undo_delete_run
(
editor
,
insert_before
->
member
.
run
.
para
->
nCharOfs
+
insert_before
->
member
.
run
.
nCharOfs
,
len
);
pDI
=
ME_MakeRun
(
style
,
flags
);
pDI
->
member
.
run
.
nCharOfs
=
insert_before
->
member
.
run
.
nCharOfs
;
pDI
->
member
.
run
.
len
=
len
;
pDI
->
member
.
run
.
para
=
insert_before
->
member
.
run
.
para
;
ME_InsertString
(
pDI
->
member
.
run
.
para
->
text
,
pDI
->
member
.
run
.
nCharOfs
,
str
,
len
);
ME_InsertBefore
(
insert_before
,
pDI
);
run
=
run_create
(
style
,
flags
);
run
->
nCharOfs
=
insert_before
->
member
.
run
.
nCharOfs
;
run
->
len
=
len
;
run
->
para
=
insert_before
->
member
.
run
.
para
;
ME_InsertString
(
run
->
para
->
text
,
run
->
nCharOfs
,
str
,
len
);
ME_InsertBefore
(
insert_before
,
run_get_di
(
run
)
);
TRACE
(
"Shift length:%d
\n
"
,
len
);
ME_PropagateCharOffset
(
insert_before
,
len
);
para_mark_rewrap
(
editor
,
insert_before
->
member
.
run
.
para
);
/* Move any cursors that were at the end of the previous run to the end of the inserted run */
prev
=
ME_FindItemBack
(
pDI
,
diRun
);
prev
=
ME_FindItemBack
(
run_get_di
(
run
)
,
diRun
);
if
(
prev
)
{
int
i
;
...
...
@@ -383,13 +388,13 @@ ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style,
if
(
editor
->
pCursors
[
i
].
pRun
==
prev
&&
editor
->
pCursors
[
i
].
nOffset
==
prev
->
member
.
run
.
len
)
{
editor
->
pCursors
[
i
].
pRun
=
pDI
;
editor
->
pCursors
[
i
].
pRun
=
run_get_di
(
run
)
;
editor
->
pCursors
[
i
].
nOffset
=
len
;
}
}
}
return
pDI
;
return
run_get_di
(
run
)
;
}
static
BOOL
run_is_splittable
(
const
ME_Run
*
run
)
...
...
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