Skip to content

zX3no/winter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

winter

Fork of tui-rs

pub fn browser(area: Rect, buf: &mut Buffer, index: Option<usize>) {
    let size = area.width / 3;
    let rem = area.width % 3;

    let chunks = layout![
        area,
        Direction::Horizontal,
        Constraint::Length(size),
        Constraint::Length(size),
        Constraint::Length(size + rem)
    ];

    let a = lines!["Artist 1", "Artist 2", "Artist 3"];
    let b = lines!["Album 1", "Album 2", "Album 3"];
    let c = lines!["Song 1", "Song 2", "Song 3"];

    fn browser_list<'a>(title: &'static str, content: Lines<'a>, use_symbol: bool) -> List<'a> {
        let block = block(Some(title.bold()), Borders::ALL, BorderType::Rounded).margin(1);
        let symbol = if use_symbol { ">" } else { " " };
        list(Some(block), vec![content], Some(symbol), Some(style()))
    }

    let artists = browser_list("Aritst", a, false);
    let albums = browser_list("Album", b, false);
    let songs = browser_list("Song", c, true);

    artists.draw(chunks[0], buf, Some(0));
    albums.draw(chunks[1], buf, Some(0));
    songs.draw(chunks[2], buf, index);
}

Terminal:

  • Cursor positioning
  • Simplify main loop even more
  • Colors are slightly different from crossterm. Most likely due to using old Win32 colors.
  • Re-write layout system.
  • Simplify main loop
  • Reset all styles on exit
  • Raw mode
  • Input support

Events:

  • Handle Shift, Ctrl and Alt.

Widgets:

  • Maybe area: Rect, buf: Buffer should be combined somehow.
  • Add builder macros like with styles -> list().style().margin(1)
  • Change Borders::ALL to just ALL and BorderType::Rounded to just Rounded. Or combine into single enum.
  • Table
  • Constraints
  • List
  • Guage
  • Block
  • Text
  • Layout
  • Replace ListState and TableState with variables. No need for struct.

Lines

  • Simplify the way text and lines work.
  • Fix styles

Text

  • Text alignment: Left, Center, Right
  • Correctly handle multi-width characters
  • Fix modifiers

Block

  • Offset titles
  • Text inside of blocks

List

  • Only index 0 shows selection symbol
  • Fix styles

Table

  • Only first line is displayed
  • Fix styles
  • Background style does not follow area only text.

Layout

  • Cleanup

Gauge

  • Fix styles

About

Terminal Renderer for Windows

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages