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
eb8f4751
Commit
eb8f4751
authored
Jan 21, 2014
by
Jactry Zeng
Committed by
Alexandre Julliard
Jan 27, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Use codepage in ME_ToUnicode.
parent
c46debee
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
18 deletions
+19
-18
editor.c
dlls/riched20/editor.c
+11
-10
editor.h
dlls/riched20/editor.h
+2
-2
string.c
dlls/riched20/string.c
+6
-6
No files found.
dlls/riched20/editor.c
View file @
eb8f4751
...
...
@@ -3364,10 +3364,9 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
len
=
lParam
?
strlen
((
char
*
)
lParam
)
:
0
;
}
}
else
{
/* FIXME: make use of pStruct->codepage in the to unicode translation */
wszText
=
ME_ToUnicode
(
bUnicode
,
(
void
*
)
lParam
,
&
len
);
wszText
=
ME_ToUnicode
(
pStruct
->
codepage
,
(
void
*
)
lParam
,
&
len
);
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
style
);
ME_EndToUnicode
(
bUnicod
e
,
wszText
);
ME_EndToUnicode
(
pStruct
->
codepag
e
,
wszText
);
}
if
(
bSelection
)
{
...
...
@@ -3555,7 +3554,8 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
int
from
,
to
,
nStartCursor
;
ME_Style
*
style
;
int
len
=
0
;
LPWSTR
wszText
=
ME_ToUnicode
(
unicode
,
(
void
*
)
lParam
,
&
len
);
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
);
...
...
@@ -3570,7 +3570,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
*/
if
(
len
>
0
&&
wszText
[
len
-
1
]
==
'\n'
)
ME_ClearTempStyle
(
editor
);
ME_EndToUnicode
(
unicod
e
,
wszText
);
ME_EndToUnicode
(
codepag
e
,
wszText
);
ME_CommitUndo
(
editor
);
ME_UpdateSelectionLinkAttribute
(
editor
);
if
(
!
wParam
)
...
...
@@ -3626,7 +3626,8 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
else
{
int
textLen
;
LPWSTR
wszText
=
ME_ToUnicode
(
unicode
,
(
void
*
)
lParam
,
&
textLen
);
LONG
codepage
=
unicode
?
CP_UNICODE
:
CP_ACP
;
LPWSTR
wszText
=
ME_ToUnicode
(
codepage
,
(
void
*
)
lParam
,
&
textLen
);
TRACE
(
"WM_SETTEXT - %s
\n
"
,
debugstr_w
(
wszText
));
/* debugstr_w() */
if
(
textLen
>
0
)
{
...
...
@@ -3643,7 +3644,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
}
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
editor
->
pBuffer
->
pDefaultStyle
);
}
ME_EndToUnicode
(
unicod
e
,
wszText
);
ME_EndToUnicode
(
codepag
e
,
wszText
);
}
}
else
...
...
@@ -4035,8 +4036,8 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
{
WCHAR
*
textW
;
int
len
;
textW
=
ME_ToUnicode
(
unicod
e
,
text
,
&
len
);
LONG
codepage
=
unicode
?
CP_UNICODE
:
CP_ACP
;
textW
=
ME_ToUnicode
(
codepag
e
,
text
,
&
len
);
if
(
!
(
editor
->
styleFlags
&
ES_MULTILINE
))
{
len
=
0
;
...
...
@@ -4044,7 +4045,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
len
++
;
}
ME_InsertTextFromCursor
(
editor
,
0
,
textW
,
len
,
editor
->
pBuffer
->
pDefaultStyle
);
ME_EndToUnicode
(
unicod
e
,
textW
);
ME_EndToUnicode
(
codepag
e
,
textW
);
ME_SetCursorToStart
(
editor
,
&
editor
->
pCursors
[
0
]);
ME_SetCursorToStart
(
editor
,
&
editor
->
pCursors
[
1
]);
}
...
...
dlls/riched20/editor.h
View file @
eb8f4751
...
...
@@ -110,8 +110,8 @@ BOOL ME_InsertString(ME_String *s, int ofs, const WCHAR *insert, int len) DECLSP
#define CP_UNICODE 1200
/* smart helpers for A<->W conversions, they reserve/free memory and call MultiByte<->WideChar functions */
LPWSTR
ME_ToUnicode
(
BOOL
unicod
e
,
LPVOID
psz
,
INT
*
len
)
DECLSPEC_HIDDEN
;
void
ME_EndToUnicode
(
BOOL
unicod
e
,
LPVOID
psz
)
DECLSPEC_HIDDEN
;
LPWSTR
ME_ToUnicode
(
LONG
codepag
e
,
LPVOID
psz
,
INT
*
len
)
DECLSPEC_HIDDEN
;
void
ME_EndToUnicode
(
LONG
codepag
e
,
LPVOID
psz
)
DECLSPEC_HIDDEN
;
static
inline
int
ME_IsWSpace
(
WCHAR
ch
)
{
...
...
dlls/riched20/string.c
View file @
eb8f4751
...
...
@@ -172,30 +172,30 @@ ME_CallWordBreakProc(ME_TextEditor *editor, WCHAR *str, INT len, INT start, INT
}
}
LPWSTR
ME_ToUnicode
(
BOOL
unicod
e
,
LPVOID
psz
,
INT
*
len
)
LPWSTR
ME_ToUnicode
(
LONG
codepag
e
,
LPVOID
psz
,
INT
*
len
)
{
*
len
=
0
;
if
(
!
psz
)
return
NULL
;
if
(
unicode
)
if
(
codepage
==
CP_UNICODE
)
{
*
len
=
lstrlenW
(
psz
);
return
psz
;
}
else
{
WCHAR
*
tmp
;
int
nChars
=
MultiByteToWideChar
(
CP_ACP
,
0
,
psz
,
-
1
,
NULL
,
0
);
int
nChars
=
MultiByteToWideChar
(
codepage
,
0
,
psz
,
-
1
,
NULL
,
0
);
if
(
!
nChars
)
return
NULL
;
if
((
tmp
=
ALLOC_N_OBJ
(
WCHAR
,
nChars
))
!=
NULL
)
*
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
psz
,
-
1
,
tmp
,
nChars
)
-
1
;
*
len
=
MultiByteToWideChar
(
codepage
,
0
,
psz
,
-
1
,
tmp
,
nChars
)
-
1
;
return
tmp
;
}
}
void
ME_EndToUnicode
(
BOOL
unicod
e
,
LPVOID
psz
)
void
ME_EndToUnicode
(
LONG
codepag
e
,
LPVOID
psz
)
{
if
(
!
unicode
)
if
(
codepage
!=
CP_UNICODE
)
FREE_OBJ
(
psz
);
}
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