Skip to content

Commit

Permalink
Introduce /redraw command
Browse files Browse the repository at this point in the history
`/redraw` command allows resolve problem for usual users,
as well as developers.

Incredibly useful when debugging with something that
can trash out the output, like GDB.

Not to mention many asynchronous commands that can break the UI
at any point.
  • Loading branch information
H3rnand3zzz committed Nov 14, 2023
1 parent 08d2a51 commit a1ff88c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/command/cmd_defs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2729,6 +2729,18 @@ static const struct cmd_t command_defs[] = {
"/privacy logging off",
"/privacy os off")
},

{ CMD_PREAMBLE("/redraw",
parse_args, 0, 0, NULL)
CMD_MAINFUNC(cmd_redraw)
CMD_TAGS(
CMD_TAG_UI)
CMD_SYN(
"/redraw")
CMD_DESC(
"Redraw user interface. Can be used when some other program interrupted profanity or wrote to the same terminal and the interface looks \"broken\"." )
},

// NEXT-COMMAND (search helper)
};

Expand Down
8 changes: 8 additions & 0 deletions src/command/cmd_funcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -9727,6 +9727,14 @@ cmd_correct_editor(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}

gboolean
cmd_redraw(ProfWin* window, const char* const command, gchar** args)
{
ui_resize();

return TRUE;
}

gboolean
cmd_silence(ProfWin* window, const char* const command, gchar** args)
{
Expand Down
1 change: 1 addition & 0 deletions src/command/cmd_funcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ gboolean cmd_executable_vcard_photo(ProfWin* window, const char* const command,
gboolean cmd_mam(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_editor(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_correct_editor(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_redraw(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_silence(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_register(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_mood(ProfWin* window, const char* const command, gchar** args);
Expand Down

0 comments on commit a1ff88c

Please sign in to comment.