Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Add support for DEL key
Browse files Browse the repository at this point in the history
  • Loading branch information
EnderIce2 committed Feb 29, 2024
1 parent c7360f4 commit 66ec562
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions kshell/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,37 @@ void StartKernelShell()
Display->UpdateBuffer();
continue;
}
case KEY_DELETE:
{
if (!(sc & KEY_PRESSED))
continue;

if (bsCount == 0)
continue;

if (seekCount == bsCount)
{
debug("seekCount == bsCount (%d == %d)",
seekCount, bsCount);
continue;
}

uint32_t tmpX, tmpY;
Display->GetBufferCursor(&tmpX, &tmpY);

Display->SetBufferCursor(unseekX, unseekY);
strBufBck();
debug("seekCount: %d: %s", seekCount, strBuf.c_str());
strBuf.erase((int)seekCount);
Display->PrintString(strBuf.c_str());
debug("after strBuf: %s", strBuf.c_str());

Display->SetBufferCursor(tmpX, tmpY);
unseekX -= Display->GetCurrentFont()->GetInfo().Width;
bsCount--;
Display->UpdateBuffer();
continue;
}
case KEY_UP_ARROW:
{
if (!(sc & KEY_PRESSED))
Expand Down

0 comments on commit 66ec562

Please sign in to comment.