Skip to content

Instantly share code, notes, and snippets.

@nocd5
Created November 17, 2014 05:37
Show Gist options
  • Save nocd5/6fda4c11c0b13e7e1146 to your computer and use it in GitHub Desktop.
Save nocd5/6fda4c11c0b13e7e1146 to your computer and use it in GitHub Desktop.
ヒストリのサーチポインタの初期化タイミング調整
diff --git a/history/history.go b/history/history.go
index 8bdf08d..b7f7e7d 100644
--- a/history/history.go
+++ b/history/history.go
@@ -341,3 +341,7 @@ func Load(path string) error {
}
return nil
}
+
+func ResetPointor() {
+ pointor = len(histories)
+}
diff --git a/nyagos.go b/nyagos.go
index 71924dd..467b0de 100644
--- a/nyagos.go
+++ b/nyagos.go
@@ -152,6 +152,7 @@ func main() {
if isReplaced {
fmt.Fprintln(os.Stdout, line)
}
+ history.ResetPointor();
if line == "" {
continue
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment