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
120ee0de
Commit
120ee0de
authored
Oct 15, 2020
by
Huw Davies
Committed by
Alexandre Julliard
Oct 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Simplify the char offset from run offset function.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
57c2580a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
12 deletions
+9
-12
editor.c
dlls/riched20/editor.c
+3
-3
editor.h
dlls/riched20/editor.h
+1
-1
run.c
dlls/riched20/run.c
+5
-8
No files found.
dlls/riched20/editor.c
View file @
120ee0de
...
...
@@ -4322,15 +4322,15 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
}
cursor_from_char_ofs
(
editor
,
wParam
,
&
cursor
);
item
=
ME_RowStart
(
cursor
.
pRun
);
nThisLineOfs
=
ME_CharOfsFromRunOfs
(
editor
,
cursor
.
pPara
,
ME_FindItemFwd
(
item
,
diRun
)
,
0
);
nThisLineOfs
=
run_char_ofs
(
&
ME_FindItemFwd
(
item
,
diRun
)
->
member
.
run
,
0
);
item_end
=
ME_FindItemFwd
(
item
,
diStartRowOrParagraphOrEnd
);
if
(
item_end
->
type
==
diStartRow
)
nNextLineOfs
=
ME_CharOfsFromRunOfs
(
editor
,
cursor
.
pPara
,
ME_FindItemFwd
(
item_end
,
diRun
),
0
);
nNextLineOfs
=
run_char_ofs
(
&
ME_FindItemFwd
(
item_end
,
diRun
)
->
member
.
run
,
0
);
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
.
len
;
nNextLineOfs
=
run_char_ofs
(
&
endRun
->
member
.
run
,
0
)
;
}
nChars
=
nNextLineOfs
-
nThisLineOfs
;
TRACE
(
"EM_LINELENGTH(%ld)==%d
\n
"
,
wParam
,
nChars
);
...
...
dlls/riched20/editor.h
View file @
120ee0de
...
...
@@ -120,6 +120,7 @@ int ME_RowNumberFromCharOfs(ME_TextEditor *editor, int nOfs) DECLSPEC_HIDDEN;
/* run.c */
void
cursor_from_char_ofs
(
ME_TextEditor
*
editor
,
int
char_ofs
,
ME_Cursor
*
cursor
)
DECLSPEC_HIDDEN
;
int
run_char_ofs
(
ME_Run
*
run
,
int
ofs
)
DECLSPEC_HIDDEN
;
ME_Run
*
run_create
(
ME_Style
*
s
,
int
nFlags
)
DECLSPEC_HIDDEN
;
ME_Run
*
run_insert
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
,
ME_Style
*
style
,
const
WCHAR
*
str
,
int
len
,
int
flags
)
DECLSPEC_HIDDEN
;
...
...
@@ -140,7 +141,6 @@ ME_Run *run_split( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
void
ME_UpdateRunFlags
(
ME_TextEditor
*
editor
,
ME_Run
*
run
)
DECLSPEC_HIDDEN
;
SIZE
ME_GetRunSizeCommon
(
ME_Context
*
c
,
const
ME_Paragraph
*
para
,
ME_Run
*
run
,
int
nLen
,
int
startx
,
int
*
pAscent
,
int
*
pDescent
)
DECLSPEC_HIDDEN
;
int
ME_CharOfsFromRunOfs
(
ME_TextEditor
*
editor
,
const
ME_DisplayItem
*
pPara
,
const
ME_DisplayItem
*
pRun
,
int
nOfs
)
DECLSPEC_HIDDEN
;
void
ME_SkipAndPropagateCharOffset
(
ME_DisplayItem
*
p
,
int
shift
)
DECLSPEC_HIDDEN
;
void
ME_SetCharFormat
(
ME_TextEditor
*
editor
,
ME_Cursor
*
start
,
ME_Cursor
*
end
,
CHARFORMAT2W
*
pFmt
)
DECLSPEC_HIDDEN
;
void
ME_SetSelectionCharFormat
(
ME_TextEditor
*
editor
,
CHARFORMAT2W
*
pFmt
)
DECLSPEC_HIDDEN
;
...
...
dlls/riched20/run.c
View file @
120ee0de
...
...
@@ -187,18 +187,15 @@ void ME_CheckCharOffsets(ME_TextEditor *editor)
}
/******************************************************************************
*
ME_CharOfsFromRunO
fs
*
run_char_o
fs
*
* Converts a character position relative to the start of the run
,
to a
* Converts a character position relative to the start of the run to a
* character position relative to the start of the document.
* Kind of a "local to global" offset conversion.
*/
int
ME_CharOfsFromRunOfs
(
ME_TextEditor
*
editor
,
const
ME_DisplayItem
*
pPara
,
const
ME_DisplayItem
*
pRun
,
int
nOfs
)
int
run_char_ofs
(
ME_Run
*
run
,
int
ofs
)
{
assert
(
pRun
&&
pRun
->
type
==
diRun
);
assert
(
pPara
&&
pPara
->
type
==
diParagraph
);
return
pPara
->
member
.
para
.
nCharOfs
+
pRun
->
member
.
run
.
nCharOfs
+
nOfs
;
return
run
->
para
->
nCharOfs
+
run
->
nCharOfs
+
ofs
;
}
/******************************************************************************
...
...
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