mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Down arrow adds current line to history and shows empty line
This commit is contained in:
parent
907beb55f6
commit
1d05a70473
@ -146,6 +146,10 @@ history_next(History history, char *item)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (g_list_next(history->session.sess_curr) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *copied = "";
|
||||
if (item != NULL) {
|
||||
copied = strdup(item);
|
||||
|
@ -490,6 +490,10 @@ _handle_edit(int result, const wint_t ch, char *input, int *size)
|
||||
next = cmd_history_next(input, size);
|
||||
if (next) {
|
||||
inp_replace_input(input, next, size);
|
||||
} else if (*size != 0) {
|
||||
input[*size] = '\0';
|
||||
cmd_history_append(input);
|
||||
inp_replace_input(input, "", size);
|
||||
}
|
||||
return 1;
|
||||
|
||||
|
@ -93,7 +93,7 @@ void prev_with_val_then_next_returns_val(void)
|
||||
assert_string_equals("Oioi", item2);
|
||||
}
|
||||
|
||||
void prev_with_val_then_next_twice_returns_val(void)
|
||||
void prev_with_val_then_next_twice_returns_null(void)
|
||||
{
|
||||
History history = history_new(10);
|
||||
history_append(history, "Hello");
|
||||
@ -102,7 +102,7 @@ void prev_with_val_then_next_twice_returns_val(void)
|
||||
char *item2 = history_next(history, item1);
|
||||
char *item3 = history_next(history, item2);
|
||||
|
||||
assert_string_equals("Oioi", item3);
|
||||
assert_is_null(item3);
|
||||
}
|
||||
|
||||
void navigate_then_append_new(void)
|
||||
@ -225,7 +225,7 @@ void register_history_tests(void)
|
||||
TEST(previous_goes_to_correct_element);
|
||||
TEST(prev_then_next_returns_empty);
|
||||
TEST(prev_with_val_then_next_returns_val);
|
||||
TEST(prev_with_val_then_next_twice_returns_val);
|
||||
TEST(prev_with_val_then_next_twice_returns_null);
|
||||
TEST(navigate_then_append_new);
|
||||
TEST(edit_item_mid_history);
|
||||
TEST(edit_previous_and_append);
|
||||
|
Loading…
Reference in New Issue
Block a user