diff --git a/CHANGES.md b/CHANGES.md index 90ad072..1d62fe8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,23 +1,32 @@ -## v0.2.0 (trunk): +## v0.2.0 (2017-10-31) -Breaking changes: -* Switch over to `Uchar.t` -* Rename input `#key` to `#special` -* Separate ASCII from general Unicode input -* Move the cursor origin from (1, 1) to (0, 0) -* Replace `I.tile` with more general `I.tabulate` +* All-around speed and memory improvements. +* Draw over lines cell-by-cell instead of using erase-and-skip. + Slower, but flicker-free drawing. +* `Term.create`: optionally inhibit synthetic TTY signals. +* Cursor origin moved from `(1, 1)` to `(0, 0)`. **breaking** +* `#key` renamed to `#special`. **breaking** +* Added `Term.fds` to get connected file descriptors. +* Added `A.equal` and `I.equal`. +* Switched over to `Uchar.t`. **breaking** +* Separated ASCII from the rest of Unicode input. **breaking** +* Added image pretty-printer `I.pp`. +* Added `notty.top` for use in the toplevel. +* Removed `I.tile`. **breaking** +* Added `I.tabulate`, generalizing `I.tile`. +* Added support for 24-bit color. +* Added `Notty_*.show_cursor` and `Notty_*.move_cursor` for manual cursor + positioning in inline mode. +* Removed `output_image_endline`. Can be replaced by `eol`. **breaking** +* `Notty_*.output_image` lost the `~clear` parameter. Can be replaced in various + ways by cursor positioning. +* `Notty_unix.output_image ~chan` renamed to `~fd`. **breaking** +* Added support for bracketed paste. +* More example programs. -Other changes: -* More examples -* Reduced memory pressure -* Lines are now completely redrawn; reduces blinking -* Option to inhibit synthetic TTY signals on term creation -* Query a terminal for file descriptors it is connected to -* Add attr and image equality - -## v0.1.1 (2016-02-09): +## v0.1.1 (2016-02-09) * `Term.input` -> `Term.event` * Option to redraw the line -## v0.1.0 (2016-02-09): +## v0.1.0 (2016-02-09) * Initial release diff --git a/README.md b/README.md index 5732b34..7d60338 100644 --- a/README.md +++ b/README.md @@ -1,66 +1,63 @@ -![demo] + + + + # Notty -**Notty** is a declarative terminal library for OCaml structured around a notion +Notty is a declarative terminal library for OCaml structured around a notion of composable images. It tries to abstract away the basic terminal programming -model, and provide one that is simpler and more expressive. +model, providing a simpler and more expressive one. The core layout engine and IO codecs are pure platform-independent OCaml. Distribution includes modules with input and output facilities for Unix, and Lwt on Unix. -As an attempt to redefine terminal programming, **Notty** has to be -"opinionated". It assumes Unicode throughout, does not have universal support +As an attempt to redefine terminal programming, Notty has to be +_opinionated_. It assumes Unicode throughout, does not have universal support for various terminals out there, and has a peculiar programming and rendering model. +Notty's core API was heavily influenced by Haskell's [Vty][vty]. + +## Where to start + Check out the [documentation], [examples], or peek directly into the [interface] file. -**Notty**'s core API was heavily influenced by Haskell's [Vty][vty]. +Building with `pkg/pkg.ml build --with-lwt true --examples true` will produce +several little example programs that also double as tests. ```OCaml (* Game of Life with ZX Spectrum kitsch. *) -let dot = I.uchar A.(fg lightred) 0x25cf 1 1 +let dot : image = I.uchar A.(fg lightred) (Uchar.of_int 0x25cf) 1 1 let background step (n, m) = - let k = int_of_float @@ (sin (float (step + m + n) /. 10.)) *. 24. in + let k = 24. *. sin (float (step + m + n) /. 10.) |> truncate in if k > 0 then I.char A.(fg (gray k)) '.' 1 1 else I.void 1 1 -let render (w, h) step life = +let render (w, h) step life : image = I.tabulate w (h - 1) @@ fun x y -> let pt = (x, y) in - if CSet.mem pt life then - dot - else background step pt + if CSet.mem pt life then dot else background step pt ``` -Building with `./pkg/pkg.ml build --with-lwt true --examples true` will produce -several little example programs that also double as tests. - -[documentation]: https://pqwy.github.io/notty +[documentation]: https://pqwy.github.io/notty/doc [examples]: http://pqwy.github.io/notty/Notty.html#examples [interface]: https://github.com/pqwy/notty/blob/master/src/notty.mli [vty]: https://hackage.haskell.org/package/vty -[demo]: https://raw.githubusercontent.com/pqwy/notty/blob/images/demo.gif ## Why? -**Q:** -**_Notty?_** - -**A:** -Terminals are tedious to program for. Notty tries to abstract the tedium away, -leaving you with a more pleasant programming surface that's quite unlike a TTY. -Hence, **No-TTY**. - -**Q:** -Why make yet another terminal library? - -**A:** -Because: +- _Notty?_ + + Terminals are tedious to program for. Notty tries to abstract the tedium away, + leaving you with a more pleasant programming surface that's quite unlike a TTY. + Hence, _No-TTY_. +- Why make yet another terminal library? + + Because: * It allows one to *describe* what should be seen, as opposed to *commanding* a terminal. * It's pretty compact. Both bells and whistles can be implemented separately. diff --git a/opam b/opam index e739c47..31eba5a 100644 --- a/opam +++ b/opam @@ -2,6 +2,7 @@ opam-version: "1.2" homepage: "https://github.com/pqwy/notty" dev-repo: "https://github.com/pqwy/notty.git" bug-reports: "https://github.com/pqwy/notty/issues" +doc: "http://pqwy.github.io/notty/doc" author: "David Kaloper " maintainer: "David Kaloper " license: "ISC"