Skip to content

Commit

Permalink
Make --navigateToChanged more robust on Windows
Browse files Browse the repository at this point in the history
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
  • Loading branch information
anthonyfok authored and bep committed Jun 27, 2017
1 parent c825a73 commit 30e14cc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions commands/hugo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 30e14cc

Please sign in to comment.