fix: correct /chrome command parsing in handle_browser_command

The function was expecting '/browser' to be in the command text and
looking at parts[1], but /chrome passes just 'chrome' or 'chrome [port]',
so we need to look at parts[0] instead.

- Changed index from parts[1] to parts[0] for first argument
- Fixed port parsing to use parts[1] instead of parts[2]
- Updated condition from parts.len() > 1 to \!parts.is_empty()

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
This commit is contained in:
James Peter
2025-08-13 21:08:18 +10:00
co-authored by Claude
parent b1bd326ef3
commit 095d97bbd2
4 changed files with 20 additions and 15 deletions
+5 -4
View File
@@ -1,6 +1,10 @@
# JustEvery Coder
**Coder** is a fast, local-first coding agent for your terminal. It's a community-driven fork focused on real developer ergonomics: Chrome DevTools automation, multi-agent flows, live theming, and on-the-fly reasoning control - all while staying compatible with upstream.
<p align="center">
<img src="docs/logo.png" alt="Coder Logo" width="400">
</p>
**Coder** is a fast, local coding agent for your terminal. It's a community-driven fork of `openai/codex` focused on real developer ergonomics: Browser integration, multi-agents, theming, and reasoning control - all while staying compatible with upstream.
## Why Coder
@@ -78,9 +82,6 @@ gemini
# Change reasoning level
/reasoning low|medium|high
# Change model
/model gpt-5-mini
# Start new conversation
/new
```
+7 -7
View File
@@ -1575,15 +1575,15 @@ impl ChatWidget<'_> {
// Parse the browser subcommand
let parts: Vec<&str> = command_text.trim().split_whitespace().collect();
let response = if parts.len() > 1 {
let first_arg = parts[1];
let response = if !parts.is_empty() {
let first_arg = parts[0];
// Check if the first argument looks like a URL (has a dot or protocol)
let is_url = first_arg.contains("://") || first_arg.contains(".");
if is_url {
// It's a URL - enable browser mode and navigate to it
let url = parts[1..].join(" ");
let url = parts.join(" ");
// Ensure URL has protocol
let full_url = if !url.contains("://") {
@@ -1764,9 +1764,9 @@ impl ChatWidget<'_> {
"chrome" => {
// Connect to Chrome instance
// Check if there's a port specified after "chrome"
let port = if parts.len() > 2 {
let port = if parts.len() > 1 {
// Try to parse the port number
parts[2].parse::<u16>().ok()
parts[1].parse::<u16>().ok()
} else {
None
};
@@ -2090,11 +2090,11 @@ impl ChatWidget<'_> {
if port.is_some() {
format!(
"Connecting to local Chrome instance on port {}...\nIf Chrome is not running with debug port, it will be launched.",
"Connecting to local Chrome instance on port {}...\n",
port.unwrap_or(9222)
)
} else {
"Auto-scanning for local Chrome instance with debug port...\nIf no Chrome found, it will be launched on port 9222.".to_string()
"Scanning for local Chrome instance with debug port...\n".to_string()
}
}
"off" => {
+8 -4
View File
@@ -143,7 +143,8 @@ fn mask_to_outline_fill_lines(
let shine =
(1.0 - (dx as f32 / (shine_band as f32 + 0.001)).clamp(0.0, 1.0)).powf(1.6);
let bright = bump_rgb(base, shine * 0.30);
color = mix_rgb(bright, Color::Rgb(145, 150, 160), fade);
// Make final state very light (almost invisible)
color = mix_rgb(bright, Color::Rgb(230, 232, 235), fade);
ch = '█';
}
// Outline (▓) for border pixels
@@ -153,7 +154,8 @@ fn mask_to_outline_fill_lines(
let period = (2 * scale_or(scale, 4)) as usize; // ~scale-based speed/size
let on = ((x + y + (frame as usize)) % period) < (period / 2);
let c = if on { bump_rgb(base, 0.22) } else { base };
color = mix_rgb(c, Color::Rgb(160, 165, 172), fade * 0.8);
// Make outline very light in final state
color = mix_rgb(c, Color::Rgb(235, 237, 240), fade * 0.8);
ch = '▓';
}
@@ -199,7 +201,8 @@ fn mask_to_outline_fill_lines_with_alpha(
let shine =
(1.0 - (dx as f32 / (shine_band as f32 + 0.001)).clamp(0.0, 1.0)).powf(1.6);
let bright = bump_rgb(base, shine * 0.30);
let mut final_color = mix_rgb(bright, Color::Rgb(145, 150, 160), fade);
// Make final state very light (almost invisible)
let mut final_color = mix_rgb(bright, Color::Rgb(230, 232, 235), fade);
// Apply alpha blending to background color
final_color = blend_to_background(final_color, alpha);
@@ -213,7 +216,8 @@ fn mask_to_outline_fill_lines_with_alpha(
let period = (2 * scale_or(scale, 4)) as usize; // ~scale-based speed/size
let on = ((x + y + (frame as usize)) % period) < (period / 2);
let c = if on { bump_rgb(base, 0.22) } else { base };
let mut final_color = mix_rgb(c, Color::Rgb(160, 165, 172), fade * 0.8);
// Make outline very light in final state
let mut final_color = mix_rgb(c, Color::Rgb(235, 237, 240), fade * 0.8);
// Apply alpha blending to background color
final_color = blend_to_background(final_color, alpha);
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB