kokoirc 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kokoirc",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Modern terminal IRC client with inline image preview, SASL, scripting, encrypted logging, and theming — built with OpenTUI, React, and Bun",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -103,10 +103,20 @@ export function CommandInput() {
103
103
  const text = event.text
104
104
  if (!text) return
105
105
 
106
- const lines = text.split(/\r?\n/).filter((l) => l.trim())
107
- if (lines.length <= 1) return // single-line paste: let input handle normally
108
-
106
+ const lines = text.split(/\r?\n/)
107
+ const nonEmptyLines = lines.filter((l) => l.trim())
108
+
109
+ // Always prevent default to stop OpenTUI input from stripping newlines
109
110
  event.preventDefault()
111
+
112
+ // Single line: insert at cursor position
113
+ if (nonEmptyLines.length <= 1) {
114
+ const currentValue = inputRef.current?.value ?? value
115
+ const newValue = currentValue + text
116
+ setValue(newValue)
117
+ if (inputRef.current) inputRef.current.value = newValue
118
+ return
119
+ }
110
120
 
111
121
  // Prepend any existing input text to first pasted line
112
122
  const currentInput = inputRef.current?.value ?? ""