history: don't store duplicate entries
Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
94bff9130d
commit
9c11ab21c7
2 changed files with 5 additions and 1 deletions
|
@ -14,6 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- `:open-link` now supports link types other than HTTP(S)
|
- `:open-link` now supports link types other than HTTP(S)
|
||||||
|
- Running the same command multiple times only adds one entry to the command
|
||||||
|
history.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,9 @@ func (h *cmdHistory) Add(cmd string) {
|
||||||
h.cmdList = h.cmdList[1:]
|
h.cmdList = h.cmdList[1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(h.cmdList) == 0 || h.cmdList[len(h.cmdList)-1] != cmd {
|
||||||
h.cmdList = append(h.cmdList, cmd)
|
h.cmdList = append(h.cmdList, cmd)
|
||||||
|
}
|
||||||
|
|
||||||
// whenever we add a new command, reset the current
|
// whenever we add a new command, reset the current
|
||||||
// pointer to the "beginning" of the list
|
// pointer to the "beginning" of the list
|
||||||
|
|
Loading…
Reference in a new issue