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
d47f6619
Commit
d47f6619
authored
Apr 26, 2008
by
Alex Villacís Lasso
Committed by
Alexandre Julliard
Apr 29, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: Add support for encoding number of CR and LF contained within a line break.
parent
09af64cb
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
10 deletions
+35
-10
caret.c
dlls/riched20/caret.c
+9
-1
editor.h
dlls/riched20/editor.h
+1
-1
editstr.h
dlls/riched20/editstr.h
+2
-0
list.c
dlls/riched20/list.c
+2
-0
para.c
dlls/riched20/para.c
+16
-7
undo.c
dlls/riched20/undo.c
+5
-1
No files found.
dlls/riched20/caret.c
View file @
d47f6619
...
...
@@ -531,7 +531,15 @@ void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor,
}
tmp_style
=
ME_GetInsertStyle
(
editor
,
nCursor
);
/* ME_SplitParagraph increases style refcount */
tp
=
ME_SplitParagraph
(
editor
,
p
->
pRun
,
p
->
pRun
->
member
.
run
.
style
);
/* TODO: move here and fix logic for pos updating according to emulation,
so that number of CR and LF encoded are a result of such logic, instead
of hardcoded as below.
*/
if
(
editor
->
bEmulateVersion10
)
tp
=
ME_SplitParagraph
(
editor
,
p
->
pRun
,
p
->
pRun
->
member
.
run
.
style
,
1
,
1
);
else
tp
=
ME_SplitParagraph
(
editor
,
p
->
pRun
,
p
->
pRun
->
member
.
run
.
style
,
1
,
0
);
p
->
pRun
=
ME_FindItemFwd
(
tp
,
diRun
);
end_run
=
ME_FindItemBack
(
tp
,
diRun
);
ME_ReleaseStyle
(
end_run
->
member
.
run
.
style
);
...
...
dlls/riched20/editor.h
View file @
d47f6619
...
...
@@ -220,7 +220,7 @@ int ME_twips2pointsY(ME_Context *c, int y);
ME_DisplayItem
*
ME_GetParagraph
(
ME_DisplayItem
*
run
);
void
ME_GetSelectionParas
(
ME_TextEditor
*
editor
,
ME_DisplayItem
**
para
,
ME_DisplayItem
**
para_end
);
void
ME_MakeFirstParagraph
(
ME_TextEditor
*
editor
);
ME_DisplayItem
*
ME_SplitParagraph
(
ME_TextEditor
*
editor
,
ME_DisplayItem
*
rp
,
ME_Style
*
style
);
ME_DisplayItem
*
ME_SplitParagraph
(
ME_TextEditor
*
editor
,
ME_DisplayItem
*
rp
,
ME_Style
*
style
,
int
numCR
,
int
numLF
);
ME_DisplayItem
*
ME_JoinParagraphs
(
ME_TextEditor
*
editor
,
ME_DisplayItem
*
tp
);
void
ME_DumpParaStyle
(
ME_Paragraph
*
s
);
void
ME_DumpParaStyleToBuf
(
const
PARAFORMAT2
*
pFmt
,
char
buf
[
2048
]);
...
...
dlls/riched20/editstr.h
View file @
d47f6619
...
...
@@ -148,6 +148,7 @@ typedef struct tagME_Run
POINT
pt
;
/* relative to para's position */
struct
tagME_TableCell
*
pCell
;
/* for MERF_CELL: points to respective cell in ME_Paragraph */
REOBJECT
*
ole_obj
;
/* FIXME: should be a union with strText (at least) */
int
nCR
;
int
nLF
;
/* for MERF_ENDPARA: number of \r and \n characters encoded by run */
}
ME_Run
;
typedef
struct
tagME_Document
{
...
...
@@ -217,6 +218,7 @@ typedef struct tagME_UndoItem
{
ME_DisplayItem
di
;
int
nStart
,
nLen
;
int
nCR
,
nLF
;
/* used by diUndoSplitParagraph */
}
ME_UndoItem
;
typedef
struct
tagME_TextBuffer
...
...
dlls/riched20/list.c
View file @
d47f6619
...
...
@@ -200,6 +200,8 @@ void ME_DumpDocument(ME_TextBuffer *buffer)
case
diRun
:
TRACE
(
" - Run(
\"
%s
\"
, %d)
\n
"
,
debugstr_w
(
pItem
->
member
.
run
.
strText
->
szData
),
pItem
->
member
.
run
.
nCharOfs
);
if
(
pItem
->
member
.
run
.
nFlags
&
MERF_ENDPARA
)
TRACE
(
" - Paragraph end: %d CR, %d LF
\n
"
,
pItem
->
member
.
run
.
nCR
,
pItem
->
member
.
run
.
nLF
);
break
;
case
diTextEnd
:
TRACE
(
"End(ofs=%d)
\n
"
,
pItem
->
member
.
para
.
nCharOfs
);
...
...
dlls/riched20/para.c
View file @
d47f6619
...
...
@@ -110,7 +110,7 @@ void ME_MarkForPainting(ME_TextEditor *editor, ME_DisplayItem *first, const ME_D
}
/* split paragraph at the beginning of the run */
ME_DisplayItem
*
ME_SplitParagraph
(
ME_TextEditor
*
editor
,
ME_DisplayItem
*
run
,
ME_Style
*
style
)
ME_DisplayItem
*
ME_SplitParagraph
(
ME_TextEditor
*
editor
,
ME_DisplayItem
*
run
,
ME_Style
*
style
,
int
numCR
,
int
numLF
)
{
ME_DisplayItem
*
next_para
=
NULL
;
ME_DisplayItem
*
run_para
=
NULL
;
...
...
@@ -119,10 +119,12 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run, ME
ME_UndoItem
*
undo
=
NULL
;
int
ofs
;
ME_DisplayItem
*
pp
;
int
end_len
=
(
editor
->
bEmulateVersion10
?
2
:
1
)
;
int
end_len
=
numCR
+
numLF
;
assert
(
run
->
type
==
diRun
);
end_run
->
member
.
run
.
nCR
=
numCR
;
end_run
->
member
.
run
.
nLF
=
numLF
;
run_para
=
ME_GetParagraph
(
run
);
assert
(
run_para
->
member
.
para
.
pFmt
->
cbSize
==
sizeof
(
PARAFORMAT2
));
...
...
@@ -204,7 +206,7 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp)
ME_DisplayItem
*
pNext
,
*
pFirstRunInNext
,
*
pRun
,
*
pTmp
;
int
i
,
shift
;
ME_UndoItem
*
undo
=
NULL
;
int
end_len
=
(
editor
->
bEmulateVersion10
?
2
:
1
)
;
int
end_len
;
assert
(
tp
->
type
==
diParagraph
);
assert
(
tp
->
member
.
para
.
next_para
);
...
...
@@ -212,6 +214,15 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp)
pNext
=
tp
->
member
.
para
.
next_para
;
/* Need to locate end-of-paragraph run here, in order to know end_len */
pRun
=
ME_FindItemBack
(
pNext
,
diRunOrParagraph
);
assert
(
pRun
);
assert
(
pRun
->
type
==
diRun
);
assert
(
pRun
->
member
.
run
.
nFlags
&
MERF_ENDPARA
);
end_len
=
pRun
->
member
.
run
.
nCR
+
pRun
->
member
.
run
.
nLF
;
{
/* null char format operation to store the original char format for the ENDPARA run */
CHARFORMAT2W
fmt
;
...
...
@@ -222,18 +233,16 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp)
if
(
undo
)
{
undo
->
nStart
=
pNext
->
member
.
para
.
nCharOfs
-
end_len
;
undo
->
nCR
=
pRun
->
member
.
run
.
nCR
;
undo
->
nLF
=
pRun
->
member
.
run
.
nLF
;
assert
(
pNext
->
member
.
para
.
pFmt
->
cbSize
==
sizeof
(
PARAFORMAT2
));
*
undo
->
di
.
member
.
para
.
pFmt
=
*
pNext
->
member
.
para
.
pFmt
;
}
shift
=
pNext
->
member
.
para
.
nCharOfs
-
tp
->
member
.
para
.
nCharOfs
-
end_len
;
pRun
=
ME_FindItemBack
(
pNext
,
diRunOrParagraph
);
pFirstRunInNext
=
ME_FindItemFwd
(
pNext
,
diRunOrParagraph
);
assert
(
pRun
);
assert
(
pRun
->
type
==
diRun
);
assert
(
pRun
->
member
.
run
.
nFlags
&
MERF_ENDPARA
);
assert
(
pFirstRunInNext
->
type
==
diRun
);
/* if some cursor points at end of paragraph, make it point to the first
...
...
dlls/riched20/undo.c
View file @
d47f6619
...
...
@@ -56,6 +56,7 @@ ME_UndoItem *ME_AddUndoItem(ME_TextEditor *editor, ME_DIType type, const ME_Disp
else
{
ME_DisplayItem
*
pItem
=
(
ME_DisplayItem
*
)
ALLOC_OBJ
(
ME_UndoItem
);
((
ME_UndoItem
*
)
pItem
)
->
nCR
=
((
ME_UndoItem
*
)
pItem
)
->
nLF
=
-
1
;
switch
(
type
)
{
case
diUndoEndTransaction
:
...
...
@@ -225,7 +226,10 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, ME_DisplayItem *pItem)
ME_CursorFromCharOfs
(
editor
,
pUItem
->
nStart
,
&
tmp
);
if
(
tmp
.
nOffset
)
tmp
.
pRun
=
ME_SplitRunSimple
(
editor
,
tmp
.
pRun
,
tmp
.
nOffset
);
new_para
=
ME_SplitParagraph
(
editor
,
tmp
.
pRun
,
tmp
.
pRun
->
member
.
run
.
style
);
assert
(
pUItem
->
nCR
>=
0
);
assert
(
pUItem
->
nLF
>=
0
);
new_para
=
ME_SplitParagraph
(
editor
,
tmp
.
pRun
,
tmp
.
pRun
->
member
.
run
.
style
,
pUItem
->
nCR
,
pUItem
->
nLF
);
assert
(
pItem
->
member
.
para
.
pFmt
->
cbSize
==
sizeof
(
PARAFORMAT2
));
*
new_para
->
member
.
para
.
pFmt
=
*
pItem
->
member
.
para
.
pFmt
;
break
;
...
...
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