Quiet selection previews and add nested directory icons
This commit is contained in:
parent
8d72f2d28d
commit
f86419b0fe
22 changed files with 219 additions and 14 deletions
|
|
@ -37,7 +37,7 @@ INSTA_UPDATE=no PROPTEST_CASES=256 cargo test --workspace --all-targets --locked
|
|||
- На узком терминале в dual отображается активная панель с индикатором `PANE 1/2` или `PANE 2/2`; состояние скрытой панели сохраняется.
|
||||
- `F3` открывает временный preview поверх любой раскладки.
|
||||
- Постоянной нижней строки hints нет: её место занимает содержимое, а `? Help` остаётся в header на каждом поддерживаемом размере.
|
||||
- Видимые каталоги перечитываются с bounded интервалом 1 секунда: внешние create/rename/delete появляются без ручного refresh; loading не создаёт очередь запросов. Фоновый poll не показывает `LOADING` и не меняет текущий кадр, строку entries или пустое состояние до получения ответа. Preview того же выбранного элемента также остаётся видимым без `LOADING PREVIEW` и обновляется атомарно; при смене выбора старое содержимое очищается, а быстрые selection changes коалесцируются за 40 ms без промежуточных reads и loading-flash. Polling приостанавливается во время planning/confirmation и внешнего редактора, чтобы фоновый listing не инвалидировал ожидающий snapshot.
|
||||
- Видимые каталоги перечитываются с bounded интервалом 1 секунда: внешние create/rename/delete появляются без ручного refresh; loading не создаёт очередь запросов. Фоновый poll не показывает `LOADING` и не меняет текущий кадр, строку entries или пустое состояние до получения ответа. Preview того же выбранного элемента также остаётся видимым без `LOADING PREVIEW` и обновляется атомарно; при смене выбора старое содержимое очищается, а быстрые selection changes коалесцируются за 40 ms без промежуточных reads и loading-flash, включая уже запущенный selection read. Polling приостанавливается во время planning/confirmation и внешнего редактора, чтобы фоновый listing не инвалидировал ожидающий snapshot.
|
||||
- Встроены 20 offline-тем (11 dark / 9 light), по умолчанию — Night Ops с прежними базовыми accents и зафиксированной accessibility-коррекцией selection; `NO_COLOR` и ASCII fallback сохраняют маркеры и структуру.
|
||||
- File icons различают каталоги, точные проектные имена, расширения, links и executables; цвет иконки и semantic цвет имени независимы. Rust имеет отдельный glyph; при включённых иконках избыточный `TYPE` не выводится, а в `none` сохраняются текстовые `DIR`/`FILE`/`LINK`/`OTH`.
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ Copy/move сначала выполняют read-only preflight и показы
|
|||
|
||||
- Текстовый preview читает не более **64 KiB** и показывает маркер усечения.
|
||||
- PNG/JPEG/GIF/BMP/WebP определяются по content magic и показываются реальными pixels в persistent/F3. Encoded input ограничен **16 MiB**, 8192 на ось, 32M pixels и 256 MiB decoder allocation; animated input становится static. Один serialized worker не пишет terminal, prepared images инвалидируются по selection/generation/endpoint/geometry/terminal epoch. Kitty/iTerm2/Sixel — best-effort через `ratatui-image`; halfblocks — universal fallback, tmux не изменяет `allow-passthrough`. `NO_COLOR`, ASCII/dumb, non-TTY, `images=false` и `--no-images` используют metadata fallback без probe.
|
||||
- Preview каталога нерекурсивный и содержит не более **100 имён**.
|
||||
- Preview каталога нерекурсивный и содержит не более **100 имён**; вложенные каталоги/файлы получают те же semantic icons, что и основной список.
|
||||
- Binary/unsupported content заменяется placeholder с метаданными.
|
||||
- UTF-8 ошибки заменяются символом `<60>`; управляющие и опасные bidi-символы экранируются.
|
||||
- Содержимое файлов никогда не исполняется.
|
||||
|
|
|
|||
|
|
@ -284,3 +284,9 @@ cargo test --test ssh_hermesvm -- --ignored --nocapture
|
|||
- Fixed Kitty/iTerm2/Sixel/halfblock protocols создаются вне Frame. Один global semaphore сериализует blocking work, cancellation checkpoints отбрасывают stale results, cache содержит не более одного prepared protocol на панель и проверяет полную identity. Persistent/F3, resize, terminal epoch и cleanup покрыты runtime tests.
|
||||
- Под tmux используется прямой Halfblocks constructor без любого `Picker`; disabled/NO_COLOR/ASCII/dumb/non-TTY не испускают probe. Production PTY с реальными pixels и substitute-tmux marker — PASS.
|
||||
- `tests/image_preview.rs`: **11 passed**; `tests/image_runtime.rs`: **11 passed**, включая max-active=1 и отмену до blocking start; общий suite: **651 passed, 0 failed, 4 ignored**, strict Clippy/doc/fmt — PASS. Реальный Kitty GUI visual check показал red/blue pixels с сохранными borders. Isolated real-tmux server также показал halfblocks/RGB, оставил `allow-passthrough` unset и завершился чисто. iTerm2/Sixel не установлены/не проверены; structural tests не заявляются как их ручная acceptance matrix.
|
||||
|
||||
## Change `fix-selection-preview-and-directory-icons`
|
||||
|
||||
- Пользовательский реальный запуск выявил, что прежний fix скрывал loading только до deadline. Selection-origin running request теперь остаётся quiet до current response: никаких `LOADING PREVIEW`, `Reading…` или `NO PREVIEW`; initial/F3 loading не изменён.
|
||||
- Directory preview получил typed bounded rows и semantic icons для вложенных generic/special folders и files; icons-off сохраняет имена.
|
||||
- Новые regressions закрывают кадр после deadline и nested directory rows, включая U+2028/U+2029 sanitization. Полный suite: **652 passed, 0 failed, 4 ignored**; strict Clippy/fmt — PASS. Финальный independent verdict: **0 findings**; пользовательский visual verdict остаётся открытым.
|
||||
|
|
|
|||
|
|
@ -275,6 +275,15 @@
|
|||
| file-navigation | Production PTY halfblocks и отсутствие substitute-tmux вызова | `tests/pty_smoke.rs::image_halfblocks_render_in_pty_without_calling_substitute_tmux` |
|
||||
| file-navigation | Config images и --no-images | `tests/appearance_config.rs::missing_config_uses_unicode_and_cli_overrides_without_a_write`, `every_documented_mode_is_parsed_and_unknown_fields_are_forward_compatible` |
|
||||
|
||||
## Change: fix-selection-preview-and-directory-icons
|
||||
|
||||
| Capability | Scenario / contract | Текущие тесты |
|
||||
|---|---|---|
|
||||
| file-navigation | Selection-origin read остаётся quiet после deadline без LOADING/Reading/NO PREVIEW | `tests/preview_debounce.rs::rapid_selection_has_no_intermediate_read_or_loading_and_starts_once_at_40ms` |
|
||||
| file-navigation | Initial/F3 loading сохраняется | `tests/preview_debounce.rs::initial_f3_and_pure_selection_effects_keep_their_distinct_modes`; `tests/ui_states.rs::loading_empty_error_and_stale_warning_are_distinct_states` |
|
||||
| terminal-ui | Nested generic/special directory и file icons, icons-off | `tests/file_type_rendering.rs::directory_preview_shows_icons_for_nested_folders_and_files` |
|
||||
|
||||
|
||||
## Change: redesign-help-and-remove-hints
|
||||
|
||||
| Requirement | Scenario / contract | Текущие тесты |
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ cargo test --test ssh_action_acceptance --locked -- --ignored --nocapture
|
|||
- `tests/preview_debounce.rs` использует explicit clock без sleeps: 39/40 ms, quiet full-Buffer/current title, отсутствие intermediate reads, один current request, все selection aliases/Repeat, initial/F3/background semantics, background completion/running/changed selection до и после deadline, dual source pending, failed navigation/connect и wrong generation/target/navigation/host при равных numeric epochs. `src/tui.rs::tests::preview_deadline_wakes_at_40ms_independently_of_redraw_ticks` использует paused Tokio clock для production `sleep_until` helper.
|
||||
- PTY `rapid_selection_burst_coalesces_preview_and_restores_terminal` подтверждает byte-level burst, итоговый target и terminal restore. Отсутствие промежуточных reads/loading доказывается детерминированными tests, а не одним подсчётом строки в diffed terminal output. `tests/ssh_connection.rs` дополнительно покрывает failed/wrong-host/superseded recovery с новой generation.
|
||||
|
||||
- `tests/preview_debounce.rs` дополнительно проверяет полный Buffer **после** запуска selection worker: `LOADING PREVIEW`, `Reading…` и `NO PREVIEW` остаются скрытыми до current response. Initial/F3 loading сохранён.
|
||||
- `tests/file_type_rendering.rs::directory_preview_shows_icons_for_nested_folders_and_files` проверяет generic/special nested folders и file icons, а также `none` fallback.
|
||||
|
||||
### Appearance config и icons
|
||||
|
||||
- `tests/icon_resolver.rs` проверяет classification без filesystem/network I/O, precedence/case/type gating, metadata fallback, semantic classes и synthetic large listing. Glyph catalog attribution находится в `THIRD_PARTY_NOTICES.md`.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
# Design
|
||||
|
||||
## Decisions
|
||||
|
||||
1. `PreviewState.selection_recovery` уже остаётся истинным от selection debounce через StartPreview до current response. Renderer использует его для quiet состояния: `debouncing || (loading && selection_recovery)`. Initial/F3 имеют `selection_recovery=false` и сохраняют loading.
|
||||
2. Scheduler, requests и stale guards не меняются; исправляется только presentation после deadline.
|
||||
3. `Preview` получает bounded typed `directory_entries` параллельно существующим sanitized lines. Renderer использует raw row только для IconResolver, а отображаемое имя берёт из соответствующей sanitized line через `zip`, включая U+2028/U+2029 escaping.
|
||||
4. Icons-off возвращает пустой glyph и обычную текстовую строку. Image/text/binary paths не затрагиваются.
|
||||
|
||||
## Tests
|
||||
|
||||
- Полный Buffer после 40 ms: нет `LOADING PREVIEW`, `NO PREVIEW`, title текущий; итоговый response применяется.
|
||||
- Directory rows: generic `📁`, `src` `💻`, text file `📄`; `none` сохраняет имена.
|
||||
- Полный suite/Clippy/fmt/doc и отсутствие `.snap.new`.
|
||||
|
||||
## Rollback
|
||||
|
||||
Вернуть прежний loading renderer и текстовые directory lines; файловые данные не затрагиваются.
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
# Proposal
|
||||
|
||||
## Why
|
||||
|
||||
Selection debounce скрывал loading только до deadline; после запуска current request renderer снова показывал `LOADING PREVIEW`/`Reading…`, поэтому реальный key repeat всё ещё дёргал preview. Кроме того, содержимое directory preview оставалось текстовым даже при включённых icons.
|
||||
|
||||
## What Changes
|
||||
|
||||
- Для pending и running selection-origin preview показывать quiet область с текущим title без `LOADING PREVIEW`, `Reading…` или `NO PREVIEW` до current response.
|
||||
- Сохранить loading для initial listing и ручного F3, не меняя scheduler/generation/epoch guards.
|
||||
- Хранить typed directory rows в Preview и показывать semantic icons для вложенных каталогов/файлов в persistent/F3, включая icons-off fallback.
|
||||
|
||||
## Impact
|
||||
|
||||
- MODIFIED visual behavior, без filesystem/SSH protocol mutations.
|
||||
- Новый regression проверяет кадр после deadline; directory test проверяет generic/special folders и files.
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# Spec Delta
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Тихий running selection preview
|
||||
Система SHALL сохранять quiet preview не только во время selection debounce, но и после запуска selection-origin read до применения current response. Промежуточные loading/unavailable тексты MUST NOT появляться; initial/F3 semantics сохраняются.
|
||||
|
||||
#### Scenario: Медленный selection request после deadline
|
||||
- **WHEN** debounce истёк и selection-origin preview read ещё выполняется
|
||||
- **THEN** title остаётся текущим, область пуста и не содержит `LOADING PREVIEW`, `Reading…` или `NO PREVIEW`
|
||||
|
||||
#### Scenario: Initial или ручной F3
|
||||
- **WHEN** выполняется initial preview или пользователь явно открыл F3
|
||||
- **THEN** существующий foreground loading остаётся разрешённым и не заменяется selection-only quiet правилом
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# Spec Delta
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Иконки содержимого directory preview
|
||||
Система SHALL показывать semantic icons для вложенных каталогов и файлов в persistent/F3 directory preview по тем же deterministic resolver rules, что и основной список. Специальный шрифт MUST NOT быть обязательным.
|
||||
|
||||
#### Scenario: Вложенные каталоги и файлы
|
||||
- **WHEN** directory preview содержит generic folder, известную folder name и обычный файл
|
||||
- **THEN** строки содержат соответствующие generic/special/file icons и читаемые имена
|
||||
|
||||
#### Scenario: Icons-off
|
||||
- **WHEN** выбран `none`
|
||||
- **THEN** содержимое directory preview остаётся читаемым без обязательных glyphs
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
# Tasks
|
||||
|
||||
## 1. Quiet running selection
|
||||
|
||||
- [x] 1.1 Расширить quiet condition на `loading && selection_recovery`; regression после deadline запрещает `LOADING PREVIEW` и `NO PREVIEW`, сохраняя текущий title.
|
||||
- [x] 1.2 Сохранить initial/F3 loading и существующие scheduler/stale/SSH tests.
|
||||
|
||||
## 2. Directory preview icons
|
||||
|
||||
- [x] 2.1 Добавить bounded typed directory rows и semantic renderer для nested folders/files без повторного parsing sanitized lines.
|
||||
- [x] 2.2 Покрыть generic/special folder/file icons и icons-off.
|
||||
|
||||
## 3. Приёмка
|
||||
|
||||
- [x] 3.1 Прогнать fmt, strict Clippy, полный tests/doc suite и обновить traceability/acceptance.
|
||||
- [x] 3.2 Получить независимый verify: финальный verdict 0 findings, включая running selection и sanitized directory rows.
|
||||
- [ ] 3.3 Получить визуальный ответ пользователя по актуальному `cargo run --locked --`.
|
||||
|
||||
## Workflow follow-up
|
||||
|
||||
- После подтверждения синхронизировать ADDED requirements и архивировать change.
|
||||
|
|
@ -1336,6 +1336,7 @@ impl AppState {
|
|||
format!("Reason: {}", result.result.unwrap_err()),
|
||||
],
|
||||
truncated: false,
|
||||
directory_entries: Vec::new(),
|
||||
});
|
||||
pane.preview.encoded_image = None;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ pub struct Preview {
|
|||
pub kind: PreviewKind,
|
||||
pub lines: Vec<String>,
|
||||
pub truncated: bool,
|
||||
/// Typed directory rows used to render icons without reparsing sanitized display text.
|
||||
pub directory_entries: Vec<EntryPreview>,
|
||||
}
|
||||
|
||||
/// A bounded byte prefix. `bytes.len()` never exceeds the requested limit.
|
||||
|
|
@ -142,6 +144,7 @@ pub fn text_preview(bytes: &[u8], truncated: bool) -> Preview {
|
|||
kind: PreviewKind::Text,
|
||||
lines,
|
||||
truncated,
|
||||
directory_entries: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -159,6 +162,7 @@ where
|
|||
kind: PreviewKind::Metadata,
|
||||
lines,
|
||||
truncated: false,
|
||||
directory_entries: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -174,6 +178,7 @@ where
|
|||
kind: PreviewKind::Binary,
|
||||
lines,
|
||||
truncated: false,
|
||||
directory_entries: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -224,6 +229,7 @@ where
|
|||
kind: PreviewKind::Directory,
|
||||
lines,
|
||||
truncated,
|
||||
directory_entries: entries.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use crate::app::{AppState, Clipboard, Overlay, PaneId, PaneMode, PaneState};
|
|||
use crate::domain::{Entry, EntryKind, Location, SourceId};
|
||||
use crate::image_preview::ImageRenderContext;
|
||||
use crate::operations::{OperationKind, WorkKind};
|
||||
use crate::preview::{Preview, TRUNCATION_MARKER};
|
||||
use crate::preview::{EntryPreview, Preview, PreviewKind, TRUNCATION_MARKER};
|
||||
use crate::ssh::HostPickerState;
|
||||
|
||||
use super::help::{HelpTabs, help_view_model};
|
||||
|
|
@ -614,7 +614,7 @@ fn render_preview(
|
|||
return;
|
||||
}
|
||||
|
||||
if pane.preview.debouncing {
|
||||
if pane.preview.debouncing || (pane.preview.loading && pane.preview.selection_recovery) {
|
||||
frame.render_widget(Paragraph::new("").style(theme.panel()), inner);
|
||||
} else if pane.selected_entry().is_none() {
|
||||
render_message(
|
||||
|
|
@ -665,6 +665,38 @@ fn render_preview(
|
|||
}
|
||||
}
|
||||
|
||||
fn directory_preview_line(
|
||||
entry: &EntryPreview,
|
||||
display_name: &str,
|
||||
width: u16,
|
||||
theme: &Theme,
|
||||
) -> Line<'static> {
|
||||
let kind = if entry.is_dir {
|
||||
EntryKind::Directory
|
||||
} else {
|
||||
EntryKind::File
|
||||
};
|
||||
let domain_entry = Entry::new(entry.name.clone(), kind);
|
||||
let icon = theme.icon_resolver().resolve(&domain_entry);
|
||||
let name = display_name;
|
||||
let width = usize::from(width);
|
||||
let glyph_width = UnicodeWidthStr::width(icon.glyph);
|
||||
if glyph_width == 0 {
|
||||
return Line::from(fit(name, width, theme.is_ascii())).style(theme.text());
|
||||
}
|
||||
let name_width = width.saturating_sub(glyph_width + 1);
|
||||
let name = if entry.is_dir {
|
||||
truncate_middle(name, name_width, theme.is_ascii())
|
||||
} else {
|
||||
truncate_filename(name, name_width, theme.is_ascii())
|
||||
};
|
||||
Line::from(vec![
|
||||
Span::styled(icon.glyph, theme.icon_style(&icon)),
|
||||
Span::raw(" "),
|
||||
Span::styled(name, theme.filename_style(icon.class)),
|
||||
])
|
||||
}
|
||||
|
||||
fn render_prepared_image(
|
||||
frame: &mut Frame,
|
||||
area: Rect,
|
||||
|
|
@ -705,16 +737,28 @@ fn render_preview_content(frame: &mut Frame, area: Rect, preview: &Preview, them
|
|||
area.width,
|
||||
area.height.saturating_sub(footer_height),
|
||||
);
|
||||
let lines: Vec<Line<'static>> = preview
|
||||
.lines
|
||||
.iter()
|
||||
.filter(|line| !preview.truncated || line.as_str() != TRUNCATION_MARKER)
|
||||
.take(usize::from(body.height))
|
||||
.map(|line| {
|
||||
let safe = sanitize(line);
|
||||
Line::from(fit(&safe, usize::from(body.width), theme.is_ascii())).style(theme.text())
|
||||
})
|
||||
.collect();
|
||||
let lines: Vec<Line<'static>> =
|
||||
if preview.kind == PreviewKind::Directory && !preview.directory_entries.is_empty() {
|
||||
preview
|
||||
.directory_entries
|
||||
.iter()
|
||||
.zip(preview.lines.iter())
|
||||
.take(usize::from(body.height))
|
||||
.map(|(entry, line)| directory_preview_line(entry, line, body.width, theme))
|
||||
.collect()
|
||||
} else {
|
||||
preview
|
||||
.lines
|
||||
.iter()
|
||||
.filter(|line| !preview.truncated || line.as_str() != TRUNCATION_MARKER)
|
||||
.take(usize::from(body.height))
|
||||
.map(|line| {
|
||||
let safe = sanitize(line);
|
||||
Line::from(fit(&safe, usize::from(body.width), theme.is_ascii()))
|
||||
.style(theme.text())
|
||||
})
|
||||
.collect()
|
||||
};
|
||||
frame.render_widget(Paragraph::new(lines).style(theme.panel()), body);
|
||||
|
||||
if footer_height > 0 {
|
||||
|
|
|
|||
|
|
@ -333,6 +333,7 @@ async fn unsupported_entry_uses_metadata_without_reading_contents() {
|
|||
"Type: Other".into(),
|
||||
],
|
||||
truncated: false,
|
||||
directory_entries: Vec::new(),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use ratatui::buffer::Buffer;
|
|||
use ratatui::style::Color;
|
||||
use rcom::app::{AppState, PaneId, PaneMode};
|
||||
use rcom::domain::{Entry, EntryKind, Location};
|
||||
use rcom::preview::{EntryPreview, directory_preview};
|
||||
use rcom::ui::{IconMode, Theme, render};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
|
|
@ -65,6 +66,43 @@ fn text_position(buffer: &Buffer, needle: &str) -> (u16, u16) {
|
|||
.unwrap_or_else(|| panic!("missing {needle}:\n{}", buffer_text(buffer)))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn directory_preview_shows_icons_for_nested_folders_and_files() {
|
||||
let mut app = canonical_app();
|
||||
app.active_pane_mut().selection.set(Some(0), 6);
|
||||
app.active_pane_mut().preview.content = Some(directory_preview([
|
||||
EntryPreview::new("nested", true),
|
||||
EntryPreview::new("src", true),
|
||||
EntryPreview::new("notes.txt", false),
|
||||
EntryPreview::new("bad\u{2028}\u{2029}", true),
|
||||
]));
|
||||
let buffer = draw(&app, 140, 30, &Theme::night_ops());
|
||||
let text = buffer_text(&buffer);
|
||||
for expected in ["📁 nested/", "💻 src/", "📄 notes.txt"] {
|
||||
assert!(text.contains(expected), "missing {expected}:\n{text}");
|
||||
}
|
||||
assert!(text.contains(r"bad\u{2028}\u{2029}/"), "{text}");
|
||||
assert!(
|
||||
!text.contains('\u{2028}') && !text.contains('\u{2029}'),
|
||||
"{text}"
|
||||
);
|
||||
|
||||
let fallback = draw(
|
||||
&app,
|
||||
140,
|
||||
30,
|
||||
&Theme::night_ops().with_icon_mode(IconMode::None),
|
||||
);
|
||||
let fallback = buffer_text(&fallback);
|
||||
assert!(fallback.contains("nested/"));
|
||||
assert!(!fallback.contains("📁 nested/"));
|
||||
assert!(fallback.contains(r"bad\u{2028}\u{2029}/"), "{fallback}");
|
||||
assert!(
|
||||
!fallback.contains('\u{2028}') && !fallback.contains('\u{2029}'),
|
||||
"{fallback}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn canonical_night_ops_fixture_separates_icons_names_and_selected_marked_state() {
|
||||
let app = canonical_app();
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ fn install_current_image(app: &mut Application, pane: PaneId, name: &str) {
|
|||
kind: PreviewKind::Image,
|
||||
lines: vec!["Preparing".into()],
|
||||
truncated: false,
|
||||
directory_entries: Vec::new(),
|
||||
});
|
||||
state.panes[pane.index()].preview.encoded_image = Some(EncodedImage {
|
||||
bytes: Arc::new(png()),
|
||||
|
|
@ -344,6 +345,7 @@ async fn background_image_refresh_prepares_accepted_new_bytes_instead_of_old_gen
|
|||
kind: PreviewKind::Image,
|
||||
lines: vec!["Changed image".into()],
|
||||
truncated: false,
|
||||
directory_entries: Vec::new(),
|
||||
}));
|
||||
response.encoded_image = Some(EncodedImage {
|
||||
bytes: Arc::new(changed_png()),
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ fn preview_app() -> AppState {
|
|||
kind: PreviewKind::Text,
|
||||
lines: vec!["1 │ stable preview".into()],
|
||||
truncated: false,
|
||||
directory_entries: Vec::new(),
|
||||
});
|
||||
app
|
||||
}
|
||||
|
|
@ -169,6 +170,7 @@ fn background_preview_keeps_the_same_file_frame_and_atomically_applies_changes()
|
|||
kind: PreviewKind::Text,
|
||||
lines: vec!["1 │ changed preview".into()],
|
||||
truncated: false,
|
||||
directory_entries: Vec::new(),
|
||||
}))));
|
||||
let after = text(&draw_size(&app, 140, 30));
|
||||
assert!(after.contains("changed preview"));
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ async fn rapid_selection_has_no_intermediate_read_or_loading_and_starts_once_at_
|
|||
kind: PreviewKind::Text,
|
||||
lines: vec!["stale-old-preview".into()],
|
||||
truncated: false,
|
||||
directory_entries: Vec::new(),
|
||||
});
|
||||
app.dispatch_at(Command::MoveSelection(1), start);
|
||||
assert_eq!(app.pending_preview_count(), 1);
|
||||
|
|
@ -110,6 +111,10 @@ async fn rapid_selection_has_no_intermediate_read_or_loading_and_starts_once_at_
|
|||
assert_eq!(app.pending_preview_count(), 0);
|
||||
assert!(app.state().panes[0].preview.loading);
|
||||
assert!(!app.state().panes[0].preview.debouncing);
|
||||
let running = draw(&app);
|
||||
assert!(!running.contains("LOADING PREVIEW"), "{running}");
|
||||
assert!(!running.contains("NO PREVIEW"), "{running}");
|
||||
assert!(preview_title(&draw_buffer(&app)).contains("c.txt"));
|
||||
|
||||
let completed = tokio::time::timeout(Duration::from_secs(1), results.recv())
|
||||
.await
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ fn rich_app() -> AppState {
|
|||
kind: PreviewKind::Text,
|
||||
lines: vec!["1 │ preview text".into(), "2 │ selected state".into()],
|
||||
truncated: true,
|
||||
directory_entries: Vec::new(),
|
||||
});
|
||||
app
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ fn preview_app(kind: PreviewKind) -> AppState {
|
|||
kind,
|
||||
lines,
|
||||
truncated: true,
|
||||
directory_entries: Vec::new(),
|
||||
});
|
||||
app
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ fn sample_app(mode: PaneMode) -> AppState {
|
|||
"3 │ Safe, bounded text preview.".to_owned(),
|
||||
],
|
||||
truncated: false,
|
||||
directory_entries: Vec::new(),
|
||||
});
|
||||
app.panes[1] = app.panes[0].clone();
|
||||
app.panes[1].location = Location::ssh(HostAlias::new("edge-prod"), "/srv/releases");
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ fn sample_app(mode: PaneMode) -> AppState {
|
|||
"3 │ The underlying panes keep their geometry.".to_owned(),
|
||||
],
|
||||
truncated: false,
|
||||
directory_entries: Vec::new(),
|
||||
});
|
||||
app.panes[1] = app.panes[0].clone();
|
||||
app.panes[1].location = Location::ssh(HostAlias::new("edge-prod"), "/srv/releases");
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ fn app_with_entries() -> AppState {
|
|||
"2 │ Read-only workspace".to_owned(),
|
||||
],
|
||||
truncated: false,
|
||||
directory_entries: Vec::new(),
|
||||
});
|
||||
app
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue