diff options
| author | Joe <rbo@gmx.us> | 2024-05-13 20:20:20 +0200 | 
|---|---|---|
| committer | Joe <rbo@gmx.us> | 2024-05-13 20:20:20 +0200 | 
| commit | aa1f44a921e158f50dbb34088be3c3cfdd29d68d (patch) | |
| tree | 4ec059b6893424d1c8581d184e5f36922ad72936 | |
| parent | go (diff) | |
| download | hardflip-aa1f44a921e158f50dbb34088be3c3cfdd29d68d.tar.gz hardflip-aa1f44a921e158f50dbb34088be3c3cfdd29d68d.tar.bz2 hardflip-aa1f44a921e158f50dbb34088be3c3cfdd29d68d.tar.xz hardflip-aa1f44a921e158f50dbb34088be3c3cfdd29d68d.tar.zst hardflip-aa1f44a921e158f50dbb34088be3c3cfdd29d68d.zip | |
good readline
Diffstat (limited to '')
| -rw-r--r-- | src/e_events.go | 17 | 
1 files changed, 14 insertions, 3 deletions
| diff --git a/src/e_events.go b/src/e_events.go index 4c38763..cb12a3e 100644 --- a/src/e_events.go +++ b/src/e_events.go @@ -279,9 +279,9 @@ func e_delete_host(data *HardData) error {  }  func e_readline(event tcell.EventKey, buffer *Buffer) { -	if len(buffer.data) > 0 && -	(event.Key() == tcell.KeyBackspace || -	event.Key() == tcell.KeyBackspace2) { +	if buffer.len() > 0 && +	   (event.Key() == tcell.KeyBackspace || +	   event.Key() == tcell.KeyBackspace2) {  		if buffer.cursor == 0 {  			return  		} else if buffer.cursor == buffer.len() { @@ -291,6 +291,14 @@ func e_readline(event tcell.EventKey, buffer *Buffer) {  				buffer.data[buffer.cursor:]...)  		}  		buffer.cursor -= 1 +	} else if event.Key() == tcell.KeyDelete || +			  event.Key() == tcell.KeyCtrlD { +		if buffer.cursor == buffer.len() { +			return +		} else { +			buffer.data = append(buffer.data[:buffer.cursor], +				buffer.data[buffer.cursor + 1:]...) +		}  	} else if event.Key() == tcell.KeyCtrlU {  		buffer.empty()  	} else if event.Rune() >= 32 && event.Rune() <= 126 { @@ -311,6 +319,9 @@ func e_readline(event tcell.EventKey, buffer *Buffer) {  	} else if event.Key() == tcell.KeyRight ||  			  event.Key() == tcell.KeyCtrlF {  		buffer.cursor += 1 +	} else if event.Key() == tcell.KeyTAB || +			  event.Key() == tcell.KeyCtrlI { +		buffer.insert("hey go fuck yourself")  	}  	if buffer.cursor > buffer.len() {  		buffer.cursor = buffer.len() | 
