limit max screen title length to window width

Applies screen title truncating to all InfoScreen classes.
This commit is contained in:
ryenus
2020-10-03 00:12:31 +08:00
committed by cgzones
parent 72613a38f4
commit ff455b0004
2 changed files with 10 additions and 10 deletions

View File

@ -45,14 +45,7 @@ static void CommandScreen_scan(InfoScreen* this) {
}
static void CommandScreen_draw(InfoScreen* this) {
char* title = xMalloc(COLS + 1);
int len = snprintf(title, COLS + 1, "Command of process %d - %s", this->process->pid, this->process->comm);
if (len > COLS) {
memset(&title[COLS - 3], '.', 3);
}
InfoScreen_drawTitled(this, "%s", title);
free(title);
InfoScreen_drawTitled(this, "Command of process %d - %s", this->process->pid, this->process->comm);
}
InfoScreenClass CommandScreen_class = {