pterm / pterm/pterm

Area does not clear properly when calling `area.update()`

Open
#789 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
5.5k
Forks
221
PR merge metrics
No merged PRs in 30d

Description

I have this code:

messageArea := pterm.DefaultArea

messageArea.Start()
err = a.chatService.ExecuteChat(
	ctx,
	activeBranch.ID,
	msg,
	a.config,
	func(s string) {
		messageBuffer.Write([]byte(s))
		messageArea.Update(messageBuffer.String())
	},
)

And when calling the function, messageArea.Update() leaves previous text on the screen when writing the updated content:

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the implementation of messageArea.Update() and reproduce the issue with the provided DefaultArea and messageBuffer example. Verify that successive updates remove leftover text from the terminal, including when the new content is shorter than the previous content.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.