Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: move from console to crossterm #213

Closed
wants to merge 22 commits into from

Commits on Jul 10, 2022

  1. Configuration menu
    Copy the full SHA
    7004341 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9bd2dd8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    56a89c0 View commit details
    Browse the repository at this point in the history
  4. cargo fmt

    grunweg committed Jul 10, 2022
    Configuration menu
    Copy the full SHA
    a857b75 View commit details
    Browse the repository at this point in the history
  5. TEMP comment out most files with compile errors: all but theme and co…

    …nfirmation prompt (which will come next)
    grunweg committed Jul 10, 2022
    Configuration menu
    Copy the full SHA
    d295ca6 View commit details
    Browse the repository at this point in the history
  6. Remove uses of console::Term, part 1: mechanically remove all uses of…

    … the Term type.
    
    Instead, crossterm uses just a io::Write trait object.
    Doesn't compile yet; many terminal methods are still missing.
    
    In the next changes, I'll slowly add them to TermThemeRenderer instead
    or replace calls by their crossterm equivalent.
    
    (The buffered example is not adjusted yet; this will happen in the very end.)
    grunweg committed Jul 10, 2022
    Configuration menu
    Copy the full SHA
    ac4a99f View commit details
    Browse the repository at this point in the history
  7. Allow flushing the terminal via TermThemeRenderer.

    The password prompt needs it, and it allows removing the Term accessor.
    grunweg committed Jul 10, 2022
    Configuration menu
    Copy the full SHA
    400df55 View commit details
    Browse the repository at this point in the history
  8. Remove clear_line() calls in input.rs.

    They are superfluous, now that TermThemeRenderer::clear also clears the current line.
    grunweg committed Jul 10, 2022
    Configuration menu
    Copy the full SHA
    528c0df View commit details
    Browse the repository at this point in the history
  9. Port input.rs to crossterm.

    This required adding another few helper methods to theme.rs,
    but apart from that went quite smoothly.
    
    The result is essentially untested; that's for later.
    grunweg committed Jul 10, 2022
    Configuration menu
    Copy the full SHA
    8d19d22 View commit details
    Browse the repository at this point in the history
  10. Mostly port select,multi_select,sort prompt to crossterm: just borrow…

    …ing errors remaining.
    grunweg committed Jul 10, 2022
    Configuration menu
    Copy the full SHA
    683a193 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    a7072aa View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2022

  1. Move TermThemeRenderer and the confirmation prompt to crossterm.

    General things of note
    - As crossterm operates on any io::Write trait object instead of
    a dedicated Term struct, we use the static terminal::size()
    method to obtain the terminal size, which returns an option.
    - We conciously only support clearing an u16 number of lines, since that's
    crossterm only allows moving the cursor by that many lines.
    - We conciously manually clear the last N lines instead of the entire terminal
    since the confirmation prompt expects it so.
    
    This change was manually tested, by running the `confirm` example with
    various inputs. The confirmation prompt behaves the same as before this change.
    grunweg committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    6d41b18 View commit details
    Browse the repository at this point in the history
  2. Make the paging module compile.

    - create a new constant for the default terminal size,
    as that's now used in three different places
    - make clear_last_lines a static method, operating on any dyn io::Write,
    now just a TermThemeRenderer -- paging also needs it.
    - also extract clear_current_line to that level
    grunweg committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    dd0d6f4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    47d1cd1 View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2022

  1. cargo fmt

    grunweg committed Aug 18, 2022
    Configuration menu
    Copy the full SHA
    82ed7d4 View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2022

  1. Allow sharing a terminal between a TermThemeRenderer and a Paging ins…

    …tance.
    
    Use an Arc<Mutex<dyn io::Write>> instead of a &mut dyn io::Write.
    - an arc allows sharing the terminal, a mutex allows mutating it while shared
    
    To avoid lots of boilerplate with .lock().unwrap(), introduce a wrapper type.
    
    Make the remaining prompts compile; almost all examples compile now.
    
    The sole exception is the buffered example, which uses console's buffered_stderr type.
    grunweg committed Aug 28, 2022
    Configuration menu
    Copy the full SHA
    cda693a View commit details
    Browse the repository at this point in the history
  2. theme.rs: remove some now-superfluous helper functions.

    - {show,hide}_cursor can be removed now,
    - flush() can be reduced to one single occurrence.
    
    These were needed before we wrapped our terminal in an Arc.
    grunweg committed Aug 28, 2022
    Configuration menu
    Copy the full SHA
    a975463 View commit details
    Browse the repository at this point in the history
  3. cargo fmt

    grunweg committed Aug 28, 2022
    Configuration menu
    Copy the full SHA
    9582bc8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    271daf3 View commit details
    Browse the repository at this point in the history
  5. Add a new helper to construct a terminal from stderr.

    Replaces lots of boilerplate with Term::new(Arc::new(Mutex::new(_))).
    grunweg committed Aug 28, 2022
    Configuration menu
    Copy the full SHA
    0bcb0da View commit details
    Browse the repository at this point in the history
  6. Fix doctests.

    grunweg committed Aug 28, 2022
    Configuration menu
    Copy the full SHA
    a44708e View commit details
    Browse the repository at this point in the history
  7. Fix clippy warnings; format.

    grunweg committed Aug 28, 2022
    Configuration menu
    Copy the full SHA
    a53f478 View commit details
    Browse the repository at this point in the history