mirror of
				https://github.com/taigrr/wtf
				synced 2025-01-18 04:03:14 -08:00 
			
		
		
		
	Don't trim whitespace from beginning of widget
Some widgets format the output using whitespace padding at the beginning. Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
		
							parent
							
								
									0f07cb6980
								
							
						
					
					
						commit
						f7d99c5eff
					
				@ -1,15 +1,13 @@
 | 
				
			|||||||
package clocks
 | 
					package clocks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import "fmt"
 | 
				
			||||||
	"fmt"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (widget *Widget) display(clocks []Clock, dateFormat string, timeFormat string) {
 | 
					func (widget *Widget) display(clocks []Clock, dateFormat string, timeFormat string) {
 | 
				
			||||||
	str := ""
 | 
						str := ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if len(clocks) == 0 {
 | 
						if len(clocks) == 0 {
 | 
				
			||||||
		str = fmt.Sprintf("\n%s", " no timezone data available")
 | 
							str = fmt.Sprintf("\n%s", " no timezone data available")
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
 | 
					 | 
				
			||||||
		for idx, clock := range clocks {
 | 
							for idx, clock := range clocks {
 | 
				
			||||||
			str += fmt.Sprintf(
 | 
								str += fmt.Sprintf(
 | 
				
			||||||
				" [%s]%-12s %-10s %7s[white]\n",
 | 
									" [%s]%-12s %-10s %7s[white]\n",
 | 
				
			||||||
 | 
				
			|||||||
@ -38,7 +38,9 @@ func (widget *TextWidget) Redraw(data func() (string, string, bool)) {
 | 
				
			|||||||
		widget.View.Clear()
 | 
							widget.View.Clear()
 | 
				
			||||||
		widget.View.SetWrap(wrap)
 | 
							widget.View.SetWrap(wrap)
 | 
				
			||||||
		widget.View.SetTitle(widget.ContextualTitle(title))
 | 
							widget.View.SetTitle(widget.ContextualTitle(title))
 | 
				
			||||||
		widget.View.SetText(strings.TrimSpace(content))
 | 
							// widget.View.SetText(strings.TrimSpace(content))
 | 
				
			||||||
 | 
							widget.View.SetText(strings.TrimRight(content, "\n"))
 | 
				
			||||||
 | 
							// widget.View.SetText(content)
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user