Skip to content

Commit

Permalink
review: bindings display restrained
Browse files Browse the repository at this point in the history
  • Loading branch information
dsjkvf authored and 097115 committed Jan 22, 2024
1 parent 5556390 commit bdbc2af
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions app/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/textproto"
"os"
"os/exec"
"strconv"
"strings"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -1625,11 +1626,22 @@ func newReviewMessage(composer *Composer, err error) *reviewMessage {
name := command[1]
strokes, _ := config.ParseKeyStrokes(cmd)
var inputs []string
for _, input := range bindings.GetReverseBindings(strokes) {
inputs = append(inputs, config.FormatKeyStrokes(input))
// force bindings for specific commands
switch cmd[:5] {
case ":send":
inputs = append(inputs, "y")
case ":abor":
inputs = append(inputs, "n")
default:
for _, input := range bindings.GetReverseBindings(strokes) {
inputs = append(inputs, config.FormatKeyStrokes(input))
}
}
// skip non-bound commands
if len(strings.Join(inputs[:], ", ")) > 0 {
actions = append(actions, fmt.Sprintf(" %-6s %-40s %s",
strings.Join(inputs[:], ", "), name, cmd))
}
actions = append(actions, fmt.Sprintf(" %-6s %-40s %s",
strings.Join(inputs, ", "), name, cmd))
}

spec := []ui.GridSpec{
Expand Down

0 comments on commit bdbc2af

Please sign in to comment.