mirror of
				https://github.com/Drezil/dear-imgui.hs.git
				synced 2025-11-04 15:11:06 +01:00 
			
		
		
		
	Fix the text fix and prepare 2.1.3 (#167)
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							68e30d98ad
						
					
				
				
					commit
					9bb66f0113
				
			@@ -1,5 +1,11 @@
 | 
				
			|||||||
# Changelog for dear-imgui
 | 
					# Changelog for dear-imgui
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## [2.1.3]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Fixed off-by-1 in internal Text wrapper.
 | 
				
			||||||
 | 
					- Fixed sliderFloat* Raw calls
 | 
				
			||||||
 | 
					- Added `formatPtr` to Raw.dragFloat* and Raw.sliderFloat*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## [2.1.2]
 | 
					## [2.1.2]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Fixed glfw example build flags.
 | 
					- Fixed glfw example build flags.
 | 
				
			||||||
@@ -100,6 +106,7 @@ Initial Hackage release based on [1.83].
 | 
				
			|||||||
[2.1.0]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.0
 | 
					[2.1.0]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.0
 | 
				
			||||||
[2.1.1]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.1
 | 
					[2.1.1]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.1
 | 
				
			||||||
[2.1.2]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.2
 | 
					[2.1.2]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.2
 | 
				
			||||||
 | 
					[2.1.3]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[1.87]: https://github.com/ocornut/imgui/releases/tag/v1.87
 | 
					[1.87]: https://github.com/ocornut/imgui/releases/tag/v1.87
 | 
				
			||||||
[1.86]: https://github.com/ocornut/imgui/releases/tag/v1.86
 | 
					[1.86]: https://github.com/ocornut/imgui/releases/tag/v1.86
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
cabal-version: 3.0
 | 
					cabal-version: 3.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
name: dear-imgui
 | 
					name: dear-imgui
 | 
				
			||||||
version: 2.1.2
 | 
					version: 2.1.3
 | 
				
			||||||
author: Oliver Charles
 | 
					author: Oliver Charles
 | 
				
			||||||
maintainer: ollie@ocharles.org.uk, aenor.realm@gmail.com
 | 
					maintainer: ollie@ocharles.org.uk, aenor.realm@gmail.com
 | 
				
			||||||
license: BSD-3-Clause
 | 
					license: BSD-3-Clause
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,6 @@ module DearImGui.Internal.Text
 | 
				
			|||||||
  ) where
 | 
					  ) where
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- base
 | 
					-- base
 | 
				
			||||||
import Control.Monad.IO.Class (liftIO)
 | 
					 | 
				
			||||||
import Foreign (nullPtr, plusPtr)
 | 
					import Foreign (nullPtr, plusPtr)
 | 
				
			||||||
import Foreign.C.String (CString)
 | 
					import Foreign.C.String (CString)
 | 
				
			||||||
import qualified GHC.Foreign as Foreign
 | 
					import qualified GHC.Foreign as Foreign
 | 
				
			||||||
@@ -34,7 +33,8 @@ import qualified Data.Text.Foreign as Text
 | 
				
			|||||||
withCString :: MonadUnliftIO m => Text -> (CString -> m a) -> m a
 | 
					withCString :: MonadUnliftIO m => Text -> (CString -> m a) -> m a
 | 
				
			||||||
withCString text action =
 | 
					withCString text action =
 | 
				
			||||||
  withUnliftIO $ \(UnliftIO unlift) ->
 | 
					  withUnliftIO $ \(UnliftIO unlift) ->
 | 
				
			||||||
    Text.withCString text (unlift action)
 | 
					    Text.withCString text $ \buf ->
 | 
				
			||||||
 | 
					      unlift $ action buf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#elif MIN_VERSION_text(2,0,0)
 | 
					#elif MIN_VERSION_text(2,0,0)
 | 
				
			||||||
-- XXX: the text is UTF-8, alas no withCString is available
 | 
					-- XXX: the text is UTF-8, alas no withCString is available
 | 
				
			||||||
@@ -57,7 +57,6 @@ withCString t@(Text _arr _off len) action =
 | 
				
			|||||||
withCString :: MonadUnliftIO m => Text -> (CString -> m a) -> m a
 | 
					withCString :: MonadUnliftIO m => Text -> (CString -> m a) -> m a
 | 
				
			||||||
withCString t action = do
 | 
					withCString t action = do
 | 
				
			||||||
  withUnliftIO $ \(UnliftIO unlift) ->
 | 
					  withUnliftIO $ \(UnliftIO unlift) ->
 | 
				
			||||||
    liftIO $
 | 
					 | 
				
			||||||
    Foreign.withCString utf8 (unpack t) $ \textPtr ->
 | 
					    Foreign.withCString utf8 (unpack t) $ \textPtr ->
 | 
				
			||||||
      unlift $ action textPtr
 | 
					      unlift $ action textPtr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user