Skip to content

Commit

Permalink
Added support for pasting text into the terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasondrejka committed Sep 27, 2024
1 parent 109222f commit adda2e1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions frontend/src/components/Terminal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ export default {
}
// Fit the terminal width to the div container size after terminal is created.
this.updateTerminalSize();
// Add paste event listener
this.terminal.textarea.addEventListener("paste", (event) => {
const textToPaste = event.clipboardData.getData("text").replace(/\n+$/, "");
this.cursorPosition += textToPaste.length;
this.terminalInputBuffer += textToPaste;
console.debug("Paste text: " + textToPaste);
this.terminal.write(textToPaste);
});
},
unmounted() {
Expand Down

0 comments on commit adda2e1

Please sign in to comment.