mirror of
				https://github.com/Maks1mS/bubbles.git
				synced 2025-11-04 15:41:21 +03:00 
			
		
		
		
	fix(table): append headers/columns to zero sized string slice
This commit is contained in:
		
				
					committed by
					
						
						Maas Lalani
					
				
			
			
				
	
			
			
			
						parent
						
							278edd1c2b
						
					
				
				
					commit
					13f52d678d
				
			@@ -346,7 +346,7 @@ func (m *Model) FromValues(value, separator string) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m Model) headersView() string {
 | 
			
		||||
	var s = make([]string, len(m.cols))
 | 
			
		||||
	var s = make([]string, 0, len(m.cols))
 | 
			
		||||
	for _, col := range m.cols {
 | 
			
		||||
		style := lipgloss.NewStyle().Width(col.Width).MaxWidth(col.Width).Inline(true)
 | 
			
		||||
		renderedCell := style.Render(runewidth.Truncate(col.Title, col.Width, "…"))
 | 
			
		||||
@@ -356,7 +356,7 @@ func (m Model) headersView() string {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *Model) renderRow(rowID int) string {
 | 
			
		||||
	var s = make([]string, len(m.cols))
 | 
			
		||||
	var s = make([]string, 0, len(m.cols))
 | 
			
		||||
	for i, value := range m.rows[rowID] {
 | 
			
		||||
		style := lipgloss.NewStyle().Width(m.cols[i].Width).MaxWidth(m.cols[i].Width).Inline(true)
 | 
			
		||||
		renderedCell := m.styles.Cell.Render(style.Render(runewidth.Truncate(value, m.cols[i].Width, "…")))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user