Skip to content
Merged
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
1 change: 1 addition & 0 deletions docs/docs/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ wsh editconfig
| term:theme | string | preset name of terminal theme to apply by default (default is "default-dark") |
| term:transparency | float64 | set the background transparency of terminal theme (default 0.5, 0 = not transparent, 1.0 = fully transparent) |
| term:allowbracketedpaste | bool | allow bracketed paste mode in terminal (default false) |
| term:shiftenternewline | bool | when enabled, Shift+Enter sends escape sequence + newline (\u001b\n) instead of carriage return, useful for claude code and similar AI coding tools (default false) |
| editor:minimapenabled | bool | set to false to disable editor minimap |
| editor:stickyscrollenabled | bool | enables monaco editor's stickyScroll feature (pinning headers of current context, e.g. class names, method names, etc.), defaults to false |
| editor:wordwrap | bool | set to true to enable word wrapping in the editor (defaults to false) |
Expand Down
19 changes: 19 additions & 0 deletions docs/docs/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,25 @@ Wave supports various AI providers including local LLMs (via Ollama), Azure Open

See our [AI Presets documentation](/ai-presets) for detailed setup instructions for each provider.

### How do I enable Claude Code support with Shift+Enter?

Wave supports Claude Code and similar AI coding tools that expect Shift+Enter to send an escape sequence + newline (`\u001b\n`) instead of a regular carriage return. This can be enabled using the `term:shiftenternewline` configuration setting.

To enable this globally for all terminals:
```bash
wsh setconfig term:shiftenternewline=true
```

To enable this for just a specific terminal block:
```bash
wsh setmeta term:shiftenternewline=true
```

You can also set this in your [settings.json](./config) file:
```json
"term:shiftenternewline": true
```

### How can I see the block numbers?

The block numbers will appear when you hold down Ctrl-Shift (and disappear once you release the key combo).
Expand Down
12 changes: 12 additions & 0 deletions frontend/app/view/term/term.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,18 @@ class TermViewModel implements ViewModel {
return false;
}
// deal with terminal specific keybindings
if (keyutil.checkKeyPressed(waveEvent, "Shift:Enter")) {
// Check if shift+enter newline is enabled via config
const shiftEnterNewlineAtom = getOverrideConfigAtom(this.blockId, "term:shiftenternewline");
const shiftEnterNewlineEnabled = globalStore.get(shiftEnterNewlineAtom) ?? false;
if (shiftEnterNewlineEnabled) {
// Support for claude code - send escape sequence + newline instead of carriage return
this.sendDataToController("\u001b\n");
event.preventDefault();
event.stopPropagation();
return false;
}
}
if (keyutil.checkKeyPressed(waveEvent, "Ctrl:Shift:v")) {
const p = navigator.clipboard.readText();
p.then((text) => {
Expand Down
2 changes: 2 additions & 0 deletions frontend/types/gotypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ declare global {
"term:vdomtoolbarblockid"?: string;
"term:transparency"?: number;
"term:allowbracketedpaste"?: boolean;
"term:shiftenternewline"?: boolean;
"term:conndebug"?: string;
"web:zoom"?: number;
"web:hidenav"?: boolean;
Expand Down Expand Up @@ -706,6 +707,7 @@ declare global {
"term:copyonselect"?: boolean;
"term:transparency"?: number;
"term:allowbracketedpaste"?: boolean;
"term:shiftenternewline"?: boolean;
"editor:minimapenabled"?: boolean;
"editor:stickyscrollenabled"?: boolean;
"editor:wordwrap"?: boolean;
Expand Down
17 changes: 17 additions & 0 deletions frontend/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,22 @@ function mergeMeta(meta: MetaType, metaUpdate: MetaType, prefix?: string): MetaT
return rtn;
}

function escapeBytes(str: string): string {
return str.replace(/[\s\S]/g, ch => {
const code = ch.charCodeAt(0);
switch (ch) {
case "\n": return "\\n";
case "\r": return "\\r";
case "\t": return "\\t";
case "\b": return "\\b";
case "\f": return "\\f";
}
if (code === 0x1b) return "\\x1b"; // escape
if (code < 0x20 || code === 0x7f) return `\\x${code.toString(16).padStart(2,"0")}`;
return ch;
});
}

function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
Expand All @@ -391,6 +407,7 @@ export {
cn,
countGraphemes,
deepCompareReturnPrev,
escapeBytes,
fireAndForget,
getPrefixedSettings,
getPromiseState,
Expand Down
1 change: 1 addition & 0 deletions pkg/waveobj/metaconsts.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const (
MetaKey_TermVDomToolbarBlockId = "term:vdomtoolbarblockid"
MetaKey_TermTransparency = "term:transparency"
MetaKey_TermAllowBracketedPaste = "term:allowbracketedpaste"
MetaKey_TermShiftEnterNewline = "term:shiftenternewline"
MetaKey_TermConnDebug = "term:conndebug"

MetaKey_WebZoom = "web:zoom"
Expand Down
1 change: 1 addition & 0 deletions pkg/waveobj/wtypemeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ type MetaTSType struct {
TermVDomToolbarBlockId string `json:"term:vdomtoolbarblockid,omitempty"`
TermTransparency *float64 `json:"term:transparency,omitempty"` // default 0.5
TermAllowBracketedPaste *bool `json:"term:allowbracketedpaste,omitempty"`
TermShiftEnterNewline *bool `json:"term:shiftenternewline,omitempty"`
TermConnDebug string `json:"term:conndebug,omitempty"` // null, info, debug

WebZoom float64 `json:"web:zoom,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions pkg/wconfig/metaconsts.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (
ConfigKey_TermCopyOnSelect = "term:copyonselect"
ConfigKey_TermTransparency = "term:transparency"
ConfigKey_TermAllowBracketedPaste = "term:allowbracketedpaste"
ConfigKey_TermShiftEnterNewline = "term:shiftenternewline"

ConfigKey_EditorMinimapEnabled = "editor:minimapenabled"
ConfigKey_EditorStickyScrollEnabled = "editor:stickyscrollenabled"
Expand Down
1 change: 1 addition & 0 deletions pkg/wconfig/settingsconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type SettingsType struct {
TermCopyOnSelect *bool `json:"term:copyonselect,omitempty"`
TermTransparency *float64 `json:"term:transparency,omitempty"`
TermAllowBracketedPaste *bool `json:"term:allowbracketedpaste,omitempty"`
TermShiftEnterNewline *bool `json:"term:shiftenternewline,omitempty"`

EditorMinimapEnabled bool `json:"editor:minimapenabled,omitempty"`
EditorStickyScrollEnabled bool `json:"editor:stickyscrollenabled,omitempty"`
Expand Down
3 changes: 3 additions & 0 deletions schema/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@
"term:allowbracketedpaste": {
"type": "boolean"
},
"term:shiftenternewline": {
"type": "boolean"
},
"editor:minimapenabled": {
"type": "boolean"
},
Expand Down
Loading