Skip to content

Commit 2f76026

Browse files
committed
Exclude commands identical to prefix from results
1 parent 52a0dbf commit 2f76026

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

history.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ func (h *history) addCommand(command string) error {
8383
func (h *history) getRecentCommand(prefix string, index uint32) (string, error) {
8484
var command string
8585

86-
// Searching for commands matching the prefix using BETWEEN
86+
// Searching for commands matching the prefix using comparisons
8787
// is much better than using LIKE because it is case sensitive,
8888
// doesn't require escaping, and makes use of the index.
8989
err := h.QueryRow(`
9090
9191
SELECT command FROM history
92-
WHERE command BETWEEN ? AND ?
92+
WHERE command > ? AND command <= ?
9393
ORDER BY time DESC, rowid
9494
LIMIT 1 OFFSET ?;
9595

0 commit comments

Comments
 (0)