Commit Graph

105 Commits

Author SHA1 Message Date
Chris Vest
ea7b5dbae2 Add Backend::print_at_rep and make Printer::print_hline use it. (#326)
* Add Backend::print_at_rep and make Printer::print_hline use it.

This avoids a string allocation in `print_hline` and makes it faster, presumably for all backends.
This speeds up the rendering of the background in StackView.

* Fix a bug in how Printer::print_hline computes the repetition count.
2019-03-12 15:03:00 -07:00
Chris Vest
561b83dbc9 Avoid iterating graphemes unless we have to.
Iterating graphemes with `text.graphemes(true)` is somewhat expensive due to the complexity of unicode.
However, we were doing it _twice_ in the `Printer::print` method in order to truncate the input text to fit the content area.
This changes that method to track the width of the intput text, and only do the grapheme iteration when truncation is actually necessary.
2019-03-12 21:30:46 +01:00
Alexandre Bury
12ad66badd Migrate MenuPopup to new scrollbase 2019-03-08 13:57:05 -08:00
Alexandre Bury
ae0e9216ce Add new ScrollBase 2019-03-07 22:33:43 -08:00
Alexandre Bury
e839bb8274 Add Printer::{shrinked,cropped}_centered 2019-03-04 12:34:50 -08:00
Alexandre Bury
242a3c68a7 Fix clippy warnings 2019-03-04 10:31:36 -08:00
Alexandre Bury
06b02e4665 Remove "extern crate" and rustfmt 2019-02-28 16:04:14 -08:00
Alexandre Bury
e096dc9740 Run cargo fix --edition-idioms 2019-02-28 15:55:10 -08:00
Alexandre Bury
e51be07e5d Update to Rust 2018
Run `cargo fix --edition` and update Cargo.toml
2019-02-28 15:54:12 -08:00
Alexandre Bury
6b278495d5 Use StyledString in SelectView 2018-11-30 13:19:08 -08:00
Alexandre Bury
193f098ee0 Add Printer::enabled 2018-11-09 14:08:43 -08:00
Alexandre Bury
49e1d1d15e Remove internal scrolling from list_view 2018-07-24 19:06:07 -07:00
Alexandre Bury
6ce2dba8a1 Fix clippy warnings 2018-06-21 14:44:30 -07:00
Alexandre Bury
5e1956b737 Merge branch 'master' into scroll 2018-06-15 23:21:10 -07:00
Alexandre Bury
0c318b7194 Add scrollbars to ScrollView 2018-06-15 19:18:24 -07:00
Alexandre Bury
8acc08f340 Rustfmt 2018-06-10 23:29:19 -07:00
Alexandre Bury
94504ae91b Scrollview: move offset to keep important area in view 2018-05-21 17:25:32 -07:00
Andrzej J Skalski
cabeef1d16 added with_theme to Printer 2018-05-21 15:53:38 +02:00
Alexandre Bury
2088d5de2a Cargo fmt 2018-05-17 17:37:39 -07:00
Alexandre Bury
755854963f Fix clippy warnings 2018-05-17 17:35:57 -07:00
Alexandre Bury
0fbc5a888e Add inner size to printer
Renamed Printer::size -> output_size
2018-04-27 16:23:07 -07:00
Alexandre Bury
5586403080 printer: add doc 2018-04-24 17:19:07 -07:00
Alexandre Bury
8c2ff6bd4f Handle content_offset in print methods 2018-04-17 17:22:56 -07:00
Alexandre Bury
b80af07268 Remove Printer::is_new 2018-04-17 16:35:56 -07:00
Alexandre Bury
f0b3287d73 Merge branch 'master' into scroll 2018-04-16 22:42:42 -07:00
Alexandre Bury
ff9f669d73 Fix tests & examples 2018-04-10 12:51:40 -07:00
Alexandre Bury
a355171844 Fix clippy warnings 2018-04-10 11:53:25 -07:00
Alexandre Bury
8641098781 Split Printer::sub_printer into sub-methods 2018-04-04 17:49:11 -07:00
Alexandre Bury
4042a45b8d Add basis for ScrollView 2018-04-04 17:48:51 -07:00
Alexandre Bury
fd09b5f806 Use Vec2 in backend methods 2018-04-02 18:08:12 -07:00
Alexandre Bury
126530b9a9 Cursive::new now takes the backend as argument 2018-04-01 16:39:03 -07:00
SEGFAULT
76d340f11d Making backend::Backend into a std::Boxable trait (#229)
* Making Backend into a Boxable Trait

* Fixed up some typos in the previous and modified some of the docs so they still compile.

* Minor Changes requested by @gyscos

* Whoops
2018-04-01 15:35:37 -07:00
Alexandre Bury
1ad515e5f0 rustfmt 2018-03-22 11:04:58 -07:00
Alexandre Bury
da8310b076 Rustfmt 2018-01-22 14:37:27 -08:00
Alexandre Bury
3674c118cb Rustfmt 2018-01-22 11:55:56 -08:00
Alexandre Bury
431285135f Make Palette directly an EnumMap
Removes the "colors" intermediate member.
2018-01-21 11:17:22 -08:00
Alexandre Bury
5ac0fce363 Refactor ColorStyle
Add the notion of PaletteColor to use a color from the palette.

Breaking change: most color styles are now methods rather than enum
variants.
2018-01-17 10:22:06 -08:00
Alexandre Bury
39405ba1ec Refactor spans and markup
We now use mostly indexed spans into a source string.
Indexed Spans can still be resolved to a string slice when needed.
2018-01-15 13:53:27 -08:00
Alexandre Bury
890b3f13e1 TextView: print styled spans of text 2018-01-10 23:58:29 +01:00
Alexandre Bury
c2d2fa0527 Update Style to include a set of effects 2018-01-08 15:44:27 +01:00
Alexandre Bury
c4670e5262 More utils re-organization 2018-01-08 12:33:43 +01:00
Alexandre Bury
e4cd68a4eb Rustfmt 2017-12-30 23:03:42 +01:00
Alexandre Bury
93982517ae Fix clippy warnings 2017-10-13 11:24:17 -07:00
Alexandre Bury
a4ca7bbf1e Rustfmt 2017-10-12 16:43:59 -07:00
Alexandre Bury
05bac7a192 More safe subtractions all around. 2017-08-14 16:32:39 -07:00
Alexandre Bury
dea07d29cf Give the background color to the clear method. 2017-06-12 23:29:26 -07:00
Alexandre Bury
9f5ce65e34 Fix doc comment 2017-06-12 18:03:52 -07:00
Alexandre Bury
5c42a59954 Refactor colors management
Do not register pairs with backend. Let backend cache color pairs if
needed.
2017-06-12 11:59:33 -07:00
Alexandre Bury
b63762d441 View::find_any now takes a closure instead of returning reference
Also updated Finder::find and find_id.
2017-02-07 15:49:06 -08:00
Robin Stumm
99fa86bec9 return length and width from utils::prefix() (renamed from utils::prefix_length()) as per df835d1 2017-02-01 20:47:33 +01:00