merge: tui view mode state

This commit is contained in:
Keisuke Hirata 2026-05-31 22:45:10 +09:00
commit 9afe8a3243
No known key found for this signature in database
5 changed files with 33 additions and 32 deletions

View File

@ -16,7 +16,7 @@ use crate::command::{
use crate::input::InputBuffer;
use crate::scroll::Scroll;
use crate::task::TaskStore;
use crate::ui::Mode;
use crate::view_mode::Mode;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CommandCompletionApply {

View File

@ -12,6 +12,7 @@ mod spawn;
mod task;
mod tool;
mod ui;
mod view_mode;
use std::future::Future;
use std::io;

View File

@ -12,7 +12,7 @@ use unicode_width::{UnicodeWidthChar, UnicodeWidthStr};
use crate::block::{Block, ToolCallBlock, ToolCallState};
use crate::cache::FileCache;
use crate::ui::Mode;
use crate::view_mode::Mode;
/// Maximum body lines in normal mode for tool output previews.
const NORMAL_MAX_BODY: usize = 5;

View File

@ -31,36 +31,7 @@ use crate::app::{ActionbarNoticeLevel, App, CompletionState, alert_source_label,
use crate::block::{Block, CompactEvent, ThinkingBlock, ThinkingState};
use crate::command::CommandCandidate;
use crate::task::{TaskCounts, TaskEntry, TaskStatus, TaskStore};
/// Display density for the history view.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Mode {
/// Every block fully expanded.
Detail,
/// Completed blocks compressed to roughly 56 lines; in-progress
/// tool blocks stay in detail.
Normal,
/// Each block rendered as a single line.
Overview,
}
impl Mode {
pub fn cycle(self) -> Self {
match self {
Mode::Detail => Mode::Normal,
Mode::Normal => Mode::Overview,
Mode::Overview => Mode::Detail,
}
}
pub fn label(self) -> &'static str {
match self {
Mode::Detail => "detail",
Mode::Normal => "normal",
Mode::Overview => "overview",
}
}
}
use crate::view_mode::Mode;
pub fn draw(frame: &mut Frame, app: &mut App) {
let area = frame.area();

View File

@ -0,0 +1,29 @@
/// Display density for the history view.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Mode {
/// Every block fully expanded.
Detail,
/// Completed blocks compressed to roughly 56 lines; in-progress
/// tool blocks stay in detail.
Normal,
/// Each block rendered as a single line.
Overview,
}
impl Mode {
pub fn cycle(self) -> Self {
match self {
Mode::Detail => Mode::Normal,
Mode::Normal => Mode::Overview,
Mode::Overview => Mode::Detail,
}
}
pub fn label(self) -> &'static str {
match self {
Mode::Detail => "detail",
Mode::Normal => "normal",
Mode::Overview => "overview",
}
}
}