Skip to content

Conversation

@mgazza
Copy link
Contributor

@mgazza mgazza commented Jun 18, 2024

I think we have an issue with backspace. It puts the cursor back one but does not remove the cell.

@mgazza mgazza force-pushed the backspace-issue branch from 0056105 to e18d143 Compare June 18, 2024 06:35
@andydotxyz
Copy link
Member

I think this is the fix you're looking for?

diff --git a/output.go b/output.go
index 3011b47..253217b 100644
--- a/output.go
+++ b/output.go
@@ -316,6 +316,12 @@ func handleOutputBackspace(t *Terminal) {
                return
        }
        t.moveCursor(t.cursorRow, t.cursorCol-1)
+       cells := t.content.Rows[t.cursorRow].Cells
+       if t.cursorCol < len(cells)-1 {
+               t.content.Rows[t.cursorRow].Cells = append(cells[0:t.cursorCol], cells[t.cursorCol+1:]...)
+       } else {
+               t.content.Rows[t.cursorRow].Cells = cells[0:t.cursorCol]
+       }
 }
 
 func handleOutputBell(t *Terminal) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants