vty 6.2 → 6.6
raw patch · 6 files changed
Files
- CHANGELOG.md +43/−1
- README.md +6/−2
- cbits/mk_wcwidth.c +19/−6
- src/Graphics/Vty/Input/Events.hs +10/−1
- src/Graphics/Vty/PictureToSpans.hs +1/−1
- vty.cabal +8/−10
CHANGELOG.md view
@@ -1,4 +1,40 @@ +6.6+---++* Added support for horizontal scrolling inputs. The `Button` type in+ `Graphics.Vty.Input.Events` got new constructors `BScrollLeft` and+ `BScrollRight` for Vty backend implementations that support horizontal+ scrolling inputs.++6.5+---++* Raised upper bound on `microlens` dependency to permit builds against+ 0.5.+* Fixed the `utf8-string` dependency lower bound to account for an added+ module in 0.3.1. (#279)+* Improved the allocation behavior of `swapSkipsForSingleColumnCharSpan`.++6.4+---++* Updated the behavior of character width computations when a custom+ character width table has been installed. Now when a custom character+ width table doesn't provide a width for a character, rather than+ defaulting to 1 column, the built-in table is consulted. This change+ shouldn't affect users using width tables generated by `vty-unix`'s+ table-building tool since that tool generates tables that will provide+ widths for all supported characters.++6.3+---++* Raise microlens upper bound to build with 0.4.14 (#278)+* Updated other bounds to permit building with GHC 9.12 (thanks Erik de+ Catro Lopo)+* Removed defunct examples from project+ 6.2 --- @@ -126,8 +162,14 @@ IO ()`, for logging to the Vty log. * `Graphics.Vty.Config` now exposes `VtyUserConfig` instead of `Config`. Many of its fields were Unix-specific and were- consequently moved to the `UnixSettings` type in `vty-unix`.+ consequently moved to the `UnixSettings` type in `vty-unix` and+ given a `settings` prefix. This includes `outputFd`, `inputFd`,+ `vmin`, `vtime`, and `termName`. * The `VtyUserConfig` type's fields got a `config` field name prefix.+ * `inputForConfig` was moved to `vty-unix` as `buildInput` but+ generally should not be needed and is exposed only for testing.+ * `outputForConfig` was moved to `vty-unix` as `buildOutput` but+ generally should not be needed and is exposed only for testing. * Behavior changes: * Since `vty` no longer implements `mkVty`, the Vty user configuration is no longer implicitly loaded by Vty-based applications.
README.md view
@@ -148,14 +148,18 @@ If you decide to contribute, that's great! Here are some guidelines you should consider to make submitting patches easier for all concerned: - - Please ensure that the examples and test suites build along with the- library by running `build.sh` in the repository.+ - Patches written completely or partially by AI are unlikely to be+ accepted. Please disclose any AI use. - If you want to take on big things, talk to me first; let's have a design/vision discussion before you start coding. Create a GitHub issue and we can use that as the place to hash things out. - If you make changes, make them consistent with the syntactic conventions already used in the codebase. - Please provide Haddock documentation for any changes you make.+ - Please do NOT include package version changes in your patches.+ Package version changes are only done at release time when the full+ scope of a release's changes can be evaluated to determine the+ appropriate version change. # Further Reading
cbits/mk_wcwidth.c view
@@ -72,6 +72,9 @@ // built-in tree search logic is used. static uint8_t* custom_table = NULL; +// Unused table cell value.+static uint8_t UNUSED_CELL = 0xff;+ // The size of the custom table, in entries. This should only be set // if custom_table is not NULL. Its value should be the size of the // custom_table array.@@ -228,14 +231,24 @@ // Return the width, in terminal cells, of the specified character. // // If the global custom width table is present, that table will be-// consulted for the character's width. If the character is not in-// the table, zero will be returned. If the custom width table is not-// present, the built-in width table will be used.+// consulted for the character's width. If the character is not in the+// table, this will fall back to the built-in table. If the character is+// in neither table, zero will be returned. If the custom width table is+// not present, the built-in width table will be used. HsInt vty_mk_wcwidth(HsChar ch) { if (custom_table_ready) { if ((ch >= 0) && (ch < custom_table_size)) {- return custom_table[ch];+ uint8_t result = custom_table[ch];++ // The table is filled with UNUSED_CELL values for+ // uninitialized ranges so we can defer to the built-in+ // table in those cases.+ if (result == UNUSED_CELL) {+ return builtin_wcwidth(ch);+ } else {+ return result;+ } } else { return -1; }@@ -249,7 +262,7 @@ // This allocates a new character width table of the specified size // (in characters). If a custom table has already been allocated, this // returns 1. Otherwise it allocates a new table, initializes all of its-// entries to 1, and returns zero.+// entries to UNUSED_CELL, and returns zero. // // Note that this does *not* mark the table as ready for use. Until the // table is marked ready, it will not be used by vty_mk_wcwidth. To mark@@ -261,7 +274,7 @@ if (size > 0 && size <= MAX_CUSTOM_TABLE_SIZE) { custom_table_ready = 0; custom_table = malloc(size);- memset(custom_table, 1, size);+ memset(custom_table, UNUSED_CELL, size); custom_table_size = size; return 0; } else {
src/Graphics/Vty/Input/Events.hs view
@@ -42,7 +42,16 @@ instance NFData Modifier -- | Mouse buttons.-data Button = BLeft | BMiddle | BRight | BScrollUp | BScrollDown+data Button+ = BLeft+ | BMiddle+ | BRight+ | BScrollUp+ | BScrollDown+ | BScrollLeft+ -- ^ Some terminals (e.g., Kitty, Alacritty) support horizontal+ -- scrolling in addition to vertical scrolling.+ | BScrollRight deriving (Eq, Show, Read, Ord, Generic) instance NFData Button
src/Graphics/Vty/PictureToSpans.hs view
@@ -172,7 +172,7 @@ swapSkipsForSingleColumnCharSpan :: Char -> Attr -> SpanOps -> SpanOps swapSkipsForSingleColumnCharSpan c a = Vector.map f- where f (Skip ow) = let txt = TL.pack $ replicate ow c+ where f (Skip ow) = let txt = TL.take (toEnum ow) $ TL.repeat c in TextSpan a ow ow txt f v = v
vty.cabal view
@@ -1,5 +1,5 @@ name: vty-version: 6.2+version: 6.6 license: BSD3 license-file: LICENSE author: AUTHORS@@ -11,12 +11,8 @@ vty is terminal GUI library in the niche of ncurses. It is intended to be easy to use and to provide good support for common terminal types. .- See the @vty-examples@ package as well as the program- @examples/interactive_terminal_test.hs@ included in the @vty@- repository for examples on how to use the library.- .- Import the @Graphics.Vty@ convenience module to get access to the core- parts of the library.+ See the example programs in the @vty-crossplatform@ package examples+ on how to use the library. . © 2006-2007 Stefan O'Rear; BSD3 license. .@@ -29,7 +25,9 @@ AUTHORS, CHANGELOG.md, LICENSE-tested-with: GHC==8.0.2, GHC==8.2.2, GHC==8.4.3, GHC==8.6.5, GHC==8.8.4, GHC==8.10.7, GHC==9.0.2, GHC==9.2.8, GHC==9.4.5, GHC==9.6.2+tested-with: GHC==8.0.2, GHC==8.2.2, GHC==8.4.3, GHC==8.6.5, GHC==8.8.4, GHC==8.10.7,+ GHC==9.0.2, GHC==9.2.8, GHC==9.4.8, GHC==9.6.6, GHC==9.8.4, GHC==9.10.1,+ GHC==9.12.1 source-repository head type: git@@ -45,12 +43,12 @@ blaze-builder >= 0.3.3.2 && < 0.5, bytestring, deepseq >= 1.1 && < 1.6,- microlens < 0.4.14,+ microlens < 0.6, microlens-mtl, mtl >= 1.1.1.0 && < 2.4, stm, text >= 0.11.3,- utf8-string >= 0.3 && < 1.1,+ utf8-string >= 0.3.1 && < 1.1, vector >= 0.7, binary, parsec,