mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Replace input on resize
This commit is contained in:
parent
32e025f5cd
commit
2101f29e06
@ -131,6 +131,15 @@ void inp_put_back(void)
|
||||
wrefresh(inp_win);
|
||||
}
|
||||
|
||||
void inp_win_write(const char * const new_input, const int size)
|
||||
{
|
||||
int i;
|
||||
inp_clear();
|
||||
for (i = 0; i < size; i++)
|
||||
waddch(inp_win, new_input[i]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Deal with command editing, return 1 if ch was an edit
|
||||
* key press: up, down, left, right or backspace
|
||||
|
@ -49,6 +49,9 @@ void profanity_run(void)
|
||||
jabber_process_events();
|
||||
inp_get_char(&ch, inp, &size);
|
||||
win_handle_special_keys(&ch);
|
||||
if (ch == KEY_RESIZE) {
|
||||
gui_resize(ch, inp, size);
|
||||
}
|
||||
}
|
||||
|
||||
inp[size++] = '\0';
|
||||
|
23
windows.c
23
windows.c
@ -57,7 +57,6 @@ static void _cons_show_incoming_message(const char * const short_from,
|
||||
const int win_index);
|
||||
static void _win_handle_switch(const int * const ch);
|
||||
static void _win_handle_page(const int * const ch);
|
||||
static void _win_handle_resize(const int * const ch);
|
||||
|
||||
void gui_init(void)
|
||||
{
|
||||
@ -107,6 +106,16 @@ void gui_close(void)
|
||||
endwin();
|
||||
}
|
||||
|
||||
void gui_resize(const int ch, const char * const input, const int size)
|
||||
{
|
||||
create_title_bar();
|
||||
create_status_bar();
|
||||
create_input_window();
|
||||
inp_win_write(input, size);
|
||||
_current_window_refresh();
|
||||
dirty = TRUE;
|
||||
}
|
||||
|
||||
int win_close_win(void)
|
||||
{
|
||||
if (win_in_chat()) {
|
||||
@ -317,7 +326,6 @@ void win_handle_special_keys(const int * const ch)
|
||||
{
|
||||
_win_handle_switch(ch);
|
||||
_win_handle_page(ch);
|
||||
_win_handle_resize(ch);
|
||||
}
|
||||
|
||||
void win_page_off(void)
|
||||
@ -514,17 +522,6 @@ static void _win_handle_switch(const int * const ch)
|
||||
}
|
||||
}
|
||||
|
||||
static void _win_handle_resize(const int * const ch)
|
||||
{
|
||||
if (*ch == KEY_RESIZE) {
|
||||
create_title_bar();
|
||||
create_status_bar();
|
||||
create_input_window();
|
||||
_current_window_refresh();
|
||||
dirty = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void _win_handle_page(const int * const ch)
|
||||
{
|
||||
int rows, cols, y, x;
|
||||
|
@ -33,10 +33,12 @@ struct prof_win {
|
||||
int paged;
|
||||
};
|
||||
|
||||
// gui startup and shutdown
|
||||
// gui startup and shutdown, resize
|
||||
void gui_init(void);
|
||||
void gui_refresh(void);
|
||||
void gui_close(void);
|
||||
void gui_resize(const int ch, const char * const input,
|
||||
const int size);
|
||||
|
||||
// create windows
|
||||
void create_title_bar(void);
|
||||
@ -92,5 +94,6 @@ void inp_put_back(void);
|
||||
void inp_non_block(void);
|
||||
void inp_block(void);
|
||||
void inp_get_password(char *passwd);
|
||||
void inp_win_write(const char * const new_input, const int size);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user