diff --git a/Sources/VLSheetView.mm b/Sources/VLSheetView.mm index 465d492..8be5b33 100644 --- a/Sources/VLSheetView.mm +++ b/Sources/VLSheetView.mm @@ -850,7 +850,7 @@ const float kSemiFloor = -1.0f*kLineH; [self editLyrics]; break; case kRegionMeasure: - [self editSelection]; + [self editSelection:([event modifierFlags] & NSShiftKeyMask) != 0]; break; default: break; diff --git a/Sources/VLSheetViewSelection.h b/Sources/VLSheetViewSelection.h index d606202..61be7ba 100644 --- a/Sources/VLSheetViewSelection.h +++ b/Sources/VLSheetViewSelection.h @@ -5,14 +5,14 @@ // // (MN) Matthias Neeracher // -// Copyright © 2006-2007 Matthias Neeracher +// Copyright © 2006-2011 Matthias Neeracher // #import "VLMIDIWriter.h" @interface VLSheetView (Selection) -- (void)editSelection; +- (void)editSelection:(BOOL)extend; - (void)adjustSelection:(NSEvent *)event; - (NSRange)sectionsInSelection; diff --git a/Sources/VLSheetViewSelection.mm b/Sources/VLSheetViewSelection.mm index 943a1fe..0443e33 100644 --- a/Sources/VLSheetViewSelection.mm +++ b/Sources/VLSheetViewSelection.mm @@ -5,7 +5,7 @@ // // (MN) Matthias Neeracher // -// Copyright © 2006-2007 Matthias Neeracher +// Copyright © 2006-2011 Matthias Neeracher // #import "VLSheetView.h" @@ -109,9 +109,16 @@ VLSequenceCallback( @implementation VLSheetView (Selection) -- (void)editSelection +- (void)editSelection:(BOOL)extend { - fSelStart = fSelEnd = fSelAnchor = fCursorMeasure; + if (extend && fSelStart > -1) { + if (fCursorMeasure > fSelEnd) + fSelEnd = fCursorMeasure; + else if (fCursorMeasure < fSelStart) + fSelStart = fCursorMeasure; + } else { + fSelStart = fSelEnd = fSelAnchor = fCursorMeasure; + } [self updateMenus]; [self setNeedsDisplay:YES]; }