Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(ios): Return starts a new line with a hardware keyboard

leepokaifae68200d393
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/MessageComposer.kt b/apps/android/app/src/main/kotlin/com/codync/android/MessageComposer.kt
index f5fe0554..689ad5f5 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/MessageComposer.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/MessageComposer.kt
@@ -51,6 +51,13 @@ import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
+import androidx.compose.ui.input.key.Key
+import androidx.compose.ui.input.key.KeyEventType
+import androidx.compose.ui.input.key.isCtrlPressed
+import androidx.compose.ui.input.key.isMetaPressed
+import androidx.compose.ui.input.key.key
+import androidx.compose.ui.input.key.onPreviewKeyEvent
+import androidx.compose.ui.input.key.type
import androidx.compose.ui.platform.LocalClipboard
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.semantics.Role
@@ -148,6 +155,10 @@ private enum class Trailing { Interrupt, Stop, Call, Send }
else -> { store.toggleFastMode(bot); clear() }
}
}
+ fun send() {
+ val command = if (files.isEmpty()) SlashCommands.builtIn(bot, typed, members) else null
+ if (command != null) run(command) else store.sendDraft(bot.id, typed, replyTo?.replyQuote) { clear(); cancelReply() }
+ }
Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {
AnimatedVisibility(commands.isNotEmpty(), enter = fadeIn(Motion.fade()) + expandVertically(Motion.layoutSize),
exit = fadeOut(Motion.fade()) + shrinkVertically(Motion.layoutSize)) {
@@ -185,7 +196,13 @@ private enum class Trailing { Interrupt, Stop, Call, Send }
}
Row(Modifier.padding(start = 18.dp, end = 6.dp, top = 6.dp, bottom = 6.dp), verticalAlignment = Alignment.Bottom,
horizontalArrangement = Arrangement.spacedBy(8.dp)) {
- BasicTextField(state = text, enabled = !queuing, modifier = Modifier.weight(1f).focusRequester(focus).contentReceiver(receiver).padding(vertical = 10.dp),
+ // A hardware keyboard's Enter is a new line; Ctrl/Meta+Enter (⌘↩ on iOS) sends, and never stops or calls.
+ val sendKey = Modifier.onPreviewKeyEvent { e ->
+ val ctrlEnter = e.type == KeyEventType.KeyDown && e.key == Key.Enter && (e.isCtrlPressed || e.isMetaPressed)
+ if (ctrlEnter && trailing == Trailing.Send && canSend) send()
+ ctrlEnter
+ }
+ BasicTextField(state = text, enabled = !queuing, modifier = Modifier.weight(1f).focusRequester(focus).contentReceiver(receiver).then(sendKey).padding(vertical = 10.dp),
textStyle = Type.body.copy(color = Palette.text), cursorBrush = SolidColor(Palette.accent),
lineLimits = TextFieldLineLimits.MultiLine(maxHeightInLines = 8),
decorator = { input -> Box { if (text.text.isEmpty()) Text(placeholder, style = Type.body, color = Palette.tertiary, maxLines = 1, overflow = TextOverflow.Ellipsis); input() } })
@@ -194,10 +211,7 @@ private enum class Trailing { Interrupt, Stop, Call, Send }
Trailing.Interrupt -> onInterrupt?.invoke()
Trailing.Stop -> store.command("stop", body("botId" to bot.id))
Trailing.Call -> onCall?.invoke()
- Trailing.Send -> {
- val command = if (files.isEmpty()) SlashCommands.builtIn(bot, typed, members) else null
- if (command != null) run(command) else store.sendDraft(bot.id, typed, replyTo?.replyQuote) { clear(); cancelReply() }
- }
+ Trailing.Send -> send()
}
}
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift
index 4275a2a9..e368a912 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift
@@ -19,6 +19,8 @@ struct Composer: View {
/// The field owns its text; the store only keeps a copy. A field bound straight to the
/// store loses a hardware keyboard's IME composition (Zhuyin, Pinyin, Kana) on iPad.
@State private var draft = ""
+ /// The cursor, so a hardware keyboard's Return starts a new line where it is.
+ @State private var selection: TextSelection?
/// Files going out with the next message.
@State private var files: [OutgoingFile] = []
@State private var pickingFiles = false
@@ -199,6 +201,7 @@ struct Composer: View {
}
.buttonStyle(PressScale())
.disabled(!enabled)
+ .keyboardShortcut(state == .send ? KeyboardShortcut(.return, modifiers: .command) : nil)
.accessibilityLabel(label)
.help(label)
.animation(Motion.reduced(Motion.morph, reduceMotion), value: state)
@@ -242,11 +245,13 @@ struct Composer: View {
private var box: some View {
HStack(alignment: .bottom, spacing: 8) {
- TextField(placeholder, text: $draft, axis: .vertical)
+ TextField(placeholder, text: $draft, selection: $selection, axis: .vertical)
.lineLimit(1...8)
.font(.body)
.textFieldStyle(.plain)
.focused($focused)
+ // A hardware keyboard's Return (⌘↩ too) submits the field and ends editing.
+ .onSubmit(newline)
.padding(.vertical, fieldPadding)
micButton
.padding(.bottom, max(0, (textLineHeight + 2 * fieldPadding - buttonSize) / 2))
@@ -383,6 +388,19 @@ struct Composer: View {
focused = true
}
+ /// Return on a hardware keyboard: a new line at the cursor, and the field keeps the keyboard.
+ /// An empty box gets none, also right after ⌘↩ sent it (the field submits after the shortcut).
+ private func newline() {
+ focused = true
+ guard !draft.isEmpty else { return }
+ // A selection left from text that has since changed (dictation, a mention) means the end.
+ let range = if case .selection(let r) = selection?.indices, r.upperBound <= draft.endIndex { r } else { draft.endIndex..<draft.endIndex }
+ // Counted in scalars: a "\n" after a lone "\r" joins it into one Character.
+ let offset = draft.unicodeScalars.distance(from: draft.startIndex, to: range.lowerBound)
+ draft.replaceSubrange(range, with: "\n")
+ selection = TextSelection(insertionPoint: draft.unicodeScalars.index(draft.startIndex, offsetBy: offset + 1))
+ }
+
private func submit() {
// Words still on their way would land in the emptied box.
dictation.stop()
diff --git a/apps/ios/WhatsNew.md b/apps/ios/WhatsNew.md
index 8bd7798c..64bed606 100644
--- a/apps/ios/WhatsNew.md
+++ b/apps/ios/WhatsNew.md
@@ -12,8 +12,12 @@ a version without one gets a generic "Bug fixes and improvements" line. Delete o
- 用麥克風聽寫時,麥克風按鈕會變成錄音膠囊:停止鍵、錄了多久,還有跟著你說話起伏的點點
- Bot 工作中時點一下狀態列,就能即時看它的思考過程和每個步驟
- 麥克風旁的向上箭頭可以選聽寫要用裝置內建語音,還是用你自己的 OpenAI 或 Gemini 金鑰
+- iPad 接實體鍵盤時,在輸入框按 Return 會換行,⌘↩ 送出
+- 群組裡被提及的 bot 若正在別的對話忙,群組會顯示它在忙,忙完就回來回答
### en-US
- While you dictate, the mic turns into a recording pill: a stop button, how long you've been talking, and dots that follow your voice
- While a bot works, tap its status line to watch its thinking and each step live
- The arrow beside the mic picks how dictation hears you: on-device speech, or your own OpenAI or Gemini key
+- On iPad with a hardware keyboard, Return starts a new line in the message box and ⌘↩ sends
+- In a group, a bot you mention that's busy in another chat now says so, and answers once it's done
diff --git a/docs/guides/composer.md b/docs/guides/composer.md
index 2bc422ad..fda334ae 100644
--- a/docs/guides/composer.md
+++ b/docs/guides/composer.md
@@ -17,6 +17,9 @@ The Electron composer restores the draft and layout behavior previously fixed in
both opening and closing. Rapid toggles cancel pending reveal callbacks.
Reduced Motion removes these transitions.
- iOS keeps its native multiline field, keyboard and existing Motion animations.
+ With a hardware keyboard (iPhone/iPad), Return inserts a newline at the cursor
+ and ⌘↩ sends (send state only); on Android, Enter inserts a newline and
+ Ctrl/Meta+Enter sends (send state only).
The terminal uses immediate text layout, with Shift/Alt-Enter (where supported)
or Ctrl+J for a newline; it has no voice button or graphical inspector animation.