Mercurial > dwindows
diff mac/dw.m @ 989:6de00477d627
Clamp the point specified in dw_mle_set_cursor() to the range of text to avoid an exception on Mac.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 07 May 2011 14:42:35 +0000 |
parents | 87dc0f5f96d0 |
children | 2d80b4dcff9a |
line wrap: on
line diff
--- 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)]; }