opencode-miniterm 1.0.18 → 1.0.19
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/bun.lock +1 -1
- package/package.json +1 -1
- package/src/commands/agents.ts +1 -0
- package/src/commands/models.ts +1 -0
- package/src/commands/sessions.ts +1 -0
- package/src/input.ts +20 -41
package/bun.lock
CHANGED
package/package.json
CHANGED
package/src/commands/agents.ts
CHANGED
package/src/commands/models.ts
CHANGED
|
@@ -116,6 +116,7 @@ async function handleKey(state: State, key: Key, str?: string) {
|
|
|
116
116
|
config.modelID = selected.modelID;
|
|
117
117
|
saveConfig();
|
|
118
118
|
const activeDisplay = await getActiveDisplay(state.client);
|
|
119
|
+
console.log();
|
|
119
120
|
console.log(activeDisplay);
|
|
120
121
|
console.log();
|
|
121
122
|
}
|
package/src/commands/sessions.ts
CHANGED
|
@@ -135,6 +135,7 @@ async function handleKey(state: State, key: Key, str?: string) {
|
|
|
135
135
|
if (selected) {
|
|
136
136
|
config.sessionIDs[process.cwd()] = selected.id;
|
|
137
137
|
saveConfig();
|
|
138
|
+
console.log();
|
|
138
139
|
console.log(`Switched to session: ${selected.id.substring(0, 8)}...`);
|
|
139
140
|
if (selected.title) {
|
|
140
141
|
console.log(` Title: ${selected.title}`);
|
package/src/input.ts
CHANGED
|
@@ -59,8 +59,9 @@ export function renderLine(): void {
|
|
|
59
59
|
// Move to the start of the line (i.e. the prompt position)
|
|
60
60
|
process.stdout.write(ansi.CURSOR_HOME);
|
|
61
61
|
if (oldWrappedRows > 0) {
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
let rowsToMove = oldWrappedRows - oldCursorRow;
|
|
63
|
+
if (cursorPosition < inputBuffer.length && rowsToMove > 0) {
|
|
64
|
+
process.stdout.write(ansi.CURSOR_DOWN(rowsToMove));
|
|
64
65
|
}
|
|
65
66
|
process.stdout.write(ansi.CURSOR_UP(oldWrappedRows));
|
|
66
67
|
}
|
|
@@ -75,17 +76,12 @@ export function renderLine(): void {
|
|
|
75
76
|
if (oldInputBuffer[i] !== inputBuffer[i]) {
|
|
76
77
|
break;
|
|
77
78
|
}
|
|
78
|
-
if (
|
|
79
|
+
if (currentCol >= consoleWidth) {
|
|
80
|
+
currentCol = 0;
|
|
79
81
|
currentRow++;
|
|
80
|
-
|
|
81
|
-
} else {
|
|
82
|
-
if (currentCol >= consoleWidth) {
|
|
83
|
-
currentCol = 0;
|
|
84
|
-
currentRow++;
|
|
85
|
-
newWrappedRows++;
|
|
86
|
-
}
|
|
87
|
-
currentCol++;
|
|
82
|
+
newWrappedRows++;
|
|
88
83
|
}
|
|
84
|
+
currentCol++;
|
|
89
85
|
start++;
|
|
90
86
|
}
|
|
91
87
|
|
|
@@ -112,48 +108,31 @@ export function renderLine(): void {
|
|
|
112
108
|
// Write the changes from the new input buffer
|
|
113
109
|
let renderExtent = Math.max(cursorPosition + 1, inputBuffer.length);
|
|
114
110
|
for (let i = start; i < renderExtent; i++) {
|
|
115
|
-
if (
|
|
111
|
+
if (currentCol >= consoleWidth) {
|
|
116
112
|
process.stdout.write("\n");
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
} else {
|
|
120
|
-
if (currentCol >= consoleWidth) {
|
|
121
|
-
process.stdout.write("\n");
|
|
122
|
-
currentCol = 0;
|
|
123
|
-
newWrappedRows++;
|
|
124
|
-
}
|
|
125
|
-
if (i < inputBuffer.length) {
|
|
126
|
-
process.stdout.write(inputBuffer[i]!);
|
|
127
|
-
}
|
|
128
|
-
currentCol++;
|
|
113
|
+
currentCol = 0;
|
|
114
|
+
newWrappedRows++;
|
|
129
115
|
}
|
|
116
|
+
if (i < inputBuffer.length) {
|
|
117
|
+
process.stdout.write(inputBuffer[i]!);
|
|
118
|
+
}
|
|
119
|
+
currentCol++;
|
|
130
120
|
}
|
|
131
121
|
|
|
132
122
|
// Calculate and move to the cursor's position
|
|
133
|
-
let
|
|
134
|
-
let
|
|
135
|
-
|
|
136
|
-
if (i < inputBuffer.length && inputBuffer[i] === "\n") {
|
|
137
|
-
row++;
|
|
138
|
-
col = 2;
|
|
139
|
-
} else {
|
|
140
|
-
col++;
|
|
141
|
-
if (col >= consoleWidth) {
|
|
142
|
-
row++;
|
|
143
|
-
col = 0;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
123
|
+
let absolutePos = 2 + cursorPosition;
|
|
124
|
+
let newCursorRow = Math.floor(absolutePos / consoleWidth);
|
|
125
|
+
let newCursorCol = absolutePos % consoleWidth;
|
|
147
126
|
process.stdout.write(ansi.CURSOR_HOME);
|
|
148
|
-
let rowsToMove = newWrappedRows -
|
|
127
|
+
let rowsToMove = newWrappedRows - newCursorRow;
|
|
149
128
|
if (rowsToMove > 0) {
|
|
150
129
|
process.stdout.write(ansi.CURSOR_UP(rowsToMove));
|
|
151
130
|
}
|
|
152
|
-
process.stdout.write(ansi.CURSOR_COL(
|
|
131
|
+
process.stdout.write(ansi.CURSOR_COL(newCursorCol));
|
|
153
132
|
|
|
154
133
|
oldInputBuffer = inputBuffer;
|
|
155
134
|
oldWrappedRows = newWrappedRows;
|
|
156
|
-
oldCursorRow =
|
|
135
|
+
oldCursorRow = newCursorRow;
|
|
157
136
|
}
|
|
158
137
|
|
|
159
138
|
export async function handleKeyPress(state: State, str: string, key: Key) {
|