Skip to content

v0.6.1

Latest
Compare
Choose a tag to compare
@rhysd rhysd released this 08 Aug 16:03
· 3 commits to main since this release
  • Add TextArea::selection_range method to get the range of the current selection. Please read the document for more details. (#81, thanks @achristmascarl)
    let mut textarea = TextArea::from(["aaa"]);
    
    // It returns `None` when the text selection is not ongoing
    assert_eq!(textarea.selection_range(), None);
    
    textarea.start_selection();
    assert_eq!(textarea.selection_range(), Some(((0, 0), (0, 0))));
    
    textarea.move_cursor(CursorMove::Forward);
    assert_eq!(textarea.selection_range(), Some(((0, 0), (0, 1))));
    
    // The first element of the pair is always smaller than the second one.
    textarea.start_selection();
    textarea.move_cursor(CursorMove::Back);
    assert_eq!(textarea.selection_range(), Some(((0, 0), (0, 1))));
  • Fix depending on the incorrect version of termion crate when tuirs-termion feature is enabled. Since tui crate depends on older version of termion crate v1.5.6, tui-textarea should depend on the same version but actually it depended on the latest version v4.0.0.
    • If you use tui-textarea with tui crate and termion crate, please ensure that your project also depends on termion v1.5. Otherwise your project accidentally depends on multiple versions of termion crate.