Browse Source

Finish implementing stubs feature, resolves #28

v0.6.0-dev
bacardi55 10 months ago
parent
commit
f49f09a16d
  1. 4
      go.mod
  2. 4
      go.sum
  3. 4
      ui/tui.go
  4. 29
      ui/tuishortcuts.go

4
go.mod

@ -4,11 +4,11 @@ go 1.13
require (
code.rocketnine.space/tslocum/cbind v0.1.5
code.rocketnine.space/tslocum/cview v1.5.6
code.rocketnine.space/tslocum/cview v1.5.7-0.20210717195249-605d0123c184
git.sr.ht/~adnano/go-gemini v0.2.2
github.com/atotto/clipboard v0.1.4
github.com/fatih/color v1.12.0
github.com/gdamore/tcell/v2 v2.3.11
github.com/gdamore/tcell/v2 v2.4.0
github.com/mitchellh/go-homedir v1.1.0
github.com/pelletier/go-toml v1.9.3
github.com/spf13/pflag v1.0.5

4
go.sum

@ -2,6 +2,8 @@ code.rocketnine.space/tslocum/cbind v0.1.5 h1:i6NkeLLNPNMS4NWNi3302Ay3zSU6MrqOT+
code.rocketnine.space/tslocum/cbind v0.1.5/go.mod h1:LtfqJTzM7qhg88nAvNhx+VnTjZ0SXBJtxBObbfBWo/M=
code.rocketnine.space/tslocum/cview v1.5.6 h1:W0HJFIIgly3LzYoTitZIIaYDDqW0u/qmA0B6jWzw6R0=
code.rocketnine.space/tslocum/cview v1.5.6/go.mod h1:RogJMObbKuGiP8+9WsFsHpPeQQqgkCXgvTLxh7IH5eE=
code.rocketnine.space/tslocum/cview v1.5.7-0.20210717195249-605d0123c184 h1:y4qK65IPsaXzQiNjJuKcOC5ER6MgPm0kqdySk877hx0=
code.rocketnine.space/tslocum/cview v1.5.7-0.20210717195249-605d0123c184/go.mod h1:sXiz0JZgcL4/bQZDVoel4PRPZRgaZOCvqrhuyQaS3J0=
git.sr.ht/~adnano/go-gemini v0.2.1 h1:f3Up4EL78CEjZWh9MHPt6vk3SCwt66mzsn3XOqWbeps=
git.sr.ht/~adnano/go-gemini v0.2.1/go.mod h1:hQ75Y0i5jSFL+FQ7AzWVAYr5LQsaFC7v3ZviNyj46dY=
git.sr.ht/~adnano/go-gemini v0.2.2 h1:p2owKzrQ1wTgvPS5CZCPYArQyNUL8ZgYOHHrTjH9sdI=
@ -15,6 +17,8 @@ github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo
github.com/gdamore/tcell/v2 v2.2.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
github.com/gdamore/tcell/v2 v2.3.11 h1:ECO6WqHGbKZ3HrSL7bG/zArMCmLaNr5vcjjMVnLHpzc=
github.com/gdamore/tcell/v2 v2.3.11/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
github.com/gdamore/tcell/v2 v2.4.0 h1:W6dxJEmaxYvhICFoTY3WrLLEXsQ11SaFnKGVEXW57KM=
github.com/gdamore/tcell/v2 v2.4.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=

4
ui/tui.go

@ -514,15 +514,13 @@ func createNewEntryStub(dateFormat string) string {
}
func createResponseStub(tlfi *core.TlFeedItem, dateFormat string) string {
lines := strings.Split(tlfi.Content, "\n")
a := tlfi.Author
if strings.Contains(tlfi.Author, " ") {
a = strings.Split(tlfi.Author, " ")[1]
}
stub := "## " + time.Now().Format(dateFormat) + "\nRE: " + a + " " + tlfi.Published.Format(dateFormat) + "\n"
for _, l := range lines[2:] {
for _, l := range strings.Split(tlfi.Content, "\n") {
stub += "> " + l + "\n"
}
stub += "\n"

29
ui/tuishortcuts.go

@ -331,15 +331,12 @@ func threadHandler(ev *tcell.EventKey) *tcell.EventKey {
return ev
}
//TODO: Use getSelectedEntryText() when cview issue is fixed:
// https://code.rocketnine.space/tslocum/cview/issues/69
entry := `3 days ago - Tue 13 Jul 2021 18:33 CEST
🤔 @bacardi55
💬 @frrobert 2021-07-13 15:59 UTC
> lace with the strict option does that
Interesting :). I was thinking about doing something like this but with a more text/gemini friendly output so that gemini browser can actually parse it (almost as a big tinylog)!
I think I'll poc that quickly after I release the next gtl version to see how it can look like :).
`
tlfi, e := getSelectedEntryText()
if e != nil {
updateFormModalContent("Couldn't find a valid entry.", "Ok", "", func() {})
toggleFormModal()
}
entry := tlfi.Content
if isReponseToEntry(entry) == true {
index := findOriginalEntry(entry)
@ -405,17 +402,7 @@ func findOriginalEntry(entry string) int {
}
func getSelectedEntryText() (*core.TlFeedItem, error) {
// TODO: GetRegionText().
entry := `22 hours ago - Sun 11 Jul 2021 22:04 CEST
🤔 @bacardi55
Just opened my first issue on cview tracker:
https://code.rocketnine.space/tslocum/cview/issues/69
https://code.rocketnine.space/tslocum/cview/issues/69
When this get resolve, the v0.6.0 could start again with multiple new things coming :)
With a second link to test:
gemini://gmi.bacardi55.io
ftp://test.com`
entry := TlTui.TimelineTV.GetRegionText("entry-" + strconv.Itoa(TlTui.SelectedEntry))
lines := strings.Split(entry, "\n")
if len(lines) < 3 {
@ -438,8 +425,6 @@ With a second link to test:
}
func extractLinks(tlfi *core.TlFeedItem) []string {
log.Println(tlfi.Content)
re := regexp.MustCompile("(?im)→ (gemini|gopher|https{0,1})://(.*)$")
return re.FindAllString(tlfi.Content, -1)
}

Loading…
Cancel
Save