generated from eblume/project-template
style: cargo fmt — normalize earlier hand-committed files
Run rustfmt over files landed in earlier commits this session that weren't fmt-checked (heph-quickadd, the heph-tui undo/move wave, the hephd quickadd supervisor). Pure formatting (struct/if-else expansion, line wrapping); no behavior change. Restores `cargo fmt --check` clean for CI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6514296b87
commit
911255fece
6 changed files with 50 additions and 22 deletions
|
|
@ -111,7 +111,10 @@ fn today_local() -> NaiveDate {
|
|||
enum SaveOutcome {
|
||||
Ok,
|
||||
/// The RPC failed — re-show with this text restored and the error shown.
|
||||
Err { text: String, message: String },
|
||||
Err {
|
||||
text: String,
|
||||
message: String,
|
||||
},
|
||||
}
|
||||
|
||||
pub struct QuickAdd {
|
||||
|
|
@ -171,7 +174,11 @@ impl QuickAdd {
|
|||
}
|
||||
|
||||
// Baseline parent pid for orphan detection (macOS supervision only).
|
||||
let orphan_parent = if supervised { current_parent_pid() } else { None };
|
||||
let orphan_parent = if supervised {
|
||||
current_parent_pid()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let (projects_tx, projects_rx) = std::sync::mpsc::channel();
|
||||
let (save_tx, save_rx) = std::sync::mpsc::channel();
|
||||
|
|
@ -393,8 +400,7 @@ impl QuickAdd {
|
|||
|
||||
// Enter always submits — the autocomplete (Tab/↑/↓/click) never
|
||||
// hijacks it, so the muscle-reflex save stays sacred.
|
||||
let submitted =
|
||||
resp.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter));
|
||||
let submitted = resp.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter));
|
||||
|
||||
// When not autocompleting, the lower area is the live chip preview.
|
||||
if rows == 0 {
|
||||
|
|
@ -425,7 +431,9 @@ impl QuickAdd {
|
|||
BASE_H
|
||||
};
|
||||
if (target_h - self.win_h_applied).abs() > 0.5 {
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::InnerSize(egui::vec2(WIN_W, target_h)));
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::InnerSize(egui::vec2(
|
||||
WIN_W, target_h,
|
||||
)));
|
||||
self.win_h_applied = target_h;
|
||||
}
|
||||
}
|
||||
|
|
@ -501,11 +509,7 @@ impl QuickAdd {
|
|||
let selected = i == self.ac_selected;
|
||||
let text = egui::RichText::new(format!("📁 {title}"))
|
||||
.size(LABEL_SIZE)
|
||||
.color(if selected {
|
||||
egui::Color32::WHITE
|
||||
} else {
|
||||
DIM
|
||||
});
|
||||
.color(if selected { egui::Color32::WHITE } else { DIM });
|
||||
if ui.selectable_label(selected, text).clicked() {
|
||||
accept = Some(title.clone());
|
||||
}
|
||||
|
|
@ -514,9 +518,11 @@ impl QuickAdd {
|
|||
if let Some(title) = accept {
|
||||
apply_completion(&mut self.text, hash_idx, query.chars().count(), &title);
|
||||
let new_idx = hash_idx + 1 + title.chars().count() + 1;
|
||||
if let Some(mut st) = egui::widgets::text_edit::TextEditState::load(ui.ctx(), field_id) {
|
||||
if let Some(mut st) = egui::widgets::text_edit::TextEditState::load(ui.ctx(), field_id)
|
||||
{
|
||||
let cc = egui::text::CCursor::new(new_idx);
|
||||
st.cursor.set_char_range(Some(egui::text::CCursorRange::one(cc)));
|
||||
st.cursor
|
||||
.set_char_range(Some(egui::text::CCursorRange::one(cc)));
|
||||
st.store(ui.ctx(), field_id);
|
||||
}
|
||||
ui.ctx().memory_mut(|m| m.request_focus(field_id));
|
||||
|
|
@ -535,7 +541,9 @@ impl QuickAdd {
|
|||
|
||||
if let Some(att) = parsed.attention {
|
||||
let (label, color) = match att {
|
||||
heph_core::Attention::Red => ("⚑ red", egui::Color32::from_rgb(0xe0, 0x6c, 0x60)),
|
||||
heph_core::Attention::Red => {
|
||||
("⚑ red", egui::Color32::from_rgb(0xe0, 0x6c, 0x60))
|
||||
}
|
||||
heph_core::Attention::Orange => {
|
||||
("⚑ orange", egui::Color32::from_rgb(0xe5, 0xc0, 0x7b))
|
||||
}
|
||||
|
|
@ -555,7 +563,11 @@ impl QuickAdd {
|
|||
.find(|p| &p.id == id)
|
||||
.map(|p| p.title.as_str())
|
||||
.unwrap_or("project");
|
||||
ui.label(egui::RichText::new(format!("📁 {title}")).color(dim).size(LABEL_SIZE));
|
||||
ui.label(
|
||||
egui::RichText::new(format!("📁 {title}"))
|
||||
.color(dim)
|
||||
.size(LABEL_SIZE),
|
||||
);
|
||||
any = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,10 @@ use eframe::egui;
|
|||
use app::QuickAdd;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name = "heph-quickadd", about = "Global quick-capture popover for hephaestus")]
|
||||
#[command(
|
||||
name = "heph-quickadd",
|
||||
about = "Global quick-capture popover for hephaestus"
|
||||
)]
|
||||
struct Cli {
|
||||
/// hephd socket to talk to (defaults to $HEPH_SOCKET or the standard path).
|
||||
#[arg(long, global = true)]
|
||||
|
|
|
|||
|
|
@ -252,8 +252,15 @@ impl MoveState {
|
|||
});
|
||||
}
|
||||
}
|
||||
if !f.is_empty() && !self.projects.iter().any(|p| p.title.eq_ignore_ascii_case(f)) {
|
||||
opts.push(MoveOption::Create { name: f.to_string() });
|
||||
if !f.is_empty()
|
||||
&& !self
|
||||
.projects
|
||||
.iter()
|
||||
.any(|p| p.title.eq_ignore_ascii_case(f))
|
||||
{
|
||||
opts.push(MoveOption::Create {
|
||||
name: f.to_string(),
|
||||
});
|
||||
}
|
||||
self.options = opts;
|
||||
self.cursor = self.cursor.min(self.options.len().saturating_sub(1));
|
||||
|
|
@ -886,7 +893,9 @@ impl<B: Backend> App<B> {
|
|||
.as_ref()
|
||||
.and_then(|sel| self.sidebar.iter().position(|e| e == sel))
|
||||
.unwrap_or_else(|| {
|
||||
let idx = self.sidebar_cursor.min(self.sidebar.len().saturating_sub(1));
|
||||
let idx = self
|
||||
.sidebar_cursor
|
||||
.min(self.sidebar.len().saturating_sub(1));
|
||||
(0..=idx)
|
||||
.rev()
|
||||
.find(|&i| self.sidebar[i].selectable())
|
||||
|
|
|
|||
|
|
@ -75,8 +75,7 @@ fn render_move(frame: &mut Frame, state: &MoveState) {
|
|||
height,
|
||||
};
|
||||
frame.render_widget(Clear, popup);
|
||||
let chunks =
|
||||
Layout::vertical([Constraint::Length(3), Constraint::Min(1)]).split(popup);
|
||||
let chunks = Layout::vertical([Constraint::Length(3), Constraint::Min(1)]).split(popup);
|
||||
|
||||
// Filter input (with the task being moved in the title).
|
||||
let input = Paragraph::new(Line::from(vec![
|
||||
|
|
|
|||
|
|
@ -446,7 +446,10 @@ fn undo_restores_a_dropped_task_and_redo_redrops_it() {
|
|||
app.undo(); // restores it to outstanding
|
||||
{
|
||||
let states = rec.borrow();
|
||||
assert_eq!(states.states.first().unwrap(), &("t1".into(), "dropped".into()));
|
||||
assert_eq!(
|
||||
states.states.first().unwrap(),
|
||||
&("t1".into(), "dropped".into())
|
||||
);
|
||||
assert_eq!(
|
||||
states.states.last().unwrap(),
|
||||
&("t1".into(), "outstanding".into()),
|
||||
|
|
|
|||
|
|
@ -229,7 +229,9 @@ fn spawn_quickadd_supervisor(socket: PathBuf) {
|
|||
use std::process::Command;
|
||||
|
||||
let Some(exe) = locate_quickadd_binary() else {
|
||||
tracing::warn!("HEPH_QUICKADD=1 but `heph-quickadd` was not found next to hephd or on PATH");
|
||||
tracing::warn!(
|
||||
"HEPH_QUICKADD=1 but `heph-quickadd` was not found next to hephd or on PATH"
|
||||
);
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue