File tree Expand file tree Collapse file tree 4 files changed +25
-5
lines changed Expand file tree Collapse file tree 4 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ module github.com/giulianopz/newscanoe
3
3
go 1.22.3
4
4
5
5
require (
6
- github.com/giulianopz/go-readability v0.1.0
6
+ github.com/giulianopz/go-readability v0.1.1
7
7
github.com/mmcdole/gofeed v1.2.1
8
8
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
9
9
golang.org/x/sync v0.1.0
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6
6
6
github.com/davecgh/go-spew v1.1.0 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
7
7
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c =
8
8
github.com/davecgh/go-spew v1.1.1 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
9
- github.com/giulianopz/go-readability v0.1.0 h1:WPHDxFoayY33sq+O3jqBoM0WKTNCVCi0lCCEtaIw0O4 =
10
- github.com/giulianopz/go-readability v0.1.0 /go.mod h1:c2qwl84Zsa+uZ78CCfr1hsWYyQL1/usDx/EtIfmcha0 =
9
+ github.com/giulianopz/go-readability v0.1.1 h1:klT1mDvWEvUO06laSwqc3g8CMFOQFjLE0duhoyARccE =
10
+ github.com/giulianopz/go-readability v0.1.1 /go.mod h1:c2qwl84Zsa+uZ78CCfr1hsWYyQL1/usDx/EtIfmcha0 =
11
11
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI =
12
12
github.com/google/go-cmp v0.6.0 /go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY =
13
13
github.com/google/gofuzz v1.0.0 /go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg =
Original file line number Diff line number Diff line change 5
5
"fmt"
6
6
"log"
7
7
"os"
8
+ "runtime/debug"
8
9
"sort"
9
10
"strings"
10
11
"sync"
@@ -472,3 +473,20 @@ func (d *display) RefreshScreen() {
472
473
473
474
fmt .Fprint (os .Stdout , buf .String ())
474
475
}
476
+
477
+ func (d * display ) ListenToInput () {
478
+ for {
479
+ func () {
480
+ defer func () {
481
+ if r := recover (); r != nil {
482
+ log .Default ().Printf ("recover from: %v\n stack trace: %v\n " , r , string (debug .Stack ()))
483
+ d .setTmpBottomMessage (2 * time .Second , "something bad happened: check the logs" )
484
+ }
485
+ }()
486
+
487
+ d .RefreshScreen ()
488
+ input := d .ReadKeyStroke (os .Stdin .Fd ())
489
+ d .ProcessKeyStroke (input )
490
+ }()
491
+ }
492
+ }
Original file line number Diff line number Diff line change @@ -168,7 +168,8 @@ func (d *display) whileReading(input byte) {
168
168
if d .currentSection == ARTICLES_LIST {
169
169
if ! util .IsHeadless () {
170
170
if err := util .OpenWithBrowser (string (d .raw [d .currentRow ()])); err != nil {
171
- d .setTmpBottomMessage (2 * time .Second , err .Error ())
171
+ log .Default ().Println ("cannot open url with browser" , err )
172
+ d .setTmpBottomMessage (2 * time .Second , "cannot open url with browser: check logs" )
172
173
}
173
174
}
174
175
}
@@ -177,7 +178,8 @@ func (d *display) whileReading(input byte) {
177
178
if d .currentSection == ARTICLES_LIST {
178
179
if util .IsLynxPresent () {
179
180
if err := util .OpenWithLynx (string (d .raw [d .currentRow ()])); err != nil {
180
- d .setTmpBottomMessage (2 * time .Second , err .Error ())
181
+ log .Default ().Println ("cannot open url with lynx" , err )
182
+ d .setTmpBottomMessage (2 * time .Second , "cannot open url with lynx: check logs" )
181
183
}
182
184
}
183
185
}
You can’t perform that action at this time.
0 commit comments