mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-22 12:43:16 +00:00
feat(layout): increase default cache size to 500 (#850)
This is a somewhat arbitrary size for the layout cache based on adding the columns and rows on my laptop's terminal (171+51 = 222) and doubling it for good measure and then adding a bit more to make it a round number. This gives enough entries to store a layout for every row and every column, twice over, which should be enough for most apps. For those that need more, the cache size can be set with `Layout::init_cache()`. Fixes: https://github.com/ratatui-org/ratatui/issues/820
This commit is contained in:
parent
1d3fbc1b15
commit
1e755967c5
1 changed files with 7 additions and 1 deletions
|
@ -103,7 +103,13 @@ struct Element {
|
|||
}
|
||||
|
||||
impl Layout {
|
||||
pub const DEFAULT_CACHE_SIZE: usize = 16;
|
||||
/// This is a somewhat arbitrary size for the layout cache based on adding the columns and rows
|
||||
/// on my laptop's terminal (171+51 = 222) and doubling it for good measure and then adding a
|
||||
/// bit more to make it a round number. This gives enough entries to store a layout for every
|
||||
/// row and every column, twice over, which should be enough for most apps. For those that need
|
||||
/// more, the cache size can be set with [`Layout::init_cache()`].
|
||||
pub const DEFAULT_CACHE_SIZE: usize = 500;
|
||||
|
||||
/// Creates a new layout with default values.
|
||||
///
|
||||
/// The `constraints` parameter accepts any type that implements `IntoIterator<Item =
|
||||
|
|
Loading…
Reference in a new issue