Mercurial > dwindows
changeset 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 | 56077b50be7e |
children | 3d898b78c2ad |
files | mac/dw.m |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
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)]; }