Handling keydow event for enter, backspace
@param {aria.utils.Event} event
@protected
498024
function (event) {
            var domUtil = ariaUtilsDom;

            var inputField = this.getTextInputField();
            var inputFieldValue = inputField.value;
            var inputFieldIsEmpty = (ariaUtilsString.trim(inputFieldValue) === "");

            switch (event.keyCode) {

                case event.KC_ARROW_LEFT :
                    if (this.hasInsertedOptions()) {

                        if (this.isInputFieldFocused()) {
                            var position = ariaUtilsCaret.getPosition(inputField);
                            if (position.start === 0 && position.end === 0) {
                                event.preventDefault();

                                // Close the dropdown in order not to mess with focus events and so on
                                this._closeDropdown();

                                // Highlight last option
                                this.highlightOption(this.insertedOptionsCount());
                                break;
                            }
                        }

                        if (this.isInHighlightedMode()) {
                            event.preventDefault();

                            this.__navigateLeftInHighlightedMode();
                            break;
                        }
                    }

                    break;

                case event.KC_ARROW_RIGHT :
                    if (this.isInHighlightedMode()) {
                        event.preventDefault();

                        this.__navigateRightInHighlightedMode();
                    }

                    break;

                case event.KC_TAB :
                    if (this.isInputFieldFocused()) {
                        if (inputFieldIsEmpty) {
                            if (inputField.nextSibling != null) {
                                event.preventDefault();

                                this._makeInputFieldLastChild();
                                this.setHelpText(false);
                                inputField.focus();
                            }
                        }
                    }

                    break;

                case event.KC_BACKSPACE :
                    if (inputFieldIsEmpty) {
                        var highlightedElementIndex = this.getHighlightedOptionIndex();
                        var highlightedElement = this.getHighlightedOption();

                        if (highlightedElement) {
                            var highlightedElementLabel = highlightedElement.textContent
                                    || highlightedElement.innerText;
                            domUtil.removeElement(highlightedElement);

                            var newIndex = highlightedElementIndex - 1;
                            if (newIndex >= 1) {
                                this.highlightOption(newIndex);
                            } else {
                                if (this.insertedOptionsCount() > 0) {
                                    this.highlightOption(1);
                                } else {
                                    this._enterInputField();
                                }
                            }

                            this._removeValue(highlightedElementLabel);
                        } else {
                            var previousSiblingElement = domUtil.getPreviousSiblingElement(inputField);
                            if (previousSiblingElement) {
                                var previousSiblingLabel = previousSiblingElement.firstChild.textContent
                                        || previousSiblingElement.firstChild.innerText;
                                domUtil.removeElement(previousSiblingElement);
                                this._removeValue(previousSiblingLabel);
                            }
                        }
                        event.preventDefault();
                    }

                    break;

                case event.KC_DELETE :
                    if (inputFieldIsEmpty) {
                        var highlightedElementIndex = this.getHighlightedOptionIndex();
                        var highlightedElement = this.getHighlightedOption();

                        if (highlightedElement) {
                            var highlightedElementLabel = highlightedElement.textContent
                                    || highlightedElement.innerText;
                            domUtil.removeElement(highlightedElement);

                            if (highlightedElementIndex <= this.insertedOptionsCount()) {
                                this.highlightOption(highlightedElementIndex);
                            } else {
                                this._enterInputField();
                            }

                            this._removeValue(highlightedElementLabel);
                        }
                    }

                    break;
            }

            if (this.isInputFieldFocused()) {
                this.$AutoComplete._dom_onkeydown.call(this, event);
            }
        }
