feat: add some whitespace to branch widget
This commit is contained in:
		
							parent
							
								
									ba5dc35913
								
							
						
					
					
						commit
						b82c582a83
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -64,12 +64,14 @@ fn process_git(
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const format = "   {s} {s}   ";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub fn layout(self: *Self) Widget.Layout {
 | 
					pub fn layout(self: *Self) Widget.Layout {
 | 
				
			||||||
    const branch = self.branch orelse return .{ .static = 0 };
 | 
					    const branch = self.branch orelse return .{ .static = 0 };
 | 
				
			||||||
    var buf: [256]u8 = undefined;
 | 
					    var buf: [256]u8 = undefined;
 | 
				
			||||||
    var fbs = std.io.fixedBufferStream(&buf);
 | 
					    var fbs = std.io.fixedBufferStream(&buf);
 | 
				
			||||||
    const writer = fbs.writer();
 | 
					    const writer = fbs.writer();
 | 
				
			||||||
    writer.print("{s} {s}", .{ branch_symbol, branch }) catch {};
 | 
					    writer.print(format, .{ branch_symbol, branch }) catch {};
 | 
				
			||||||
    const len = self.plane.egc_chunk_width(fbs.getWritten(), 0, 1);
 | 
					    const len = self.plane.egc_chunk_width(fbs.getWritten(), 0, 1);
 | 
				
			||||||
    return .{ .static = len };
 | 
					    return .{ .static = len };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -82,7 +84,7 @@ pub fn render(self: *Self, theme: *const Widget.Theme) bool {
 | 
				
			||||||
    self.plane.set_style(theme.statusbar);
 | 
					    self.plane.set_style(theme.statusbar);
 | 
				
			||||||
    self.plane.fill(" ");
 | 
					    self.plane.fill(" ");
 | 
				
			||||||
    self.plane.home();
 | 
					    self.plane.home();
 | 
				
			||||||
    _ = self.plane.print("{s} {s}", .{ branch_symbol, branch }) catch {};
 | 
					    _ = self.plane.print(format, .{ branch_symbol, branch }) catch {};
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue