зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-08-28 11:36:17 +03:00
17 KiB
17 KiB
v0.3.1 - 04 Nov 2023
- Fix the width of rendered tab character (
\t) is wrong in some cases when hard tab is enabled byTextArea::set_hard_tab_indent(#43). - Fix key inputs are doubled on Windows when converting from
crossterm::event::KeyEventintotui_textarea::Input. Note that the conversion fromcrossterm::event::Eventintotui_textarea::Inputdoes not have this issue. - Support converting the following type instances into
tui_textarea::Input.crossterm::event::KeyCodecrossterm::event::KeyEventcrossterm::event::MouseEventcrossterm::event::MouseKindtermwiz::input::KeyCodetermwiz::input::KeyEventtermion::event::MouseButton
- Fix typos in API document and error message (#40, thanks @fritzrehde).
v0.3.0 - 24 Oct 2023
- BREAKING CHANGE: Enable ratatui support by default instead of inactive tui-rs.
ratatui-prefix is removed from allratatui-*features.crossterm,termion, andtermwizfeatures are for ratatui:# ratatui with crossterm backend tui-textarea = "0.3" # ratatui with termwiz backend tui-textarea = { version = "0.3", features = ["termwiz"], default-features = false } # ratatui with termion backend tui-textarea = { version = "0.3", features = ["termion"], default-features = false }- Instead, features for tui-rs support are now prefixed with
tuirs-:# tui-rs with crossterm backend tui-textarea = { version = "0.3", features = ["tuirs-crossterm"], default-features = false } # Use proper version of crossterm crossterm = "0.2.5" - Examples and documents are now implemented and described with ratatui by default
- BREAKING CHANGE: Rename
your-backendfeatures tono-backend. You need to update the feature names if you're using tui-textarea with your own backend. - Relax the restriction of ratatui crate dependency from
0.23.0to>=0.23.0, <1, which means 'v0.23.0 or later and earlier than v1'. The latest version of ratatui (v0.24.0) now works with tui-textarea (#36). - Enable
termwizandtermionfeatures on generating the API document. APIs to convert from input events of termwiz/termion totui_textarea::Inputare now listed in the document.
Previous Backend features table (v0.2.4):
| crossterm | termion | termwiz | Your own backend | |
|---|---|---|---|---|
| tui-rs | crossterm (enabled by default) |
termion |
N/A | your-backend |
| ratatui | ratatui-crossterm |
ratatui-termion |
ratatui-termwiz |
ratatui-your-backend |
New backend features table (v0.3.0):
| crossterm | termion | termwiz | Your own backend | |
|---|---|---|---|---|
| tui-rs | tuirs-crossterm |
tuirs-termion |
N/A | tuirs-no-backend |
| ratatui | crossterm (enabled by default) |
termion |
termwiz |
no-backend |
v0.2.4 - 21 Oct 2023
- Support the ratatui's termwiz backend.
ratatui-termwizfeature was newly added for this.- Add the following dependencies in your Cargo.toml to use termwiz support.
termwiz = "0.20" ratatui = { version = "0.23", default-features = false, features = ["termwiz"] } tui-textarea = { version = "0.2.4", default-features = false, features = ["ratatui-termwiz"] } - Read and run the
termwizexample to know the API usage.cargo run --example termwiz --no-default-features --features=ratatui-termwiz
- Add the following dependencies in your Cargo.toml to use termwiz support.
- Fix calculating the length of tab character when the line contains wide characters. Now the length of wide characters like あ are calculated as 2 correctly.
v0.2.3 - 20 Oct 2023
- Add APIs to mask text with a character (#32, thanks @pm100).
TextArea::set_mask_char,TextArea::clear_mask_char,TextArea::mask_charare added. See the documentation for more details.- The
passwordexample was added to show the usage.
- Fix the length of displayed hard tab in text (#33, thanks @pm100).
v0.2.2 - 01 Oct 2023
Very small patch release only for fixing the build failure on docs.rs. No implementation has been changed.
v0.2.1 - 01 Oct 2023
- Add the support for ratatui crate in addition to tui-rs. The ratatui crate is a community fork of inactive tui-rs crate. (#12)
- The latest version of ratatui v0.23 is supported.
- tui-textarea still uses tui-rs by default to keep the compatibility at this moment. ratatui users explicitly need to set features for it. See the installation document for the features matrix. For example, when you want to use ratatui and crossterm, write the following in your
Cargo.toml:[dependencies] ratatui = "*" tui-textarea = { version = "*", features = ["ratatui-crossterm"], default-features = false } - tui-rs is no longer maintained and the repository was archived. At the next minor version bump, tui-textarea will switch the default features from tui-rs to ratatui. If you use tui-rs, I recommend to switch your dependency to ratatui.
- Examples with ratatui are added to the
examplesdirectory. For example, the following command runs ratatui version ofeditorexample:cargo run --example ratatui_editor --no-default-features --features=ratatui-crossterm,search file.txt
- Add support for the placeholder text which is rendered when no text is input in the textarea. (#16, thanks @pm100)
- Use
TextArea::set_placeholder_textto set the text. To change the text style, useTextArea::set_placeholder_style. See the API documentation for more details. popup_placeholderexample was added to show the usage.cargo run --example popup_placeholder
- Use
- Derive
Debugtrait forTextAreastruct. (#23) - Fix a key input is received twice on Windows. (#17, thanks @pm100)
v0.2.0 - 18 Oct 2022
- Add
Scrollingenum to provide more flexible scrolling viaTextArea::scrollmethod. It has the following enum variants.- BREAKING
Scrolling::Deltascrolls the textarea by given rows and cols. This variant can be converted from(i16, i16)so migrating from v0.1.6 is very easy.let rows: i16 = ...; let cols: i16 = ...; // Until v0.1.6 textarea.scroll(rows, cols); // Since v0.2.0 textarea.scroll((rows, cols)); Scrolling::PageDownandScrolling::PageUpscroll the textarea by page.Scrolling::HalfPageDownandScrolling::HalfPageUpscroll the textarea by half-page.
- BREAKING
- Update default key mappings handled by
TextArea::inputmethod.- BREAKING Change
PageDownandPageUpkeys to scroll down/up the textarea by page since v0.2.0. Until v0.1.6, it moved the cursor down/up by one paragraph. - Add
Ctrl+VandAlt+Vkeys to scroll down/up the textarea by page as Emacs-like key mappings. - Add
Alt+]andAlt+[keys to move the cursor down/up by one paragraph as Emacs-like key mappings.
- BREAKING Change
- BREAKING Add
#[non_exhaustive]attribute toCursorMoveenum. This is because more cursor move variations may be added in the future. - Fix panic when the max history size is zero (which means the edit history is disabled). (#4)
v0.1.6 - 28 Sep 2022
- Support mouse scroll. (#2)
- Handle mouse events for both
crosstermandtermionbackends. TextArea::scrollmethod was added.Key::MouseScrollUpandKey::MouseScrollDownvirtual keys are added toKeyenum so that custom backends can support mouse scrolling.CursorMove::InViewportvariant was added toCursorMoveenum, which ensures the cursor to be within the viewport.
- Handle mouse events for both
- Add
TextArea::alignmentandTextArea::set_alignmentto set the text alignment of textarea. Note that right and center alignments don't work well with line number so callingTextArea::set_alignmentwith them automatically disables it. (#3, thanks @Volkalex28)
- Set
rust-versionto 1.56.1 inCargo.tomlto show MSRV explicitly.
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 wasO(n)wherenwas number of all lines. Now the cost isO(1). - Implement
CloneforTextAreaso that textarea instances can be copied easily. It is useful when you create multiple textarea instances with the same configuration. Create a firstTextAreainstance with configuring blocks and styles, then simply clone it. - Add
arbitraryfeature which is disabled by default. By enabling it,Input,KeyandCursorMovecan 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
TextAreaimplementation. The implementation of text search was separated tosrc/search.rs. The implementation of highlighting was separated tosrc/highlight.rs. And the implementation of widget rendered by tui-rs was separated tosrc/widget.rs. These refactorings changed no public API.
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' (
^Jby default).
v0.1.3 - 08 Jul 2022
- Text search was implemented. Text search is gated behind
searchfeature flag to avoid depending onregexcrate until it is necessary. See the usage document, the API document, and the working example for more details.TextArea::set_search_patternsets a search pattern in regular expression. This updates highlights at matches in textarea, but does not move the cursor.TextArea::search_forwardmoves cursor to the next match of the text search based on current cursor position.TextArea::search_backmoves cursor to the previous match of the text search based on current cursor position.TextArea::set_search_stylesets the text style for highlighting matches of text search.
v0.1.2 - 25 Jun 2022
- Indent with hard tab is now supported.
TextArea::set_hard_tab_indentmethod enables indentation with a hard tab on hitting a tab key.Demo withlet mut textarea = TextArea::default(); textarea.set_hard_tab_indent(true); textarea.insert_tab(); assert_eq!(textarea.lines(), ["\t"]);cargo run --example editor:
- Add
TextArea::indentmethod 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");
v0.1.1 - 21 Jun 2022
- Add
TextArea::yank_textandTextArea::set_yank_textto 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 withTextArea::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)
v0.1.0 - 19 Jun 2022
First release 🎉
- GitHub repository: https://github.com/rhysd/tui-textarea
- crates.io: https://crates.io/crates/tui-textarea
- docs.rs: https://docs.rs/tui-textarea/latest/tui_textarea/