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
86f077b1
Commit
86f077b1
authored
Jan 31, 2013
by
Huw Davies
Committed by
Alexandre Julliard
Jan 31, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Add an explicit run length member and use it rather than accessing the string length.
parent
f24ba125
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
78 additions
and
78 deletions
+78
-78
caret.c
dlls/riched20/caret.c
+21
-21
editor.c
dlls/riched20/editor.c
+16
-16
editstr.h
dlls/riched20/editstr.h
+1
-0
paint.c
dlls/riched20/paint.c
+2
-2
para.c
dlls/riched20/para.c
+1
-1
run.c
dlls/riched20/run.c
+25
-26
table.c
dlls/riched20/table.c
+2
-2
undo.c
dlls/riched20/undo.c
+1
-1
wrap.c
dlls/riched20/wrap.c
+6
-6
writer.c
dlls/riched20/writer.c
+3
-3
No files found.
dlls/riched20/caret.c
View file @
86f077b1
...
...
@@ -236,7 +236,7 @@ ME_GetCursorCoordinates(ME_TextEditor *editor, ME_Cursor *pCursor,
assert
(
run
);
assert
(
run
->
type
==
diRun
);
sz
=
ME_GetRunSize
(
&
c
,
&
para
->
member
.
para
,
&
run
->
member
.
run
,
run
->
member
.
run
.
strText
->
nL
en
,
&
run
->
member
.
run
,
run
->
member
.
run
.
l
en
,
row
->
member
.
row
.
nLMargin
);
}
}
...
...
@@ -317,11 +317,11 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
/* We aren't deleting anything in this run, so we will go back to the
* last run we are deleting text in. */
ME_PrevRun
(
&
c
.
pPara
,
&
c
.
pRun
);
c
.
nOffset
=
c
.
pRun
->
member
.
run
.
strText
->
nL
en
;
c
.
nOffset
=
c
.
pRun
->
member
.
run
.
l
en
;
}
run
=
&
c
.
pRun
->
member
.
run
;
if
(
run
->
nFlags
&
MERF_ENDPARA
)
{
int
eollen
=
c
.
pRun
->
member
.
run
.
strText
->
nL
en
;
int
eollen
=
c
.
pRun
->
member
.
run
.
l
en
;
BOOL
keepFirstParaFormat
;
if
(
!
ME_FindItemFwd
(
c
.
pRun
,
diParagraph
))
...
...
@@ -376,15 +376,16 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
shift
-=
nCharsToDelete
;
TRACE
(
"Deleting %d (remaning %d) chars at %d in %s (%d)
\n
"
,
nCharsToDelete
,
nChars
,
c
.
nOffset
,
debugstr_run
(
run
),
run
->
strText
->
nL
en
);
debugstr_run
(
run
),
run
->
l
en
);
/* nOfs is a character offset (from the start of the document
to the current (deleted) run */
add_undo_insert_run
(
editor
,
nOfs
+
nChars
,
get_text
(
run
,
c
.
nOffset
),
nCharsToDelete
,
run
->
nFlags
,
run
->
style
);
TRACE
(
"Post deletion string: %s (%d)
\n
"
,
debugstr_run
(
run
),
run
->
strText
->
nLen
);
TRACE
(
"Shift value: %d
\n
"
,
shift
);
ME_StrDeleteV
(
run
->
strText
,
c
.
nOffset
,
nCharsToDelete
);
run
->
len
-=
nCharsToDelete
;
TRACE
(
"Post deletion string: %s (%d)
\n
"
,
debugstr_run
(
run
),
run
->
len
);
TRACE
(
"Shift value: %d
\n
"
,
shift
);
/* update cursors (including c) */
for
(
i
=-
1
;
i
<
editor
->
nCursors
;
i
++
)
{
...
...
@@ -397,9 +398,9 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
else
pThisCur
->
nOffset
-=
nCharsToDelete
;
assert
(
pThisCur
->
nOffset
>=
0
);
assert
(
pThisCur
->
nOffset
<=
run
->
strText
->
nL
en
);
assert
(
pThisCur
->
nOffset
<=
run
->
l
en
);
}
if
(
pThisCur
->
nOffset
==
run
->
strText
->
nL
en
)
if
(
pThisCur
->
nOffset
==
run
->
l
en
)
{
pThisCur
->
pRun
=
ME_FindItemFwd
(
pThisCur
->
pRun
,
diRunOrParagraphOrEnd
);
assert
(
pThisCur
->
pRun
->
type
==
diRun
);
...
...
@@ -415,9 +416,9 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
else
ME_PropagateCharOffset
(
c
.
pRun
,
shift
);
if
(
!
cursor
.
pRun
->
member
.
run
.
strText
->
nL
en
)
if
(
!
cursor
.
pRun
->
member
.
run
.
l
en
)
{
TRACE
(
"Removing
useless
run
\n
"
);
TRACE
(
"Removing
empty
run
\n
"
);
ME_Remove
(
cursor
.
pRun
);
ME_DestroyDisplayItem
(
cursor
.
pRun
);
}
...
...
@@ -625,7 +626,7 @@ int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
cursor
->
pRun
=
ME_FindItemBack
(
cursor
->
pRun
,
diRun
);
}
cursor
->
nOffset
-=
cursor
->
pRun
->
member
.
run
.
nCharOfs
;
}
else
if
(
cursor
->
nOffset
>=
cursor
->
pRun
->
member
.
run
.
strText
->
nL
en
)
{
}
else
if
(
cursor
->
nOffset
>=
cursor
->
pRun
->
member
.
run
.
l
en
)
{
ME_DisplayItem
*
next_para
;
int
new_offset
;
...
...
@@ -635,9 +636,9 @@ int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
{
/* new offset in the same paragraph */
do
{
cursor
->
nOffset
-=
cursor
->
pRun
->
member
.
run
.
strText
->
nL
en
;
cursor
->
nOffset
-=
cursor
->
pRun
->
member
.
run
.
l
en
;
cursor
->
pRun
=
ME_FindItemFwd
(
cursor
->
pRun
,
diRun
);
}
while
(
cursor
->
nOffset
>=
cursor
->
pRun
->
member
.
run
.
strText
->
nL
en
);
}
while
(
cursor
->
nOffset
>=
cursor
->
pRun
->
member
.
run
.
l
en
);
return
nRelOfs
;
}
...
...
@@ -657,9 +658,9 @@ int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
cursor
->
nOffset
=
new_offset
-
cursor
->
pPara
->
member
.
para
.
nCharOfs
;
cursor
->
pRun
=
ME_FindItemFwd
(
cursor
->
pPara
,
diRun
);
while
(
cursor
->
nOffset
>=
cursor
->
pRun
->
member
.
run
.
strText
->
nL
en
)
while
(
cursor
->
nOffset
>=
cursor
->
pRun
->
member
.
run
.
l
en
)
{
cursor
->
nOffset
-=
cursor
->
pRun
->
member
.
run
.
strText
->
nL
en
;
cursor
->
nOffset
-=
cursor
->
pRun
->
member
.
run
.
l
en
;
cursor
->
pRun
=
ME_FindItemFwd
(
cursor
->
pRun
,
diRun
);
}
}
/* else new offset is in the same run */
...
...
@@ -687,7 +688,7 @@ ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
if
(
pOtherRun
->
type
==
diRun
)
{
if
(
ME_CallWordBreakProc
(
editor
,
pOtherRun
->
member
.
run
.
strText
,
pOtherRun
->
member
.
run
.
strText
->
nL
en
-
1
,
pOtherRun
->
member
.
run
.
l
en
-
1
,
WB_ISDELIMITER
)
&&
!
(
pRun
->
member
.
run
.
nFlags
&
MERF_ENDPARA
)
&&
!
(
cursor
->
pRun
==
pRun
&&
cursor
->
nOffset
==
0
)
...
...
@@ -695,7 +696,7 @@ ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
WB_ISDELIMITER
))
break
;
pRun
=
pOtherRun
;
nOffset
=
pOtherRun
->
member
.
run
.
strText
->
nL
en
;
nOffset
=
pOtherRun
->
member
.
run
.
l
en
;
}
else
if
(
pOtherRun
->
type
==
diParagraph
)
{
...
...
@@ -728,7 +729,7 @@ ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
break
;
nOffset
=
ME_CallWordBreakProc
(
editor
,
pRun
->
member
.
run
.
strText
,
nOffset
,
WB_MOVEWORDRIGHT
);
if
(
nOffset
<
pRun
->
member
.
run
.
strText
->
nL
en
)
if
(
nOffset
<
pRun
->
member
.
run
.
l
en
)
break
;
pOtherRun
=
ME_FindItemFwd
(
pRun
,
diRunOrParagraphOrEnd
);
if
(
pOtherRun
->
type
==
diRun
)
...
...
@@ -878,7 +879,7 @@ static BOOL ME_ReturnFoundPos(ME_TextEditor *editor, ME_DisplayItem *found,
rx
=
0
;
result
->
pRun
=
found
;
result
->
nOffset
=
ME_CharFromPointCursor
(
editor
,
rx
,
&
found
->
member
.
run
);
if
(
result
->
nOffset
==
found
->
member
.
run
.
strText
->
nL
en
&&
rx
)
if
(
result
->
nOffset
==
found
->
member
.
run
.
l
en
&&
rx
)
{
result
->
pRun
=
ME_FindItemFwd
(
result
->
pRun
,
diRun
);
result
->
nOffset
=
0
;
...
...
@@ -1199,8 +1200,7 @@ static ME_DisplayItem *ME_FindRunInRow(ME_TextEditor *editor, ME_DisplayItem *pR
if
(
x
>=
run_x
&&
x
<
run_x
+
width
)
{
int
ch
=
ME_CharFromPointCursor
(
editor
,
x
-
run_x
,
&
pNext
->
member
.
run
);
ME_String
*
s
=
pNext
->
member
.
run
.
strText
;
if
(
ch
<
s
->
nLen
)
{
if
(
ch
<
pNext
->
member
.
run
.
len
)
{
if
(
pOffset
)
*
pOffset
=
ch
;
return
pNext
;
...
...
dlls/riched20/editor.c
View file @
86f077b1
...
...
@@ -1750,7 +1750,7 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH
/* Check to see if next character is a whitespace */
if
(
flags
&
FR_WHOLEWORD
)
{
if
(
nCurStart
+
nMatched
==
pCurItem
->
member
.
run
.
strText
->
nL
en
)
if
(
nCurStart
+
nMatched
==
pCurItem
->
member
.
run
.
l
en
)
{
pNextItem
=
ME_FindItemFwd
(
pCurItem
,
diRun
);
nNextStart
=
-
nMatched
;
...
...
@@ -1774,7 +1774,7 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH
TRACE
(
"found at %d-%d
\n
"
,
cursor
.
nOffset
,
cursor
.
nOffset
+
nLen
);
return
cursor
.
nOffset
;
}
if
(
nCurStart
+
nMatched
==
pCurItem
->
member
.
run
.
strText
->
nL
en
)
if
(
nCurStart
+
nMatched
==
pCurItem
->
member
.
run
.
l
en
)
{
pCurItem
=
ME_FindItemFwd
(
pCurItem
,
diRun
);
nCurStart
=
-
nMatched
;
...
...
@@ -1786,7 +1786,7 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH
wLastChar
=
' '
;
cursor
.
nOffset
++
;
if
(
cursor
.
nOffset
==
cursor
.
pRun
->
member
.
run
.
strText
->
nL
en
)
if
(
cursor
.
nOffset
==
cursor
.
pRun
->
member
.
run
.
l
en
)
{
ME_NextRun
(
&
cursor
.
pPara
,
&
cursor
.
pRun
);
cursor
.
nOffset
=
0
;
...
...
@@ -1815,7 +1815,7 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH
if
(
nCurEnd
==
0
)
{
ME_PrevRun
(
&
pCurPara
,
&
pCurItem
);
nCurEnd
=
pCurItem
->
member
.
run
.
strText
->
nL
en
+
nMatched
;
nCurEnd
=
pCurItem
->
member
.
run
.
l
en
+
nMatched
;
}
while
(
pCurItem
&&
ME_CharCompare
(
*
get_text
(
&
pCurItem
->
member
.
run
,
nCurEnd
-
nMatched
-
1
),
...
...
@@ -1839,7 +1839,7 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH
{
pPrevItem
=
ME_FindItemBack
(
pCurItem
,
diRun
);
if
(
pPrevItem
)
nPrevEnd
=
pPrevItem
->
member
.
run
.
strText
->
nL
en
+
nMatched
;
nPrevEnd
=
pPrevItem
->
member
.
run
.
l
en
+
nMatched
;
}
if
(
pPrevItem
)
...
...
@@ -1866,7 +1866,7 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH
ME_PrevRun
(
&
pCurPara
,
&
pCurItem
);
/* Don't care about pCurItem becoming NULL here; it's already taken
* care of in the exterior loop condition */
nCurEnd
=
pCurItem
->
member
.
run
.
strText
->
nL
en
+
nMatched
;
nCurEnd
=
pCurItem
->
member
.
run
.
l
en
+
nMatched
;
}
}
if
(
pCurItem
)
...
...
@@ -1878,7 +1878,7 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH
if
(
cursor
.
nOffset
<
0
)
{
ME_PrevRun
(
&
cursor
.
pPara
,
&
cursor
.
pRun
);
cursor
.
nOffset
=
cursor
.
pRun
->
member
.
run
.
strText
->
nL
en
;
cursor
.
nOffset
=
cursor
.
pRun
->
member
.
run
.
l
en
;
}
}
}
...
...
@@ -3011,7 +3011,7 @@ static void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM
info
.
lParam
=
lParam
;
cursor
.
nOffset
=
0
;
info
.
chrg
.
cpMin
=
ME_GetCursorOfs
(
&
cursor
);
info
.
chrg
.
cpMax
=
info
.
chrg
.
cpMin
+
cursor
.
pRun
->
member
.
run
.
strText
->
nL
en
;
info
.
chrg
.
cpMax
=
info
.
chrg
.
cpMin
+
cursor
.
pRun
->
member
.
run
.
l
en
;
ITextHost_TxNotify
(
editor
->
texthost
,
info
.
nmhdr
.
code
,
&
info
);
}
}
...
...
@@ -3708,7 +3708,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
WCHAR
*
str
=
get_text
(
&
run
->
member
.
run
,
0
);
unsigned
int
nCopy
;
nCopy
=
min
(
nCharsLeft
,
run
->
member
.
run
.
strText
->
nL
en
);
nCopy
=
min
(
nCharsLeft
,
run
->
member
.
run
.
l
en
);
if
(
unicode
)
memcpy
(
dest
,
str
,
nCopy
*
sizeof
(
WCHAR
));
...
...
@@ -3755,7 +3755,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
assert
(
last_para
->
member
.
run
.
nFlags
&
MERF_ENDPARA
);
if
(
editor
->
bEmulateVersion10
&&
prev_para
&&
last_para
->
member
.
run
.
nCharOfs
==
0
&&
prev_para
->
member
.
run
.
strText
->
nL
en
==
1
&&
prev_para
->
member
.
run
.
l
en
==
1
&&
*
get_text
(
&
prev_para
->
member
.
run
,
0
)
==
'\r'
)
{
/* In 1.0 emulation, the last solitary \r at the very end of the text
...
...
@@ -3820,7 +3820,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
}
else
{
ME_DisplayItem
*
endRun
=
ME_FindItemBack
(
item_end
,
diRun
);
assert
(
endRun
&&
endRun
->
member
.
run
.
nFlags
&
MERF_ENDPARA
);
nNextLineOfs
=
item_end
->
member
.
para
.
nCharOfs
-
endRun
->
member
.
run
.
strText
->
nL
en
;
nNextLineOfs
=
item_end
->
member
.
para
.
nCharOfs
-
endRun
->
member
.
run
.
l
en
;
}
nChars
=
nNextLineOfs
-
nThisLineOfs
;
TRACE
(
"EM_LINELENGTH(%ld)==%d
\n
"
,
wParam
,
nChars
);
...
...
@@ -4604,7 +4604,7 @@ int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int buflen,
assert
(
pRun
);
pNextRun
=
ME_FindItemFwd
(
pRun
,
diRun
);
nLen
=
pRun
->
member
.
run
.
strText
->
nL
en
-
start
->
nOffset
;
nLen
=
pRun
->
member
.
run
.
l
en
-
start
->
nOffset
;
str
=
get_text
(
&
pRun
->
member
.
run
,
start
->
nOffset
);
/* No '\r' is appended to the last paragraph. */
...
...
@@ -4636,7 +4636,7 @@ int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int buflen,
pRun
=
pNextRun
;
pNextRun
=
ME_FindItemFwd
(
pRun
,
diRun
);
nLen
=
pRun
->
member
.
run
.
strText
->
nL
en
;
nLen
=
pRun
->
member
.
run
.
l
en
;
str
=
get_text
(
&
pRun
->
member
.
run
,
0
);
}
*
buffer
=
0
;
...
...
@@ -4779,7 +4779,7 @@ static BOOL ME_FindNextURLCandidate(ME_TextEditor *editor,
{
WCHAR
*
strStart
=
get_text
(
&
cursor
.
pRun
->
member
.
run
,
0
);
WCHAR
*
str
=
strStart
+
cursor
.
nOffset
;
int
nLen
=
cursor
.
pRun
->
member
.
run
.
strText
->
nL
en
-
cursor
.
nOffset
;
int
nLen
=
cursor
.
pRun
->
member
.
run
.
l
en
-
cursor
.
nOffset
;
nChars
-=
nLen
;
if
(
~
cursor
.
pRun
->
member
.
run
.
nFlags
&
MERF_ENDPARA
)
...
...
@@ -4953,9 +4953,9 @@ static BOOL ME_UpdateLinkAttribute(ME_TextEditor *editor, ME_Cursor *start, int
/* Update candidateEnd since setting character formats may split
* runs, which can cause a cursor to be at an invalid offset within
* a split run. */
while
(
candidateEnd
.
nOffset
>=
candidateEnd
.
pRun
->
member
.
run
.
strText
->
nL
en
)
while
(
candidateEnd
.
nOffset
>=
candidateEnd
.
pRun
->
member
.
run
.
l
en
)
{
candidateEnd
.
nOffset
-=
candidateEnd
.
pRun
->
member
.
run
.
strText
->
nL
en
;
candidateEnd
.
nOffset
-=
candidateEnd
.
pRun
->
member
.
run
.
l
en
;
candidateEnd
.
pRun
=
ME_FindItemFwd
(
candidateEnd
.
pRun
,
diRun
);
}
modified
=
TRUE
;
...
...
dlls/riched20/editstr.h
View file @
86f077b1
...
...
@@ -145,6 +145,7 @@ typedef struct tagME_Run
ME_Style
*
style
;
struct
tagME_Paragraph
*
para
;
/* ptr to the run's paragraph */
int
nCharOfs
;
/* relative to para's offset */
int
len
;
/* length of run's text */
int
nWidth
;
/* width of full run, width of leading&trailing ws */
int
nFlags
;
int
nAscent
,
nDescent
;
/* pixels above/below baseline */
...
...
dlls/riched20/paint.c
View file @
86f077b1
...
...
@@ -425,7 +425,7 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa
{
if
(
c
->
editor
->
cPasswordMask
)
{
ME_String
*
szMasked
=
ME_MakeStringR
(
c
->
editor
->
cPasswordMask
,
run
->
strText
->
nL
en
);
ME_String
*
szMasked
=
ME_MakeStringR
(
c
->
editor
->
cPasswordMask
,
run
->
l
en
);
ME_DrawTextWithStyle
(
c
,
x
,
y
,
szMasked
->
szData
,
szMasked
->
nLen
,
run
->
style
,
run
->
nWidth
,
nSelFrom
-
runofs
,
nSelTo
-
runofs
,
...
...
@@ -435,7 +435,7 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa
}
else
ME_DrawTextWithStyle
(
c
,
x
,
y
,
get_text
(
run
,
0
),
run
->
strText
->
nL
en
,
run
->
style
,
run
->
nWidth
,
get_text
(
run
,
0
),
run
->
l
en
,
run
->
style
,
run
->
nWidth
,
nSelFrom
-
runofs
,
nSelTo
-
runofs
,
c
->
pt
.
y
+
para
->
pt
.
y
+
start
->
member
.
row
.
pt
.
y
,
start
->
member
.
row
.
nHeight
);
...
...
dlls/riched20/para.c
View file @
86f077b1
...
...
@@ -341,7 +341,7 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp,
assert
(
pRun
->
type
==
diRun
);
assert
(
pRun
->
member
.
run
.
nFlags
&
MERF_ENDPARA
);
end_len
=
pRun
->
member
.
run
.
strText
->
nL
en
;
end_len
=
pRun
->
member
.
run
.
l
en
;
/* null char format operation to store the original char format for the ENDPARA run */
ME_InitCharFormat2W
(
&
fmt
);
...
...
dlls/riched20/run.c
View file @
86f077b1
...
...
@@ -123,12 +123,12 @@ void ME_CheckCharOffsets(ME_TextEditor *editor)
case
diRun
:
TRACE_
(
richedit_check
)(
"run, real ofs = %d (+ofsp = %d), counted = %d, len = %d, txt = %s, flags=%08x, fx&mask = %08x
\n
"
,
p
->
member
.
run
.
nCharOfs
,
p
->
member
.
run
.
nCharOfs
+
ofsp
,
ofsp
+
ofs
,
p
->
member
.
run
.
strText
->
nL
en
,
debugstr_run
(
&
p
->
member
.
run
),
p
->
member
.
run
.
l
en
,
debugstr_run
(
&
p
->
member
.
run
),
p
->
member
.
run
.
nFlags
,
p
->
member
.
run
.
style
->
fmt
.
dwMask
&
p
->
member
.
run
.
style
->
fmt
.
dwEffects
);
assert
(
ofs
==
p
->
member
.
run
.
nCharOfs
);
assert
(
p
->
member
.
run
.
strText
->
nL
en
);
ofs
+=
p
->
member
.
run
.
strText
->
nL
en
;
assert
(
p
->
member
.
run
.
l
en
);
ofs
+=
p
->
member
.
run
.
l
en
;
break
;
case
diCell
:
TRACE_
(
richedit_check
)(
"cell
\n
"
);
...
...
@@ -226,11 +226,12 @@ void ME_JoinRuns(ME_TextEditor *editor, ME_DisplayItem *p)
for
(
i
=
0
;
i
<
editor
->
nCursors
;
i
++
)
{
if
(
editor
->
pCursors
[
i
].
pRun
==
pNext
)
{
editor
->
pCursors
[
i
].
pRun
=
p
;
editor
->
pCursors
[
i
].
nOffset
+=
p
->
member
.
run
.
strText
->
nL
en
;
editor
->
pCursors
[
i
].
nOffset
+=
p
->
member
.
run
.
l
en
;
}
}
ME_AppendString
(
p
->
member
.
run
.
strText
,
pNext
->
member
.
run
.
strText
);
p
->
member
.
run
.
len
+=
pNext
->
member
.
run
.
len
;
ME_Remove
(
pNext
);
ME_DestroyDisplayItem
(
pNext
);
ME_UpdateRunFlags
(
editor
,
&
p
->
member
.
run
);
...
...
@@ -308,7 +309,7 @@ ME_DisplayItem *ME_SplitRunSimple(ME_TextEditor *editor, ME_Cursor *cursor)
new_run
=
ME_MakeRun
(
run
->
member
.
run
.
style
,
ME_VSplitString
(
run
->
member
.
run
.
strText
,
nOffset
),
run
->
member
.
run
.
nFlags
&
MERF_SPLITMASK
);
run
->
member
.
run
.
len
=
nOffset
;
new_run
->
member
.
run
.
nCharOfs
=
run
->
member
.
run
.
nCharOfs
+
nOffset
;
new_run
->
member
.
run
.
para
=
run
->
member
.
run
.
para
;
cursor
->
pRun
=
new_run
;
...
...
@@ -342,6 +343,7 @@ ME_DisplayItem *ME_MakeRun(ME_Style *s, ME_String *strData, int nFlags)
item
->
member
.
run
.
strText
=
strData
;
item
->
member
.
run
.
nFlags
=
nFlags
;
item
->
member
.
run
.
nCharOfs
=
-
1
;
item
->
member
.
run
.
len
=
strData
->
nLen
;
item
->
member
.
run
.
para
=
NULL
;
ME_AddRefStyle
(
s
);
return
item
;
...
...
@@ -379,10 +381,10 @@ ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style,
static
BOOL
run_is_splittable
(
const
ME_Run
*
run
)
{
WCHAR
*
str
=
get_text
(
run
,
0
),
*
p
;
int
i
,
len
=
run
->
strText
->
nLen
;
int
i
;
BOOL
found_ink
=
FALSE
;
for
(
i
=
0
,
p
=
str
;
i
<
len
;
i
++
,
p
++
)
for
(
i
=
0
,
p
=
str
;
i
<
run
->
len
;
i
++
,
p
++
)
{
if
(
ME_IsWSpace
(
*
p
))
{
...
...
@@ -397,9 +399,9 @@ static BOOL run_is_splittable( const ME_Run *run )
static
BOOL
run_is_entirely_ws
(
const
ME_Run
*
run
)
{
WCHAR
*
str
=
get_text
(
run
,
0
),
*
p
;
int
i
,
len
=
run
->
strText
->
nLen
;
int
i
;
for
(
i
=
0
,
p
=
str
;
i
<
len
;
i
++
,
p
++
)
for
(
i
=
0
,
p
=
str
;
i
<
run
->
len
;
i
++
,
p
++
)
if
(
!
ME_IsWSpace
(
*
p
))
return
FALSE
;
return
TRUE
;
...
...
@@ -439,7 +441,7 @@ void ME_UpdateRunFlags(ME_TextEditor *editor, ME_Run *run)
else
run
->
nFlags
&=
~
MERF_STARTWHITE
;
if
(
ME_IsWSpace
(
*
get_text
(
run
,
run
->
strText
->
nL
en
-
1
)
))
if
(
ME_IsWSpace
(
*
get_text
(
run
,
run
->
l
en
-
1
)
))
run
->
nFlags
|=
MERF_ENDWHITE
;
else
run
->
nFlags
&=
~
MERF_ENDWHITE
;
...
...
@@ -461,7 +463,7 @@ int ME_CharFromPoint(ME_Context *c, int cx, ME_Run *run)
int
fit
=
0
;
HGDIOBJ
hOldFont
;
SIZE
sz
;
if
(
!
run
->
strText
->
nL
en
||
cx
<=
0
)
if
(
!
run
->
l
en
||
cx
<=
0
)
return
0
;
if
(
run
->
nFlags
&
MERF_TAB
||
...
...
@@ -483,14 +485,14 @@ int ME_CharFromPoint(ME_Context *c, int cx, ME_Run *run)
if
(
c
->
editor
->
cPasswordMask
)
{
ME_String
*
strMasked
=
ME_MakeStringR
(
c
->
editor
->
cPasswordMask
,
run
->
strText
->
nL
en
);
GetTextExtentExPointW
(
c
->
hDC
,
strMasked
->
szData
,
run
->
strText
->
nL
en
,
ME_String
*
strMasked
=
ME_MakeStringR
(
c
->
editor
->
cPasswordMask
,
run
->
l
en
);
GetTextExtentExPointW
(
c
->
hDC
,
strMasked
->
szData
,
run
->
l
en
,
cx
,
&
fit
,
NULL
,
&
sz
);
ME_DestroyString
(
strMasked
);
}
else
{
GetTextExtentExPointW
(
c
->
hDC
,
get_text
(
run
,
0
),
run
->
strText
->
nL
en
,
GetTextExtentExPointW
(
c
->
hDC
,
get_text
(
run
,
0
),
run
->
l
en
,
cx
,
&
fit
,
NULL
,
&
sz
);
}
...
...
@@ -514,11 +516,11 @@ int ME_CharFromPointCursor(ME_TextEditor *editor, int cx, ME_Run *run)
{
ME_String
*
mask_text
=
NULL
;
WCHAR
*
str
;
int
fit
=
0
,
len
;
int
fit
=
0
;
ME_Context
c
;
HGDIOBJ
hOldFont
;
SIZE
sz
,
sz2
,
sz3
;
if
(
!
run
->
strText
->
nL
en
||
cx
<=
0
)
if
(
!
run
->
l
en
||
cx
<=
0
)
return
0
;
if
(
run
->
nFlags
&
(
MERF_TAB
|
MERF_ENDCELL
))
...
...
@@ -538,19 +540,18 @@ int ME_CharFromPointCursor(ME_TextEditor *editor, int cx, ME_Run *run)
return
1
;
}
len
=
run
->
strText
->
nLen
;
if
(
editor
->
cPasswordMask
)
{
mask_text
=
ME_MakeStringR
(
editor
->
cPasswordMask
,
len
);
mask_text
=
ME_MakeStringR
(
editor
->
cPasswordMask
,
run
->
len
);
str
=
mask_text
->
szData
;
}
else
str
=
get_text
(
run
,
0
);
hOldFont
=
ME_SelectStyleFont
(
&
c
,
run
->
style
);
GetTextExtentExPointW
(
c
.
hDC
,
str
,
len
,
GetTextExtentExPointW
(
c
.
hDC
,
str
,
run
->
len
,
cx
,
&
fit
,
NULL
,
&
sz
);
if
(
fit
!=
len
)
if
(
fit
!=
run
->
len
)
{
GetTextExtentPoint32W
(
c
.
hDC
,
str
,
fit
,
&
sz2
);
GetTextExtentPoint32W
(
c
.
hDC
,
str
,
fit
+
1
,
&
sz3
);
...
...
@@ -595,7 +596,6 @@ int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset)
ME_Context
c
;
ME_String
*
mask_text
=
NULL
;
WCHAR
*
str
;
int
len
;
ME_InitContext
(
&
c
,
editor
,
ITextHost_TxGetDC
(
editor
->
texthost
));
if
(
pRun
->
nFlags
&
MERF_GRAPHICS
)
...
...
@@ -608,10 +608,9 @@ int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset)
nOffset
=
0
;
}
len
=
pRun
->
strText
->
nLen
;
if
(
editor
->
cPasswordMask
)
{
mask_text
=
ME_MakeStringR
(
editor
->
cPasswordMask
,
len
);
mask_text
=
ME_MakeStringR
(
editor
->
cPasswordMask
,
pRun
->
len
);
str
=
mask_text
->
szData
;
}
else
...
...
@@ -633,7 +632,7 @@ static SIZE ME_GetRunSizeCommon(ME_Context *c, const ME_Paragraph *para, ME_Run
int
startx
,
int
*
pAscent
,
int
*
pDescent
)
{
SIZE
size
;
int
nMaxLen
=
run
->
strText
->
nL
en
;
int
nMaxLen
=
run
->
l
en
;
if
(
nLen
>
nMaxLen
)
nLen
=
nMaxLen
;
...
...
@@ -726,7 +725,7 @@ void ME_CalcRunExtent(ME_Context *c, const ME_Paragraph *para, int startx, ME_Ru
run
->
nWidth
=
0
;
else
{
int
nEnd
=
run
->
strText
->
nL
en
;
int
nEnd
=
run
->
l
en
;
SIZE
size
=
ME_GetRunSizeCommon
(
c
,
para
,
run
,
nEnd
,
startx
,
&
run
->
nAscent
,
&
run
->
nDescent
);
run
->
nWidth
=
size
.
cx
;
...
...
@@ -806,7 +805,7 @@ void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, C
/* ME_DumpStyle(new_style); */
add_undo_set_char_fmt
(
editor
,
para
->
member
.
para
.
nCharOfs
+
run
->
member
.
run
.
nCharOfs
,
run
->
member
.
run
.
strText
->
nL
en
,
&
run
->
member
.
run
.
style
->
fmt
);
run
->
member
.
run
.
l
en
,
&
run
->
member
.
run
.
style
->
fmt
);
ME_ReleaseStyle
(
run
->
member
.
run
.
style
);
run
->
member
.
run
.
style
=
new_style
;
run
=
ME_FindItemFwd
(
run
,
diRunOrParagraph
);
...
...
dlls/riched20/table.c
View file @
86f077b1
...
...
@@ -305,7 +305,7 @@ void ME_ProtectPartialTableDeletion(ME_TextEditor *editor, ME_Cursor *c, int *nC
-
end_para
->
member
.
para
.
nCharOfs
;
if
(
remaining
)
{
assert
(
remaining
<
c2
.
pRun
->
member
.
run
.
strText
->
nL
en
);
assert
(
remaining
<
c2
.
pRun
->
member
.
run
.
l
en
);
end_para
=
end_para
->
member
.
para
.
next_para
;
}
}
...
...
@@ -353,7 +353,7 @@ void ME_ProtectPartialTableDeletion(ME_TextEditor *editor, ME_Cursor *c, int *nC
{
ME_Run
*
end_run
=
&
ME_FindItemBack
(
next_para
,
diRun
)
->
member
.
run
;
int
nCharsNew
=
(
next_para
->
member
.
para
.
nCharOfs
-
nOfs
-
end_run
->
strText
->
nL
en
);
-
end_run
->
l
en
);
nCharsNew
=
max
(
nCharsNew
,
0
);
assert
(
nCharsNew
<=
*
nChars
);
*
nChars
=
nCharsNew
;
...
...
dlls/riched20/undo.c
View file @
86f077b1
...
...
@@ -187,7 +187,7 @@ BOOL add_undo_split_para( ME_TextEditor *editor, const ME_Paragraph *para, const
struct
undo_item
*
undo
=
add_undo
(
editor
,
undo_split_para
);
if
(
!
undo
)
return
FALSE
;
undo
->
u
.
split_para
.
pos
=
para
->
nCharOfs
-
run
->
strText
->
nL
en
;
undo
->
u
.
split_para
.
pos
=
para
->
nCharOfs
-
run
->
l
en
;
undo
->
u
.
split_para
.
eol_str
=
ME_StrDup
(
run
->
strText
);
undo
->
u
.
split_para
.
fmt
=
*
para
->
pFmt
;
undo
->
u
.
split_para
.
border
=
para
->
border
;
...
...
dlls/riched20/wrap.c
View file @
86f077b1
...
...
@@ -111,7 +111,7 @@ static void ME_InsertRowStart(ME_WrapContext *wc, const ME_DisplayItem *pEnd)
/* Exclude space characters from run width.
* Other whitespace or delimiters are not treated this way. */
SIZE
sz
;
int
len
=
p
->
member
.
run
.
strText
->
nL
en
;
int
len
=
p
->
member
.
run
.
l
en
;
WCHAR
*
text
=
get_text
(
&
p
->
member
.
run
,
len
-
1
);
assert
(
len
);
...
...
@@ -120,7 +120,7 @@ static void ME_InsertRowStart(ME_WrapContext *wc, const ME_DisplayItem *pEnd)
len
--
;
if
(
len
)
{
if
(
len
==
p
->
member
.
run
.
strText
->
nL
en
)
if
(
len
==
p
->
member
.
run
.
l
en
)
{
width
+=
p
->
member
.
run
.
nWidth
;
}
else
{
...
...
@@ -233,7 +233,7 @@ static ME_DisplayItem *ME_MaximizeSplit(ME_WrapContext *wc, ME_DisplayItem *p, i
if
(
piter
->
member
.
run
.
nFlags
&
MERF_ENDWHITE
)
{
i
=
ME_ReverseFindNonWhitespaceV
(
piter
->
member
.
run
.
strText
,
piter
->
member
.
run
.
strText
->
nL
en
);
piter
->
member
.
run
.
l
en
);
pp
=
ME_SplitRun
(
wc
,
piter
,
i
);
wc
->
pt
=
pp
->
member
.
run
.
pt
;
return
pp
;
...
...
@@ -256,7 +256,7 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
ME_Run
*
run
=
&
p
->
member
.
run
;
idesp
=
i
=
ME_CharFromPoint
(
wc
->
context
,
loc
,
run
);
len
=
run
->
strText
->
nL
en
;
len
=
run
->
l
en
;
assert
(
len
>
0
);
assert
(
i
<
len
);
if
(
i
)
{
...
...
@@ -283,7 +283,7 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
piter
=
wc
->
pLastSplittableRun
;
run
=
&
piter
->
member
.
run
;
len
=
run
->
strText
->
nL
en
;
len
=
run
->
l
en
;
/* don't split words */
i
=
ME_ReverseFindWhitespaceV
(
run
->
strText
,
len
);
if
(
i
==
len
)
...
...
@@ -340,7 +340,7 @@ static ME_DisplayItem *ME_WrapHandleRun(ME_WrapContext *wc, ME_DisplayItem *p)
run
->
pt
.
x
=
wc
->
pt
.
x
;
run
->
pt
.
y
=
wc
->
pt
.
y
;
ME_WrapSizeRun
(
wc
,
p
);
len
=
run
->
strText
->
nL
en
;
len
=
run
->
l
en
;
if
(
wc
->
bOverflown
)
/* just skipping final whitespaces */
{
...
...
dlls/riched20/writer.c
View file @
86f077b1
...
...
@@ -870,7 +870,7 @@ static BOOL ME_StreamOutRTF(ME_TextEditor *editor, ME_OutStream *pStream,
return
FALSE
;
}
/* Skip as many characters as required by current line break */
nChars
=
max
(
0
,
nChars
-
cursor
.
pRun
->
member
.
run
.
strText
->
nL
en
);
nChars
=
max
(
0
,
nChars
-
cursor
.
pRun
->
member
.
run
.
l
en
);
}
else
if
(
cursor
.
pRun
->
member
.
run
.
nFlags
&
MERF_ENDROW
)
{
if
(
!
ME_StreamOutPrint
(
pStream
,
"
\\
line
\r\n
"
))
return
FALSE
;
...
...
@@ -884,7 +884,7 @@ static BOOL ME_StreamOutRTF(ME_TextEditor *editor, ME_OutStream *pStream,
if
(
!
ME_StreamOutRTFCharProps
(
pStream
,
&
cursor
.
pRun
->
member
.
run
.
style
->
fmt
))
return
FALSE
;
nEnd
=
(
cursor
.
pRun
==
endCur
.
pRun
)
?
endCur
.
nOffset
:
cursor
.
pRun
->
member
.
run
.
strText
->
nL
en
;
nEnd
=
(
cursor
.
pRun
==
endCur
.
pRun
)
?
endCur
.
nOffset
:
cursor
.
pRun
->
member
.
run
.
l
en
;
if
(
!
ME_StreamOutRTFText
(
pStream
,
get_text
(
&
cursor
.
pRun
->
member
.
run
,
cursor
.
nOffset
),
nEnd
-
cursor
.
nOffset
))
return
FALSE
;
...
...
@@ -919,7 +919,7 @@ static BOOL ME_StreamOutText(ME_TextEditor *editor, ME_OutStream *pStream,
/* TODO: Handle SF_TEXTIZED */
while
(
success
&&
nChars
&&
cursor
.
pRun
)
{
nLen
=
min
(
nChars
,
cursor
.
pRun
->
member
.
run
.
strText
->
nL
en
-
cursor
.
nOffset
);
nLen
=
min
(
nChars
,
cursor
.
pRun
->
member
.
run
.
l
en
-
cursor
.
nOffset
);
if
(
!
editor
->
bEmulateVersion10
&&
cursor
.
pRun
->
member
.
run
.
nFlags
&
MERF_ENDPARA
)
{
...
...
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