gizak / termui

Golang terminal dashboard
MIT License
13.06k stars 783 forks source link

Delete keystroke #240

Open tetrahedronix opened 5 years ago

tetrahedronix commented 5 years ago

I tried to modify the Backspace function to simulate the delete key, it seems to work except for the first character. Does someone know if this feature has already been implemented in wip-input-widget?

func (self *TextBox) Delete() {
    // ll: line length
    if ll := len(self.text[self.cursorPoint.Y-1]); self.cursorPoint.X-1 < ll {
        self.text[self.cursorPoint.Y-1] = append(self.text[self.cursorPoint.Y-1][:self.cursorPoint.X-1],
            self.text[self.cursorPoint.Y-1][self.cursorPoint.X:]...)

    }
}