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
468609ae
Commit
468609ae
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 paragraph and run ptrs in InsertTextFromCursor().
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5160c30f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
12 deletions
+18
-12
caret.c
dlls/riched20/caret.c
+12
-12
editor.h
dlls/riched20/editor.h
+1
-0
para.c
dlls/riched20/para.c
+5
-0
No files found.
dlls/riched20/caret.c
View file @
468609ae
...
...
@@ -579,7 +579,8 @@ void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor,
ME_InternalInsertTextFromCursor
(
editor
,
nCursor
,
&
tab
,
1
,
style
,
MERF_TAB
);
pos
++
;
}
else
{
/* handle EOLs */
ME_DisplayItem
*
tp
,
*
end_run
,
*
run
,
*
prev
;
ME_Run
*
end_run
,
*
run
,
*
prev
;
ME_Paragraph
*
new_para
;
int
eol_len
=
0
;
/* Check if new line is allowed for this control */
...
...
@@ -619,31 +620,30 @@ void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor,
if
(
p
->
nOffset
==
p
->
pRun
->
member
.
run
.
len
)
{
run
=
ME_FindItemFwd
(
p
->
pRun
,
diR
un
);
if
(
!
run
)
run
=
p
->
pR
un
;
run
=
run_next
(
&
p
->
pRun
->
member
.
r
un
);
if
(
!
run
)
run
=
&
p
->
pRun
->
member
.
r
un
;
}
else
{
if
(
p
->
nOffset
)
ME_SplitRunSimple
(
editor
,
p
);
run
=
p
->
pR
un
;
run
=
&
p
->
pRun
->
member
.
r
un
;
}
tp
=
ME_SplitParagraph
(
editor
,
run
,
style
,
eol_str
,
eol_len
,
0
);
end_run
=
ME_FindItemBack
(
tp
,
diRun
);
new_para
=
&
ME_SplitParagraph
(
editor
,
run_get_di
(
run
),
style
,
eol_str
,
eol_len
,
0
)
->
member
.
para
;
end_run
=
para_end_run
(
para_prev
(
new_para
)
);
/* Move any cursors that were at the end of the previous run to the beginning of the new para */
prev
=
ME_FindItemBack
(
end_run
,
diR
un
);
prev
=
run_prev
(
end_r
un
);
if
(
prev
)
{
int
i
;
for
(
i
=
0
;
i
<
editor
->
nCursors
;
i
++
)
{
if
(
editor
->
pCursors
[
i
].
pRun
==
prev
&&
editor
->
pCursors
[
i
].
nOffset
==
prev
->
member
.
run
.
len
)
if
(
editor
->
pCursors
[
i
].
pRun
==
run_get_di
(
prev
)
&&
editor
->
pCursors
[
i
].
nOffset
==
prev
->
len
)
{
editor
->
pCursors
[
i
].
pPara
=
tp
;
editor
->
pCursors
[
i
].
pRun
=
run
;
editor
->
pCursors
[
i
].
pPara
=
para_get_di
(
new_para
)
;
editor
->
pCursors
[
i
].
pRun
=
run
_get_di
(
run
)
;
editor
->
pCursors
[
i
].
nOffset
=
0
;
}
}
...
...
dlls/riched20/editor.h
View file @
468609ae
...
...
@@ -214,6 +214,7 @@ void para_mark_remove( ME_TextEditor *editor, ME_Paragraph *para ) DECLSPEC_HIDD
ME_Paragraph
*
para_next
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
ME_Paragraph
*
para_prev
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
ME_Run
*
para_first_run
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
ME_Run
*
para_end_run
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
static
inline
ME_DisplayItem
*
para_get_di
(
ME_Paragraph
*
para
)
{
return
(
ME_DisplayItem
*
)((
ptrdiff_t
)
para
-
offsetof
(
ME_DisplayItem
,
member
));
...
...
dlls/riched20/para.c
View file @
468609ae
...
...
@@ -116,6 +116,11 @@ ME_Run *para_first_run( ME_Paragraph *para )
return
NULL
;
}
ME_Run
*
para_end_run
(
ME_Paragraph
*
para
)
{
return
para
->
eop_run
;
}
void
ME_MakeFirstParagraph
(
ME_TextEditor
*
editor
)
{
static
const
WCHAR
cr_lf
[]
=
{
'\r'
,
'\n'
,
0
};
...
...
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