Skip to content

Commit

Permalink
Adds ringing a bell if history out of range
Browse files Browse the repository at this point in the history
  • Loading branch information
ksysoev committed Oct 22, 2023
1 parent 229df19 commit a57c6ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const (
MacOSDeleteKey = 127

KeyboardBufferSize = 10

Bell = "\a"
)

type CLI struct {
Expand Down
4 changes: 4 additions & 0 deletions pkg/cli/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ func (ed *Editor) EditRequest(keyStream <-chan keyboard.KeyEvent, initBuffer str
req := ed.History.GetRequst(historyIndex)

if req == "" {
fmt.Print(Bell)
historyIndex--

continue
}

Expand All @@ -74,7 +76,9 @@ func (ed *Editor) EditRequest(keyStream <-chan keyboard.KeyEvent, initBuffer str
req := ed.History.GetRequst(historyIndex)

if req == "" {
fmt.Print(Bell)
historyIndex++

continue
}

Expand Down

0 comments on commit a57c6ce

Please sign in to comment.