Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: ignore unhandled control characters #254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type CompletionManager struct {
func (c *CompletionManager) GetSelectedSuggestion() (s Suggest, ok bool) {
if c.selected == -1 {
return Suggest{}, false
} else if c.selected < -1 {
} else if c.selected < -1 || c.selected >= len(c.tmp) {
debug.Assert(false, "must not reach here")
c.selected = -1
return Suggest{}, false
Expand Down
8 changes: 4 additions & 4 deletions input.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ var ASCIISequences = []*ASCIICode{
{Key: ControlF, ASCIICode: []byte{0x6}},
{Key: ControlG, ASCIICode: []byte{0x7}},
{Key: ControlH, ASCIICode: []byte{0x8}},
//{Key: ControlI, ASCIICode: []byte{0x9}},
//{Key: ControlJ, ASCIICode: []byte{0xa}},
// {Key: ControlI, ASCIICode: []byte{0x9}},
// {Key: ControlJ, ASCIICode: []byte{0xa}},
{Key: ControlK, ASCIICode: []byte{0xb}},
{Key: ControlL, ASCIICode: []byte{0xc}},
{Key: ControlM, ASCIICode: []byte{0xd}},
Expand Down Expand Up @@ -113,8 +113,8 @@ var ASCIISequences = []*ASCIICode{
{Key: F8, ASCIICode: []byte{0x1b, 0x5b, 0x31, 0x39, 0x7e}},
{Key: F9, ASCIICode: []byte{0x1b, 0x5b, 0x32, 0x30, 0x7e}},
{Key: F10, ASCIICode: []byte{0x1b, 0x5b, 0x32, 0x31, 0x7e}},
{Key: F11, ASCIICode: []byte{0x1b, 0x5b, 0x32, 0x32, 0x7e}},
{Key: F12, ASCIICode: []byte{0x1b, 0x5b, 0x32, 0x34, 0x7e, 0x8}},
{Key: F11, ASCIICode: []byte{0x1b, 0x5b, 0x32, 0x33, 0x7e}},
{Key: F12, ASCIICode: []byte{0x1b, 0x5b, 0x32, 0x34, 0x7e}},
{Key: F13, ASCIICode: []byte{0x1b, 0x5b, 0x25, 0x7e}},
{Key: F14, ASCIICode: []byte{0x1b, 0x5b, 0x26, 0x7e}},
{Key: F15, ASCIICode: []byte{0x1b, 0x5b, 0x28, 0x7e}},
Expand Down
3 changes: 3 additions & 0 deletions prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ func (p *Prompt) feed(b []byte) (shouldExit bool, exec *Exec) {
if p.handleASCIICodeBinding(b) {
return
}
if len(b) > 0 && (b[0] <= 0x1f || b[0] == 0x7f) {
break
}
p.buf.InsertText(string(b), false, true)
}

Expand Down