fix: added scroll hint to message on command output
This commit is contained in:
parent
402c93db50
commit
1e2f1b147b
@ -5,6 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const CommandOutputExitMessage = "Press ENTER to continue"
|
const CommandOutputExitMessage = "Press ENTER to continue"
|
||||||
|
const CommandOutputScrollMessage = "Use j/k to scroll"
|
||||||
|
|
||||||
type CommandOutput struct {
|
type CommandOutput struct {
|
||||||
Title string
|
Title string
|
||||||
|
|||||||
@ -341,7 +341,11 @@ func overlayCommandOutputWindow(view string, cmd *core.CommandOutput, styles sty
|
|||||||
content := styles.LineStyle.Render(strings.ReplaceAll(l, "\n", "\\n"))
|
content := styles.LineStyle.Render(strings.ReplaceAll(l, "\n", "\\n"))
|
||||||
overlay = append(overlay, content)
|
overlay = append(overlay, content)
|
||||||
}
|
}
|
||||||
overlay = append(overlay, styles.CommandContinueMessage.Render(core.CommandOutputExitMessage))
|
msg := core.CommandOutputExitMessage
|
||||||
|
if len(cmd.Lines) > len(cmd.Viewport(termHeight)) {
|
||||||
|
msg += ". " + core.CommandOutputScrollMessage
|
||||||
|
}
|
||||||
|
overlay = append(overlay, styles.CommandContinueMessage.Render(msg))
|
||||||
|
|
||||||
// NOTE: strings.Split on "\n" is safe as long as no style uses .Width()/.Height()/.Padding()/.Margin(),
|
// NOTE: strings.Split on "\n" is safe as long as no style uses .Width()/.Height()/.Padding()/.Margin(),
|
||||||
// which would cause Lipgloss to embed newlines internally and corrupt the line count.
|
// which would cause Lipgloss to embed newlines internally and corrupt the line count.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user