TCHAR buffer = new TCHAR (getCodePage (), newText, true); OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, buffer); return LRESULT.ZERO;
LRESULT wmClipboard (int hwndText, int msg, int wParam, int lParam) {	if ((style & SWT.READ_ONLY) != 0) return null;	if (!hooks (SWT.Verify) && !filters (SWT.Verify)) return null;	boolean call = false, select = false;	int [] start = new int [1], end = new int [1];	String oldText = null, newText = null;	switch (msg) {		case OS.WM_CLEAR:		case OS.WM_CUT:			OS.SendMessage (hwndText, OS.EM_GETSEL, start, end);			if (start [0] != end [0]) {				newText = "";				call = true;			}			break;		case OS.WM_PASTE:			OS.SendMessage (hwndText, OS.EM_GETSEL, start, end);			newText = getClipboardText ();			break;		case OS.EM_UNDO:		case OS.WM_UNDO:			if (OS.SendMessage (hwndText, OS.EM_CANUNDO, 0, 0) != 0) {				ignoreModify = true;				OS.SendMessage (hwndText, OS.EM_GETSEL, start, end);				OS.CallWindowProc (EditProc, hwndText, msg, wParam, lParam);				newText = getSelectionText ();				OS.CallWindowProc (EditProc, hwndText, msg, wParam, lParam);				ignoreModify = false;			}			break;		case OS.WM_SETTEXT:			select = true;			end [0] = OS.GetWindowTextLength (hwndText);			oldText = getText ();			int length = OS.IsUnicode ? OS.wcslen (lParam) : OS.strlen (lParam);			TCHAR buffer = new TCHAR (getCodePage (), length);			int byteCount = buffer.length () * TCHAR.sizeof;			OS.MoveMemory (buffer, lParam, byteCount);			newText = buffer.toString (0, length);			break;	}	if (newText != null && !newText.equals (oldText)) {		oldText = newText;		newText = verifyText (newText, start [0], end [0], null);		if (newText == null) return LRESULT.ZERO;		if (!newText.equals (oldText)) {			if (call) {				OS.CallWindowProc (EditProc, hwndText, msg, wParam, lParam);			}			if (select) {				OS.SendMessage (hwndText, OS.EM_SETSEL, start [0], end [0]);			}			TCHAR buffer = new TCHAR (getCodePage (), newText, true);			OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, buffer);			return LRESULT.ZERO;		}	}	return null;}