1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-01 19:24:15 -04:00

Merge branch 'master' into unicode

This commit is contained in:
James Booth 2013-07-13 23:17:35 +01:00
commit 60cad8d296
3 changed files with 11 additions and 3 deletions

View File

@ -146,6 +146,10 @@ history_next(History history, char *item)
return NULL; return NULL;
} }
if (g_list_next(history->session.sess_curr) == NULL) {
return NULL;
}
char *copied = ""; char *copied = "";
if (item != NULL) { if (item != NULL) {
copied = strdup(item); copied = strdup(item);

View File

@ -490,6 +490,10 @@ _handle_edit(int result, const wint_t ch, char *input, int *size)
next = cmd_history_next(input, size); next = cmd_history_next(input, size);
if (next) { if (next) {
inp_replace_input(input, next, size); inp_replace_input(input, next, size);
} else if (*size != 0) {
input[*size] = '\0';
cmd_history_append(input);
inp_replace_input(input, "", size);
} }
return 1; return 1;

View File

@ -93,7 +93,7 @@ void prev_with_val_then_next_returns_val(void)
assert_string_equals("Oioi", item2); 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 history = history_new(10);
history_append(history, "Hello"); 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 *item2 = history_next(history, item1);
char *item3 = history_next(history, item2); char *item3 = history_next(history, item2);
assert_string_equals("Oioi", item3); assert_is_null(item3);
} }
void navigate_then_append_new(void) void navigate_then_append_new(void)
@ -225,7 +225,7 @@ void register_history_tests(void)
TEST(previous_goes_to_correct_element); TEST(previous_goes_to_correct_element);
TEST(prev_then_next_returns_empty); TEST(prev_then_next_returns_empty);
TEST(prev_with_val_then_next_returns_val); 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(navigate_then_append_new);
TEST(edit_item_mid_history); TEST(edit_item_mid_history);
TEST(edit_previous_and_append); TEST(edit_previous_and_append);