diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 080cfec5b2..618da96fed 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -12,8 +12,6 @@ - optimize away dispatch - code gc -- ppc register decls - - #jump-f #jump-f-label - extract word inside M:, C:, and structure browsing for these - each-slot combinator @@ -22,7 +20,6 @@ - don't hardcode so many colors - ffi unicode strings: null char security hole - utf16 string boxing -- sdl console crash - more accurate types for various words - optimize out >array, >tuple, >hashtable etc - write read: write should flush diff --git a/library/sdl/sdl-utils.factor b/library/sdl/sdl-utils.factor index 5a82231758..6c2fae5c83 100644 --- a/library/sdl/sdl-utils.factor +++ b/library/sdl/sdl-utils.factor @@ -133,8 +133,13 @@ global [ SDL_LockSurface ] when drop ; +: filter-nulls ( str -- str ) + "\0" over str-contains? [ + [ dup CHAR: \0 = [ drop CHAR: \s ] when ] str-map + ] when ; + : draw-string ( x y font text fg -- width ) - over str-length 0 = [ + >r filter-nulls r> over str-length 0 = [ 2drop 3drop 0 ] [ >r >r lookup-font r> r> @@ -145,7 +150,7 @@ global [ ] ifte ; : size-string ( font text -- w h ) - >r lookup-font r> dup str-length 0 = [ + >r lookup-font r> filter-nulls dup str-length 0 = [ drop TTF_FontHeight 0 swap ] [ [ TTF_SizeUNICODE drop ] 2keep diff --git a/library/test/memory.factor b/library/test/memory.factor index dcabd54094..44974d3d64 100644 --- a/library/test/memory.factor +++ b/library/test/memory.factor @@ -7,7 +7,7 @@ USE: lists num-types [ [ - (instances) [ + builtin-type instances [ class drop ] each ] keep diff --git a/library/test/tuple.factor b/library/test/tuple.factor index 7a44b3d636..eea3af872e 100644 --- a/library/test/tuple.factor +++ b/library/test/tuple.factor @@ -51,8 +51,3 @@ C: quuux-tuple-2 point-x ] unit-test - -! Ensure we have a fresh word. -DEFER: losing-eq FORGET: losing-eq -[ t ] [ DEFER: losing-eq \ losing-eq TUPLE: losing-eq x y ; \ losing-eq eq? ] -unit-test