/* The buffer has been expanded, create a new line and
insert it into the link list */
LINEDEF *new_line = HeapAlloc(GetProcessHeap(), 0, sizeof(LINEDEF));
- if (new_line == NULL)
- break;
+ if (new_line == NULL) // reactos r33509
+ break; // reactos r33509
new_line->next = previous_line->next;
previous_line->next = new_line;
current_line = new_line;
if(textA)
{
HLOCAL hloc32W_new;
- UINT countW_new = MultiByteToWideChar(CP_ACP, 0, textA, countA, NULL, 0);
- TRACE("%d bytes translated to %d WCHARs\n", countA, countW_new);
+ UINT countW_new = MultiByteToWideChar(CP_ACP, 0, textA, -1, NULL, 0);
if(countW_new > es->buffer_size + 1)
{
UINT alloc_size = ROUND_TO_GROW(countW_new * sizeof(WCHAR));
else
WARN("FAILED! Will synchronize partially\n");
}
+ es->text = LocalLock(es->hloc32W);
+ MultiByteToWideChar(CP_ACP, 0, textA, -1, es->text, es->buffer_size + 1);
+ LocalUnlock(es->hloc32A);
}
- /*TRACE("Locking 32-bit UNICODE buffer\n");*/
- es->text = LocalLock(es->hloc32W);
- if(textA)
- {
- MultiByteToWideChar(CP_ACP, 0, textA, countA, es->text, es->buffer_size + 1);
- LocalUnlock(es->hloc32A);
- }
+ else es->text = LocalLock(es->hloc32W);
}
if(es->flags & EF_APP_HAS_HANDLE) text_buffer_changed(es);
es->lock_count++;
if (force || (es->lock_count == 1)) {
if (es->hloc32W) {
- CHAR *textA = NULL; // ReactOS hacked!
UINT countA = 0;
UINT countW = get_text_length(es) + 1;
else
WARN("FAILED! Will synchronize partially\n");
}
- textA = LocalLock(es->hloc32A);
- }
-
- if(textA)
- {
- WideCharToMultiByte(CP_ACP, 0, es->text, countW, textA, countA, NULL, NULL);
- LocalUnlock(es->hloc32A);
+ WideCharToMultiByte(CP_ACP, 0, es->text, countW,
+ LocalLock(es->hloc32A), countA, NULL, NULL);
+ LocalUnlock(es->hloc32A);
}
LocalUnlock(es->hloc32W);
es->tabs = NULL;
else {
es->tabs = HeapAlloc(GetProcessHeap(), 0, count * sizeof(INT));
- if (es->tabs == NULL)
+ if (es->tabs == NULL) // reactos r33503
{
es->tabs_count = 0;
return FALSE;
- }
+ } // reactos r33503
memcpy(es->tabs, tabs, count * sizeof(INT));
}
return TRUE;
ulength = strlenW(es->undo_text);
utext = HeapAlloc(GetProcessHeap(), 0, (ulength + 1) * sizeof(WCHAR));
- if (utext == NULL)
- return FALSE;
+ if (utext == NULL) // reactos r33503
+ return FALSE; // reactos r33503
strcpyW(utext, es->undo_text);
* controls without ES_WANTRETURN would attempt to detect whether it is inside
* a dialog box or not.
*/
-static BOOL EDIT_IsInsideDialog(EDITSTATE *es)
+static inline BOOL EDIT_IsInsideDialog(EDITSTATE *es)
{
return (es->flags & EF_DIALOGMODE);
}
*/
static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y)
{
-#ifdef __REACTOS__
- HMENU menu = LoadMenuA(User32Instance, "EDITMENU");
-#else
HMENU menu = LoadMenuA(user32_module, "EDITMENU");
-#endif
HMENU popup = GetSubMenu(menu, 0);
UINT start = es->selection_start;
UINT end = es->selection_end;
y = rc.top + (rc.bottom - rc.top) / 2;
}
+ if (!(es->flags & EF_FOCUSED))
+ SetFocus(es->hwndSelf);
+
+#ifdef __REACTOS__
selectedItem = TrackPopupMenu(popup, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, x, y, 0, es->hwndSelf, NULL);
// Added see Revision 43925 comments.
switch (selectedItem) {
ERR("unknown menu item, please report\n");
break;
}
-
+#endif
DestroyMenu(menu);
}
EDIT_UpdateText(es, NULL, TRUE);
if (es->flags & EF_FOCUSED) {
DestroyCaret();
- CreateCaret(es->hwndSelf, 0, 2, es->line_height);
+ CreateCaret(es->hwndSelf, 0, 1, es->line_height);
EDIT_SetCaretPos(es, es->selection_end,
es->flags & EF_AFTER_WRAP);
ShowCaret(es->hwndSelf);
/*********************************************************************
*
- * WM_DESTROY
+ * WM_NCDESTROY
*
*/
-static LRESULT EDIT_WM_Destroy(EDITSTATE *es)
+static LRESULT EDIT_WM_NCDestroy(EDITSTATE *es)
{
LINEDEF *pc, *pp;
* The messages are in the order of the actual integer values
* (which can be found in include/windows.h)
*/
-LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
- WPARAM wParam, LPARAM lParam, BOOL unicode )
+LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode )
{
EDITSTATE *es = (EDITSTATE *)GetWindowLongPtrW( hwnd, 0 );
LRESULT result = 0;
if (!es && msg != WM_NCCREATE)
return DefWindowProcT(hwnd, msg, wParam, lParam, unicode);
- if (es && (msg != WM_DESTROY)) EDIT_LockBuffer(es);
+ if (es && (msg != WM_NCDESTROY)) EDIT_LockBuffer(es);
switch (msg) {
case EM_GETSEL:
break;
/* these messages missing from specs */
- case WM_USER+15:
case 0x00bf:
- case WM_USER+16:
case 0x00c0:
- case WM_USER+19:
case 0x00c3:
- case WM_USER+26:
case 0x00ca:
FIXME("undocumented message 0x%x, please report\n", msg);
result = DefWindowProcW(hwnd, msg, wParam, lParam);
result = EDIT_WM_NCCreate(hwnd, (LPCREATESTRUCTW)lParam, unicode);
break;
- case WM_DESTROY:
- result = EDIT_WM_Destroy(es);
+ case WM_NCDESTROY:
+ result = EDIT_WM_NCDestroy(es);
es = NULL;
#ifdef __REACTOS__
NtUserSetWindowFNID(hwnd, FNID_DESTROY);
CS_DBLCLKS | CS_PARENTDC, /* style */
EditWndProcA, /* procA */
EditWndProcW, /* procW */
-#ifdef _WIN64
- sizeof(EDITSTATE *), /* extra */
-#else
+#ifndef _WIN64
sizeof(EDITSTATE *) + sizeof(WORD), /* extra */
+#else
+ sizeof(EDITSTATE *), /* extra */
#endif
IDC_IBEAM, /* cursor */
0 /* brush */