packages feed

ansiform 0.9.0.6 → 1.0.0

raw patch · 9 files changed

+34/−10 lines, 9 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -4,6 +4,10 @@  ## Functional Versions +### 1.0.0 -- 2026-10-21+* Forms now draw every prefilled field when they open, so all current values are visible before the first field is focused. The active field redraws the same text and starts with the cursor at the end.+* Marked the library stable at 1.0.0 after the editable form fields, the shortcut key reader, the line editing core and the multiplatform CI work.+ ### 0.9.0.6 -- 2026-10-21 * Fixed a lone Escape never timing out in `readKeyPress` and the line editor. `waitKey` called `isEOF` before `hWaitForInput`; on a terminal, `isEOF` blocks until the next key, so Esc cancellation and the 50 ms sequence timeout never fired. `waitKey` now relies on `hWaitForInput` and converts only end-of-file exceptions into `KeyEnded`. * Verified the Linux terminal checklist in `docs/platforms.md` under a pseudo-terminal: immediate keys, arrow isolation, forms, editor navigation, Esc cancellation, horizontal scrolling, colour detection and resize all pass.
README.md view
@@ -10,7 +10,7 @@  > **Formerly known as Vis.** Ansiform is a terminal formatting library, unrelated to the JavaScript `vis-network` graph visualization library or to the Hackage package [`Vis`](https://hackage.haskell.org/package/Vis) (3D graphics). See [Naming](https://github.com/Tralen/ansiform/blob/master/docs/naming.md). -Current version: **0.9.0.6**.+Current version: **1.0.0**.  Repository: <https://github.com/Tralen/ansiform>. 
ansiform.cabal view
@@ -1,6 +1,6 @@ cabal-version:       3.0 name:                ansiform-version:             0.9.0.6+version:             1.0.0 synopsis:            Display formatting for command line interfaces. description:         Basic format DSL for building an ANSI command line interface                      with colors, alignment, tables, paragraphs and more.
docs/input.md view
@@ -120,6 +120,8 @@  `promptWithInitial section row column initial` places the cursor at the end of `initial`, so the user can backspace, move and insert without retyping the value. Non-printable characters are removed, because the editor is single-line. An empty initial value is still meaningful: it opens the editor with an empty buffer, which lets a form use the same editor for every field. +When the form opens, every field with an initial value is drawn in its prompt line, so all current values are visible before the first field is focused. The active field redraws the same text and starts with the cursor at the end. Fields built with `promptAt` keep their page text and receive input through the terminal line discipline.+ The editor owns the region from the prompt column to the end of the line. It clears that region and redraws the visible window on every key, scrolling horizontally when the value is wider than the terminal. The window uses `charWidth`, so wide characters and combining marks keep the cursor aligned.  | Key | Action |
docs/platforms.md view
@@ -74,4 +74,4 @@ 5. Confirm that colours appear on a terminal and disappear when output is redirected. 6. Resize the terminal and confirm that the layout uses the new width. -On 2026-10-21 the checklist was executed on Linux under a pseudo-terminal and all six items passed. That run found the lone-Escape timeout fixed in 0.9.0.6. macOS and Windows still need the same run on real terminals.+On 2026-10-21 the checklist was executed on Linux under a pseudo-terminal. The first run found the lone-Escape timeout fixed in 0.9.0.6. A second run for 1.0.0 confirmed all six items and that every prefilled field is visible as soon as the edit form opens. macOS and Windows still need the same run on real terminals.
docs/releasing.md view
@@ -5,7 +5,7 @@ ## Current status  - Package: `ansiform`. The name is already registered on Hackage.-- Version: 0.9.0.5.+- Version: 0.9.0.6. - License: MIT. - `cabal sdist` produces a complete source distribution with sources, docs, examples, tests, README, ChangeLog and LICENSE. - Haddock builds with 100% coverage for the public functions and types. The remaining warnings are only about module re-exports.@@ -13,9 +13,9 @@ - GitHub: public at <https://github.com/Tralen/ansiform>; the local remote is `git@github.com:Tralen/ansiform.git`. - `source-repository`, `homepage` and `bug-reports` are set to the GitHub URL. - The history has been rewritten and contains no personal paths.-- Tag `0.9.0.5` and its GitHub release are published at <https://github.com/Tralen/ansiform/releases/tag/0.9.0.5>.-- Hackage: 0.9.0.5 is published at <https://hackage.haskell.org/package/ansiform-0.9.0.5>, with documentation uploaded.-- The 0.9.0.5 release fixes the Windows render crash and the macOS CI toolchain, and marks the first Hackage publication since 0.7.10.4. The 0.8.0 to 0.9.0.4 changes are recorded in `ChangeLog.md`, including editable form fields, `Ansiform.Line`, `readKeyPress` and the platform documentation.+- Tag `0.9.0.6` and its GitHub release are published at <https://github.com/Tralen/ansiform/releases/tag/0.9.0.6>.+- Hackage: 0.9.0.6 is published at <https://hackage.haskell.org/package/ansiform-0.9.0.6>, with documentation uploaded.+- The 0.9.0.6 release fixes the lone-Escape timeout found by the Linux terminal checklist. The 0.9.0.5 release fixed the Windows render crash and the macOS CI toolchain and was the first Hackage publication since 0.7.10.4. The 0.8.0 to 0.9.0.5 changes are recorded in `ChangeLog.md`, including editable form fields, `Ansiform.Line`, `readKeyPress` and the platform documentation.  ## Credentials 
docs/tutorial.md view
@@ -237,7 +237,7 @@ promptWithInitial :: Number -> Number -> Offset -> String -> Prompt ``` -Each field opens with its current value in the editable buffer and the cursor at the end. The user can backspace, insert and move with the arrows, `Home`, `End` and `Delete`, then press Enter to submit. Esc cancels the whole form. The editor scrolls horizontally when a value is wider than the terminal, so a long URL stays editable. The prompt column and row are the same as in the add form, because both use the same page.+Both fields are visible as soon as the edit form opens, with their current values in place. The title is focused first and its cursor starts at the end. The user can backspace, insert and move with the arrows, `Home`, `End` and `Delete`, then press Enter to submit. Esc cancels the whole form. The editor scrolls horizontally when a value is wider than the terminal, so a long URL stays editable. The prompt column and row are the same as in the add form, because both use the same page.  When stdin is not a terminal, `readForm` reads a line per prompt and ignores the initial value, which keeps the program usable in pipes and tests. 
examples/Demo.hs view
@@ -16,7 +16,7 @@  -- Version of this demo, following the package version. demoVersion :: String-demoVersion = "0.9.0.6"+demoVersion = "1.0.0"  -- The philosophers shown in the Groups screen. data Philosopher
src/Ansiform/Internal/Input.hs view
@@ -227,10 +227,28 @@             let useEditor = interactive && any (isJust . promptInitial) prompts                 fields = zip lines' prompts                 readFields = if useEditor-                    then readEditorFields h total fields+                    then do+                        width <- termWOn h+                        lastLine <- drawInitialFields h width total fields+                        moveCursorBy h (total - lastLine) 0+                        readEditorFields h total fields                     else withLineInput (readPlainFields h total fields)             values <- readFields             return (st', values)++-- Draws the initial window of every editable field before the first field is+-- read, so a form shows all current values at once. A field without an+-- initial value is left as the page drew it. Returns the last line drawn.+drawInitialFields :: Handle -> Int -> Int -> [(Int, Prompt)] -> IO Int+drawInitialFields _ _ current [] = return current+drawInitialFields h width current ((line, prompt):rest) =+    case promptInitial prompt of+        Nothing -> drawInitialFields h width current rest+        Just initial -> do+            moveCursorBy h (line - current) (promptColumn prompt)+            redrawLine h width (promptColumn prompt)+                        (LineState initial (length initial))+            drawInitialFields h width line rest  -- Reads prompts through the terminal line discipline. readPlainFields :: Handle -> Int -> [(Int, Prompt)] -> IO (Either FormError [String])