commit ghc-text-zipper for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-text-zipper for openSUSE:Factory checked in at 2023-11-23 21:40:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-text-zipper (Old) and /work/SRC/openSUSE:Factory/.ghc-text-zipper.new.25432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-text-zipper" Thu Nov 23 21:40:22 2023 rev:7 rq:1127157 version:0.13 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-text-zipper/ghc-text-zipper.changes 2023-04-04 21:24:09.614467654 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-text-zipper.new.25432/ghc-text-zipper.changes 2023-11-23 21:41:40.921776148 +0100 @@ -1,0 +2,13 @@ +Sat Apr 4 20:59:07 UTC 2023 - Peter Simons <psimons@suse.com> + +- Update text-zipper to version 0.13. + 0.13 + ---- + + Bug fixes: + * The zipper constructors now ignores non-printable characters (see + also #13) + * `insertMany` now no longer drops the input following a non-printable + character (#13) + +------------------------------------------------------------------- Old: ---- text-zipper-0.12.tar.gz New: ---- text-zipper-0.13.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-text-zipper.spec ++++++ --- /var/tmp/diff_new_pack.VQp4ze/_old 2023-11-23 21:41:41.517798100 +0100 +++ /var/tmp/diff_new_pack.VQp4ze/_new 2023-11-23 21:41:41.521798248 +0100 @@ -20,7 +20,7 @@ %global pkgver %{pkg_name}-%{version} %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.12 +Version: 0.13 Release: 0 Summary: A text editor zipper library License: BSD-3-Clause ++++++ text-zipper-0.12.tar.gz -> text-zipper-0.13.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-zipper-0.12/CHANGELOG.md new/text-zipper-0.13/CHANGELOG.md --- old/text-zipper-0.12/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 +++ new/text-zipper-0.13/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,4 +1,13 @@ +0.13 +---- + +Bug fixes: + * The zipper constructors now ignores non-printable characters (see + also #13) + * `insertMany` now no longer drops the input following a non-printable + character (#13) + 0.12 ---- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-zipper-0.12/src/Data/Text/Zipper.hs new/text-zipper-0.13/src/Data/Text/Zipper.hs --- old/text-zipper-0.12/src/Data/Text/Zipper.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/text-zipper-0.13/src/Data/Text/Zipper.hs 2001-09-09 03:46:40.000000000 +0200 @@ -59,6 +59,7 @@ import Control.Applicative ((<$>)) import Control.DeepSeq import Data.Char (isPrint) +import Data.List (foldl') import Data.Monoid import qualified Data.Text as T import qualified Data.Vector as V @@ -146,7 +147,10 @@ (first, rest) = if null limitedLs then (mempty, mempty) else (head limitedLs, tail limitedLs) - in TZ mempty first [] rest fromCh drp tk lngth lst int nl linesFunc toListF lmt + numLines = length ls + insertLine z (i, l) = (if i < numLines - 1 then breakLine else id) $ insertMany l z + loadInitial z = foldl' insertLine z $ zip [0..] (first:rest) + in loadInitial $ TZ mempty mempty mempty mempty fromCh drp tk lngth lst int nl linesFunc toListF lmt -- | Get the text contents of the zipper. getText :: (Monoid a) => TextZipper a -> [a] @@ -224,28 +228,19 @@ -- Otherwise insert the character and move the cursor one position to -- the right. insertChar :: (Monoid a) => Char -> TextZipper a -> TextZipper a -insertChar ch tz = maybe tz id $ insertChar_ ch tz - -insertChar_ :: (Monoid a) => Char -> TextZipper a -> Maybe (TextZipper a) -insertChar_ ch tz - | ch == '\n' = breakLine_ tz - | isPrint ch = Just $ tz { toLeft = toLeft tz `mappend` (fromChar tz ch) } - | otherwise = Nothing +insertChar ch tz + | ch == '\n' = breakLine tz + | isPrint ch = tz { toLeft = toLeft tz `mappend` (fromChar tz ch) } + | otherwise = tz -- | Insert many characters at the current cursor position. Move the -- cursor to the end of the inserted text. insertMany :: (Monoid a) => a -> TextZipper a -> TextZipper a -insertMany str tz = - let go [] z = z - go (c:cs) z = maybe z (go cs) $ insertChar_ c z - in go (toList_ tz str) tz +insertMany str tz = foldl' (flip insertChar) tz $ toList_ tz str -- | Insert a line break at the current cursor position. breakLine :: (Monoid a) => TextZipper a -> TextZipper a -breakLine tz = maybe tz id $ breakLine_ tz - -breakLine_ :: (Monoid a) => TextZipper a -> Maybe (TextZipper a) -breakLine_ tz = +breakLine tz = -- Plus two because we count the current line and the line we are -- about to create; if that number of lines exceeds the limit, -- ignore this operation. @@ -254,9 +249,9 @@ } in case lineLimit tz of Just lim -> if length (above tz) + length (below tz) + 2 > lim - then Nothing - else Just modified - Nothing -> Just modified + then tz + else modified + Nothing -> modified -- | Move the cursor to the end of the current line. gotoEOL :: (Monoid a) => TextZipper a -> TextZipper a diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-zipper-0.12/tests/WordsSpec.hs new/text-zipper-0.13/tests/WordsSpec.hs --- old/text-zipper-0.12/tests/WordsSpec.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/text-zipper-0.13/tests/WordsSpec.hs 2001-09-09 03:46:40.000000000 +0200 @@ -3,8 +3,6 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module WordsSpec (spec) where --- This test suite is Copyright (c) Hans-Peter Deifel - import Test.Hspec import Test.QuickCheck @@ -17,11 +15,31 @@ spec :: Spec spec = do + constructorSpec + insertCharSpec + insertManySpec moveWordLeftSpec moveWordRightSpec deletePrevWordSpec deleteWordSpec +constructorSpec :: Spec +constructorSpec = describe "constructor" $ do + it "inserts only printable characters at construction time" $ + (stringZipper ["abc\x1b def"] Nothing) `shouldBe` (stringZipper ["abc def"] Nothing) + +insertCharSpec :: Spec +insertCharSpec = describe "insertChar" $ do + it "ignores an insert of a non-printable character" $ + let z = stringZipper [] Nothing + in (insertChar '\x1b' z) `shouldBe` z + +insertManySpec :: Spec +insertManySpec = describe "insertMany" $ do + it "ignores an insert of a non-printable character" $ + let z = stringZipper ["abc"] Nothing + in (insertMany "ghi\x1bjkl" z) `shouldBe` (insertMany "ghijkl" z) + moveWordLeftSpec :: Spec moveWordLeftSpec = describe "moveWordLeft" $ do it "does nothing at the start of the text" $ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-zipper-0.12/text-zipper.cabal new/text-zipper-0.13/text-zipper.cabal --- old/text-zipper-0.12/text-zipper.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/text-zipper-0.13/text-zipper.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,5 @@ name: text-zipper -version: 0.12 +version: 0.13 synopsis: A text editor zipper library description: This library provides a zipper and API for editing text. license: BSD3
participants (1)
-
Source-Sync