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
579618c0
Commit
579618c0
authored
Oct 14, 2020
by
Huw Davies
Committed by
Alexandre Julliard
Oct 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Return a run ptr from the run insert function.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1797d212
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
28 deletions
+35
-28
caret.c
dlls/riched20/caret.c
+1
-1
editor.h
dlls/riched20/editor.h
+3
-2
run.c
dlls/riched20/run.c
+28
-21
undo.c
dlls/riched20/undo.c
+3
-4
No files found.
dlls/riched20/caret.c
View file @
579618c0
...
...
@@ -471,7 +471,7 @@ ME_InternalInsertTextFromCursor(ME_TextEditor *editor, int nCursor,
assert
(
p
->
pRun
->
type
==
diRun
);
return
ME_InsertRunAtCursor
(
editor
,
p
,
style
,
str
,
len
,
flags
);
return
run_get_di
(
run_insert
(
editor
,
p
,
style
,
str
,
len
,
flags
)
);
}
static
struct
re_object
*
create_re_object
(
const
REOBJECT
*
reo
)
...
...
dlls/riched20/editor.h
View file @
579618c0
...
...
@@ -119,8 +119,8 @@ int ME_RowNumberFromCharOfs(ME_TextEditor *editor, int nOfs) DECLSPEC_HIDDEN;
/* run.c */
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
;
ME_
Run
*
run_insert
(
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
;
void
ME_PropagateCharOffset
(
ME_DisplayItem
*
p
,
int
shift
)
DECLSPEC_HIDDEN
;
/* this one accounts for 1/2 char tolerance */
...
...
@@ -133,6 +133,7 @@ void run_join( ME_TextEditor *editor, ME_Run *run ) DECLSPEC_HIDDEN;
ME_Run
*
run_next
(
ME_Run
*
run
)
DECLSPEC_HIDDEN
;
ME_Run
*
run_next_all_paras
(
ME_Run
*
run
)
DECLSPEC_HIDDEN
;
ME_Run
*
run_prev
(
ME_Run
*
run
)
DECLSPEC_HIDDEN
;
ME_Run
*
run_prev_all_paras
(
ME_Run
*
run
)
DECLSPEC_HIDDEN
;
ME_Run
*
run_split
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
)
DECLSPEC_HIDDEN
;
void
ME_UpdateRunFlags
(
ME_TextEditor
*
editor
,
ME_Run
*
run
)
DECLSPEC_HIDDEN
;
SIZE
ME_GetRunSizeCommon
(
ME_Context
*
c
,
const
ME_Paragraph
*
para
,
ME_Run
*
run
,
int
nLen
,
...
...
dlls/riched20/run.c
View file @
579618c0
...
...
@@ -57,6 +57,16 @@ ME_Run *run_next_all_paras( ME_Run *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
);
if
(
ME_PrevRun
(
&
dummy
,
&
item
,
TRUE
))
return
&
item
->
member
.
run
;
return
NULL
;
}
/******************************************************************************
* ME_CanJoinRuns
*
...
...
@@ -347,56 +357,53 @@ ME_Run *run_create( ME_Style *s, int flags )
}
/******************************************************************************
*
ME_InsertRunAtCursor
*
run_insert
*
* Inserts a new run with given style, flags and content at a given position,
* which is passed as a cursor structure (which consists of a run and
* a run-relative character offset).
*/
ME_DisplayItem
*
ME_InsertRunAtCursor
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
,
ME_Style
*
style
,
const
WCHAR
*
str
,
int
len
,
int
flags
)
ME_Run
*
run_insert
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
,
ME_Style
*
style
,
const
WCHAR
*
str
,
int
len
,
int
flags
)
{
ME_DisplayItem
*
insert_before
=
cursor
->
pRun
,
*
prev
;
ME_Run
*
run
;
ME_Run
*
insert_before
=
&
cursor
->
pRun
->
member
.
run
,
*
run
,
*
prev
;
if
(
cursor
->
nOffset
)
{
if
(
cursor
->
nOffset
==
cursor
->
pRun
->
member
.
run
.
len
)
if
(
cursor
->
nOffset
==
insert_before
->
len
)
{
insert_before
=
ME_FindItemFwd
(
cursor
->
pRun
,
diRun
);
if
(
!
insert_before
)
insert_before
=
cursor
->
pR
un
;
/* Always insert before the final eop run */
insert_before
=
run_next_all_paras
(
insert_before
);
if
(
!
insert_before
)
insert_before
=
&
cursor
->
pRun
->
member
.
r
un
;
/* Always insert before the final eop run */
}
else
{
run_split
(
editor
,
cursor
);
insert_before
=
cursor
->
pR
un
;
insert_before
=
&
cursor
->
pRun
->
member
.
r
un
;
}
}
add_undo_delete_run
(
editor
,
insert_before
->
member
.
run
.
para
->
nCharOfs
+
insert_before
->
member
.
run
.
nCharOfs
,
len
);
add_undo_delete_run
(
editor
,
insert_before
->
para
->
nCharOfs
+
insert_before
->
nCharOfs
,
len
);
run
=
run_create
(
style
,
flags
);
run
->
nCharOfs
=
insert_before
->
member
.
run
.
nCharOfs
;
run
->
nCharOfs
=
insert_before
->
nCharOfs
;
run
->
len
=
len
;
run
->
para
=
insert_before
->
member
.
run
.
para
;
run
->
para
=
insert_before
->
para
;
ME_InsertString
(
run
->
para
->
text
,
run
->
nCharOfs
,
str
,
len
);
ME_InsertBefore
(
insert_before
,
run_get_di
(
run
)
);
ME_InsertBefore
(
run_get_di
(
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
);
ME_PropagateCharOffset
(
run_get_di
(
insert_before
)
,
len
);
para_mark_rewrap
(
editor
,
insert_before
->
para
);
/* Move any cursors that were at the end of the previous run to the end of the inserted run */
prev
=
ME_FindItemBack
(
run_get_di
(
run
),
diR
un
);
prev
=
run_prev_all_paras
(
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
].
pRun
=
run_get_di
(
run
);
editor
->
pCursors
[
i
].
nOffset
=
len
;
...
...
@@ -404,7 +411,7 @@ ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style,
}
}
return
run
_get_di
(
run
)
;
return
run
;
}
static
BOOL
run_is_splittable
(
const
ME_Run
*
run
)
...
...
dlls/riched20/undo.c
View file @
579618c0
...
...
@@ -357,10 +357,9 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
{
ME_Cursor
tmp
;
ME_CursorFromCharOfs
(
editor
,
undo
->
u
.
insert_run
.
pos
,
&
tmp
);
ME_InsertRunAtCursor
(
editor
,
&
tmp
,
undo
->
u
.
insert_run
.
style
,
undo
->
u
.
insert_run
.
str
,
undo
->
u
.
insert_run
.
len
,
undo
->
u
.
insert_run
.
flags
);
run_insert
(
editor
,
&
tmp
,
undo
->
u
.
insert_run
.
style
,
undo
->
u
.
insert_run
.
str
,
undo
->
u
.
insert_run
.
len
,
undo
->
u
.
insert_run
.
flags
);
break
;
}
case
undo_delete_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