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
ade37203
Commit
ade37203
authored
Aug 12, 2009
by
Dylan Smith
Committed by
Alexandre Julliard
Aug 12, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: Use ME_Cursor instead of offsets for ME_GetCharFormat.
Prevent extra conversions from character offset to ME_Cursor.
parent
2bc72693
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
19 deletions
+27
-19
editor.c
dlls/riched20/editor.c
+8
-2
editor.h
dlls/riched20/editor.h
+2
-1
run.c
dlls/riched20/run.c
+17
-16
No files found.
dlls/riched20/editor.c
View file @
ade37203
...
...
@@ -4846,9 +4846,12 @@ static BOOL ME_UpdateLinkAttribute(ME_TextEditor *editor, int sel_min, int sel_m
if
(
beforeURL
[
0
]
<
beforeURL
[
1
])
{
ME_Cursor
from
,
to
;
ME_CursorFromCharOfs
(
editor
,
beforeURL
[
0
],
&
from
);
ME_CursorFromCharOfs
(
editor
,
beforeURL
[
1
],
&
to
);
/* CFE_LINK effect should be consistently unset */
link
.
cbSize
=
sizeof
(
link
);
ME_GetCharFormat
(
editor
,
beforeURL
[
0
],
beforeURL
[
1
]
,
&
link
);
ME_GetCharFormat
(
editor
,
&
from
,
&
to
,
&
link
);
if
(
!
(
link
.
dwMask
&
CFM_LINK
)
||
(
link
.
dwEffects
&
CFE_LINK
))
{
/* CFE_LINK must be unset from this range */
...
...
@@ -4862,9 +4865,12 @@ static BOOL ME_UpdateLinkAttribute(ME_TextEditor *editor, int sel_min, int sel_m
}
if
(
inURL
[
0
]
<
inURL
[
1
])
{
ME_Cursor
from
,
to
;
ME_CursorFromCharOfs
(
editor
,
inURL
[
0
],
&
from
);
ME_CursorFromCharOfs
(
editor
,
inURL
[
1
],
&
to
);
/* CFE_LINK effect should be consistently set */
link
.
cbSize
=
sizeof
(
link
);
ME_GetCharFormat
(
editor
,
inURL
[
0
],
inURL
[
1
]
,
&
link
);
ME_GetCharFormat
(
editor
,
&
from
,
&
to
,
&
link
);
if
(
!
(
link
.
dwMask
&
CFM_LINK
)
||
!
(
link
.
dwEffects
&
CFE_LINK
))
{
/* CFE_LINK must be set on this range */
...
...
dlls/riched20/editor.h
View file @
ade37203
...
...
@@ -149,7 +149,8 @@ int ME_CharOfsFromRunOfs(ME_TextEditor *editor, const ME_DisplayItem *pPara, con
void
ME_SkipAndPropagateCharOffset
(
ME_DisplayItem
*
p
,
int
shift
);
void
ME_SetCharFormat
(
ME_TextEditor
*
editor
,
int
nFrom
,
int
nLen
,
CHARFORMAT2W
*
pFmt
);
void
ME_SetSelectionCharFormat
(
ME_TextEditor
*
editor
,
CHARFORMAT2W
*
pFmt
);
void
ME_GetCharFormat
(
ME_TextEditor
*
editor
,
int
nFrom
,
int
nLen
,
CHARFORMAT2W
*
pFmt
);
void
ME_GetCharFormat
(
ME_TextEditor
*
editor
,
const
ME_Cursor
*
from
,
const
ME_Cursor
*
to
,
CHARFORMAT2W
*
pFmt
);
void
ME_GetSelectionCharFormat
(
ME_TextEditor
*
editor
,
CHARFORMAT2W
*
pFmt
);
void
ME_GetDefaultCharFormat
(
ME_TextEditor
*
editor
,
CHARFORMAT2W
*
pFmt
);
void
ME_SetDefaultCharFormat
(
ME_TextEditor
*
editor
,
CHARFORMAT2W
*
mod
);
...
...
dlls/riched20/run.c
View file @
ade37203
...
...
@@ -842,20 +842,20 @@ void ME_GetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt)
/******************************************************************************
* ME_GetSelectionCharFormat
*
*
* If selection exists, it returns all style elements that are set consistently
* in the whole selection. If not, it just returns the current style.
*/
* in the whole selection. If not, it just returns the current style.
*/
void
ME_GetSelectionCharFormat
(
ME_TextEditor
*
editor
,
CHARFORMAT2W
*
pFmt
)
{
int
nFrom
,
nTo
;
ME_GetSelectionOfs
(
editor
,
&
nFrom
,
&
nTo
);
if
(
nFrom
==
nTo
&&
editor
->
pBuffer
->
pCharStyle
)
ME_Cursor
*
from
,
*
to
;
if
(
!
ME_IsSelection
(
editor
)
&&
editor
->
pBuffer
->
pCharStyle
)
{
ME_CopyCharFormat
(
pFmt
,
&
editor
->
pBuffer
->
pCharStyle
->
fmt
);
return
;
}
ME_GetCharFormat
(
editor
,
nFrom
,
nTo
,
pFmt
);
ME_GetSelection
(
editor
,
&
from
,
&
to
);
ME_GetCharFormat
(
editor
,
from
,
to
,
pFmt
);
}
/******************************************************************************
...
...
@@ -864,16 +864,17 @@ void ME_GetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt)
* Returns the style consisting of those attributes which are consistently set
* in the whole character range.
*/
void
ME_GetCharFormat
(
ME_TextEditor
*
editor
,
int
nFrom
,
int
nTo
,
CHARFORMAT2W
*
pFmt
)
void
ME_GetCharFormat
(
ME_TextEditor
*
editor
,
const
ME_Cursor
*
from
,
const
ME_Cursor
*
to
,
CHARFORMAT2W
*
pFmt
)
{
ME_DisplayItem
*
run
,
*
run_end
;
int
nOffset
,
nOffset2
;
CHARFORMAT2W
tmp
;
ME_RunOfsFromCharOfs
(
editor
,
nFrom
,
NULL
,
&
run
,
&
nOffset
);
if
(
nFrom
==
nTo
)
/* special case - if selection is empty, take previous char's formatting */
run
=
from
->
pRun
;
/* special case - if selection is empty, take previous char's formatting */
if
(
from
->
pRun
==
to
->
pRun
&&
from
->
nOffset
==
to
->
nOffset
)
{
if
(
!
nOffset
)
if
(
!
from
->
nOffset
)
{
ME_DisplayItem
*
tmp_run
=
ME_FindItemBack
(
run
,
diRunOrParagraph
);
if
(
tmp_run
->
type
==
diRun
)
{
...
...
@@ -884,10 +885,10 @@ void ME_GetCharFormat(ME_TextEditor *editor, int nFrom, int nTo, CHARFORMAT2W *p
ME_GetRunCharFormat
(
editor
,
run
,
pFmt
);
return
;
}
if
(
nTo
>
nFrom
)
/* selection consists of chars from nFrom up to nTo-1 */
nTo
--
;
ME_RunOfsFromCharOfs
(
editor
,
nTo
,
NULL
,
&
run_end
,
&
nOffset2
);
run_end
=
to
->
pRun
;
if
(
!
to
->
nOffset
)
run_end
=
ME_FindItemBack
(
run_end
,
diRun
);
ME_GetRunCharFormat
(
editor
,
run
,
pFmt
);
...
...
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