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
cb9353bc
Commit
cb9353bc
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 and para ptrs in the cursor up/down handler.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ab95fb31
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
75 deletions
+60
-75
caret.c
dlls/riched20/caret.c
+60
-70
editor.h
dlls/riched20/editor.h
+0
-1
para.c
dlls/riched20/para.c
+0
-4
No files found.
dlls/riched20/caret.c
View file @
cb9353bc
...
@@ -1196,80 +1196,70 @@ static int ME_GetXForArrow(ME_TextEditor *editor, ME_Cursor *pCursor)
...
@@ -1196,80 +1196,70 @@ static int ME_GetXForArrow(ME_TextEditor *editor, ME_Cursor *pCursor)
}
}
static
void
static
void
cursor_move_line
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
,
BOOL
up
,
BOOL
extend
)
ME_MoveCursorLines
(
ME_TextEditor
*
editor
,
ME_Cursor
*
pCursor
,
int
nRelOfs
,
BOOL
extend
)
{
{
ME_DisplayItem
*
pRun
=
run_get_di
(
pCursor
->
run
);
ME_Paragraph
*
old_para
=
cursor
->
para
,
*
new_para
;
ME_Paragraph
*
old_para
=
pCursor
->
para
,
*
new_para
;
ME_Row
*
row
=
row_from_cursor
(
cursor
);
ME_DisplayItem
*
pItem
;
int
x
=
ME_GetXForArrow
(
editor
,
cursor
);
int
x
=
ME_GetXForArrow
(
editor
,
pCursor
);
if
(
nRelOfs
==
-
1
)
if
(
up
)
{
/* start of this row */
pItem
=
ME_FindItemBack
(
pRun
,
diStartRow
);
assert
(
pItem
);
/* start of the previous row */
pItem
=
ME_FindItemBack
(
pItem
,
diStartRow
);
if
(
!
pItem
)
/* row not found */
{
if
(
extend
)
ME_SetCursorToStart
(
editor
,
pCursor
);
return
;
}
new_para
=
&
ME_GetParagraph
(
pItem
)
->
member
.
para
;
if
(
old_para
->
nFlags
&
MEPF_ROWEND
||
(
para_cell
(
old_para
)
&&
para_cell
(
old_para
)
!=
para_cell
(
new_para
)))
{
/* Brought out of a cell */
new_para
=
para_prev
(
table_row_start
(
old_para
));
if
(
!
new_para
)
return
;
/* At the top, so don't go anywhere. */
pItem
=
ME_FindItemFwd
(
para_get_di
(
new_para
),
diStartRow
);
}
if
(
new_para
->
nFlags
&
MEPF_ROWEND
)
{
/* Brought into a table row */
ME_Cell
*
cell
=
table_row_end_cell
(
new_para
);
while
(
x
<
cell
->
pt
.
x
&&
cell_prev
(
cell
))
cell
=
cell_prev
(
cell
);
if
(
cell_next
(
cell
))
/* else - we are still at the end of the row */
pItem
=
ME_FindItemBack
(
cell_get_di
(
cell_next
(
cell
)
),
diStartRow
);
}
}
else
{
/* start of the next row */
pItem
=
ME_FindItemFwd
(
pRun
,
diStartRow
);
if
(
!
pItem
)
/* row not found */
{
if
(
extend
)
ME_SetCursorToEnd
(
editor
,
pCursor
,
TRUE
);
return
;
}
new_para
=
&
ME_GetParagraph
(
pItem
)
->
member
.
para
;
if
(
old_para
->
nFlags
&
MEPF_ROWSTART
||
(
para_cell
(
old_para
)
&&
para_cell
(
old_para
)
!=
para_cell
(
new_para
)))
{
{
/* Brought out of a cell */
/* start of the previous row */
new_para
=
para_next
(
table_row_end
(
old_para
)
);
row
=
row_prev_all_paras
(
row
);
if
(
!
para_next
(
new_para
))
return
;
/* At the bottom, so don't go anywhere. */
if
(
!
row
)
pItem
=
ME_FindItemFwd
(
para_get_di
(
new_para
),
diStartRow
);
{
if
(
extend
)
ME_SetCursorToStart
(
editor
,
cursor
);
return
;
}
new_para
=
row_para
(
row
);
if
(
old_para
->
nFlags
&
MEPF_ROWEND
||
(
para_cell
(
old_para
)
&&
para_cell
(
old_para
)
!=
para_cell
(
new_para
)))
{
/* Brought out of a cell */
new_para
=
para_prev
(
table_row_start
(
old_para
));
if
(
!
new_para
)
return
;
/* At the top, so don't go anywhere. */
row
=
para_first_row
(
new_para
);
}
if
(
new_para
->
nFlags
&
MEPF_ROWEND
)
{
/* Brought into a table row */
ME_Cell
*
cell
=
table_row_end_cell
(
new_para
);
while
(
x
<
cell
->
pt
.
x
&&
cell_prev
(
cell
))
cell
=
cell_prev
(
cell
);
if
(
cell_next
(
cell
))
/* else - we are still at the end of the row */
row
=
para_end_row
(
cell_end_para
(
cell
)
);
}
}
}
if
(
new_para
->
nFlags
&
MEPF_ROWSTART
)
else
{
{
/* Brought into a table row */
/* start of the next row */
ME_Cell
*
cell
=
table_row_first_cell
(
new_para
);
row
=
row_next_all_paras
(
row
);
while
(
cell_next
(
cell
)
&&
x
>=
cell_next
(
cell
)
->
pt
.
x
)
if
(
!
row
)
cell
=
cell_next
(
cell
);
{
pItem
=
ME_FindItemFwd
(
cell_get_di
(
cell
),
diStartRow
);
if
(
extend
)
ME_SetCursorToEnd
(
editor
,
cursor
,
TRUE
);
return
;
}
new_para
=
row_para
(
row
);
if
(
old_para
->
nFlags
&
MEPF_ROWSTART
||
(
para_cell
(
old_para
)
&&
para_cell
(
old_para
)
!=
para_cell
(
new_para
)))
{
/* Brought out of a cell */
new_para
=
para_next
(
table_row_end
(
old_para
)
);
if
(
!
para_next
(
new_para
))
return
;
/* At the bottom, so don't go anywhere. */
row
=
para_first_row
(
new_para
);
}
if
(
new_para
->
nFlags
&
MEPF_ROWSTART
)
{
/* Brought into a table row */
ME_Cell
*
cell
=
table_row_first_cell
(
new_para
);
while
(
cell_next
(
cell
)
&&
x
>=
cell_next
(
cell
)
->
pt
.
x
)
cell
=
cell_next
(
cell
);
row
=
para_first_row
(
cell_first_para
(
cell
)
);
}
}
}
}
if
(
!
row
)
return
;
if
(
!
pItem
)
{
row_cursor
(
editor
,
row
,
x
,
cursor
);
/* row not found - ignore */
return
;
}
row_cursor
(
editor
,
&
pItem
->
member
.
row
,
x
,
pCursor
);
}
}
static
void
ME_ArrowPageUp
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
)
static
void
ME_ArrowPageUp
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
)
...
@@ -1434,10 +1424,10 @@ ME_ArrowKey(ME_TextEditor *editor, int nVKey, BOOL extend, BOOL ctrl)
...
@@ -1434,10 +1424,10 @@ ME_ArrowKey(ME_TextEditor *editor, int nVKey, BOOL extend, BOOL ctrl)
success
=
ME_MoveCursorChars
(
editor
,
&
tmp_curs
,
+
1
,
extend
);
success
=
ME_MoveCursorChars
(
editor
,
&
tmp_curs
,
+
1
,
extend
);
break
;
break
;
case
VK_UP
:
case
VK_UP
:
ME_MoveCursorLines
(
editor
,
&
tmp_curs
,
-
1
,
extend
);
cursor_move_line
(
editor
,
&
tmp_curs
,
TRUE
,
extend
);
break
;
break
;
case
VK_DOWN
:
case
VK_DOWN
:
ME_MoveCursorLines
(
editor
,
&
tmp_curs
,
+
1
,
extend
);
cursor_move_line
(
editor
,
&
tmp_curs
,
FALSE
,
extend
);
break
;
break
;
case
VK_PRIOR
:
case
VK_PRIOR
:
ME_ArrowPageUp
(
editor
,
&
tmp_curs
);
ME_ArrowPageUp
(
editor
,
&
tmp_curs
);
...
...
dlls/riched20/editor.h
View file @
cb9353bc
...
@@ -208,7 +208,6 @@ void editor_get_selection_para_fmt( ME_TextEditor *editor, PARAFORMAT2 *fmt ) DE
...
@@ -208,7 +208,6 @@ void editor_get_selection_para_fmt( ME_TextEditor *editor, PARAFORMAT2 *fmt ) DE
void
editor_mark_rewrap_all
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
void
editor_mark_rewrap_all
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
void
editor_set_default_para_fmt
(
ME_TextEditor
*
editor
,
PARAFORMAT2
*
pFmt
)
DECLSPEC_HIDDEN
;
void
editor_set_default_para_fmt
(
ME_TextEditor
*
editor
,
PARAFORMAT2
*
pFmt
)
DECLSPEC_HIDDEN
;
BOOL
editor_set_selection_para_fmt
(
ME_TextEditor
*
editor
,
const
PARAFORMAT2
*
fmt
)
DECLSPEC_HIDDEN
;
BOOL
editor_set_selection_para_fmt
(
ME_TextEditor
*
editor
,
const
PARAFORMAT2
*
fmt
)
DECLSPEC_HIDDEN
;
ME_DisplayItem
*
ME_GetParagraph
(
ME_DisplayItem
*
run
)
DECLSPEC_HIDDEN
;
void
ME_MakeFirstParagraph
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
void
ME_MakeFirstParagraph
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
void
ME_DumpParaStyle
(
ME_Paragraph
*
s
)
DECLSPEC_HIDDEN
;
void
ME_DumpParaStyle
(
ME_Paragraph
*
s
)
DECLSPEC_HIDDEN
;
void
ME_DumpParaStyleToBuf
(
const
PARAFORMAT2
*
pFmt
,
char
buf
[
2048
])
DECLSPEC_HIDDEN
;
void
ME_DumpParaStyleToBuf
(
const
PARAFORMAT2
*
pFmt
,
char
buf
[
2048
])
DECLSPEC_HIDDEN
;
...
...
dlls/riched20/para.c
View file @
cb9353bc
...
@@ -794,10 +794,6 @@ ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_fir
...
@@ -794,10 +794,6 @@ ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_fir
return
para
;
return
para
;
}
}
ME_DisplayItem
*
ME_GetParagraph
(
ME_DisplayItem
*
item
)
{
return
ME_FindItemBackOrHere
(
item
,
diParagraph
);
}
void
ME_DumpParaStyleToBuf
(
const
PARAFORMAT2
*
pFmt
,
char
buf
[
2048
])
void
ME_DumpParaStyleToBuf
(
const
PARAFORMAT2
*
pFmt
,
char
buf
[
2048
])
{
{
char
*
p
;
char
*
p
;
...
...
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