Skip to content
Open
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
8 changes: 4 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2566,8 +2566,8 @@ def clear_history():
os.unlink(file_path)
elif os.path.isdir(file_path):
shutil.rmtree(file_path)
except Exception:
pass
except Exception as exc:
logger.warning("Failed to remove execution log entry %s: %s", file_path, exc)

# Clear session logs
if os.path.exists(SESSION_LOG_DIR):
Expand All @@ -2578,8 +2578,8 @@ def clear_history():
os.unlink(file_path)
elif os.path.isdir(file_path):
shutil.rmtree(file_path)
except Exception:
pass
except Exception as exc:
logger.warning("Failed to remove session log entry %s: %s", file_path, exc)

return jsonify({
'success': True,
Expand Down
31 changes: 31 additions & 0 deletions ui/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ let state = {
activeTerminalId: 1,
nextTerminalId: 2,
autoScroll: {}, // per-terminal auto-scroll toggle: { termId: bool }
terminalWordWrap: localStorage.getItem('terminal-word-wrap') !== 'false',
workspaceRestored: false,
workspaceProfiles: [],
restoreMode: 'full',
Expand Down Expand Up @@ -890,6 +891,7 @@ document.addEventListener('DOMContentLoaded', async () => {
initResizers();
await restoreSession();
applyTerminalDensity();
applyTerminalWordWrap();

// Initialize auto-scroll as enabled for terminal 1
state.autoScroll[1] = true;
Expand Down Expand Up @@ -2501,6 +2503,29 @@ function updateAutoScrollBtn(termId, isOn) {
persistWorkspace();
}

function applyTerminalWordWrap(enabled = state.terminalWordWrap) {
state.terminalWordWrap = enabled;

document.querySelectorAll('.cli-body').forEach(body => {
body.classList.toggle('terminal-word-wrap-off', !enabled);
});

const btn = document.getElementById('btn-word-wrap');
if (btn) {
btn.classList.toggle('active', enabled);
btn.title = enabled ? 'Word wrap: On' : 'Word wrap: Off';
btn.setAttribute('aria-pressed', String(enabled));
}
}

function toggleTerminalWordWrap() {
const enabled = !state.terminalWordWrap;
localStorage.setItem('terminal-word-wrap', String(enabled));
applyTerminalWordWrap(enabled);
persistWorkspace();
notify(`Terminal word wrap ${enabled ? 'enabled' : 'disabled'}.`, 'info');
}

const TERMINAL_DENSITIES = ['compact', 'normal', 'relaxed'];

function getTerminalDensity() {
Expand Down Expand Up @@ -3472,6 +3497,12 @@ function bindEvents() {
updateAutoScrollBtn(state.activeTerminalId, true);
}

const btnWordWrap = document.getElementById('btn-word-wrap');
if (btnWordWrap) {
btnWordWrap.addEventListener('click', toggleTerminalWordWrap);
applyTerminalWordWrap();
}

const densityControl = document.getElementById('terminal-density-control');
if (densityControl) {
densityControl.addEventListener('click', (event) => {
Expand Down
11 changes: 11 additions & 0 deletions ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,17 @@ <h2>Scripts</h2>
<path d="m19 12-7 7-7-7" />
</svg>
</button>
<button class="btn-icon active" id="btn-word-wrap" title="Word wrap: On"
aria-label="Toggle terminal word wrap" aria-pressed="true">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round">
<path d="M4 7h16" />
<path d="M4 12h10" />
<path d="m14 12 3 3-3 3" />
<path d="M4 17h8" />
</svg>
</button>
<div class="terminal-density-control" id="terminal-density-control" role="group"
aria-label="Terminal line height density">
<button class="density-option" type="button" data-density="compact"
Expand Down
6 changes: 6 additions & 0 deletions ui/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,12 @@ body {
word-break: break-word;
}

.cli-body.terminal-word-wrap-off {
overflow-x: auto;
white-space: pre;
word-break: normal;
}

.cli-body.terminal-density-compact {
--terminal-line-height: 1.35;
}
Expand Down
Loading