Commits

Darius Damalakas committed 489e416

applying alicew patch - Shift-selection with the keyboard now works as it does with the mouse. The selected region is a rectangle with one corner at the position of the first cell that was selected, and the other at the position of the last cell that was selected. Previously the selected cells were just any that had been visited.

  • Participants
  • Parent commits 8721124

Comments (0)

Files changed (1)

SourceGrid/SourceGrid/Grids/GridVirtual.cs

 
 		#region Special Keys and command keys
 		/// <summary>
+		/// Stores the active position when user presses shift
+		/// </summary>
+ 		private Position m_firstCellShiftSelected;
+
+		/// <summary>
 		/// Processes a command key.
 		/// </summary>
 		/// <param name="msg"></param>
 			Keys keyData
 		)
 		{
+			// if shift pressed, remember which cell is selected
+			if (keyData == (Keys.Shift | Keys.ShiftKey))
+			{
+				m_firstCellShiftSelected = Selection.ActivePosition;
+			}
+
 			if ((keyData == Keys.Enter ||
 			     keyData == Keys.Escape ||
 			     keyData == Keys.Tab ||
 				
 				e.Handled = true;
 			}
+			if (shiftPressed)
+			{
+				Selection.ResetSelection(true);
+				Selection.SelectRange(new Range(m_firstCellShiftSelected, Selection.ActivePosition), true);
+			}
+
 			#endregion
 
 			#region Clipboard