summaryrefslogtreecommitdiffstats
path: root/commands/hugo.go
diff options
context:
space:
mode:
authorAnthony Fok <foka@debian.org>2017-06-27 03:17:43 -0600
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-06-27 11:45:54 +0200
commit30e14cc31678ddc204b082ab362f86b6b8063881 (patch)
treeb75f803f1bd97645076a5c54b7f663b0173754c8 /commands/hugo.go
parentc825a7312131b4afa67ee90d593640dee3525d98 (diff)
Make `--navigateToChanged` more robust on Windows
This ensures the new "open 'current content page' in browser" works on Windows, especially with Emacs and Vim. Special thanks to @bep for coming up with the idea of the fix. See #3645
Diffstat (limited to 'commands/hugo.go')
-rw-r--r--commands/hugo.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index 42e129cf1..b939ce6e9 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -1028,13 +1028,15 @@ func (c *commandeer) newWatcher(port int) error {
}
func pickOneWritePath(events []fsnotify.Event) string {
+ name := ""
+
for _, ev := range events {
- if ev.Op&fsnotify.Write == fsnotify.Write {
- return ev.Name
+ if ev.Op&fsnotify.Write == fsnotify.Write && len(ev.Name) > len(name) {
+ name = ev.Name
}
}
- return ""
+ return name
}
func (c *commandeer) isStatic(path string) bool {