Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(editor): wrap long lines at the editor's edge, like VS Code (#738)

Ruben Lütkefd4d2ce0dec3
diff --git a/docs/code-editor.md b/docs/code-editor.md
index b21847674a..15161af665 100644
--- a/docs/code-editor.md
+++ b/docs/code-editor.md
@@ -21,6 +21,7 @@ terminals back without closing a file.
| Search in all files | **Ctrl+Shift+F** opens the **Search** tab: match case, whole word, regular expressions, include/exclude globs, and **Replace all** (a second click confirms; files with unsaved changes are left out) |
| See what changed | Coloured marks in the gutter (added, modified, deleted lines against the last commit), the **Changes** tab, or **Show changes**: the file against the last commit, editable on the right |
| Rendered view | **Ctrl+Shift+V** for Markdown, HTML and SVG |
+| Long lines | Wrap at the right edge of the editor, so a line never runs off-screen and there is no sideways scrolling. The line number stays on the first row of the line |
| Follow mode | **Follow mode** above the text lays one file out over as many columns as the width fits (two to six), each continuing on the line after the last full line of the column before it. Scrolling any column scrolls them all; the arrow keys walk the cursor from the bottom of one column into the top of the next and back, and typing works in every column. The setting belongs to the tab; a reload starts it off |
| Encoding, line endings | Click them in the status bar: reopen or save with another encoding, switch between LF and CRLF |
| Tabs | **Ctrl+W** closes, **Ctrl+Tab** switches, **Ctrl+Shift+T** reopens the last closed tab. A single click opens a preview tab (italic) that the next single click replaces; a double click or an edit keeps it |
diff --git a/dodaios/ui/web/frontend/src/components/agentic/editor/followMode.ts b/dodaios/ui/web/frontend/src/components/agentic/editor/followMode.ts
index 80b3638eca..23a05b9195 100644
--- a/dodaios/ui/web/frontend/src/components/agentic/editor/followMode.ts
+++ b/dodaios/ui/web/frontend/src/components/agentic/editor/followMode.ts
@@ -105,8 +105,11 @@ export function followColumns(lead: CodeEditor, hosts: HTMLElement[]): FollowCol
// or a jump to a line lands where it was asked to.
if (event.source !== "keyboard" || !editor.hasTextFocus()) return;
const before = top;
- const line = event.selection.getPosition().lineNumber;
- const target = followColumnOf(editor.getTopForLineNumber(line), before, step(), columns.length, above());
+ // The cursor's own row: a wrapped line spans several rows, and the
+ // cursor may sit on any of them.
+ const row = editor.getScrolledVisiblePosition(event.selection.getPosition());
+ if (!row) return;
+ const target = followColumnOf(row.top + editor.getScrollTop(), before, step(), columns.length, above());
if (target === null) return;
// The editor scrolls its cursor into view right after this event
// (with a line of air below it). The line is on the surface already,
diff --git a/dodaios/ui/web/frontend/src/components/agentic/editor/monacoRuntime.ts b/dodaios/ui/web/frontend/src/components/agentic/editor/monacoRuntime.ts
index f2cfc86ab8..8d61516536 100644
--- a/dodaios/ui/web/frontend/src/components/agentic/editor/monacoRuntime.ts
+++ b/dodaios/ui/web/frontend/src/components/agentic/editor/monacoRuntime.ts
@@ -152,6 +152,8 @@ export const EDITOR_OPTIONS: monaco.editor.IEditorOptions & monaco.editor.IGloba
scrollbar: { verticalScrollbarSize: 10, horizontalScrollbarSize: 10, useShadows: false },
cursorSmoothCaretAnimation: "on",
renderWhitespace: "selection",
+ // Long lines wrap at the editor's edge instead of running off-screen.
+ wordWrap: "on",
scrollBeyondLastLine: false,
padding: { top: 8, bottom: 8 },
// Hovers and the suggest list may overflow the editor's box instead of