Skip to content

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

Merged
sawka merged 6 commits intowavetermdev:mainfrom
mswiszcz:fix/misc-improvements
Mar 31, 2026
Merged

fix: Mouse Back/Forward support in webviews + few bugfixes#3141
sawka merged 6 commits intowavetermdev:mainfrom
mswiszcz:fix/misc-improvements

Conversation

@mswiszcz
Copy link
Copy Markdown
Contributor

  • 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: 8e52e35f-5c36-40da-8c29-9aa392db6dcf

📥 Commits

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

📒 Files selected for processing (1)
  • emain/emain-ipc.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • emain/emain-ipc.ts

Walkthrough

This pull request adds support for mouse back/forward button navigation across multiple components. It introduces an IPC listener in the main process to handle navigation commands, a mouse event handler in the webview preload script to detect mouse buttons 3 (back) and 4 (forward) and send navigation messages, and a shell environment variable that conditionally sets COLORTERM to truecolor. Additionally, the tab bar component's button sizing logic is adjusted to return 0 when the AI button is hidden, and the sizing function invocation behavior is modified.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 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 main changes: mouse back/forward navigation support in webviews plus multiple bug fixes, matching the primary objectives of the PR.
Description check ✅ Passed The description is directly related to the changeset, providing a bulleted list of specific improvements that correspond to the actual code modifications across multiple files.

✏️ 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

Incremental review of 2 commits since previous review:

  • a2bc8b12: Replace deprecated sender.goBack() with navigationHistory.goBack()
  • 10bed894: Undo emain-window.ts changes (reverts previous issues)

All previous issues are now resolved. The current changes:

  • emain/emain-ipc.ts: Uses navigationHistory API for mouse back/forward navigation (fixes deprecation)

No new issues found.

Files Reviewed (2 files)
  • emain/emain-ipc.ts
  • emain/emain-window.ts

Reviewed by minimax-m2.5-20260211 · 893,593 tokens

@sawka sawka merged commit 984b4e5 into wavetermdev:main Mar 31, 2026
4 checks passed
suruoxi pushed a commit to suruoxi/waveterm that referenced this pull request Apr 1, 2026
…ev#3141)

- 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

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

3 participants