fix: 禁用 glamour word wrap,改用 lipgloss.Print 输出
- getWrapWidth() 支持 wrap_width=-1 禁用换行,添加 LINES fallback - outputLineByLine() 使用 lipgloss.Print 替代 fmt.Println - 解决 glamour word wrap 导致列表项换行异常的问题
This commit is contained in:
@@ -82,6 +82,9 @@ func getWrapWidth() int {
|
||||
if cfg.Markdown.WrapWidth > 0 {
|
||||
return cfg.Markdown.WrapWidth
|
||||
}
|
||||
if cfg.Markdown.WrapWidth < 0 {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
if cols := os.Getenv("COLUMNS"); cols != "" {
|
||||
@@ -90,9 +93,15 @@ func getWrapWidth() int {
|
||||
}
|
||||
}
|
||||
|
||||
if cols := os.Getenv("LINES"); cols != "" {
|
||||
if w, err := strconv.Atoi(cols); err == nil && w > 0 {
|
||||
return w
|
||||
}
|
||||
}
|
||||
|
||||
width, _, err := term.GetSize(0)
|
||||
if err != nil || width <= 0 {
|
||||
return 80
|
||||
return 0
|
||||
}
|
||||
return width
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user