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
ab95fb31
Commit
ab95fb31
authored
Nov 09, 2020
by
Huw Davies
Committed by
Alexandre Julliard
Nov 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Use row ptrs in the page up/down handlers.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
47228b7d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
71 deletions
+63
-71
caret.c
dlls/riched20/caret.c
+34
-71
editor.h
dlls/riched20/editor.h
+3
-0
row.c
dlls/riched20/row.c
+26
-0
No files found.
dlls/riched20/caret.c
View file @
ab95fb31
...
...
@@ -1272,104 +1272,67 @@ ME_MoveCursorLines(ME_TextEditor *editor, ME_Cursor *pCursor, int nRelOfs, BOOL
row_cursor
(
editor
,
&
pItem
->
member
.
row
,
x
,
pCursor
);
}
static
void
ME_ArrowPageUp
(
ME_TextEditor
*
editor
,
ME_Cursor
*
pCursor
)
static
void
ME_ArrowPageUp
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
)
{
ME_DisplayItem
*
p
=
ME_FindItemFwd
(
editor
->
pBuffer
->
pFirst
,
diStartRow
);
ME_Row
*
row
=
para_first_row
(
editor_first_para
(
editor
)
),
*
last_row
;
int
x
,
yd
,
old_scroll_pos
=
editor
->
vert_si
.
nPos
;
if
(
editor
->
vert_si
.
nPos
<
p
->
member
.
row
.
nHeight
)
if
(
editor
->
vert_si
.
nPos
<
row
->
nHeight
)
{
ME_SetCursorToStart
(
editor
,
pCursor
);
ME_SetCursorToStart
(
editor
,
cursor
);
/* Native clears seems to clear this x value on page up at the top
* of the text, but not on page down at the end of the text.
* Doesn't make sense, but we try to be bug for bug compatible. */
editor
->
nUDArrowX
=
-
1
;
}
else
{
ME_DisplayItem
*
pRun
=
run_get_di
(
pCursor
->
run
);
ME_DisplayItem
*
pLast
;
int
x
,
y
,
yd
,
yp
;
int
yOldScrollPos
=
editor
->
vert_si
.
nPos
;
x
=
ME_GetXForArrow
(
editor
,
pCursor
);
p
=
ME_FindItemBack
(
pRun
,
diStartRowOrParagraph
);
assert
(
p
->
type
==
diStartRow
);
yp
=
ME_FindItemBack
(
p
,
diParagraph
)
->
member
.
para
.
pt
.
y
;
y
=
yp
+
p
->
member
.
row
.
pt
.
y
;
}
else
{
x
=
ME_GetXForArrow
(
editor
,
cursor
);
row
=
row_from_cursor
(
cursor
);
ME_ScrollUp
(
editor
,
editor
->
sizeWindow
.
cy
);
ME_ScrollUp
(
editor
,
editor
->
sizeWindow
.
cy
);
/* Only move the cursor by the amount scrolled. */
yd
=
y
+
editor
->
vert_si
.
nPos
-
yOldScrollP
os
;
pLast
=
p
;
yd
=
cursor
->
para
->
pt
.
y
+
row
->
pt
.
y
+
editor
->
vert_si
.
nPos
-
old_scroll_p
os
;
last_row
=
row
;
do
{
p
=
ME_FindItemBack
(
p
,
diStartRowOrParagraph
);
if
(
!
p
)
break
;
if
(
p
->
type
==
diParagraph
)
{
/* crossing paragraphs */
if
(
p
->
member
.
para
.
prev_para
==
NULL
)
break
;
yp
=
p
->
member
.
para
.
prev_para
->
member
.
para
.
pt
.
y
;
continue
;
while
((
row
=
row_prev_all_paras
(
row
)))
{
if
(
row_para
(
row
)
->
pt
.
y
+
row
->
pt
.
y
<
yd
)
break
;
last_row
=
row
;
}
y
=
yp
+
p
->
member
.
row
.
pt
.
y
;
if
(
y
<
yd
)
break
;
pLast
=
p
;
}
while
(
1
);
row_cursor
(
editor
,
&
pLast
->
member
.
row
,
x
,
pC
ursor
);
row_cursor
(
editor
,
last_row
,
x
,
c
ursor
);
}
}
static
void
ME_ArrowPageDown
(
ME_TextEditor
*
editor
,
ME_Cursor
*
pCursor
)
static
void
ME_ArrowPageDown
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
)
{
ME_DisplayItem
*
pLast
;
int
x
,
y
;
/* Find y position of the last row */
pLast
=
editor
->
pBuffer
->
pLast
;
y
=
pLast
->
member
.
para
.
prev_para
->
member
.
para
.
pt
.
y
+
ME_FindItemBack
(
pLast
,
diStartRow
)
->
member
.
row
.
pt
.
y
;
ME_Row
*
row
=
para_end_row
(
para_prev
(
editor_end_para
(
editor
)
)
),
*
last_row
;
int
x
,
yd
,
old_scroll_pos
=
editor
->
vert_si
.
nPos
;
x
=
ME_GetXForArrow
(
editor
,
pCursor
);
x
=
ME_GetXForArrow
(
editor
,
cursor
);
if
(
editor
->
vert_si
.
nPos
>=
y
-
editor
->
sizeWindow
.
cy
)
if
(
editor
->
vert_si
.
nPos
>=
row_para
(
row
)
->
pt
.
y
+
row
->
pt
.
y
-
editor
->
sizeWindow
.
cy
)
ME_SetCursorToEnd
(
editor
,
cursor
,
FALSE
);
else
{
ME_SetCursorToEnd
(
editor
,
pCursor
,
FALSE
);
}
else
{
ME_DisplayItem
*
pRun
=
run_get_di
(
pCursor
->
run
);
ME_DisplayItem
*
p
;
int
yd
,
yp
;
int
yOldScrollPos
=
editor
->
vert_si
.
nPos
;
p
=
ME_FindItemBack
(
pRun
,
diStartRowOrParagraph
);
assert
(
p
->
type
==
diStartRow
);
yp
=
ME_FindItemBack
(
p
,
diParagraph
)
->
member
.
para
.
pt
.
y
;
y
=
yp
+
p
->
member
.
row
.
pt
.
y
;
row
=
row_from_cursor
(
cursor
);
/* For native richedit controls:
* v1.0 - v3.1 can only scroll down as far as the scrollbar lets us
* v4.1 can scroll past this position here. */
ME_ScrollDown
(
editor
,
editor
->
sizeWindow
.
cy
);
ME_ScrollDown
(
editor
,
editor
->
sizeWindow
.
cy
);
/* Only move the cursor by the amount scrolled. */
yd
=
y
+
editor
->
vert_si
.
nPos
-
yOldScrollP
os
;
pLast
=
p
;
yd
=
cursor
->
para
->
pt
.
y
+
row
->
pt
.
y
+
editor
->
vert_si
.
nPos
-
old_scroll_p
os
;
last_row
=
row
;
do
{
p
=
ME_FindItemFwd
(
p
,
diStartRowOrParagraph
);
if
(
!
p
)
break
;
if
(
p
->
type
==
diParagraph
)
{
yp
=
p
->
member
.
para
.
pt
.
y
;
continue
;
while
((
row
=
row_next_all_paras
(
row
)))
{
if
(
row_para
(
row
)
->
pt
.
y
+
row
->
pt
.
y
>=
yd
)
break
;
last_row
=
row
;
}
y
=
yp
+
p
->
member
.
row
.
pt
.
y
;
if
(
y
>=
yd
)
break
;
pLast
=
p
;
}
while
(
1
);
row_cursor
(
editor
,
&
pLast
->
member
.
row
,
x
,
pC
ursor
);
row_cursor
(
editor
,
last_row
,
x
,
c
ursor
);
}
}
...
...
dlls/riched20/editor.h
View file @
ab95fb31
...
...
@@ -115,8 +115,11 @@ ME_Run *row_first_run( ME_Row *row ) DECLSPEC_HIDDEN;
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_Row
*
row_next_all_paras
(
ME_Row
*
row
)
DECLSPEC_HIDDEN
;
ME_Run
*
row_next_run
(
ME_Row
*
row
,
ME_Run
*
run
)
DECLSPEC_HIDDEN
;
int
row_number_from_char_ofs
(
ME_TextEditor
*
editor
,
int
ofs
)
DECLSPEC_HIDDEN
;
ME_Paragraph
*
row_para
(
ME_Row
*
row
)
DECLSPEC_HIDDEN
;
ME_Row
*
row_prev_all_paras
(
ME_Row
*
row
)
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 @
ab95fb31
...
...
@@ -33,6 +33,24 @@ ME_Row *row_next( ME_Row *row )
return
&
item
->
member
.
row
;
}
ME_Row
*
row_next_all_paras
(
ME_Row
*
row
)
{
ME_DisplayItem
*
item
;
item
=
ME_FindItemFwd
(
row_get_di
(
row
),
diStartRow
);
if
(
!
item
)
return
NULL
;
return
&
item
->
member
.
row
;
}
ME_Row
*
row_prev_all_paras
(
ME_Row
*
row
)
{
ME_DisplayItem
*
item
;
item
=
ME_FindItemBack
(
row_get_di
(
row
),
diStartRow
);
if
(
!
item
)
return
NULL
;
return
&
item
->
member
.
row
;
}
ME_Run
*
row_first_run
(
ME_Row
*
row
)
{
ME_DisplayItem
*
item
;
...
...
@@ -82,6 +100,14 @@ void row_end_cursor( ME_Row *row, ME_Cursor *cursor, BOOL include_eop )
cursor
->
nOffset
=
(
item
->
type
==
diStartRow
||
include_eop
)
?
cursor
->
run
->
len
:
0
;
}
ME_Paragraph
*
row_para
(
ME_Row
*
row
)
{
ME_Cursor
cursor
;
row_first_cursor
(
row
,
&
cursor
);
return
cursor
.
para
;
}
ME_Row
*
row_from_row_number
(
ME_TextEditor
*
editor
,
int
row_num
)
{
ME_Paragraph
*
para
=
editor_first_para
(
editor
);
...
...
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