Update devcontainer configuration and enhance terminal handling in InkApp. Change base image to 'devpit:latest' and implement a blinking cursor feature in the terminal display, improving user experience and visual feedback during input.
This commit is contained in:
@@ -35,19 +35,24 @@ class TerminalService extends EventEmitter {
|
||||
});
|
||||
|
||||
this.ptyProcess.onData((data) => {
|
||||
// Normalize line endings
|
||||
const normalized = String(data).replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
||||
const parts = normalized.split('\n');
|
||||
|
||||
// First part joins the existing partial
|
||||
if (parts.length > 0) {
|
||||
this.partial += parts[0];
|
||||
}
|
||||
|
||||
// For each subsequent part before the last, we have completed lines
|
||||
for (let i = 1; i < parts.length; i += 1) {
|
||||
this.lines.push(this.partial);
|
||||
this.partial = parts[i];
|
||||
const str = String(data);
|
||||
for (let i = 0; i < str.length; i += 1) {
|
||||
const ch = str[i];
|
||||
if (ch === '\\n') {
|
||||
// Line feed completes the current line
|
||||
this.lines.push(this.partial);
|
||||
this.partial = '';
|
||||
} else if (ch === '\\r') {
|
||||
// Carriage return: move to start of line; start overwriting
|
||||
this.partial = '';
|
||||
} else if (ch === '\\b' || ch === '\\x7f') {
|
||||
// Backspace or DEL: remove last char if present
|
||||
if (this.partial.length > 0) {
|
||||
this.partial = this.partial.slice(0, -1);
|
||||
}
|
||||
} else {
|
||||
this.partial += ch;
|
||||
}
|
||||
}
|
||||
|
||||
// Enforce max lines buffer
|
||||
|
||||
Reference in New Issue
Block a user