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 (-5 / +21 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 123-130 Link Here
123
				keyStrokes = handleKeyUp(event, keyStrokes);
125
				keyStrokes = handleKeyUp(event, keyStrokes);
124
			}
126
			}
125
127
128
			
126
			// Update the underlying widget.
129
			// Update the underlying widget.
127
			setKeySequence(KeySequence.getInstance(keyStrokes));
130
			if (keyStrokes != null) {
131
				setKeySequence(KeySequence.getInstance(keyStrokes));
132
			} else {
133
				clear();
134
			}
128
135
129
			// Prevent the event from reaching the widget.
136
			// Prevent the event from reaching the widget.
130
			event.doit = false;
137
			event.doit = false;
Lines 144-150 Link Here
144
		 */
151
		 */
145
		private KeyStroke[] handleKeyDown(Event event, KeyStroke[] keyStrokes) {
152
		private KeyStroke[] handleKeyDown(Event event, KeyStroke[] keyStrokes) {
146
			// Is it an unmodified backspace character?
153
			// Is it an unmodified backspace character?
147
			if ((event.character == SWT.BS) && (event.stateMask == 0)) {
154
			if ((event.character == SWT.BS || event.character == SWT.DEL) && (event.stateMask == 0)) {
148
				return deleteKeyStroke(keyStrokes);
155
				return deleteKeyStroke(keyStrokes);
149
			}
156
			}
150
157
Lines 614-619 Link Here
614
	 * @param allowIncomplete
621
	 * @param allowIncomplete
615
	 *            Whether incomplete strokes should be allowed to exist in the
622
	 *            Whether incomplete strokes should be allowed to exist in the
616
	 *            list after the deletion.
623
	 *            list after the deletion.
624
	 * @param deletedKeyStrokes
625
	 *            The list of keystrokes that were deleted by this operation.
626
	 *            Declared as final since it will hold a reference to the new
627
	 *            keyStroke array that has deleted the selected keystrokes.
617
	 * @return The index at which a subsequent insert should occur. This index
628
	 * @return The index at which a subsequent insert should occur. This index
618
	 *         only has meaning to the <code>insertStrokeAt</code> method.
629
	 *         only has meaning to the <code>insertStrokeAt</code> method.
619
	 */
630
	 */
Lines 676-685 Link Here
676
		 * Remove the strokes that are touched by the selection. Keep track of
687
		 * Remove the strokes that are touched by the selection. Keep track of
677
		 * the first stroke removed.
688
		 * the first stroke removed.
678
		 */
689
		 */
679
		final int newLength = endStrokeIndex - startStrokeIndex + 1;
690
		final int newLength = keyStrokesLength
691
				- (endStrokeIndex - startStrokeIndex + 1);
680
		deletedKeyStrokes[0] = new KeyStroke[newLength];
692
		deletedKeyStrokes[0] = new KeyStroke[newLength];
681
		final KeyStroke startStroke = keyStrokes[startStrokeIndex];
693
		final KeyStroke startStroke = keyStrokes[startStrokeIndex];
682
		System.arraycopy(keyStrokes, 0, keyStrokes, 0, newLength);
694
		KeyStroke keyStrokeResult[] = new KeyStroke[newLength];
695
		System.arraycopy(keyStrokes, 0, keyStrokeResult, 0, startStrokeIndex);
696
		System.arraycopy(keyStrokes, endStrokeIndex + 1, keyStrokeResult,
697
				startStrokeIndex, keyStrokesLength - endStrokeIndex - 1);
698
		System.arraycopy(keyStrokeResult, 0, deletedKeyStrokes[0], 0, newLength);
683
699
684
		/*
700
		/*
685
		 * Allow the first stroke removed to be replaced by an incomplete
701
		 * Allow the first stroke removed to be replaced by an incomplete
Lines 696-702 Link Here
696
						startStrokeIndex);
712
						startStrokeIndex);
697
				added[startStrokeIndex] = incompleteStroke;
713
				added[startStrokeIndex] = incompleteStroke;
698
				System.arraycopy(deletedKeyStrokes[0], startStrokeIndex, added,
714
				System.arraycopy(deletedKeyStrokes[0], startStrokeIndex, added,
699
						startStrokeIndex + 1, newLength);
715
						startStrokeIndex + 1, newLength - startStrokeIndex);
700
				deletedKeyStrokes[0] = added;
716
				deletedKeyStrokes[0] = added;
701
			}
717
			}
702
		}
718
		}

Return to bug 89610