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
eee54d95
Commit
eee54d95
authored
Aug 23, 2005
by
Phil Krylov
Committed by
Alexandre Julliard
Aug 23, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a RichEdit RTF reader bug which resulted in loss of text.
Eliminated unneeded recursion in ME_InsertTextFromCursor().
parent
f6f63a8f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
34 deletions
+38
-34
caret.c
dlls/riched20/caret.c
+37
-32
reader.c
dlls/riched20/reader.c
+1
-2
No files found.
dlls/riched20/caret.c
View file @
eee54d95
...
...
@@ -325,6 +325,28 @@ void ME_InsertGraphicsFromCursor(ME_TextEditor *editor, int nCursor)
ME_SendSelChange
(
editor
);
}
static
void
ME_InternalInsertTextFromCursor
(
ME_TextEditor
*
editor
,
int
nCursor
,
const
WCHAR
*
str
,
int
len
,
ME_Style
*
style
,
int
flags
)
{
ME_DisplayItem
*
pNewRun
=
NULL
;
ME_Cursor
*
p
=
&
editor
->
pCursors
[
nCursor
];
editor
->
bCaretAtEnd
=
FALSE
;
assert
(
p
->
pRun
->
type
==
diRun
);
ME_AddRefStyle
(
style
);
pNewRun
=
ME_MakeRun
(
style
,
ME_MakeStringN
(
str
,
len
),
flags
);
/* addrefs style */
ME_InsertRun
(
editor
,
ME_CharOfsFromRunOfs
(
editor
,
p
->
pRun
,
p
->
nOffset
),
pNewRun
);
ME_DestroyDisplayItem
(
pNewRun
);
ME_ReleaseStyle
(
style
);
}
void
ME_InsertTextFromCursor
(
ME_TextEditor
*
editor
,
int
nCursor
,
const
WCHAR
*
str
,
int
len
,
ME_Style
*
style
)
{
...
...
@@ -332,9 +354,6 @@ void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor,
ME_Cursor
*
p
=
NULL
;
assert
(
style
);
editor
->
bCaretAtEnd
=
FALSE
;
ME_AddRefStyle
(
style
);
/* FIXME really HERE ? */
if
(
ME_IsSelection
(
editor
))
...
...
@@ -343,37 +362,33 @@ void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor,
assert
(
nCursor
>=
0
&&
nCursor
<
editor
->
nCursors
);
if
(
len
==
-
1
)
len
=
lstrlenW
(
str
);
while
(
len
)
{
pos
=
str
;
/* FIXME this sucks - no respect for unicode (what else can be a line separator in unicode?) */
while
(
pos
-
str
<
len
&&
*
pos
!=
'\r'
&&
*
pos
!=
'\n'
&&
*
pos
!=
'\t'
)
pos
++
;
if
(
pos
-
str
<
len
&&
*
pos
==
'\t'
)
{
/* handle tabs */
ME_DisplayItem
*
pNewRun
=
NULL
;
WCHAR
tab
=
'\t'
;
if
(
pos
!=
str
)
ME_InsertTextFromCursor
(
editor
,
nCursor
,
str
,
pos
-
str
,
style
);
ME_InternalInsertTextFromCursor
(
editor
,
nCursor
,
str
,
pos
-
str
,
style
,
0
);
p
=
&
editor
->
pCursors
[
nCursor
];
assert
(
style
);
assert
(
p
->
pRun
->
type
==
diRun
);
pNewRun
=
ME_MakeRun
(
style
,
ME_MakeStringN
(
&
tab
,
1
),
MERF_TAB
);
/* addrefs style */
ME_InsertRun
(
editor
,
ME_CharOfsFromRunOfs
(
editor
,
p
->
pRun
,
p
->
nOffset
),
pNewRun
);
ME_DestroyDisplayItem
(
pNewRun
);
ME_ReleaseStyle
(
style
);
ME_InternalInsertTextFromCursor
(
editor
,
nCursor
,
&
tab
,
1
,
style
,
MERF_TAB
);
pos
++
;
if
(
pos
-
str
<
len
)
{
ME_InsertTextFromCursor
(
editor
,
nCursor
,
pos
,
len
-
(
pos
-
str
),
style
);
if
(
pos
-
str
<=
len
)
{
len
-=
pos
-
str
;
str
=
pos
;
continue
;
}
return
;
}
if
(
pos
-
str
<
len
)
{
/* handle EOLs */
ME_DisplayItem
*
tp
,
*
end_run
;
ME_Paragraph
*
para
;
ME_Style
*
tmp_style
;
if
(
pos
!=
str
)
ME_InsertTextFromCursor
(
editor
,
nCursor
,
str
,
pos
-
str
,
style
);
ME_InternalInsertTextFromCursor
(
editor
,
nCursor
,
str
,
pos
-
str
,
style
,
0
);
p
=
&
editor
->
pCursors
[
nCursor
];
tp
=
ME_FindItemBack
(
p
->
pRun
,
diParagraph
);
para
=
&
tp
->
member
.
para
;
...
...
@@ -394,24 +409,14 @@ void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor,
pos
++
;
if
(
pos
-
str
<
len
&&
*
pos
==
'\n'
)
pos
++
;
if
(
pos
-
str
<
len
)
{
ME_InsertTextFromCursor
(
editor
,
nCursor
,
pos
,
len
-
(
pos
-
str
),
style
);
if
(
pos
-
str
<=
len
)
{
len
-=
pos
-
str
;
str
=
pos
;
continue
;
}
ME_ReleaseStyle
(
style
);
return
;
}
p
=
&
editor
->
pCursors
[
nCursor
];
if
(
style
)
{
ME_DisplayItem
*
pNewRun
=
NULL
;
assert
(
p
->
pRun
->
type
==
diRun
);
pNewRun
=
ME_MakeRun
(
style
,
ME_MakeStringN
(
str
,
len
),
0
);
/* addrefs style */
ME_InsertRun
(
editor
,
ME_CharOfsFromRunOfs
(
editor
,
p
->
pRun
,
p
->
nOffset
),
pNewRun
);
ME_DestroyDisplayItem
(
pNewRun
);
ME_ReleaseStyle
(
style
);
return
;
}
else
{
assert
(
0
);
ME_InternalInsertTextFromCursor
(
editor
,
nCursor
,
str
,
len
,
style
,
0
);
len
=
0
;
}
}
...
...
dlls/riched20/reader.c
View file @
eee54d95
...
...
@@ -2739,10 +2739,9 @@ RTFPutUnicodeString(RTF_Info *info, WCHAR *string, int length)
int
fit
=
min
(
length
,
sizeof
(
info
->
OutputBuffer
)
/
sizeof
(
WCHAR
)
-
info
->
dwOutputCount
);
memmove
(
info
->
OutputBuffer
+
info
->
dwOutputCount
,
string
,
fit
*
sizeof
(
WCHAR
));
info
->
dwOutputCount
+=
fit
;
if
(
fit
==
sizeof
(
info
->
OutputBuffer
)
/
sizeof
(
WCHAR
)
-
info
->
dwOutputCount
)
RTFFlushUnicodeOutputBuffer
(
info
);
else
info
->
dwOutputCount
+=
fit
;
length
-=
fit
;
string
+=
fit
;
}
...
...
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