# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1304779355 0 # Node ID 6de00477d627af19e08a96004cf9c2c14882ec0c # Parent 56077b50be7e29433a77a8d2c6989cce745bd3be Clamp the point specified in dw_mle_set_cursor() to the range of text to avoid an exception on Mac. diff -r 56077b50be7e -r 6de00477d627 mac/dw.m --- a/mac/dw.m Sat May 07 06:29:35 2011 +0000 +++ b/mac/dw.m Sat May 07 14:42:35 2011 +0000 @@ -4381,6 +4381,13 @@ { NSScrollView *sv = handle; DWMLE *mle = [sv documentView]; + NSTextStorage *ts = [mle textStorage]; + NSMutableString *ms = [ts mutableString]; + NSUInteger length = [ms length]; + if(point < 0) + point = 0; + if(point > length) + point = (int)length; [mle setSelectedRange: NSMakeRange(point,point)]; }