File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -260,7 +260,11 @@ func (v *calendarView) fetchIdentity() tea.Cmd {
260260 if err != nil || identity == nil {
261261 return identityLoadedMsg {firstWeekDay : time .Monday }
262262 }
263- return identityLoadedMsg {firstWeekDay : time .Weekday (identity .FirstWeekDay )}
263+ wd := identity .FirstWeekDay
264+ if wd < 0 || wd > 6 {
265+ wd = 1 // default to Monday
266+ }
267+ return identityLoadedMsg {firstWeekDay : time .Weekday (wd )}
264268 }
265269}
266270
Original file line number Diff line number Diff line change @@ -804,19 +804,28 @@ func truncateStr(s string, maxLen int) string {
804804 if maxLen <= 0 {
805805 return ""
806806 }
807- if len (s ) <= maxLen {
807+ if lipgloss . Width (s ) <= maxLen {
808808 return s
809809 }
810810 if maxLen <= 1 {
811811 return "…"
812812 }
813- return s [:maxLen - 1 ] + "…"
813+ runes := []rune (s )
814+ for len (runes ) > 0 && lipgloss .Width (string (runes ))+ lipgloss .Width ("…" ) > maxLen {
815+ runes = runes [:len (runes )- 1 ]
816+ }
817+ return string (runes ) + "…"
814818}
815819
816820func centerPad (s string , width int ) string {
817- pad := width - len (s )
821+ sw := lipgloss .Width (s )
822+ pad := width - sw
818823 if pad <= 0 {
819- return s [:width ]
824+ runes := []rune (s )
825+ for len (runes ) > 0 && lipgloss .Width (string (runes )) > width {
826+ runes = runes [:len (runes )- 1 ]
827+ }
828+ return string (runes )
820829 }
821830 left := pad / 2
822831 right := pad - left
Original file line number Diff line number Diff line change @@ -91,39 +91,39 @@ var hourglassFrames = [hourglassTotalFrames][]string{
9191 " │⣿⣿⣿│ " ,
9292 " ╰───╯" ,
9393 },
94- { // 8: 90° horizontal — sand on right
94+ { // 8: ~67° tilt
9595 "╭─ " ,
9696 "│ ──╮ " ,
9797 "╰─ ⣠╭── " ,
9898 " ──╯ ⣾⣿⣿─╮" ,
9999 " ╰──⣿│" ,
100100 " ─╯" ,
101101 },
102- { // 8 : 90° horizontal — sand on right
102+ { // 9 : 90° horizontal — sand on right
103103 " " ,
104104 "╭───╮ ╭───╮" ,
105105 "│ ⣠⣾⣿⣿⣿│" ,
106106 "╰───╯ ╰───╯" ,
107107 " " ,
108108 " " ,
109109 },
110- { // 8: 90° horizontal — sand on right
110+ { // 10: ~113° tilt
111111 " ─╮" ,
112112 " ╭──⣿│" ,
113113 " ──╮ ⣾⣿⣿─╯" ,
114114 "╭─ ╰── " ,
115115 "│ ──╯ " ,
116116 "╰─ " ,
117117 },
118- { // 9 : ~135° tilt — sand now top-right, empty bottom-left
118+ { // 11 : ~135° tilt — sand now top-right, empty bottom-left
119119 " ╭───╮" ,
120120 " │⣿⣿⣿│ " ,
121121 " ╰╮ ╭╯ " ,
122122 " ╭╯ ╰╮ " ,
123123 " │ │ " ,
124124 "╰───╯ " ,
125125 },
126- { // 10 : 180° inverted — sand at top, glass upside-down
126+ { // 12 : 180° inverted — sand at top, glass upside-down
127127 " ╭───╮ " ,
128128 " │⣿⣿⣿│ " ,
129129 " ╰╮⣿╭╯ " ,
You can’t perform that action at this time.
0 commit comments