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
b132d8bf
Commit
b132d8bf
authored
Nov 03, 2020
by
Huw Davies
Committed by
Alexandre Julliard
Nov 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Use para and row ptrs in the row number from offset function.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
410dceb9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
35 deletions
+26
-35
editor.c
dlls/riched20/editor.c
+4
-8
editor.h
dlls/riched20/editor.h
+1
-1
row.c
dlls/riched20/row.c
+21
-26
No files found.
dlls/riched20/editor.c
View file @
b132d8bf
...
...
@@ -4312,17 +4312,13 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
}
case
EM_LINEFROMCHAR
:
{
if
(
wParam
==
-
1
)
return
ME_RowNumberFromCharOfs
(
editor
,
ME_GetCursorOfs
(
&
editor
->
pCursors
[
1
]));
else
return
ME_RowNumberFromCharOfs
(
editor
,
wParam
);
if
(
wParam
==
-
1
)
wParam
=
ME_GetCursorOfs
(
editor
->
pCursors
+
1
);
return
row_number_from_char_ofs
(
editor
,
wParam
);
}
case
EM_EXLINEFROMCHAR
:
{
if
(
lParam
==
-
1
)
return
ME_RowNumberFromCharOfs
(
editor
,
ME_GetCursorOfs
(
&
editor
->
pCursors
[
1
]));
else
return
ME_RowNumberFromCharOfs
(
editor
,
lParam
);
if
(
lParam
==
-
1
)
lParam
=
ME_GetCursorOfs
(
editor
->
pCursors
+
1
);
return
row_number_from_char_ofs
(
editor
,
lParam
);
}
case
EM_LINEINDEX
:
{
...
...
dlls/riched20/editor.h
View file @
b132d8bf
...
...
@@ -118,7 +118,7 @@ ME_Row *row_from_cursor( ME_Cursor *cursor ) DECLSPEC_HIDDEN;
ME_Row
*
row_from_row_number
(
ME_TextEditor
*
editor
,
int
row_num
)
DECLSPEC_HIDDEN
;
ME_Row
*
row_next
(
ME_Row
*
row
)
DECLSPEC_HIDDEN
;
ME_Run
*
row_next_run
(
ME_Row
*
row
,
ME_Run
*
run
)
DECLSPEC_HIDDEN
;
int
ME_RowNumberFromCharOfs
(
ME_TextEditor
*
editor
,
int
nOfs
)
DECLSPEC_HIDDEN
;
int
row_number_from_char_ofs
(
ME_TextEditor
*
editor
,
int
ofs
)
DECLSPEC_HIDDEN
;
static
inline
ME_DisplayItem
*
row_get_di
(
ME_Row
*
row
)
{
return
(
ME_DisplayItem
*
)((
ptrdiff_t
)
row
-
offsetof
(
ME_DisplayItem
,
member
));
...
...
dlls/riched20/row.c
View file @
b132d8bf
...
...
@@ -102,33 +102,28 @@ ME_Row *row_from_row_number( ME_TextEditor *editor, int row_num )
}
int
ME_RowNumberFromCharOfs
(
ME_TextEditor
*
editor
,
int
nOfs
)
int
row_number_from_char_ofs
(
ME_TextEditor
*
editor
,
int
ofs
)
{
ME_DisplayItem
*
item
=
ME_FindItemFwd
(
editor
->
pBuffer
->
pFirst
,
diParagraph
);
int
nRow
=
0
;
while
(
item
->
type
==
diParagraph
&&
item
->
member
.
para
.
next_para
->
member
.
para
.
nCharOfs
<=
nOfs
)
{
nRow
+=
item
->
member
.
para
.
nRows
;
item
=
item
->
member
.
para
.
next_para
;
}
if
(
item
->
type
==
diParagraph
)
{
ME_DisplayItem
*
next_para
=
item
->
member
.
para
.
next_para
;
nOfs
-=
item
->
member
.
para
.
nCharOfs
;
item
=
ME_FindItemFwd
(
item
,
diRun
);
while
((
item
=
ME_FindItemFwd
(
item
,
diStartRowOrParagraph
))
!=
NULL
)
ME_Paragraph
*
para
=
editor_first_para
(
editor
);
ME_Row
*
row
;
ME_Cursor
cursor
;
int
row_num
=
0
;
while
(
para_next
(
para
)
&&
para_next
(
para
)
->
nCharOfs
<=
ofs
)
{
row_num
+=
para
->
nRows
;
para
=
para_next
(
para
);
}
if
(
para_next
(
para
))
{
if
(
item
==
next_para
)
break
;
item
=
ME_FindItemFwd
(
item
,
diRun
);
if
(
item
->
member
.
run
.
nCharOfs
>
nOfs
)
break
;
nRow
++
;
for
(
row
=
para_first_row
(
para
);
row
;
row
=
row_next
(
row
)
)
{
row_end_cursor
(
row
,
&
cursor
,
TRUE
);
if
(
ME_GetCursorOfs
(
&
cursor
)
>
ofs
)
break
;
row_num
++
;
}
}
}
return
nRow
;
return
row_num
;
}
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