Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 89610 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jface/bindings/keys/KeySequenceText.java (-4 / +17 lines)
Lines 76-81 Link Here
76
		 *            The key strokes from which to delete. This list must not
76
		 *            The key strokes from which to delete. This list must not
77
		 *            be <code>null</code>, and must represent a valid key
77
		 *            be <code>null</code>, and must represent a valid key
78
		 *            sequence.
78
		 *            sequence.
79
		 * @return An array of keystrokes minus the keystrokes that were
80
		 *         deleted.
79
		 */
81
		 */
80
		private final KeyStroke[] deleteKeyStroke(final KeyStroke[] keyStrokes) {
82
		private final KeyStroke[] deleteKeyStroke(final KeyStroke[] keyStrokes) {
81
			clearInsertionIndex();
83
			clearInsertionIndex();
Lines 144-150 Link Here
144
		 */
146
		 */
145
		private KeyStroke[] handleKeyDown(Event event, KeyStroke[] keyStrokes) {
147
		private KeyStroke[] handleKeyDown(Event event, KeyStroke[] keyStrokes) {
146
			// Is it an unmodified backspace character?
148
			// Is it an unmodified backspace character?
147
			if ((event.character == SWT.BS) && (event.stateMask == 0)) {
149
			if ((event.character == SWT.BS || event.character == SWT.DEL) && (event.stateMask == 0)) {
148
				return deleteKeyStroke(keyStrokes);
150
				return deleteKeyStroke(keyStrokes);
149
			}
151
			}
150
152
Lines 614-619 Link Here
614
	 * @param allowIncomplete
616
	 * @param allowIncomplete
615
	 *            Whether incomplete strokes should be allowed to exist in the
617
	 *            Whether incomplete strokes should be allowed to exist in the
616
	 *            list after the deletion.
618
	 *            list after the deletion.
619
	 * @param deletedKeyStrokes
620
	 *            The list of keystrokes that were deleted by this operation.
621
	 *            Declared as final since it will hold a reference to the new
622
	 *            keyStroke array that has deleted the selected keystrokes.
617
	 * @return The index at which a subsequent insert should occur. This index
623
	 * @return The index at which a subsequent insert should occur. This index
618
	 *         only has meaning to the <code>insertStrokeAt</code> method.
624
	 *         only has meaning to the <code>insertStrokeAt</code> method.
619
	 */
625
	 */
Lines 660-665 Link Here
660
		 */
666
		 */
661
		int endStrokeIndex;
667
		int endStrokeIndex;
662
		if (start == end) {
668
		if (start == end) {
669
			// return the current keystrokes, nothing has to be deleted
670
			deletedKeyStrokes[0] = keyStrokes;
663
			return startStrokeIndex;
671
			return startStrokeIndex;
664
		}
672
		}
665
673
Lines 676-685 Link Here
676
		 * Remove the strokes that are touched by the selection. Keep track of
684
		 * Remove the strokes that are touched by the selection. Keep track of
677
		 * the first stroke removed.
685
		 * the first stroke removed.
678
		 */
686
		 */
679
		final int newLength = endStrokeIndex - startStrokeIndex + 1;
687
		final int newLength = keyStrokesLength
688
				- (endStrokeIndex - startStrokeIndex + 1);
680
		deletedKeyStrokes[0] = new KeyStroke[newLength];
689
		deletedKeyStrokes[0] = new KeyStroke[newLength];
681
		final KeyStroke startStroke = keyStrokes[startStrokeIndex];
690
		final KeyStroke startStroke = keyStrokes[startStrokeIndex];
682
		System.arraycopy(keyStrokes, 0, keyStrokes, 0, newLength);
691
		KeyStroke keyStrokeResult[] = new KeyStroke[newLength];
692
		System.arraycopy(keyStrokes, 0, keyStrokeResult, 0, startStrokeIndex);
693
		System.arraycopy(keyStrokes, endStrokeIndex + 1, keyStrokeResult,
694
				startStrokeIndex, keyStrokesLength - endStrokeIndex - 1);
695
		System.arraycopy(keyStrokeResult, 0, deletedKeyStrokes[0], 0, newLength);
683
696
684
		/*
697
		/*
685
		 * Allow the first stroke removed to be replaced by an incomplete
698
		 * Allow the first stroke removed to be replaced by an incomplete
Lines 696-702 Link Here
696
						startStrokeIndex);
709
						startStrokeIndex);
697
				added[startStrokeIndex] = incompleteStroke;
710
				added[startStrokeIndex] = incompleteStroke;
698
				System.arraycopy(deletedKeyStrokes[0], startStrokeIndex, added,
711
				System.arraycopy(deletedKeyStrokes[0], startStrokeIndex, added,
699
						startStrokeIndex + 1, newLength);
712
						startStrokeIndex + 1, newLength - startStrokeIndex);
700
				deletedKeyStrokes[0] = added;
713
				deletedKeyStrokes[0] = added;
701
			}
714
			}
702
		}
715
		}

Return to bug 89610