Commit Graph

1399 Commits

Author SHA1 Message Date
Alexandre Bury
d464dc8ce0 Add Margins::zeroes 2020-12-18 14:08:09 -08:00
Alexandre Bury
418fda99ba Update rustfmt config
Now uses nightly rustfmt.
2020-12-18 14:07:47 -08:00
Alexandre Bury
368dca6033 Add TextView::set_style 2020-12-18 14:07:47 -08:00
Deven96
40efcc6727
Added mythra Project to showcases (#527) 2020-12-09 10:35:04 -08:00
Alexandre Bury
b2826f16dd Remove unused imports 2020-12-06 14:11:41 -08:00
Alexandre Bury
8003fc1773 Re-organize imports 2020-12-05 23:45:29 -08:00
Alexandre Bury
bac285000d Fix handling of newline at end of content. 2020-12-05 23:44:05 -08:00
Alexandre Bury
0a66978d7f Move event handling outside of scroll::Core 2020-12-05 23:05:47 -08:00
Alexandre Bury
31b8e1f515 Reformat & fix clippy 2020-12-01 12:23:29 -08:00
Alexandre Bury
1b10ea154d Scrolling: Rename available_size -> last_available_size 2020-12-01 12:23:29 -08:00
Tejun Heo
529aff0f23
Make SpannedString iterators double ended & exact sized (#524)
So that users can, for example, do .spans().len() to determine the number of
spans.
2020-11-26 13:38:27 -08:00
Alexandre Bury
b79ccf62da Manually derive Clone for RadioGroup<T>
To avoid the `T: Clone` bound.
2020-11-10 08:34:40 -08:00
Saul Chavez Sanchez
b3ada6be20
Really minor fix (#520)
* Really minor fix

Now it looks a little bit prettier
2020-10-28 19:56:43 -07:00
Alexandre Bury
fb23445e1d Add Cursive::screen_size based on last layout phase 2020-10-26 12:30:00 -07:00
Alexandre Bury
58bbae5ec8 Rename SpannedString::shrink_to_fit -> trim 2020-10-15 17:38:13 -07:00
Alexandre Bury
382557f713 Add mutable attribute access to SpannedStrings 2020-10-15 17:22:44 -07:00
Alexandre Bury
60fcbba54a Add public TextContent::with_content 2020-10-15 16:17:39 -07:00
Alexandre Bury
b03eafaabb Add methods to remove from a SpannedString and shrink it 2020-10-15 16:11:29 -07:00
Alexandre Bury
7f25dd71d3 Add Finder::call_on_all and Cursive::call_on_all_named 2020-10-15 13:58:24 -07:00
Alexandre Bury
47d8d23198 Fix clippy lints 2020-10-09 15:59:41 -07:00
Robin Krahl
994a3cf545
List rusty-man in readme (#518)
This patch adds rusty-man, a rustdoc documentation viewer for the
terminal, to the list of cursive applications in the readme.
2020-10-09 15:59:37 -07:00
Alexandre Bury
03cd0d41da Fix cursive_run doc 2020-10-09 15:44:48 -07:00
Alexandre Bury
801fa8e54b Deprecate ScrollBase 2020-10-09 15:44:35 -07:00
Tianyi Shi
c7c5f7955f
add new example: stopwatch (#503)
Co-authored-by: Mckol <mckol363@gmail.com>
2020-10-08 19:41:57 -07:00
Tianyi Shi
ac06b3ac3a
add sudoku-tui to showcase (#514) 2020-10-08 13:36:03 -07:00
Robin Krahl
c5ccacf30e
Add cursive-markup to readme (#513)
* Add cursive-markup to readme

The cursive-markup crate provides a view that can render HTML or other
markup.  This patch adds it to the list of third-party views in the
readme.
2020-10-07 14:27:11 -07:00
Robin Krahl
28c64958ca
Implement FromIterator for SpannedString (#512)
This patch implements FromIterator<SpannedString<T>> for
SpannedString<T> to make it easier to create strings programatically.
We could also use fold directly without extracting the first element,
but that would require an additional allocation.
2020-10-07 10:55:12 -07:00
Robin Krahl
0e2a111f59
Mark XY::stack_{horizontal, vertical} as must_use (#511)
The method names stack_horizontal and stack_vertical don’t make it clear
whether the methods modify self or return the modified version.
Therefore, it is easy to use them wrong if you don’t look at the
documentation.  This patch adds the must_use attribute to both methods
to make it easier to spot such mistakes.
2020-10-06 14:21:56 -07:00
Robin Krahl
3f60d383aa
Implement FromIterator for Style (#510)
This patch implements FromIterator<&Style> and FromIterator<T:
Into<Style>> for Style to make it easier to programatically create
styles.  Style already has a merge method, but it takes a slice instead
of an iterator.
2020-10-06 14:05:52 -07:00
Robin Krahl
02ce9f8a35
Derive Default for XY (#509)
This patch derives Default for XY<T>.  This makes it easier to deal with
types like XY<usize>.
2020-10-06 13:12:29 -07:00
Robin Krahl
f694e2ae25
Remove outdated comment from button.rs (#508)
Before commit f9c9e56518, this match
interpreted the key code 10 as the Enter key.  Since it now uses the
Key::Enter variant instead, the comment explaining the magic number is
no longer needed.
2020-10-06 12:31:40 -07:00
Tianyi Shi
3ab4f9b0f7
new example: autocomplete search box (#502)
new example: autocomplete search box
2020-09-21 21:31:19 -07:00
Mckol
7b579a7d54
Improved the select example. (#501)
Now the `OnEventView.on_pre_event_inner()` calls return
`Some(EventResult::Consumed(Some(Callback)))` instead of
`Some(EventResult::Consumed(None))`.
This follows the guidelines from documentation of methods returning a
`Callback`, which say that it should be ran on the `Cursive`.
While in this example this doesn't make a difference, the previous
version created confusion for new users who might not realize you can
pass the `Callback`s to the `Cursive` this way.
2020-09-21 14:16:16 -07:00
Alexandre Bury
e7a813b383 Fix chunk_iterator with empty spans after hard-stop 2020-08-26 16:44:56 -07:00
Alexandre Bury
b5651e3ac4 Add test for empty span after hard-stop 2020-08-26 16:44:41 -07:00
Alexandre Bury
7e32e0649e Fix handling of multi-bytes newlines 2020-08-26 15:19:51 -07:00
Alexandre Bury
f13914a272 Add test 2020-08-26 15:19:40 -07:00
Alexandre Bury
eec4dd8e68 Fix unimported CString 2020-08-25 23:27:48 -07:00
Alexandre Bury
e2f79776a4 Manuall call setlocale for pancurses backend
Once (if?) pancurses merges the corresponding PR[1], we can revert that.

[1]: https://github.com/ihalila/pancurses/pull/78
2020-08-25 23:09:53 -07:00
Alexandre Bury
64b68ed718 Use libc::setlocale for ncurses backend 2020-08-25 11:01:45 -07:00
Asad Mehmood
049919b609
BLT: Use bearlibterminal char function (#496)
It already handles shift, capslock and user keymap
Leave fallback for when it doesnt work (CTRL pressed?)
2020-08-25 10:57:19 -07:00
poorie
792c4f1638
fix missing brace (#495) 2020-08-24 08:48:07 -07:00
Alexandre Bury
ad935f5126 ScreensView: dispatch call_on_any and focus_view to all screens 2020-08-23 10:18:01 -07:00
Asad Mehmood
69feb373e6
Fix backslash crash with blt backent (#492)
Pressing backslash would cause cursive to panic.
2020-08-21 13:28:33 -07:00
Alexandre Bury
b75b5017e1 ScrollView: Do not change offset in directionless focus change 2020-08-17 10:50:33 -07:00
Alexandre Bury
9e804fd105 Add pause example 2020-08-05 17:19:37 -07:00
Alexandre Bury
76170ab2dd Fix blt runnable 2020-08-04 23:35:43 -07:00
Alexandre Bury
2cd6d7a80c Make backends pausable 2020-08-04 23:24:11 -07:00
Alexandre Bury
01bb32d640 Fixes 2020-08-04 14:51:16 -07:00
Alexandre Bury
bf25cb90ae Add methods to initialize backends from stdio 2020-08-04 13:58:15 -07:00