1117933
def key_press_event(self, event):
        
        input_buffer = self._get_input_buffer()
        ctrl = int(event.modifiers() & QtCore.Qt.ControlModifier) != 0
        shift = int(event.modifiers() & QtCore.Qt.ShiftModifier) != 0
        delete = event.key() in [QtCore.Qt.Key_Backspace, QtCore.Qt.Key_Delete]
        ignore = False
        if delete and not input_buffer and not shift:
            return False
        if ctrl:
            if shift and event.key() == QtCore.Qt.Key_V:
                self.edit.insertPlainText(QtWidgets.qApp.clipboard().text())
                return False
            elif event.key() == QtCore.Qt.Key_L:
                self.edit.clear()
                if sys.platform == 'win32':
                    self.process.write(b'\r')
                self.process.write(b'\n')
                return False
        if (shift or ctrl) and event.key() == QtCore.Qt.Key_Backspace:
            if input_buffer.strip() != '':
                return True
            self._clear_user_buffer()
            return False
        if event.key() == QtCore.Qt.Key_Up:
            if self.is_code_completion_popup_visible():
                return True
            self._insert_command(self._history.scroll_up())
            return False
        if event.key() == QtCore.Qt.Key_Left:
            return bool(input_buffer)
        if event.key() == QtCore.Qt.Key_Down:
            if self.is_code_completion_popup_visible():
                return True
            self._insert_command(self._history.scroll_down())
            return False
        if event.key() == QtCore.Qt.Key_Home:
            tc = self.edit.textCursor()
            tc.movePosition(tc.StartOfBlock)
            tc.movePosition(tc.Right, tc.MoveAnchor, self.edit._formatter._prefix_len)
            self.edit.setTextCursor(tc)
            return False
        if event.key() == QtCore.Qt.Key_End:
            tc = self.edit.textCursor()
            tc.movePosition(tc.EndOfBlock)
            self.edit.setTextCursor(tc)
            self._cursor_pos = len(self._get_input_buffer())
            return False
        if event.key() in [QtCore.Qt.Key_Return, QtCore.Qt.Key_Enter]:
            if self.is_code_completion_popup_visible():
                return True
            tc = self.edit.textCursor()
            tc.movePosition(tc.EndOfBlock)
            self.edit.setTextCursor(tc)
            # send the user input to the child process
            if self.edit.flg_use_pty or 'cmd.exe' in self.process.program():
                # remove user buffer from text edit, the content of the buffer will be
                # drawn as soon as we write it to the process stdin
                tc = self.edit.textCursor()
                for _ in input_buffer:
                    tc.deletePreviousChar()
                self.edit.setTextCursor(tc)
            self._history.add_command(input_buffer)
            if sys.platform == 'win32':
                input_buffer += "\r"
            input_buffer += "\n"
            self.process.write(input_buffer.encode())
            if self.edit.flg_use_pty or 'cmd.exe' in self.process.program():
                ignore = True
        return not ignore
1246152
function () {
        Event.on(this.id, "keydown",  this.handleKeyDown,  this, true);
        Event.on(this.id, "keypress", this.handleKeyPress, this, true);
    }
289312
def key_pressed_event(self, event):
        
        if event.key() == self.keys.ESCAPE:
            self.close()

        self.example.key_event(event.key(), self.keys.ACTION_PRESS)
884452
def on_key_down(self, event):
        ''''''
        state = self.state

        # send all key events to the parent
        if self.mouse_pos:
            latlon = self.coordinates(self.mouse_pos.x, self.mouse_pos.y)
            selected = self.selected_objects(self.mouse_pos)
            state.event_queue.put(SlipKeyEvent(latlon, event, selected))

        c = event.GetUniChar()
        if c == ord('+') or (c == ord('=') and event.ShiftDown()):
            self.change_zoom(1.0/1.2)
            event.Skip()
        elif c == ord('-'):
            self.change_zoom(1.2)
            event.Skip()
        elif c == ord('G'):
            self.enter_position()
            event.Skip()
        elif c == ord('C'):
            self.clear_thumbnails()
            event.Skip()
357796
function(event) {
      var electric = Editor.Parser.electricChars, self = this;
      // Hack for Opera, and Firefox on OS X, in which stopping a
      // keydown event does not prevent the associated keypress event
      // from happening, so we have to cancel enter and tab again
      // here.
      if ((this.frozen && (!this.keyFilter || this.keyFilter(event.keyCode))) ||
          event.code == 13 || (event.code == 9 && this.options.tabMode != "default") ||
          (event.keyCode == 32 && event.shiftKey && this.options.tabMode == "default"))
        event.stop();
      else if (electric && electric.indexOf(event.character) != -1)
        this.parent.setTimeout(function(){self.indentAtCursor(null);}, 0);
      else if ((event.character == "v" || event.character == "V")
               && (event.ctrlKey || event.metaKey) && !event.altKey) // ctrl-V
        this.reroutePasteEvent();
    }
1345369
protected void keyEvent(final KeyEvent event) {
		try {
			if (event.getID() == KeyEvent.KEY_PRESSED && event.getKeyCode() == KeyEvent.VK_ENTER
					&& isEditable()) {
				// voir aussi focusEvent
				setValue(getValue());
			}
		} catch (final Exception e) {
			beep();
		}
	}
1073425
protected void keyPressed(final KeyEvent event) {
		final int keyCode = event.getKeyCode();
		final int modifiers = event.getModifiers();
		if ((modifiers & Event.CTRL_MASK) != 0 && keyCode == KeyEvent.VK_ADD) {
			adjustColumnWidths();
		}
		// else if (modifiers == 0)
		// {
		// final int selectedColumn = getSelectedColumn() != -1 ? getSelectedColumn() : 0;
		// final int selectedRow = getSelectedRow() != -1 ? getSelectedRow() : 0;
		// final int rowCount = getRowCount();
		// if (isCellEditable(selectedRow, selectedColumn) || rowCount == 0)
		// {
		// return;
		// }
		// final String keyChar = String.valueOf(event.getKeyChar());
		// String text;
		// for (int i = selectedRow + 1; i < rowCount; i++)
		// {
		// text = getTextAt(i, selectedColumn);
		// if (text != null && text.regionMatches(true, 0, keyChar, 0, 1))
		// {
		// setRowSelectionInterval(i, i);
		// setColumnSelectionInterval(selectedColumn, selectedColumn);
		// scrollRectToVisible(getCellRect(i, selectedColumn, true));
		// return;
		// }
		// }
		// for (int i = 0; i <= selectedRow; i++)
		// {
		// text = getTextAt(i, selectedColumn);
		// if (text != null && text.regionMatches(true, 0, keyChar, 0, 1))
		// {
		// setRowSelectionInterval(i, i);
		// setColumnSelectionInterval(selectedColumn, selectedColumn);
		// scrollRectToVisible(getCellRect(i, selectedColumn, true));
		// return;
		// }
		// }
		// }
	}
1308723
public void onKeyDown (KeyDownEvent event)
    {
        if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
            _onEnter.onClick(null);
        }
    }
638794
public void keyPressed(KeyEvent event)
    {
        lastKeyName = event.getName();
        lastCode = Integer.valueOf(event.getCode());
        if (!keys.contains(lastCode))
        {
            keys.add(lastCode);
        }
    }
148756
function keydown(event) {
			var inc = 0;
			if (ctrl.horizontal) {
				if (event.which === 37) { // LEFT
					inc = -1;
				} else if (event.which === 39) { // RIGHT
					inc = 1;
				}
			} else {
				var innerLimit = ctrl.getInnerLimit();
				if (event.which === 38) { // UP
					inc = -1;
				} else if (event.which === 40) { // DOWN
					inc = 1;
				} else if (event.which === 33) { // PAGEUP
					inc = -innerLimit;
				} else if (event.which === 34) { // PAGEDOWN
					inc = innerLimit;
				} else if (event.which === 35) { // END
					inc = $scope.total - $scope.ngBegin - innerLimit;
				} else if (event.which === 36) { // HOME
					inc = -$scope.ngBegin;
				}
			}
			if (inc !== 0) {
				boxesScrollServices.stopEvent(event);
				$scope.ngBegin = $scope.ngBegin + inc;
			}
		}
