Created
November 17, 2014 05:37
-
-
Save nocd5/6fda4c11c0b13e7e1146 to your computer and use it in GitHub Desktop.
ヒストリのサーチポインタの初期化タイミング調整
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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