1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 22:30:03 -04:00

Add support for buffers other than a String in TextEdit (#399)

* Initial design for `TextBuffer` trait, to allow `TextEdit` to edit types other than `String`.

* Moved `insert_text` implementation into `TextBuffer`.
This allows the user to implement text inserting depedent on their type instead of using a `String` and converting back to `S`, which may be a lossless convertion.

* Moved part of `delete_selected_ccursor_range` implementation into `TextBuffer::delete_range`.

* `TextBuffer::insert_text` not returns how many characters were inserted into the buffer.
This allows implementations to "saturate" the buffer, only allowing for a limited length of characters to be inserted.

* Now using `byte_index_from_char_index` instead of custom implementation.

* `decrease_identation` impl now modified the string in-place.
Removed `From<String>` bound for `TextBuffer`.

* Added changes to changelog.

* Moved updated changelog to .

* Updated documentation on `TextBuffer`.

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>

* Renamed `TextBuffer::delete_text_range` to `delete_char_range`.

Co-authored-by: Filipe Rodrigues <filipejacintorodrigues1@gmail.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
Zenithsiz
2021-05-20 20:00:50 +01:00
committed by GitHub
parent d292b831a1
commit 57981d49ee
3 changed files with 120 additions and 93 deletions

View File

@@ -10,7 +10,8 @@ NOTE: [`eframe`](eframe/CHANGELOG.md), [`egui_web`](egui_web/CHANGELOG.md) and [
### Added ⭐
* Add support for [cint](https://crates.io/crates/cint) under `cint` feature.
* Add features `extra_asserts` and `extra_debug_asserts` to enable additional checks.
* Add an option to overwrite frame of SidePanel and TopPanel
* Add an option to overwrite frame of SidePanel and TopPanel.
* `TextEdit` now supports edits on a generic buffer using `TextBuffer`.
## 0.12.0 - 2021-05-10 - Multitouch, user memory, window pivots, and improved plots