Skip to content

clear screen Cmd #236

@golonzovsky

Description

@golonzovsky

I would like to clear top of screen from within my app (same as Ctrl+L in bash).

It seems I need to print "\033[H\033[2J" (for nix) and initiate full redraw. I see internal renderer.repaint is only initiated from WindowSizeMsg:

		case "ctrl+l":
			fmt.Print("\033[H\033[2J") // only nix
			w, h, _ := term.GetSize(0) // wouldnt work if out is set
			return m, func() tea.Msg { // hack to trigger redraw
				return tea.WindowSizeMsg{Width: w, Height: h}
			}
		}

Is there an easier way to do this?
Would be nice to have built-in tea.ClearScreen cmd or at least some way to trigger full redraw so solution is less hacky and cross-platform.

clear_screen

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions