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
aaf29c79
Commit
aaf29c79
authored
Oct 26, 2020
by
Huw Davies
Committed by
Alexandre Julliard
Oct 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Use row and para helpers for the selection function.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0fda889f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
24 deletions
+46
-24
caret.c
dlls/riched20/caret.c
+14
-24
editor.h
dlls/riched20/editor.h
+3
-0
row.c
dlls/riched20/row.c
+29
-0
No files found.
dlls/riched20/caret.c
View file @
aaf29c79
...
...
@@ -818,38 +818,28 @@ ME_SelectByType(ME_TextEditor *editor, ME_SelectionType selectionType)
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
ME_MoveCursorWords
(
editor
,
&
editor
->
pCursors
[
1
],
-
1
);
break
;
case
stLine
:
case
stParagraph
:
{
ME_DisplayItem
*
pItem
;
ME_DIType
fwdSearchType
,
backSearchType
;
if
(
selectionType
==
stParagraph
)
{
backSearchType
=
diParagraph
;
fwdSearchType
=
diParagraphOrEnd
;
}
else
{
backSearchType
=
diStartRow
;
fwdSearchType
=
diStartRowOrParagraphOrEnd
;
}
pItem
=
ME_FindItemFwd
(
editor
->
pCursors
[
0
].
pRun
,
fwdSearchType
);
assert
(
pItem
);
if
(
pItem
->
type
==
diTextEnd
)
editor
->
pCursors
[
0
].
pRun
=
ME_FindItemBack
(
pItem
,
diRun
);
else
editor
->
pCursors
[
0
].
pRun
=
ME_FindItemFwd
(
pItem
,
diRun
);
editor
->
pCursors
[
0
].
pPara
=
ME_GetParagraph
(
editor
->
pCursors
[
0
].
pRun
);
editor
->
pCursors
[
0
].
nOffset
=
0
;
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
pItem
=
ME_FindItemBack
(
pItem
,
backSearchType
);
editor
->
pCursors
[
1
].
pRun
=
ME_FindItemFwd
(
pItem
,
diRun
);
editor
->
pCursors
[
1
].
pPara
=
ME_GetParagraph
(
editor
->
pCursors
[
1
].
pRun
);
editor
->
pCursors
[
0
].
pRun
=
run_get_di
(
para_end_run
(
&
editor
->
pCursors
[
0
].
pPara
->
member
.
para
)
);
editor
->
pCursors
[
0
].
pPara
=
para_get_di
(
editor
->
pCursors
[
0
].
pRun
->
member
.
run
.
para
);
editor
->
pCursors
[
0
].
nOffset
=
editor
->
pCursors
[
0
].
pRun
->
member
.
run
.
len
;
editor
->
pCursors
[
1
].
pRun
=
run_get_di
(
para_first_run
(
&
editor
->
pCursors
[
1
].
pPara
->
member
.
para
)
);
editor
->
pCursors
[
1
].
nOffset
=
0
;
break
;
case
stLine
:
{
ME_Row
*
row
=
row_from_cursor
(
editor
->
pCursors
);
row_first_cursor
(
row
,
editor
->
pCursors
+
1
);
row_end_cursor
(
row
,
editor
->
pCursors
,
TRUE
);
break
;
}
case
stDocument
:
/* Select everything with cursor anchored from the start of the text */
editor
->
nSelectionType
=
stDocument
;
ME_SetCursorToStart
(
editor
,
&
editor
->
pCursors
[
1
]);
ME_SetCursorToEnd
(
editor
,
&
editor
->
pCursors
[
0
],
FALS
E
);
ME_SetCursorToEnd
(
editor
,
&
editor
->
pCursors
[
0
],
TRU
E
);
break
;
default:
assert
(
0
);
}
...
...
dlls/riched20/editor.h
View file @
aaf29c79
...
...
@@ -111,7 +111,10 @@ int ME_ReverseFindNonWhitespaceV(const ME_String *s, int nVChar) DECLSPEC_HIDDEN
int
ME_ReverseFindWhitespaceV
(
const
ME_String
*
s
,
int
nVChar
)
DECLSPEC_HIDDEN
;
/* row.c */
void
row_end_cursor
(
ME_Row
*
row
,
ME_Cursor
*
cursor
,
BOOL
include_eop
)
DECLSPEC_HIDDEN
;
void
row_first_cursor
(
ME_Row
*
row
,
ME_Cursor
*
cursor
)
DECLSPEC_HIDDEN
;
ME_Run
*
row_first_run
(
ME_Row
*
row
)
DECLSPEC_HIDDEN
;
ME_Row
*
row_from_cursor
(
ME_Cursor
*
cursor
)
DECLSPEC_HIDDEN
;
ME_Row
*
row_next
(
ME_Row
*
row
)
DECLSPEC_HIDDEN
;
ME_Run
*
row_next_run
(
ME_Row
*
row
,
ME_Run
*
run
)
DECLSPEC_HIDDEN
;
ME_DisplayItem
*
ME_RowStart
(
ME_DisplayItem
*
item
)
DECLSPEC_HIDDEN
;
...
...
dlls/riched20/row.c
View file @
aaf29c79
...
...
@@ -53,6 +53,35 @@ ME_Run *row_next_run( ME_Row *row, ME_Run *run )
return
&
item
->
member
.
run
;
}
ME_Row
*
row_from_cursor
(
ME_Cursor
*
cursor
)
{
ME_DisplayItem
*
item
;
item
=
ME_FindItemBack
(
cursor
->
pRun
,
diStartRow
);
return
&
item
->
member
.
row
;
}
void
row_first_cursor
(
ME_Row
*
row
,
ME_Cursor
*
cursor
)
{
ME_DisplayItem
*
item
;
item
=
ME_FindItemFwd
(
row_get_di
(
row
),
diRun
);
cursor
->
pRun
=
item
;
cursor
->
pPara
=
para_get_di
(
cursor
->
pRun
->
member
.
run
.
para
);
cursor
->
nOffset
=
0
;
}
void
row_end_cursor
(
ME_Row
*
row
,
ME_Cursor
*
cursor
,
BOOL
include_eop
)
{
ME_DisplayItem
*
item
,
*
run
;
item
=
ME_FindItemFwd
(
row_get_di
(
row
),
diStartRowOrParagraphOrEnd
);
run
=
ME_FindItemBack
(
item
,
diRun
);
cursor
->
pRun
=
run
;
cursor
->
pPara
=
para_get_di
(
cursor
->
pRun
->
member
.
run
.
para
);
cursor
->
nOffset
=
(
item
->
type
==
diStartRow
||
include_eop
)
?
cursor
->
pRun
->
member
.
run
.
len
:
0
;
}
/* I'm sure these functions would simplify some code in caret ops etc,
* I just didn't remember them when I wrote that code
*/
...
...
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