Skip to content

fix: Mouse Back/Forward support in webviews + few bugfixes#3141

Open
mswiszcz wants to merge 4 commits intowavetermdev:mainfrom
mswiszcz:fix/misc-improvements
Open

fix: Mouse Back/Forward support in webviews + few bugfixes#3141
mswiszcz wants to merge 4 commits intowavetermdev:mainfrom
mswiszcz:fix/misc-improvements

Conversation

@mswiszcz
Copy link
Copy Markdown

  • Add Mouse-3/Mouse-4 (back/forward) navigation support in webviews
  • Add COLORTERM=truecolor env variable for terminal sessions
  • Fix AI button width calculation when button is hidden
  • Fix setSizeAndPosition animation on tab layout updates
  • Increase DevInitTimeout for slower startup scenarios
  • Update .gitignore and package-lock.json

mswiszcz and others added 2 commits March 27, 2026 23:02
- Add Mouse-3/Mouse-4 (back/forward) navigation support in webviews
- Add COLORTERM=truecolor env variable for terminal sessions
- Fix AI button width calculation when button is hidden
- Fix setSizeAndPosition animation on tab layout updates
- Increase DevInitTimeout for slower startup scenarios
- Adjust background opacity for better visual consistency
- Update .gitignore and package-lock.json
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 27, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d81c4614-ff37-41c8-a2d2-e517ce8c69b5

📥 Commits

Reviewing files that changed from the base of the PR and between 899d08d and 5cea860.

📒 Files selected for processing (3)
  • emain/emain-window.ts
  • emain/preload-webview.ts
  • pkg/util/shellutil/shellutil.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • emain/preload-webview.ts
  • pkg/util/shellutil/shellutil.go
  • emain/emain-window.ts

Walkthrough

This pull request adds mouse-button back/forward navigation: a preload script listens for mouseup of buttons 3/4 and sends IPC; the main process adds a webview-mouse-navigate IPC handler that calls webview navigation. It also updates .gitignore, increases a dev init timeout and adjusts tab positioning/control flow in emain-window.ts, tweaks tabbar sizing logic, and conditionally sets COLORTERM=truecolor in shell environment output.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Details

Changes are heterogeneous across renderer preload, main process IPC and window/tab lifecycle, frontend tabbar sizing, gitignore, and a small Go env-var addition. The most involved review area is emain-window.ts due to altered control flow around tab initialization and wave-ready handling; IPC/preload interactions should be checked together for correctness. Other edits are small and localized.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the primary changes: mouse back/forward support in webviews and multiple bug fixes, matching the actual changeset content.
Description check ✅ Passed The description is directly related to the changeset, listing specific improvements including mouse navigation support, environment variable additions, UI fixes, and configuration updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@emain/emain-window.ts`:
- Around line 464-466: The code skips reinitialization when tabView.isWaveReady
is true, but doesn't verify the savedInitOpts.windowId matches the current
window context (this.waveWindowId), risking stale windowId reuse; update the
branch guarding reuse (where tabView.isWaveReady is checked before calling
finalizePositioning) to validate tabView.savedInitOpts.windowId ===
this.waveWindowId and if it mismatches, clear or reset savedInitOpts and set
tabView.isWaveReady = false so the normal wave-init runs (or log and throw if
you prefer strict enforcement); alternatively add a clear comment above the
check documenting the architectural assumption if you choose not to implement
the runtime validation.

In `@emain/preload-webview.ts`:
- Around line 28-33: The mouseup listener currently sends IPC for any event,
allowing page scripts to synthesize navigation events; modify the
document.addEventListener("mouseup", ...) handler to reject non-user input by
checking event.isTrusted (and optionally that event is a MouseEvent and button
is 3 or 4) before calling ipcRenderer.send("webview-mouse-navigate", ...), so
only trusted user-initiated mouse events trigger back/forward navigation.

In `@pkg/util/shellutil/shellutil.go`:
- Line 225: The code unconditionally sets COLORTERM="truecolor"
(rtn["COLORTERM"] = "truecolor"), which overwrites any user value when merged
into envs used by RunCmdInPty and RunSimpleCmdInPty; change this to only set
COLORTERM when it is not already present—i.e., check for an existing COLORTERM
in the environment map (or os.Environ() derived map) and only assign "truecolor"
if absent so user-defined COLORTERM is preserved.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 66b1bd9c-8353-4309-84f4-a9630b7823ed

📥 Commits

Reviewing files that changed from the base of the PR and between 96c2526 and 899d08d.

📒 Files selected for processing (6)
  • .gitignore
  • emain/emain-ipc.ts
  • emain/emain-window.ts
  • emain/preload-webview.ts
  • frontend/app/tab/tabbar.tsx
  • pkg/util/shellutil/shellutil.go

- Add event.isTrusted guard to webview mouse navigation to prevent
  synthetic event injection
- Only set COLORTERM=truecolor when not already set by user
- Validate windowId when reusing wave-ready tabs across windows

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Mar 27, 2026

Code Review Summary

Status: No New Issues | Recommendation: Merge

The changes implement mouse back/forward navigation, COLORTERM support, and various bug fixes as described. No new issues identified beyond existing comments.

Files Reviewed (6 files)
  • .gitignore
  • emain/emain-ipc.ts
  • emain/emain-window.ts
  • emain/preload-webview.ts
  • frontend/app/tab/tabbar.tsx
  • pkg/util/shellutil/shellutil.go

Reviewed by minimax-m2.5-20260211 · 533,858 tokens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants