1
0
зеркало из https://github.com/glebtv/tui-textarea.git synced 2026-09-03 14:26:17 +03:00
Files
tui-textarea/CHANGELOG.md
2022-07-18 20:21:26 +09:00

5.7 KiB

v0.1.5 - 18 Jul 2022

  • Improve performance to render a textarea widget. When number of lines increases, now rendering lines is about 2~8x faster according to our benchmark suites. See the commit for more details of the benchmark results. This was archived by managing a vertical scroll position by ourselves instead of scroll handling by Paragraph. Previously, a cost of rendering lines was O(n) where n was number of all lines. Now the cost is O(1).
  • Implement Clone for TextArea so that textarea instances can be copied easily. It is useful when you create multiple textarea instances with the same configuration. Create a first TextArea instance with configuring blocks and styles, then simply clone it.
  • Add arbitrary feature which is disabled by default. By enabling it, Input, Key and CursorMove can be randomly generated via arbitrary crate. This feature aims to be used by fuzzing tests.
  • Add many benchmark suites to track performance; insert/delete lines/characters, text search, moving a cursor.
  • Improve fuzzing tests to include rendering a textarea to a dummy terminal backend and moving a cursor randomly.
  • Refactor TextArea implementation. The implementation of text search was separated to src/search.rs. The implementation of highlighting was separated to src/highlight.rs. And the implementation of widget rendered by tui-rs was separated to src/widget.rs. There is no public API change by these refactorings.

Changes

v0.1.4 - 10 Jul 2022

  • Fix the cursor line style was not applied when a cursor is at the end of line.
  • Fix the cursor position after undoing the modification by 'delete until head of line' (^J by default).

Changes

v0.1.3 - 08 Jul 2022

  • Text search was implemented. Text search is gated behind search feature flag to avoid depending on regex crate until it is necessary. See the usage document, the API document, and the working example for more details.
    • TextArea::set_search_pattern sets a search pattern in regular expression. This updates highlights at matches in textarea, but does not move the cursor.
    • TextArea::search_forward moves cursor to the next match of the text search based on current cursor position.
    • TextArea::search_back moves cursor to the previous match of the text search based on current cursor position.
    • TextArea::set_search_style sets the text style for highlighting matches of text search. search in editor example

Changes

v0.1.2 - 25 Jun 2022

  • Indent with hard tab is now supported. TextArea::set_hard_tab_indent method enables indentation with a hard tab on hitting a tab key.
    let mut textarea = TextArea::default();
    
    textarea.set_hard_tab_indent(true);
    textarea.insert_tab();
    assert_eq!(textarea.lines(), ["\t"]);
    
    Demo with cargo run --example editor: screencast
  • Add TextArea::indent method to get an indent string of textarea.
    let mut textarea = TextArea::default();
    
    assert_eq!(textarea.indent(), "    ");
    textarea.set_tab_length(2);
    assert_eq!(textarea.indent(), "  ");
    textarea.set_hard_tab_indent(true);
    assert_eq!(textarea.indent(), "\t");
    

Changes

v0.1.1 - 21 Jun 2022

  • Add TextArea::yank_text and TextArea::set_yank_text to set/get yanked text of the textarea.
    let mut textarea = TextArea::default();
    textarea.set_yank_text("hello, world");
    assert_eq!(textarea.yank_text(), "hello, world");
    textarea.paste();
    assert_eq!(textarea.lines(), ["hello, world"]);
    
  • Add CursorMove::Jump(row, col) variant to move cursor to arbitrary (row, col) position with TextArea::move_cursor.
    let mut textarea = TextArea::from(["aaaa", "bbbb"]);
    textarea.move_cursor(CursorMove::Jump(1, 2));
    assert_eq!(textarea.cursor(), (1, 2));
    
  • Fix hard tabs are not rendered (#1)

Changes

v0.1.0 - 19 Jun 2022

First release 🎉

Changes