750996
function (event) {
                if (event.keyCode == aria.DomEvent.KC_SPACE) {
                    this._setRadioValue();
                    event.preventDefault(true);
                } else if (event.keyCode == aria.DomEvent.KC_LEFT) {
                    this._navigate(-1);
                    event.preventDefault(true);
                } else if (event.keyCode == aria.DomEvent.KC_RIGHT) {
                    this._navigate(+1);
                    event.preventDefault(true);
                } else if (event.keyCode == aria.DomEvent.KC_DOWN) {
                    this._navigate(+1);
                    event.preventDefault(true);
                } else if (event.keyCode == aria.DomEvent.KC_UP) {
                    this._navigate(-1);
                    event.preventDefault(true);
                }
            }
726727
function _processKey(event, bindings) {
			for (var id in bindings) {
				if (bindings[id] && bindings[id].keyBinding && bindings[id].command) {
					if (bindings[id].keyBinding.match(event)) {
						var activeBinding = bindings[id];
						var keyBinding = activeBinding.keyBinding;
						// Check for keys that are scoped to a particular part of the DOM
						if (!keyBinding.domScope || lib.contains(lib.node(keyBinding.domScope), event.target)) {
							if (executeBinding(activeBinding)) {
								lib.stop(event);
								return;
							}
						}
					}
				}
			}
		}
1359595
public void onKeyPress(KeyPressEvent event) {
		String name = event.getKeyName();
		if (KeyNames.ENTER.equals(name)) {
			reorderValues();
		}
	}
437067
function(event) {
      if (this.frozen == "leave") this.frozen = null;
      if (this.frozen && (!this.keyFilter || this.keyFilter(event.keyCode))) {
        event.stop();
        this.frozen(event);
        return;
      }

      var code = event.keyCode;
      // Don't scan when the user is typing.
      this.delayScanning();
      // Schedule a paren-highlight event, if configured.
      if (this.options.autoMatchParens)
        this.scheduleParenHighlight();

      // The various checks for !altKey are there because AltGr sets both
      // ctrlKey and altKey to true, and should not be recognised as
      // Control.
      if (code == 13) { // enter
        if (event.ctrlKey && !event.altKey) {
          this.reparseBuffer();
        }
        else {
          select.insertNewlineAtCursor(this.win);
          this.indentAtCursor();
          select.scrollToCursor(this.container);
        }
        event.stop();
      }
      else if (code == 9 && this.options.tabMode != "default" && !event.ctrlKey) { // tab
        this.handleTab(!event.shiftKey);
        event.stop();
      }
      else if (code == 32 && event.shiftKey && this.options.tabMode == "default") { // space
        this.handleTab(true);
        event.stop();
      }
      else if (code == 36 && !event.shiftKey && !event.ctrlKey) { // home
        if (this.home()) event.stop();
      }
      else if (code == 35 && !event.shiftKey && !event.ctrlKey) { // end
        if (this.end()) event.stop();
      }
      else if ((code == 219 || code == 221) && event.ctrlKey && !event.altKey) { // [, ]
        this.highlightParens(event.shiftKey, true);
        event.stop();
      }
      else if (event.metaKey && !event.shiftKey && (code == 37 || code == 39)) { // Meta-left/right
        var cursor = select.selectionTopNode(this.container);
        if (cursor === false || !this.container.firstChild) return;

        if (code == 37) select.focusAfterNode(startOfLine(cursor), this.container);
        else {
          var end = endOfLine(cursor, this.container);
          select.focusAfterNode(end ? end.previousSibling : this.container.lastChild, this.container);
        }
        event.stop();
      }
      else if ((event.ctrlKey || event.metaKey) && !event.altKey) {
        if ((event.shiftKey && code == 90) || code == 89) { // shift-Z, Y
          select.scrollToNode(this.history.redo());
          event.stop();
        }
        else if (code == 90 || (safari && code == 8)) { // Z, backspace
          select.scrollToNode(this.history.undo());
          event.stop();
        }
        else if (code == 83 && this.options.saveFunction) { // S
          this.options.saveFunction();
          event.stop();
        }
        else if (internetExplorer && code == 86) {
          this.reroutePasteEvent();
        }
      }
    }
578419
function (node, callback) {
      GOVUK.details.addEvent(node, 'keypress', function (e, target) {
        // When the key gets pressed - check if it is enter or space
        if (GOVUK.details.charCode(e) === GOVUK.details.KEY_ENTER || GOVUK.details.charCode(e) === GOVUK.details.KEY_SPACE) {
          if (target.nodeName.toLowerCase() === 'summary') {
            // Prevent space from scrolling the page
            // and enter from submitting a form
            GOVUK.details.preventDefault(e)
            // Click to let the click event do all the necessary action
            if (target.click) {
              target.click()
            } else {
              // except Safari 5.1 and under don't support .click() here
              callback(e, target)
            }
          }
        }
      })

      // Prevent keyup to prevent clicking twice in Firefox when using space key
      GOVUK.details.addEvent(node, 'keyup', function (e, target) {
        if (GOVUK.details.charCode(e) === GOVUK.details.KEY_SPACE) {
          if (target.nodeName === 'SUMMARY') {
            GOVUK.details.preventDefault(e)
          }
        }
      })

      GOVUK.details.addEvent(node, 'click', function (e, target) {
        callback(e, target)
      })
    }
1359610
function ( event ) {

        //if(!event.type) return;

      //  console.log( event.type )

        if( event.type.indexOf( R.prevDefault ) !== -1 ) event.preventDefault(); 

        if( event.type === 'contextmenu' ) return; 

        //if( event.type === 'keydown'){ R.editText( event ); return;}

        //if( event.type !== 'keydown' && event.type !== 'wheel' ) event.preventDefault();
        //event.stopPropagation();

        R.findZone();
       
        var e = R.e;

        if( event.type === 'keydown') R.editText( event );

        if( event.type === 'wheel' ) e.delta = event.deltaY > 0 ? 1 : -1;
        else e.delta = 0;
        
        e.clientX = event.clientX || 0;
        e.clientY = event.clientY || 0;
        e.type = event.type;

        // mobile

        if( R.isMobile ){

            if( event.touches && event.touches.length > 0 ){
        
                e.clientX = event.touches[ 0 ].clientX || 0;
                e.clientY = event.touches[ 0 ].clientY || 0;

            }

            if( event.type === 'touchstart') e.type = 'mousedown';
            if( event.type === 'touchend') e.type = 'mouseup';
            if( event.type === 'touchmove') e.type = 'mousemove';

        }
        
        
        /*
        if( event.type === 'touchstart'){ e.type = 'mousedown'; R.findID( e ); }
        if( event.type === 'touchend'){ e.type = 'mouseup';  if( R.ID !== null ) R.ID.handleEvent( e ); R.clearOldID(); }
        if( event.type === 'touchmove'){ e.type = 'mousemove';  }
        */


        if( e.type === 'mousedown' ) R.lock = true;
        if( e.type === 'mouseup' ) R.lock = false;

        if( R.isMobile && e.type === 'mousedown' ) R.findID( e );
        if( e.type === 'mousemove' && !R.lock ) R.findID( e );
        

        if( R.ID !== null ){

            if( R.ID.isCanvasOnly ) {

                e.clientX = R.ID.mouse.x;
                e.clientY = R.ID.mouse.y;

            }

            R.ID.handleEvent( e );

        }

        if( R.isMobile && e.type === 'mouseup' ) R.clearOldID();

    }