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
7a27ffb2
Commit
7a27ffb2
authored
Jan 22, 2013
by
Huw Davies
Committed by
Alexandre Julliard
Jan 22, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Avoid an unnecessary string duplication.
parent
2cb3df60
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
18 deletions
+9
-18
caret.c
dlls/riched20/caret.c
+8
-17
undo.c
dlls/riched20/undo.c
+1
-1
No files found.
dlls/riched20/caret.c
View file @
7a27ffb2
...
...
@@ -361,6 +361,7 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
else
{
ME_Cursor
cursor
;
ME_UndoItem
*
undo
;
int
nCharsToDelete
=
min
(
nChars
,
c
.
nOffset
);
int
i
;
...
...
@@ -378,25 +379,15 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
nCharsToDelete
,
nChars
,
c
.
nOffset
,
debugstr_w
(
run
->
strText
->
szData
),
run
->
strText
->
nLen
);
if
(
!
c
.
nOffset
&&
run
->
strText
->
nLen
==
nCharsToDelete
)
undo
=
ME_AddUndoItem
(
editor
,
diUndoInsertRun
,
c
.
pRun
);
if
(
undo
)
{
/* undo = reinsert whole run */
/* nOfs is a character offset (from the start of the document
to the current (deleted) run */
ME_UndoItem
*
pUndo
=
ME_AddUndoItem
(
editor
,
diUndoInsertRun
,
c
.
pRun
);
if
(
pUndo
)
pUndo
->
di
.
member
.
run
.
nCharOfs
=
nOfs
+
nChars
;
}
else
{
/* undo = reinsert partial run */
ME_UndoItem
*
pUndo
=
ME_AddUndoItem
(
editor
,
diUndoInsertRun
,
c
.
pRun
);
if
(
pUndo
)
{
ME_DestroyString
(
pUndo
->
di
.
member
.
run
.
strText
);
pUndo
->
di
.
member
.
run
.
nCharOfs
=
nOfs
+
nChars
;
pUndo
->
di
.
member
.
run
.
strText
=
ME_MakeStringN
(
run
->
strText
->
szData
+
c
.
nOffset
,
nCharsToDelete
);
}
/* nOfs is a character offset (from the start of the document
to the current (deleted) run */
undo
->
di
.
member
.
run
.
nCharOfs
=
nOfs
+
nChars
;
undo
->
di
.
member
.
run
.
strText
=
ME_MakeStringN
(
run
->
strText
->
szData
+
c
.
nOffset
,
nCharsToDelete
);
}
TRACE
(
"Post deletion string: %s (%d)
\n
"
,
debugstr_w
(
run
->
strText
->
szData
),
run
->
strText
->
nLen
);
TRACE
(
"Shift value: %d
\n
"
,
shift
);
ME_StrDeleteV
(
run
->
strText
,
c
.
nOffset
,
nCharsToDelete
);
...
...
dlls/riched20/undo.c
View file @
7a27ffb2
...
...
@@ -73,7 +73,7 @@ ME_UndoItem *ME_AddUndoItem(ME_TextEditor *editor, ME_DIType type, const ME_Disp
case
diUndoInsertRun
:
assert
(
pdi
);
pItem
->
member
.
run
=
pdi
->
member
.
run
;
pItem
->
member
.
run
.
strText
=
ME_StrDup
(
pItem
->
member
.
run
.
strText
)
;
pItem
->
member
.
run
.
strText
=
NULL
;
ME_AddRefStyle
(
pItem
->
member
.
run
.
style
);
if
(
pdi
->
member
.
run
.
ole_obj
)
{
...
...
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