Refactored the HorizontallyScrollableText struct to handle Unicode strings more uniformly and to not rely on byte boundaries but instead to rely on Unicode char boundaries
This commit is contained in:
@@ -47,7 +47,7 @@ impl DrawUi for CollectionsUi {
|
||||
draw_collections,
|
||||
draw_search_box,
|
||||
30,
|
||||
11,
|
||||
13,
|
||||
),
|
||||
ActiveRadarrBlock::FilterCollections => draw_popup_over(
|
||||
f,
|
||||
@@ -56,7 +56,7 @@ impl DrawUi for CollectionsUi {
|
||||
draw_collections,
|
||||
draw_filter_box,
|
||||
30,
|
||||
11,
|
||||
13,
|
||||
),
|
||||
ActiveRadarrBlock::UpdateAllCollectionsPrompt => draw_prompt_popup_over(
|
||||
f,
|
||||
|
||||
@@ -48,10 +48,10 @@ impl DrawUi for LibraryUi {
|
||||
{
|
||||
ActiveRadarrBlock::Movies => draw_library(f, app, content_rect),
|
||||
ActiveRadarrBlock::SearchMovie => {
|
||||
draw_popup_over(f, app, content_rect, draw_library, draw_search_box, 30, 11)
|
||||
draw_popup_over(f, app, content_rect, draw_library, draw_search_box, 30, 13)
|
||||
}
|
||||
ActiveRadarrBlock::FilterMovies => {
|
||||
draw_popup_over(f, app, content_rect, draw_library, draw_filter_box, 30, 11)
|
||||
draw_popup_over(f, app, content_rect, draw_library, draw_filter_box, 30, 13)
|
||||
}
|
||||
ActiveRadarrBlock::UpdateAllMoviesPrompt => draw_prompt_popup_over(
|
||||
f,
|
||||
|
||||
+31
-6
@@ -25,8 +25,9 @@ use crate::ui::radarr_ui::root_folders::RootFoldersUi;
|
||||
use crate::ui::radarr_ui::system::SystemUi;
|
||||
use crate::ui::utils::{
|
||||
borderless_block, horizontal_chunks, layout_block, line_gauge_with_label, line_gauge_with_title,
|
||||
show_cursor, style_awaiting_import, style_bold, style_default, style_failure, style_success,
|
||||
style_unmonitored, style_warning, title_block, title_block_centered, vertical_chunks_with_margin,
|
||||
show_cursor, style_awaiting_import, style_bold, style_default, style_failure, style_help,
|
||||
style_success, style_unmonitored, style_warning, title_block, title_block_centered,
|
||||
vertical_chunks_with_margin,
|
||||
};
|
||||
use crate::ui::DrawUi;
|
||||
use crate::utils::convert_to_gb;
|
||||
@@ -231,8 +232,15 @@ fn determine_row_style(downloads_vec: &[DownloadRecord], movie: &Movie) -> Style
|
||||
}
|
||||
|
||||
fn draw_search_box<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect) {
|
||||
let chunks =
|
||||
vertical_chunks_with_margin(vec![Constraint::Length(3), Constraint::Min(0)], area, 1);
|
||||
let chunks = vertical_chunks_with_margin(
|
||||
vec![
|
||||
Constraint::Length(3),
|
||||
Constraint::Length(1),
|
||||
Constraint::Min(0),
|
||||
],
|
||||
area,
|
||||
1,
|
||||
);
|
||||
if !app.data.radarr_data.is_searching {
|
||||
let error_msg = match app.get_current_route() {
|
||||
Route::Radarr(active_radarr_block, _) => match active_radarr_block {
|
||||
@@ -272,15 +280,27 @@ fn draw_search_box<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Re
|
||||
let input = Paragraph::new(block_content.as_str())
|
||||
.style(style_default())
|
||||
.block(title_block_centered(block_title));
|
||||
let help = Paragraph::new("<esc> cancel")
|
||||
.style(style_help())
|
||||
.alignment(Alignment::Center)
|
||||
.block(borderless_block());
|
||||
show_cursor(f, chunks[0], offset, block_content);
|
||||
|
||||
f.render_widget(input, chunks[0]);
|
||||
f.render_widget(help, chunks[1]);
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_filter_box<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect) {
|
||||
let chunks =
|
||||
vertical_chunks_with_margin(vec![Constraint::Length(3), Constraint::Min(0)], area, 1);
|
||||
let chunks = vertical_chunks_with_margin(
|
||||
vec![
|
||||
Constraint::Length(3),
|
||||
Constraint::Length(1),
|
||||
Constraint::Min(0),
|
||||
],
|
||||
area,
|
||||
1,
|
||||
);
|
||||
if !app.data.radarr_data.is_filtering {
|
||||
let error_msg = match app.get_current_route() {
|
||||
Route::Radarr(active_radarr_block, _) => match active_radarr_block {
|
||||
@@ -320,9 +340,14 @@ fn draw_filter_box<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Re
|
||||
let input = Paragraph::new(block_content.as_str())
|
||||
.style(style_default())
|
||||
.block(title_block_centered(block_title));
|
||||
let help = Paragraph::new("<esc> cancel")
|
||||
.style(style_help())
|
||||
.alignment(Alignment::Center)
|
||||
.block(borderless_block());
|
||||
show_cursor(f, chunks[0], offset, block_content);
|
||||
|
||||
f.render_widget(input, chunks[0]);
|
||||
f.render_widget(help, chunks[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ impl DrawUi for RootFoldersUi {
|
||||
draw_root_folders,
|
||||
draw_add_root_folder_prompt_box,
|
||||
30,
|
||||
15,
|
||||
13,
|
||||
),
|
||||
ActiveRadarrBlock::DeleteRootFolderPrompt => draw_prompt_popup_over(
|
||||
f,
|
||||
|
||||
Reference in New Issue
Block a user