1
1
package display
2
2
3
+ // This file contains the functions that aren't part of the public API.
4
+ // The funcs are for network and displaying.
5
+
3
6
import (
4
7
"net/url"
5
8
"strconv"
@@ -9,17 +12,20 @@ import (
9
12
"github.com/makeworld-the-better-one/amfora/structs"
10
13
)
11
14
12
- // This file contains the functions that aren't part of the public API.
13
- // The funcs are for network and displaying.
14
-
15
- // followLink should be used when the user "clicks" a link on a page.
16
- // Not when a URL is opened on a new tab for the first time.
17
- // It will handle setting the bottomBar.
15
+ // followLink should be used when the user "clicks" a link on a page,
16
+ // but not when a URL is opened on a new tab for the first time.
17
+ //
18
+ // It will handle updating the bottomBar.
19
+ //
20
+ // It should be called with the `go` keyword to spawn a new goroutine if
21
+ // it would otherwise block the UI loop, such as when called from an input
22
+ // handler.
23
+ //
24
+ // It blocks until navigation is finished, and we've completed any user
25
+ // interaction related to loading the URL (such as info, error modals)
18
26
func followLink (t * tab , prev , next string ) {
19
27
if strings .HasPrefix (next , "about:" ) {
20
- if final , ok := handleAbout (t , next ); ok {
21
- t .addToHistory (final )
22
- }
28
+ goURL (t , next )
23
29
return
24
30
}
25
31
@@ -29,7 +35,7 @@ func followLink(t *tab, prev, next string) {
29
35
Error ("URL Error" , err .Error ())
30
36
return
31
37
}
32
- go goURL (t , nextURL )
38
+ goURL (t , nextURL )
33
39
return
34
40
}
35
41
// No content on current tab, so the "prev" URL is not valid.
@@ -39,7 +45,7 @@ func followLink(t *tab, prev, next string) {
39
45
Error ("URL Error" , "Link URL could not be parsed" )
40
46
return
41
47
}
42
- go goURL (t , next )
48
+ goURL (t , next )
43
49
}
44
50
45
51
// reformatPage will take the raw page content and reformat it according to the current terminal dimensions.
0 commit comments