mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Home and end keys
This commit is contained in:
parent
157a864ffe
commit
d92499da79
19
input_win.c
19
input_win.c
@ -234,26 +234,33 @@ static int _handle_edit(const int ch, char *input, int *size)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case KEY_RIGHT:
|
case KEY_RIGHT:
|
||||||
if (inp_x <= *size)
|
if (inp_x < *size) {
|
||||||
wmove(inp_win, inp_y, inp_x+1);
|
wmove(inp_win, inp_y, inp_x+1);
|
||||||
|
|
||||||
// current position off screen to right
|
// current position off screen to right
|
||||||
if ((inp_x - pad_start) > cols-2) {
|
if ((inp_x + 1 - pad_start) >= cols) {
|
||||||
pad_start++;
|
pad_start++;
|
||||||
prefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1);
|
prefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case KEY_UP:
|
case KEY_UP:
|
||||||
prev = history_previous(input, size);
|
prev = history_previous(input, size);
|
||||||
if (prev)
|
if (prev) {
|
||||||
_replace_input(input, prev, size);
|
_replace_input(input, prev, size);
|
||||||
|
pad_start = 0;
|
||||||
|
prefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case KEY_DOWN:
|
case KEY_DOWN:
|
||||||
next = history_next(input, size);
|
next = history_next(input, size);
|
||||||
if (next)
|
if (next) {
|
||||||
_replace_input(input, next, size);
|
_replace_input(input, next, size);
|
||||||
|
pad_start = 0;
|
||||||
|
prefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case KEY_HOME:
|
case KEY_HOME:
|
||||||
@ -263,11 +270,11 @@ static int _handle_edit(const int ch, char *input, int *size)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case KEY_END:
|
case KEY_END:
|
||||||
|
wmove(inp_win, inp_y, *size);
|
||||||
if (*size > cols-2) {
|
if (*size > cols-2) {
|
||||||
pad_start = ((*size) - cols) + 2;
|
pad_start = *size - cols + 1;
|
||||||
prefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1);
|
prefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1);
|
||||||
}
|
}
|
||||||
wmove(inp_win, inp_y, (*size) + 1);
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case 9: // tab
|
case 9: // tab
|
||||||
|
Loading…
Reference in New Issue
Block a user