зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-08-28 11:36:17 +03:00
implement Scrolling enum to specify scrolling more flexibly
this is a breaking change. next release should be v0.2.0.
Этот коммит содержится в:
@@ -415,7 +415,7 @@ notify how to move the cursor.
|
||||
| `textarea.set_search_pattern(pattern)` | Set a pattern for text search |
|
||||
| `textarea.search_forward(match_cursor)` | Move cursor to next match of text search |
|
||||
| `textarea.search_back(match_cursor)` | Move cursor to previous match of text search |
|
||||
| `textarea.scroll(rows, cols)` | Scroll the viewport |
|
||||
| `textarea.scroll(scrolling)` | Scroll the viewport |
|
||||
|
||||
To define your own key mappings, simply call the above methods in your code instead of `TextArea::input()` method. The
|
||||
following example defines modal key mappings like Vim.
|
||||
@@ -468,8 +468,8 @@ loop {
|
||||
Input { key: Key::Esc, .. } => textarea.set_search_pattern("").unwrap(),
|
||||
Input { key: Key::Char('n'), .. } => textarea.search_forward(),
|
||||
Input { key: Key::Char('N'), .. } => textarea.search_back(),
|
||||
Input { key: Key::Char('e'), ctrl: true .. } => textarea.scroll(1, 0),
|
||||
Input { key: Key::Char('y'), ctrl: true .. } => textarea.scroll(-1, 0),
|
||||
Input { key: Key::Char('e'), ctrl: true .. } => textarea.scroll((1, 0)),
|
||||
Input { key: Key::Char('y'), ctrl: true .. } => textarea.scroll((-1, 0)),
|
||||
_ => {},
|
||||
},
|
||||
Mode::Insert => match read()?.into() {
|
||||
|
||||
Ссылка в новой задаче
Block a user