Skip to content

Commit

Permalink
Help users avoid inserting "l" by accident right after pressing ctrl-l
Browse files Browse the repository at this point in the history
  • Loading branch information
xyproto committed Jan 26, 2025
1 parent ebd22f1 commit a780a54
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions v2/keyloop.go
Original file line number Diff line number Diff line change
Expand Up @@ -2112,14 +2112,16 @@ func Loop(tty *vt100.TTY, fnord FilenameOrData, lineNumber LineNumber, colNumber
default: // any other key
keyRunes := []rune(key)
if len(keyRunes) > 0 && unicode.IsLetter(keyRunes[0]) { // letter

if keyRunes[0] == 'n' && kh.TwoLastAre("c:14") && kh.PrevWithin(500*time.Millisecond) {
// Avoid inserting "n" if the user very recently pressed ctrl-n twice
break
} else if keyRunes[0] == 'p' && kh.TwoLastAre("c:16") && kh.PrevWithin(500*time.Millisecond) {
// Avoid inserting "p" if the user very recently pressed ctrl-p twice
break
} else if e.mode == mode.ManPage && keyRunes[0] == 'q' {
} else if keyRunes[0] == 'l' && kh.TwoLastAre("c:12") && kh.PrevWithin(500*time.Millisecond) {
// Avoid inserting "l" if the user very recently pressed ctrl-l twice
break
} else if keyRunes[0] == 'q' && e.mode == mode.ManPage {
// If o is used as a man page viewer, exit at the press of "q"
clearOnQuit.Store(false)
e.quit = true
Expand Down

0 comments on commit a780a54

Please sign in to comment.