Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the prompt sometimes not being erased properly #15880

Merged
merged 2 commits into from
Sep 26, 2023

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Aug 25, 2023

A carriage return (enter key) will increase the _distanceEnd by up to
viewport-width many columns, since it increases the Y distance between
the start and end by 1 (it's a newline after all).
This will make _flushBuffer() think that the new _buffer is way longer
than the old one and so _erase() ends up not erasing the tail end of
the prompt, even if the new prompt is actually shorter.

This commit fixes the issue by separating the newline printing
out from the regular text printing loops.

Validation Steps Performed

  • Run cmd.exe
  • Write "echo hello" and press Enter
  • Write "foobar foo bar" (don't press Enter)
  • Press F7, select "echo hello" and press Enter
  • Previous prompt says "echo hello" ✅

@lhecker lhecker added Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Area-CookedRead The cmd.exe COOKED_READ handling labels Aug 25, 2023
DHowett added a commit that referenced this pull request Sep 22, 2023
# Conflicts:
#	src/host/readDataCooked.hpp
@DHowett DHowett changed the title Fixed prompt sometimes not being erased properly Fix the prompt sometimes not being erased properly Sep 25, 2023
@DHowett DHowett enabled auto-merge (squash) September 26, 2023 00:23
auto-merge was automatically disabled September 26, 2023 00:24

Base branch was modified

@DHowett DHowett merged commit c7f30a8 into main Sep 26, 2023
17 checks passed
@DHowett DHowett deleted the dev/lhecker/8000-cmdline-fixup branch September 26, 2023 00:24
DHowett pushed a commit that referenced this pull request Sep 26, 2023
A carriage return (enter key) will increase the _distanceEnd by up to
viewport-width many columns, since it increases the Y distance between
the start and end by 1 (it's a newline after all).
This will make _flushBuffer() think that the new _buffer is way longer
than the old one and so _erase() ends up not erasing the tail end of
the prompt, even if the new prompt is actually shorter.

This commit fixes the issue by separating the newline printing
out from the regular text printing loops.

## Validation Steps Performed
* Run cmd.exe
* Write "echo hello" and press Enter
* Write "foobar foo bar" (don't press Enter)
* Press F7, select "echo hello" and press Enter
* Previous prompt says "echo hello" ✅

(cherry picked from commit c7f30a8)
Service-Card-Id: 90642765
Service-Version: 1.19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CookedRead The cmd.exe COOKED_READ handling Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) zBugBash-Consider
Projects
Development

Successfully merging this pull request may close these issues.

3 participants