Commit Graph

30 Commits (master)

Author SHA1 Message Date
Manos Pitsidianakis 111ee5953b
Add wasm build 2020-09-14 16:00:17 +03:00
Manos Pitsidianakis d95aae1987
terminal/keys: add `Space` identifier in Key Display impl 2020-08-26 00:54:05 +03:00
Manos Pitsidianakis 5db749c258
terminal/cells.rs: fix resize to grow actually making the grid smaller 2020-08-02 16:52:19 +03:00
Manos Pitsidianakis fb523c140a
terminal/cells: resize growable grid when exactly at bounds 2020-08-02 00:49:59 +03:00
Manos Pitsidianakis 44ffbe54e2
input_thread: add atomic refcount to check if thread is dead 2020-07-23 13:23:23 +03:00
Manos Pitsidianakis a7e177586a
Fix clippy lints 2020-07-06 15:27:08 +03:00
Manos Pitsidianakis ca7bbd9de4
Fix pasted text not being registered immediately
Input thread reading from stdin should continue reading after receiving
the magic BRACKET START sequence until receiving the BRACKET END
sequence.
2020-06-26 21:12:57 +03:00
Manos Pitsidianakis b946b61cf1
terminal/cells.rs: remove unused variables 2020-06-23 17:31:25 +03:00
Manos Pitsidianakis fe655e679c
Fix rustfmt suggestions 2020-06-12 01:42:06 +03:00
Manos Pitsidianakis 55948dd7c2
Use BTreeSet instead of HashSet in copy_area()
I kind of forgot about BTreeSets, and kept a separate HashSet and sorted
index of the set's keys.
2020-06-10 19:02:54 +03:00
Manos Pitsidianakis c07185a3aa
regexp: add priority field to regular expressions 2020-06-08 00:55:30 +03:00
Manos Pitsidianakis 465c78e903
Add Cell::keep_attrs() method 2020-06-08 00:55:29 +03:00
Manos Pitsidianakis 3e31c46a74
Add "regexp" feature, format text with regexps
`regexp` feature uses the pcre2 library to enable the user to define
regular expressions for matching text and applying text formatting to
the matches. An example from the theme configuration I used to test
this:

  [terminal.themes.win95.text_format_regexps]
  "listing.subject" = { "\\[[^\\]]*\\]" = { attrs = "Bold" } }
  "listing.from" = { "\\<[^\\>]*\\>(?:(?:\\s*$)|(?=,))" = { attrs = "Italics" } }

  [terminal.themes.win95.text_format_regexps."pager.envelope.body"]
  "^>.*$" = { attrs = "Italics" }
  "\\d+\\s?(?:(?:[KkMmTtGg]?[Bb])|(?:[KkMmTtGg][Bb]?)(?=\\s))" = { attrs = "Bold | Underline" }
2020-06-05 10:56:36 +03:00
Manos Pitsidianakis ef0f269fbf
terminal: add FormatTag, text format tags
FormatTag describes a set of attributes, colors that exist in a
tag_table field of CellBuffer. The field of tag_associations contains
the hash of a tag and the {start,end} index of the cells that have this
attribute. A tag can thus be used many times.

An example of use is

    let t = self.pager.insert_tag(FormatTag {
        attrs: Attr::ITALICS,
        ..Default::default()
    });
    debug!("FormatTag hash = {}", t);
    let (width, height) = self.pager.size();
    for i in 0..height {
      if self.pager.content[(0, i)].ch() == '>' {
        self.pager.set_tag(t, (0, i), (width.saturating_sub(1), i));
      }
    }

This will set reply lines in text as italics.

This feature interface is not used anywhere yet.
2020-06-05 10:56:36 +03:00
Manos Pitsidianakis 049175e743
pager: fix filter invocation and ansi parsing 2020-05-31 22:37:06 +03:00
Manos Pitsidianakis 12feca9c97
terminal/ansi: add attribute support
Add attribute escape sequence support in terminal::ansi, which handles
converting strings with ansi escape sequences into meli's internal
terminal structures in order to incorporate them into the UI.
2020-05-29 20:43:39 +03:00
Manos Pitsidianakis b8261ee36a
Overhaul input thread
Remove raw/non raw distinction.

Use a pipe for input thread commands and poll stdin/pipe for events
2020-05-29 15:43:05 +03:00
Manos Pitsidianakis bd404e6937
Execute user shell commands with /bin/sh
Execute user provided command invocations $CMD such as `editor_cmd` with
`/bin/sh` as `/bin/sh -c "$CMD"

Previously, user commands were split by whitespace which must trigger
erroneous behavior if quotes are involved.
2020-05-28 21:02:49 +03:00
Manos Pitsidianakis bfff0e4feb
conf: add options for logging
Add options for log file location and maximum log level. Also add
manpage entries for these options in `meli.conf.5`
2020-05-28 21:02:49 +03:00
Manos Pitsidianakis 4930d1b46c
Add Italics, Blink, Dim and Hidden text attributes
Text attributes have been rewritten as bit flags, so for example instead of
"BoldUnderline" you'd have to define "Bold | Underline" in your theme
settings.

Requested in #21
2020-04-05 15:57:05 +03:00
Manos Pitsidianakis a8c1016f37
Add various logic checks 2020-03-12 09:47:39 +02:00
Manos Pitsidianakis 63af2a688a
Detect breaks on write_string_to_grid 2020-02-28 09:17:30 +02:00
Manos Pitsidianakis 126b65817e
Forward input on input/rawinput switch
Input thread listens on stdin input and forwards the input to the main
process. When an embedded terminal is launched within the main process,
the input thread is asked to switch to raw input, that is to send the
parsed input and the raw bytes to the main process in order to get them
forwarded to the embedded terminal. The switch happens by calling
get_events and get_events_raw.

When the input thread receives an InputCommand::{No,}Raw, it has already
received an input event, since the `select!` is within the
stdin events for loop. (There's no way to `select` on blocking iterators
or raw fds, which is unfortunate.).

This commit forwards the input to the next function instead of dropping
it.
2020-02-27 16:41:58 +02:00
Manos Pitsidianakis ac71d627f1
Implement search for CellBuffer 2020-02-26 12:25:57 +02:00
Manos Pitsidianakis c88d1cae51
Fix create_box boundary fg color 2020-02-25 22:15:13 +02:00
Manos Pitsidianakis eb501b6d50
ui: add ThemeAttribute argument to clear_area()
clear_area() sets the cleared cell attributes according to the new
argument.
2020-02-08 23:54:15 +02:00
Manos Pitsidianakis d6e3c51b07
ui: move box drawing to src/terminal
No logical reason for it not to be in the terminal module anymore (the
set_and_join* functions predate the terminal module which is why they
weren't there to begin with).
2020-02-08 23:54:15 +02:00
Manos Pitsidianakis f131e01bfc
Fix drawing getting stuck in empty terminal
Fix drawing getting stuck in loops when terminal is too small by
checking for it.
2020-02-08 23:54:15 +02:00
Manos Pitsidianakis 05b91f1c02
Remove text_processing
Unwrap text_processing into melib

In preparation for uploading meli as a separate crate on crates.io.
2020-02-04 17:29:55 +02:00
Manos Pitsidianakis 8b6ea8de9a
Remove ui crate
Merge ui crate with root crate.

In preparation for uploading `meli` as a separate crate on crates.io.

Workspace crates will need to be published as well and having a separate
`ui` crate and binary perhaps doesn't make sense anymore.
2020-02-04 17:29:55 +02:00