Skip to content

Commit

Permalink
tui: fix RawContent to use a proper CommentWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
azimut committed Apr 29, 2023
1 parent 12a302b commit 6a09d48
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion internal/discourse/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmd tea.Cmd
// Initialize data to be used for links scrapping
if m.render.RawContent == "" {
m.LineWidth = 300
oldCommentWidth := m.CommentWidth
m.LineWidth = 400
m.CommentWidth = 300
m.render.RawContent = m.String()
m.CommentWidth = oldCommentWidth
}
m.render, cmd = m.render.Update(msg)
switch msg := msg.(type) {
Expand Down
5 changes: 4 additions & 1 deletion internal/fourchan/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmd tea.Cmd
// Initialize data to be used for links scrapping
if m.render.RawContent == "" {
m.LineWidth = 300
oldCommentWidth := m.CommentWidth
m.LineWidth = 400
m.CommentWidth = 300
m.render.RawContent = m.String()
m.CommentWidth = oldCommentWidth
}
m.render, cmd = m.render.Update(msg)
switch msg := msg.(type) {
Expand Down
5 changes: 4 additions & 1 deletion internal/hackernews/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmd tea.Cmd
// Initialize data to be used for links scrapping
if m.render.RawContent == "" {
m.LineWidth = 300
oldCommentWidth := m.CommentWidth
m.LineWidth = 400
m.CommentWidth = 300
m.render.RawContent = m.String()
m.CommentWidth = oldCommentWidth
}
m.render, cmd = m.render.Update(msg)
switch msg := msg.(type) {
Expand Down
5 changes: 4 additions & 1 deletion internal/reddit/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmd tea.Cmd
// Initialize data to be used for links scrapping
if m.render.RawContent == "" {
m.LineWidth = 300
oldCommentWidth := m.CommentWidth
m.LineWidth = 400
m.CommentWidth = 300
m.render.RawContent = m.String()
m.CommentWidth = oldCommentWidth
}
m.render, cmd = m.render.Update(msg) // initializes the structs it needed
switch msg := msg.(type) {
Expand Down
5 changes: 4 additions & 1 deletion internal/vichan/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmd tea.Cmd
// Initialize data to be used for links scrapping
if m.render.RawContent == "" {
m.LineWidth = 300
oldCommentWidth := m.CommentWidth
m.LineWidth = 400
m.CommentWidth = 300
m.render.RawContent = fmt.Sprint(m)
m.CommentWidth = oldCommentWidth
}
m.render, cmd = m.render.Update(msg)
switch msg := msg.(type) {
Expand Down

0 comments on commit 6a09d48

Please sign in to comment.