Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ dirge --provider glm # defaults to glm-4
| `!! cmd` | Run shell command (invisible) |
| `@<query>` | File picker (Tab/Enter select, Esc cancel) |
| Mouse drag | Select text (copies to clipboard on release) |
| (input) | Live token count shown next to input bar (`N tk`) |

## Prompts system

Expand Down
11 changes: 11 additions & 0 deletions src/ui/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,17 @@ impl Renderer {
.collect();
write!(stdout, "{}", visible)?;

let token_est = input_line.len() as u64 / 4;
if token_est > 0 {
write!(
stdout,
"{}",
SetForegroundColor(self.color(Color::DarkGrey))
)?;
write!(stdout, " ({} tk)", token_est)?;
write!(stdout, "{}", ResetColor)?;
}

stdout.execute(MoveTo(0, status_row))?;
write!(stdout, "{}", " ".repeat(cols as usize))?;
stdout.execute(MoveTo(0, status_row))?;
Expand Down
Loading