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
251e1685
Commit
251e1685
authored
May 27, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 27, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Implement SetText() for selection range.
parent
d2723461
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
22 deletions
+42
-22
editor.c
dlls/riched20/editor.c
+26
-19
editor.h
dlls/riched20/editor.h
+1
-0
richole.c
dlls/riched20/richole.c
+15
-3
No files found.
dlls/riched20/editor.c
View file @
251e1685
...
...
@@ -3134,6 +3134,30 @@ static void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM
}
}
void
ME_ReplaceSel
(
ME_TextEditor
*
editor
,
BOOL
can_undo
,
const
WCHAR
*
str
,
int
len
)
{
int
from
,
to
,
nStartCursor
;
ME_Style
*
style
;
nStartCursor
=
ME_GetSelectionOfs
(
editor
,
&
from
,
&
to
);
style
=
ME_GetSelectionInsertStyle
(
editor
);
ME_InternalDeleteText
(
editor
,
&
editor
->
pCursors
[
nStartCursor
],
to
-
from
,
FALSE
);
ME_InsertTextFromCursor
(
editor
,
0
,
str
,
len
,
style
);
ME_ReleaseStyle
(
style
);
/* drop temporary style if line end */
/*
* FIXME question: does abc\n mean: put abc,
* clear temp style, put \n? (would require a change)
*/
if
(
len
>
0
&&
str
[
len
-
1
]
==
'\n'
)
ME_ClearTempStyle
(
editor
);
ME_CommitUndo
(
editor
);
ME_UpdateSelectionLinkAttribute
(
editor
);
if
(
!
can_undo
)
ME_EmptyUndoStack
(
editor
);
ME_UpdateRepaint
(
editor
,
FALSE
);
}
#define UNSUPPORTED_MSG(e) \
case e: \
FIXME(#e ": stub\n"); \
...
...
@@ -3609,31 +3633,14 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
}
case
EM_REPLACESEL
:
{
int
from
,
to
,
nStartCursor
;
ME_Style
*
style
;
int
len
=
0
;
LONG
codepage
=
unicode
?
CP_UNICODE
:
CP_ACP
;
LPWSTR
wszText
=
ME_ToUnicode
(
codepage
,
(
void
*
)
lParam
,
&
len
);
TRACE
(
"EM_REPLACESEL - %s
\n
"
,
debugstr_w
(
wszText
));
nStartCursor
=
ME_GetSelectionOfs
(
editor
,
&
from
,
&
to
);
style
=
ME_GetSelectionInsertStyle
(
editor
);
ME_InternalDeleteText
(
editor
,
&
editor
->
pCursors
[
nStartCursor
],
to
-
from
,
FALSE
);
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
style
);
ME_ReleaseStyle
(
style
);
/* drop temporary style if line end */
/*
* FIXME question: does abc\n mean: put abc,
* clear temp style, put \n? (would require a change)
*/
if
(
len
>
0
&&
wszText
[
len
-
1
]
==
'\n'
)
ME_ClearTempStyle
(
editor
);
ME_ReplaceSel
(
editor
,
!!
wParam
,
wszText
,
len
);
ME_EndToUnicode
(
codepage
,
wszText
);
ME_CommitUndo
(
editor
);
ME_UpdateSelectionLinkAttribute
(
editor
);
if
(
!
wParam
)
ME_EmptyUndoStack
(
editor
);
ME_UpdateRepaint
(
editor
,
FALSE
);
return
len
;
}
case
EM_SCROLLCARET
:
...
...
dlls/riched20/editor.h
View file @
251e1685
...
...
@@ -262,6 +262,7 @@ void ME_RTFTblAttrHook(struct _RTF_Info *info) DECLSPEC_HIDDEN;
void
ME_RTFSpecialCharHook
(
struct
_RTF_Info
*
info
)
DECLSPEC_HIDDEN
;
void
ME_StreamInFill
(
ME_InStream
*
stream
)
DECLSPEC_HIDDEN
;
extern
BOOL
me_debug
DECLSPEC_HIDDEN
;
void
ME_ReplaceSel
(
ME_TextEditor
*
editor
,
BOOL
can_undo
,
const
WCHAR
*
str
,
int
len
)
DECLSPEC_HIDDEN
;
/* table.c */
BOOL
ME_IsInTable
(
ME_DisplayItem
*
pItem
)
DECLSPEC_HIDDEN
;
...
...
dlls/riched20/richole.c
View file @
251e1685
...
...
@@ -3860,14 +3860,26 @@ static HRESULT WINAPI ITextSelection_fnGetText(ITextSelection *me, BSTR *pbstr)
return
S_OK
;
}
static
HRESULT
WINAPI
ITextSelection_fnSetText
(
ITextSelection
*
me
,
BSTR
b
str
)
static
HRESULT
WINAPI
ITextSelection_fnSetText
(
ITextSelection
*
me
,
BSTR
str
)
{
ITextSelectionImpl
*
This
=
impl_from_ITextSelection
(
me
);
ME_TextEditor
*
editor
;
int
len
,
to
,
from
;
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
str
));
if
(
!
This
->
reOle
)
return
CO_E_RELEASED
;
FIXME
(
"not implemented
\n
"
);
return
E_NOTIMPL
;
editor
=
This
->
reOle
->
editor
;
len
=
strlenW
(
str
);
ME_GetSelectionOfs
(
editor
,
&
from
,
&
to
);
ME_ReplaceSel
(
editor
,
FALSE
,
str
,
len
);
if
(
len
<
to
-
from
)
textranges_update_ranges
(
This
->
reOle
,
from
,
len
,
RANGE_UPDATE_DELETE
);
return
S_OK
;
}
static
HRESULT
WINAPI
ITextSelection_fnGetChar
(
ITextSelection
*
me
,
LONG
*
pch
)
...
...
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