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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
86 deletions
+78
-86
caret.c
dlls/riched20/caret.c
+49
-86
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,105 +1272,68 @@ ME_MoveCursorLines(ME_TextEditor *editor, ME_Cursor *pCursor, int nRelOfs, BOOL
...
@@ -1272,105 +1272,68 @@ ME_MoveCursorLines(ME_TextEditor *editor, ME_Cursor *pCursor, int nRelOfs, BOOL
row_cursor
(
editor
,
&
pItem
->
member
.
row
,
x
,
pCursor
);
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
/* 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.
* 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. */
* Doesn't make sense, but we try to be bug for bug compatible. */
editor
->
nUDArrowX
=
-
1
;
editor
->
nUDArrowX
=
-
1
;
}
else
{
}
ME_DisplayItem
*
pRun
=
run_get_di
(
pCursor
->
run
);
else
ME_DisplayItem
*
pLast
;
{
int
x
,
y
,
yd
,
yp
;
x
=
ME_GetXForArrow
(
editor
,
cursor
);
int
yOldScrollPos
=
editor
->
vert_si
.
nPos
;
row
=
row_from_cursor
(
cursor
);
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
;
ME_ScrollUp
(
editor
,
editor
->
sizeWindow
.
cy
);
ME_ScrollUp
(
editor
,
editor
->
sizeWindow
.
cy
);
/* Only move the cursor by the amount scrolled. */
/* Only move the cursor by the amount scrolled. */
yd
=
y
+
editor
->
vert_si
.
nPos
-
yOldScrollP
os
;
yd
=
cursor
->
para
->
pt
.
y
+
row
->
pt
.
y
+
editor
->
vert_si
.
nPos
-
old_scroll_p
os
;
pLast
=
p
;
last_row
=
row
;
do
{
while
((
row
=
row_prev_all_paras
(
row
)))
p
=
ME_FindItemBack
(
p
,
diStartRowOrParagraph
);
{
if
(
!
p
)
if
(
row_para
(
row
)
->
pt
.
y
+
row
->
pt
.
y
<
yd
)
break
;
break
;
last_row
=
row
;
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
;
}
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
;
ME_Row
*
row
=
para_end_row
(
para_prev
(
editor_end_para
(
editor
)
)
),
*
last_row
;
int
x
,
y
;
int
x
,
yd
,
old_scroll_pos
=
editor
->
vert_si
.
nPos
;
/* Find y position of the last row */
x
=
ME_GetXForArrow
(
editor
,
cursor
);
pLast
=
editor
->
pBuffer
->
pLast
;
y
=
pLast
->
member
.
para
.
prev_para
->
member
.
para
.
pt
.
y
+
ME_FindItemBack
(
pLast
,
diStartRow
)
->
member
.
row
.
pt
.
y
;
x
=
ME_GetXForArrow
(
editor
,
pCursor
);
if
(
editor
->
vert_si
.
nPos
>=
row_para
(
row
)
->
pt
.
y
+
row
->
pt
.
y
-
editor
->
sizeWindow
.
cy
)
ME_SetCursorToEnd
(
editor
,
cursor
,
FALSE
);
else
{
row
=
row_from_cursor
(
cursor
);
if
(
editor
->
vert_si
.
nPos
>=
y
-
editor
->
sizeWindow
.
cy
)
/* For native richedit controls:
{
* v1.0 - v3.1 can only scroll down as far as the scrollbar lets us
ME_SetCursorToEnd
(
editor
,
pCursor
,
FALSE
);
* v4.1 can scroll past this position here. */
}
else
{
ME_ScrollDown
(
editor
,
editor
->
sizeWindow
.
cy
);
ME_DisplayItem
*
pRun
=
run_get_di
(
pCursor
->
run
);
/* Only move the cursor by the amount scrolled. */
ME_DisplayItem
*
p
;
yd
=
cursor
->
para
->
pt
.
y
+
row
->
pt
.
y
+
editor
->
vert_si
.
nPos
-
old_scroll_pos
;
int
yd
,
yp
;
last_row
=
row
;
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
;
/* 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
);
/* Only move the cursor by the amount scrolled. */
yd
=
y
+
editor
->
vert_si
.
nPos
-
yOldScrollPos
;
pLast
=
p
;
do
{
while
((
row
=
row_next_all_paras
(
row
)))
p
=
ME_FindItemFwd
(
p
,
diStartRowOrParagraph
);
{
if
(
!
p
)
if
(
row_para
(
row
)
->
pt
.
y
+
row
->
pt
.
y
>=
yd
)
break
;
break
;
last_row
=
row
;
if
(
p
->
type
==
diParagraph
)
{
}
yp
=
p
->
member
.
para
.
pt
.
y
;
continue
;
}
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_ArrowHome
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
)
static
void
ME_ArrowHome
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
)
...
...
dlls/riched20/editor.h
View file @
ab95fb31
...
@@ -115,8 +115,11 @@ ME_Run *row_first_run( ME_Row *row ) DECLSPEC_HIDDEN;
...
@@ -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_cursor
(
ME_Cursor
*
cursor
)
DECLSPEC_HIDDEN
;
ME_Row
*
row_from_row_number
(
ME_TextEditor
*
editor
,
int
row_num
)
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
(
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
;
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
;
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
)
static
inline
ME_DisplayItem
*
row_get_di
(
ME_Row
*
row
)
{
{
return
(
ME_DisplayItem
*
)((
ptrdiff_t
)
row
-
offsetof
(
ME_DisplayItem
,
member
));
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 )
...
@@ -33,6 +33,24 @@ ME_Row *row_next( ME_Row *row )
return
&
item
->
member
.
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_Run
*
row_first_run
(
ME_Row
*
row
)
{
{
ME_DisplayItem
*
item
;
ME_DisplayItem
*
item
;
...
@@ -82,6 +100,14 @@ void row_end_cursor( ME_Row *row, ME_Cursor *cursor, BOOL include_eop )
...
@@ -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
;
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_Row
*
row_from_row_number
(
ME_TextEditor
*
editor
,
int
row_num
)
{
{
ME_Paragraph
*
para
=
editor_first_para
(
editor
);
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