fix: layout misc changes

Ayman Bagabas created

Change summary

ui/components/code/code.go | 5 ++---
ui/pages/repo/files.go     | 2 +-
ui/pages/repo/filesitem.go | 1 +
ui/pages/repo/repo.go      | 8 +++++---
ui/styles/styles.go        | 1 +
5 files changed, 10 insertions(+), 7 deletions(-)

Detailed changes

ui/components/code/code.go 🔗

@@ -164,9 +164,8 @@ func (r *Code) ScrollPercent() float64 {
 func (r *Code) glamourize(w int, md string) (string, error) {
 	r.renderMutex.Lock()
 	defer r.renderMutex.Unlock()
-	// This fixes a bug with markdown text wrapping being off by one.
-	if w > 0 {
-		w--
+	if w > 120 {
+		w = 120
 	}
 	tr, err := glamour.NewTermRenderer(
 		glamour.WithStyles(r.styleConfig),

ui/pages/repo/files.go 🔗

@@ -307,7 +307,7 @@ func (f *Files) StatusBarValue() string {
 func (f *Files) StatusBarInfo() string {
 	switch f.activeView {
 	case filesViewFiles:
-		return fmt.Sprintf(" %d/%d", f.selector.Index()+1, len(f.selector.VisibleItems()))
+		return fmt.Sprintf("# %d/%d", f.selector.Index()+1, len(f.selector.VisibleItems()))
 	case filesViewContent:
 		return fmt.Sprintf("☰ %.f%%", f.code.ScrollPercent()*100)
 	default:

ui/pages/repo/filesitem.go 🔗

@@ -104,6 +104,7 @@ func (d FileItemDelegate) Render(w io.Writer, m list.Model, index int, listItem
 
 	name := i.Title()
 	size := humanize.Bytes(uint64(i.entry.Size()))
+	size = strings.ReplaceAll(size, " ", "")
 	sizeLen := lipgloss.Width(size)
 	if i.entry.IsTree() {
 		size = strings.Repeat(" ", sizeLen)

ui/pages/repo/repo.go 🔗

@@ -273,9 +273,12 @@ func (r *Repo) headerView() string {
 	name := r.common.Styles.RepoHeaderName.Render(r.selectedRepo.Name())
 	desc := r.selectedRepo.Description()
 	if desc == "" {
-		desc = "No description"
+		desc = name
+		name = ""
+	} else {
+		desc = r.common.Styles.RepoHeaderDesc.Render(desc)
 	}
-	desc = r.common.Styles.RepoHeaderDesc.Render(desc)
+	// TODO move this into a style.
 	urlStyle := lipgloss.NewStyle().
 		MarginLeft(1).
 		Foreground(lipgloss.Color("168")).
@@ -283,7 +286,6 @@ func (r *Repo) headerView() string {
 		Align(lipgloss.Right)
 	url := git.RepoURL(cfg.Host, cfg.Port, r.selectedRepo.Repo())
 	url = common.TruncateString(url, r.common.Width-lipgloss.Width(desc)-1)
-	// TODO move this into a style.
 	url = urlStyle.Render(url)
 	style := r.common.Styles.RepoHeader.Copy().Width(r.common.Width)
 	return style.Render(

ui/styles/styles.go 🔗

@@ -113,6 +113,7 @@ func DefaultStyles() *Styles {
 		Foreground(lipgloss.Color("15")).
 		Align(lipgloss.Left).
 		Height(1).
+		PaddingLeft(1).
 		MarginBottom(1).
 		Bold(true)