caretAlignment = PREVIOUS_OFFSET_TRAILING;
void handleKey(Event event) {	int action;	if (event.keyCode != 0) {		// special key pressed (e.g., F1)		action = getKeyBinding(event.keyCode | event.stateMask);	} else {		// character key pressed		action = getKeyBinding(event.character | event.stateMask);		if (action == SWT.NULL) {			// see if we have a control character			if ((event.stateMask & SWT.CTRL) != 0 && (event.character >= 0) && event.character <= 31) {				// get the character from the CTRL+char sequence, the control				// key subtracts 64 from the value of the key that it modifies				int c = event.character + 64;				action = getKeyBinding(c | event.stateMask);			}		}	}	if (action == SWT.NULL) {		boolean ignore = false;				if (IS_CARBON) {			// Ignore accelerator key combinations (we do not want to 			// insert a character in the text in this instance). Do not  			// ignore COMMAND+ALT combinations since that key sequence			// produces characters on the mac.			ignore = (event.stateMask ^ SWT.COMMAND) == 0 ||					(event.stateMask ^ (SWT.COMMAND | SWT.SHIFT)) == 0;		} else if (IS_MOTIF) {			// Ignore accelerator key combinations (we do not want to 			// insert a character in the text in this instance). Do not  			// ignore ALT combinations since this key sequence			// produces characters on motif.			ignore = (event.stateMask ^ SWT.CTRL) == 0 ||					(event.stateMask ^ (SWT.CTRL | SWT.SHIFT)) == 0;		} else {			// Ignore accelerator key combinations (we do not want to 			// insert a character in the text in this instance). Don't  			// ignore CTRL+ALT combinations since that is the Alt Gr 			// key on some keyboards.  See bug 20953. 			ignore = (event.stateMask ^ SWT.ALT) == 0 || 					(event.stateMask ^ SWT.CTRL) == 0 ||					(event.stateMask ^ (SWT.ALT | SWT.SHIFT)) == 0 ||					(event.stateMask ^ (SWT.CTRL | SWT.SHIFT)) == 0;		}		// -ignore anything below SPACE except for line delimiter keys and tab.		// -ignore DEL 		if (!ignore && event.character > 31 && event.character != SWT.DEL || 		    event.character == SWT.CR || event.character == SWT.LF || 		    event.character == TAB) {			doContent(event.character);			update();		}	} else {		invokeAction(action);	}}