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
5419a980
Commit
5419a980
authored
Aug 19, 2019
by
Huw Davies
Committed by
Alexandre Julliard
Aug 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Clearly separate the selection setting functions.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
14e34bed
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
22 deletions
+26
-22
caret.c
dlls/riched20/caret.c
+8
-5
editor.c
dlls/riched20/editor.c
+11
-11
editor.h
dlls/riched20/editor.h
+2
-1
richole.c
dlls/riched20/richole.c
+4
-4
txtsrv.c
dlls/riched20/txtsrv.c
+1
-1
No files found.
dlls/riched20/caret.c
View file @
5419a980
...
@@ -122,8 +122,14 @@ int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how)
...
@@ -122,8 +122,14 @@ int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how)
return
length
;
return
length
;
}
}
/******************************************************************
int
ME_SetSelection
(
ME_TextEditor
*
editor
,
int
from
,
int
to
)
* set_selection_cursors
*
* Updates the selection cursors.
*
* Note that this does not invalidate either the old or the new selections.
*/
int
set_selection_cursors
(
ME_TextEditor
*
editor
,
int
from
,
int
to
)
{
{
int
selectionEnd
=
0
;
int
selectionEnd
=
0
;
const
int
len
=
ME_GetTextLength
(
editor
);
const
int
len
=
ME_GetTextLength
(
editor
);
...
@@ -139,7 +145,6 @@ int ME_SetSelection(ME_TextEditor *editor, int from, int to)
...
@@ -139,7 +145,6 @@ int ME_SetSelection(ME_TextEditor *editor, int from, int to)
{
{
ME_SetCursorToStart
(
editor
,
&
editor
->
pCursors
[
1
]);
ME_SetCursorToStart
(
editor
,
&
editor
->
pCursors
[
1
]);
ME_SetCursorToEnd
(
editor
,
&
editor
->
pCursors
[
0
],
TRUE
);
ME_SetCursorToEnd
(
editor
,
&
editor
->
pCursors
[
0
],
TRUE
);
ME_InvalidateSelection
(
editor
);
return
len
+
1
;
return
len
+
1
;
}
}
...
@@ -165,7 +170,6 @@ int ME_SetSelection(ME_TextEditor *editor, int from, int to)
...
@@ -165,7 +170,6 @@ int ME_SetSelection(ME_TextEditor *editor, int from, int to)
end
--
;
end
--
;
}
}
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
ME_Repaint
(
editor
);
}
}
return
end
;
return
end
;
}
}
...
@@ -194,7 +198,6 @@ int ME_SetSelection(ME_TextEditor *editor, int from, int to)
...
@@ -194,7 +198,6 @@ int ME_SetSelection(ME_TextEditor *editor, int from, int to)
{
{
ME_SetCursorToEnd
(
editor
,
&
editor
->
pCursors
[
0
],
FALSE
);
ME_SetCursorToEnd
(
editor
,
&
editor
->
pCursors
[
0
],
FALSE
);
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
ME_InvalidateSelection
(
editor
);
return
len
;
return
len
;
}
}
...
...
dlls/riched20/editor.c
View file @
5419a980
...
@@ -1622,7 +1622,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
...
@@ -1622,7 +1622,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
}
else
{
}
else
{
style
=
editor
->
pBuffer
->
pDefaultStyle
;
style
=
editor
->
pBuffer
->
pDefaultStyle
;
ME_AddRefStyle
(
style
);
ME_AddRefStyle
(
style
);
ME_SetSelection
(
editor
,
0
,
0
);
set_selection_cursors
(
editor
,
0
,
0
);
ME_InternalDeleteText
(
editor
,
&
editor
->
pCursors
[
1
],
ME_InternalDeleteText
(
editor
,
&
editor
->
pCursors
[
1
],
ME_GetTextLength
(
editor
),
FALSE
);
ME_GetTextLength
(
editor
),
FALSE
);
from
=
to
=
0
;
from
=
to
=
0
;
...
@@ -1756,9 +1756,9 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
...
@@ -1756,9 +1756,9 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
cf
.
dwMask
=
CFM_ALL2
;
cf
.
dwMask
=
CFM_ALL2
;
ME_MoveCursorChars
(
editor
,
&
lastcharCursor
,
-
1
,
FALSE
);
ME_MoveCursorChars
(
editor
,
&
lastcharCursor
,
-
1
,
FALSE
);
ME_GetCharFormat
(
editor
,
&
lastcharCursor
,
&
linebreakCursor
,
&
cf
);
ME_GetCharFormat
(
editor
,
&
lastcharCursor
,
&
linebreakCursor
,
&
cf
);
ME_SetSelection
(
editor
,
newto
,
-
1
);
set_selection_cursors
(
editor
,
newto
,
-
1
);
ME_SetSelectionCharFormat
(
editor
,
&
cf
);
ME_SetSelectionCharFormat
(
editor
,
&
cf
);
ME_SetSelection
(
editor
,
newto
,
newto
);
set_selection_cursors
(
editor
,
newto
,
newto
);
ME_MoveCursorChars
(
editor
,
&
linebreakCursor
,
-
linebreakSize
,
FALSE
);
ME_MoveCursorChars
(
editor
,
&
linebreakCursor
,
-
linebreakSize
,
FALSE
);
ME_GetTextW
(
editor
,
lastchar
,
2
,
&
linebreakCursor
,
linebreakSize
,
FALSE
,
FALSE
);
ME_GetTextW
(
editor
,
lastchar
,
2
,
&
linebreakCursor
,
linebreakSize
,
FALSE
,
FALSE
);
...
@@ -1781,7 +1781,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
...
@@ -1781,7 +1781,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
ERR
(
"EM_STREAMIN without SF_TEXT or SF_RTF
\n
"
);
ERR
(
"EM_STREAMIN without SF_TEXT or SF_RTF
\n
"
);
/* put the cursor at the top */
/* put the cursor at the top */
if
(
!
(
format
&
SFF_SELECTION
))
if
(
!
(
format
&
SFF_SELECTION
))
ME_SetSelection
(
editor
,
0
,
0
);
set_selection_cursors
(
editor
,
0
,
0
);
ME_CursorFromCharOfs
(
editor
,
from
,
&
start
);
ME_CursorFromCharOfs
(
editor
,
from
,
&
start
);
ME_UpdateLinkAttribute
(
editor
,
&
start
,
to
-
from
);
ME_UpdateLinkAttribute
(
editor
,
&
start
,
to
-
from
);
}
}
...
@@ -2147,14 +2147,14 @@ static int ME_GetTextRange(ME_TextEditor *editor, WCHAR *strText,
...
@@ -2147,14 +2147,14 @@ static int ME_GetTextRange(ME_TextEditor *editor, WCHAR *strText,
}
}
}
}
static
int
handle_EM_EXSETSEL
(
ME_TextEditor
*
editor
,
int
to
,
int
from
)
int
set_selection
(
ME_TextEditor
*
editor
,
int
to
,
int
from
)
{
{
int
end
;
int
end
;
TRACE
(
"%d - %d
\n
"
,
to
,
from
);
TRACE
(
"%d - %d
\n
"
,
to
,
from
);
ME_InvalidateSelection
(
editor
);
ME_InvalidateSelection
(
editor
);
end
=
ME_SetSelection
(
editor
,
to
,
from
);
end
=
set_selection_cursors
(
editor
,
to
,
from
);
ME_InvalidateSelection
(
editor
);
ME_InvalidateSelection
(
editor
);
update_caret
(
editor
);
update_caret
(
editor
);
ME_SendSelChange
(
editor
);
ME_SendSelChange
(
editor
);
...
@@ -2682,7 +2682,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
...
@@ -2682,7 +2682,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
case
'A'
:
case
'A'
:
if
(
ctrl_is_down
)
if
(
ctrl_is_down
)
{
{
handle_EM_EXSETSEL
(
editor
,
0
,
-
1
);
set_selection
(
editor
,
0
,
-
1
);
return
TRUE
;
return
TRUE
;
}
}
break
;
break
;
...
@@ -3796,7 +3796,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
...
@@ -3796,7 +3796,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
}
}
case
EM_SETSEL
:
case
EM_SETSEL
:
{
{
return
handle_EM_EXSETSEL
(
editor
,
wParam
,
lParam
);
return
set_selection
(
editor
,
wParam
,
lParam
);
}
}
case
EM_SETSCROLLPOS
:
case
EM_SETSCROLLPOS
:
{
{
...
@@ -3821,7 +3821,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
...
@@ -3821,7 +3821,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
{
{
CHARRANGE
range
=
*
(
CHARRANGE
*
)
lParam
;
CHARRANGE
range
=
*
(
CHARRANGE
*
)
lParam
;
return
handle_EM_EXSETSEL
(
editor
,
range
.
cpMin
,
range
.
cpMax
);
return
set_selection
(
editor
,
range
.
cpMin
,
range
.
cpMax
);
}
}
case
EM_SHOWSCROLLBAR
:
case
EM_SHOWSCROLLBAR
:
{
{
...
@@ -4122,7 +4122,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
...
@@ -4122,7 +4122,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
TRACE
(
"WM_SETTEXT - NULL
\n
"
);
TRACE
(
"WM_SETTEXT - NULL
\n
"
);
ME_SetCursorToStart
(
editor
,
&
cursor
);
ME_SetCursorToStart
(
editor
,
&
cursor
);
ME_UpdateLinkAttribute
(
editor
,
&
cursor
,
INT_MAX
);
ME_UpdateLinkAttribute
(
editor
,
&
cursor
,
INT_MAX
);
ME_SetSelection
(
editor
,
0
,
0
);
set_selection_cursors
(
editor
,
0
,
0
);
editor
->
nModifyStep
=
0
;
editor
->
nModifyStep
=
0
;
ME_CommitUndo
(
editor
);
ME_CommitUndo
(
editor
);
ME_EmptyUndoStack
(
editor
);
ME_EmptyUndoStack
(
editor
);
...
@@ -4813,7 +4813,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
...
@@ -4813,7 +4813,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
HeapFree
(
GetProcessHeap
(),
0
,
lpCompStr
);
HeapFree
(
GetProcessHeap
(),
0
,
lpCompStr
);
if
(
dwIndex
==
GCS_COMPSTR
)
if
(
dwIndex
==
GCS_COMPSTR
)
ME_SetSelection
(
editor
,
editor
->
imeStartIndex
,
set_selection_cursors
(
editor
,
editor
->
imeStartIndex
,
editor
->
imeStartIndex
+
dwBufLen
/
sizeof
(
WCHAR
));
editor
->
imeStartIndex
+
dwBufLen
/
sizeof
(
WCHAR
));
}
}
ME_ReleaseStyle
(
style
);
ME_ReleaseStyle
(
style
);
...
...
dlls/riched20/editor.h
View file @
5419a980
...
@@ -149,7 +149,7 @@ void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod) DECLSPEC_
...
@@ -149,7 +149,7 @@ void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod) DECLSPEC_
/* caret.c */
/* caret.c */
void
ME_SetCursorToStart
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
)
DECLSPEC_HIDDEN
;
void
ME_SetCursorToStart
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
)
DECLSPEC_HIDDEN
;
int
ME_SetSelection
(
ME_TextEditor
*
editor
,
int
from
,
int
to
)
DECLSPEC_HIDDEN
;
int
set_selection_cursors
(
ME_TextEditor
*
editor
,
int
from
,
int
to
)
DECLSPEC_HIDDEN
;
BOOL
ME_MoveCursorWords
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
,
int
nRelOfs
)
DECLSPEC_HIDDEN
;
BOOL
ME_MoveCursorWords
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
,
int
nRelOfs
)
DECLSPEC_HIDDEN
;
void
hide_caret
(
ME_TextEditor
*
ed
)
DECLSPEC_HIDDEN
;
void
hide_caret
(
ME_TextEditor
*
ed
)
DECLSPEC_HIDDEN
;
void
show_caret
(
ME_TextEditor
*
ed
)
DECLSPEC_HIDDEN
;
void
show_caret
(
ME_TextEditor
*
ed
)
DECLSPEC_HIDDEN
;
...
@@ -255,6 +255,7 @@ void ME_RTFSpecialCharHook(struct _RTF_Info *info) DECLSPEC_HIDDEN;
...
@@ -255,6 +255,7 @@ void ME_RTFSpecialCharHook(struct _RTF_Info *info) DECLSPEC_HIDDEN;
void
ME_StreamInFill
(
ME_InStream
*
stream
)
DECLSPEC_HIDDEN
;
void
ME_StreamInFill
(
ME_InStream
*
stream
)
DECLSPEC_HIDDEN
;
extern
BOOL
me_debug
DECLSPEC_HIDDEN
;
extern
BOOL
me_debug
DECLSPEC_HIDDEN
;
void
ME_ReplaceSel
(
ME_TextEditor
*
editor
,
BOOL
can_undo
,
const
WCHAR
*
str
,
int
len
)
DECLSPEC_HIDDEN
;
void
ME_ReplaceSel
(
ME_TextEditor
*
editor
,
BOOL
can_undo
,
const
WCHAR
*
str
,
int
len
)
DECLSPEC_HIDDEN
;
int
set_selection
(
ME_TextEditor
*
editor
,
int
to
,
int
from
)
DECLSPEC_HIDDEN
;
/* table.c */
/* table.c */
BOOL
ME_IsInTable
(
ME_DisplayItem
*
pItem
)
DECLSPEC_HIDDEN
;
BOOL
ME_IsInTable
(
ME_DisplayItem
*
pItem
)
DECLSPEC_HIDDEN
;
...
...
dlls/riched20/richole.c
View file @
5419a980
...
@@ -2149,7 +2149,7 @@ static HRESULT WINAPI ITextRange_fnSelect(ITextRange *me)
...
@@ -2149,7 +2149,7 @@ static HRESULT WINAPI ITextRange_fnSelect(ITextRange *me)
if
(
!
This
->
child
.
reole
)
if
(
!
This
->
child
.
reole
)
return
CO_E_RELEASED
;
return
CO_E_RELEASED
;
ME_SetS
election
(
This
->
child
.
reole
->
editor
,
This
->
start
,
This
->
end
);
set_s
election
(
This
->
child
.
reole
->
editor
,
This
->
start
,
This
->
end
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -4649,7 +4649,7 @@ static HRESULT WINAPI ITextSelection_fnSetStart(ITextSelection *me, LONG value)
...
@@ -4649,7 +4649,7 @@ static HRESULT WINAPI ITextSelection_fnSetStart(ITextSelection *me, LONG value)
ME_GetSelectionOfs
(
This
->
reOle
->
editor
,
&
start
,
&
end
);
ME_GetSelectionOfs
(
This
->
reOle
->
editor
,
&
start
,
&
end
);
hr
=
textrange_setstart
(
This
->
reOle
,
value
,
&
start
,
&
end
);
hr
=
textrange_setstart
(
This
->
reOle
,
value
,
&
start
,
&
end
);
if
(
hr
==
S_OK
)
if
(
hr
==
S_OK
)
ME_SetS
election
(
This
->
reOle
->
editor
,
start
,
end
);
set_s
election
(
This
->
reOle
->
editor
,
start
,
end
);
return
hr
;
return
hr
;
}
}
...
@@ -4684,7 +4684,7 @@ static HRESULT WINAPI ITextSelection_fnSetEnd(ITextSelection *me, LONG value)
...
@@ -4684,7 +4684,7 @@ static HRESULT WINAPI ITextSelection_fnSetEnd(ITextSelection *me, LONG value)
ME_GetSelectionOfs
(
This
->
reOle
->
editor
,
&
start
,
&
end
);
ME_GetSelectionOfs
(
This
->
reOle
->
editor
,
&
start
,
&
end
);
hr
=
textrange_setend
(
This
->
reOle
,
value
,
&
start
,
&
end
);
hr
=
textrange_setend
(
This
->
reOle
,
value
,
&
start
,
&
end
);
if
(
hr
==
S_OK
)
if
(
hr
==
S_OK
)
ME_SetS
election
(
This
->
reOle
->
editor
,
start
,
end
);
set_s
election
(
This
->
reOle
->
editor
,
start
,
end
);
return
hr
;
return
hr
;
}
}
...
@@ -4803,7 +4803,7 @@ static HRESULT WINAPI ITextSelection_fnCollapse(ITextSelection *me, LONG bStart)
...
@@ -4803,7 +4803,7 @@ static HRESULT WINAPI ITextSelection_fnCollapse(ITextSelection *me, LONG bStart)
ME_GetSelectionOfs
(
This
->
reOle
->
editor
,
&
start
,
&
end
);
ME_GetSelectionOfs
(
This
->
reOle
->
editor
,
&
start
,
&
end
);
hres
=
range_Collapse
(
bStart
,
&
start
,
&
end
);
hres
=
range_Collapse
(
bStart
,
&
start
,
&
end
);
if
(
SUCCEEDED
(
hres
))
if
(
SUCCEEDED
(
hres
))
ME_SetS
election
(
This
->
reOle
->
editor
,
start
,
end
);
set_s
election
(
This
->
reOle
->
editor
,
start
,
end
);
return
hres
;
return
hres
;
}
}
...
...
dlls/riched20/txtsrv.c
View file @
5419a980
...
@@ -290,7 +290,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSetText(ITextServices *iface, LPC
...
@@ -290,7 +290,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSetText(ITextServices *iface, LPC
ME_InternalDeleteText
(
This
->
editor
,
&
cursor
,
ME_GetTextLength
(
This
->
editor
),
FALSE
);
ME_InternalDeleteText
(
This
->
editor
,
&
cursor
,
ME_GetTextLength
(
This
->
editor
),
FALSE
);
if
(
pszText
)
if
(
pszText
)
ME_InsertTextFromCursor
(
This
->
editor
,
0
,
pszText
,
-
1
,
This
->
editor
->
pBuffer
->
pDefaultStyle
);
ME_InsertTextFromCursor
(
This
->
editor
,
0
,
pszText
,
-
1
,
This
->
editor
->
pBuffer
->
pDefaultStyle
);
ME_SetSelection
(
This
->
editor
,
0
,
0
);
set_selection_cursors
(
This
->
editor
,
0
,
0
);
This
->
editor
->
nModifyStep
=
0
;
This
->
editor
->
nModifyStep
=
0
;
OleFlushClipboard
();
OleFlushClipboard
();
ME_EmptyUndoStack
(
This
->
editor
);
ME_EmptyUndoStack
(
This
->
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