Commit Graph

1373 Commits

Author SHA1 Message Date
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
Alexandre Bury
b4dfaf4d9f Update Changelog 2020-08-02 17:30:03 -07:00
Alexandre Bury
b4b8f951fb Add non-chained methods to ProgressBar 2020-08-02 17:16:13 -07:00
James Tai
bc49eebeb8
Fix text alignment when wrapped (#471)
* Fix text alignment when wrapped

This changes the `LinesIterator` to return a `width` that corresponds
with the actual total length of the chunks, rather than returning the
total available width, when a line is wrapped. This effectively reverts
20cb033b8d (I am not sure why that commit
changed it).

* Add `is_wrapped` flag to `Row`

* Fix TextArea width with wrapped rows

Co-authored-by: Alexandre Bury <alexandre.bury@gmail.com>
2020-07-25 16:51:33 -07:00
Matthias Beyer
d96904a07d
Fix typo (#474)
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-07-23 08:50:26 -07:00
Alexandre Bury
b7bf861554 Reword cursive_core::backend module doc 2020-07-20 08:54:38 -07:00
Alexandre Bury
d31d0d0d76 Derive more stuff 2020-07-13 12:54:03 -07:00
Alexandre Bury
96919c6561 Mention ncspot in Readme 2020-07-13 09:38:05 -07:00
Alexandre Bury
20d9d321c1 Mention samtay/so in Readme 2020-07-13 09:33:01 -07:00
Alex Parrill
afe3123dac
Derive Clone+Copy for Align, HAlign, VAlign (#469)
Fixes #468
2020-07-12 21:17:52 -07:00
Alexandre Bury
56008db796 Enable multi-rows views in ListView 2020-07-07 00:11:52 -07:00
maxim
63b438188f [Doc] Improves the documentation about using custom themes
As starting to use the cursive library I've found it challenging to
figure out how to actually use the themes. Only after checking the
source code, and another library actually using this feature, I've
managed to apply it to my project.

This change makes it easier for new commers to use toml themes by
extending the documentationn
2020-07-06 15:15:35 -07:00
Alexandre Bury
4d322eb42d Rename master branch -> main 2020-07-06 15:03:29 -07:00
Alexandre Bury
1f87a44de6 Update changelog 2020-07-06 12:09:49 -07:00
Alexandre Bury
db9a3c32b1 Fix scroll::core size handling 2020-07-06 10:23:49 -07:00
Alexandre Bury
2e308d8d26 Fix bad scrolling detection 2020-07-05 15:29:30 -07:00
Alexandre Bury
e8960fe89d Bump cursive-core to 0.1.1 2020-07-04 10:29:45 -07:00
Alexandre Bury
adec5ae066 Loosen dependencies 2020-07-04 10:27:02 -07:00
Alexandre Bury
945fe1aa45 Update dependencies 2020-07-04 10:18:30 -07:00
Alexandre Bury
f047ee5f5c Remove inferred lifetime parameters to Printer 2020-07-03 20:38:08 -07:00
Alexandre Bury
58480d14f9 Update Changelog 2020-07-03 20:31:43 -07:00
Alexandre Bury
7ca0b145bd Make Cursive::dump take &mut self 2020-07-03 09:17:50 -07:00
Alexandre Bury
58ef6c298b Add NamedView::{name, set_name} and {LinearLayout,FixedLayout}::find_child_from_name 2020-07-02 23:59:55 -07:00
Alexandre Bury
421c08c922 Add missing method to FixedLayout 2020-07-02 23:59:55 -07:00
Alexandre Bury
f5687f5eab Fix FixedLayout::required_size 2020-07-02 23:59:55 -07:00
Alexandre Bury
9e5491bda2 Remove debug log and fix initial focus (again) 2020-07-02 23:59:55 -07:00
Alexandre Bury
f2b1fac679 Fix bad initial focus 2020-07-02 23:59:55 -07:00