Esempio n. 1
0
void gui_entry_erase_word(GUI_ENTRY_REC *entry, int to_space)
{
	int to;

        g_return_if_fail(entry != NULL);
	if (entry->pos == 0)
		return;

	to = entry->pos - 1;

	if (to_space) {
		while (entry->text[to] == ' ' && to > 0)
			to--;
		while (entry->text[to] != ' ' && to > 0)
			to--;
	} else {
		while (!i_isalnum(entry->text[to]) && to > 0)
			to--;
		while (i_isalnum(entry->text[to]) && to > 0)
			to--;
	}
	if (to > 0) to++;

        gui_entry_erase(entry, entry->pos-to, TRUE);
}
Esempio n. 2
0
void gui_entry_erase_next_word(GUI_ENTRY_REC *entry, int to_space)
{
	int to, size;

        g_return_if_fail(entry != NULL);
	if (entry->pos == entry->text_len)
		return;

        to = entry->pos;
	if (to_space) {
		while (entry->text[to] == ' ' && to < entry->text_len)
			to++;
		while (entry->text[to] != ' ' && to < entry->text_len)
			to++;
	} else {
		while (!i_isalnum(entry->text[to]) && to < entry->text_len)
			to++;
		while (i_isalnum(entry->text[to]) && to < entry->text_len)
			to++;
	}

        size = to-entry->pos;
	entry->pos = to;
        gui_entry_erase(entry, size, TRUE);
}
Esempio n. 3
0
static void key_delete_character(void)
{
	if (gui_entry_get_pos() < (int)strlen(gui_entry_get_text())) {
		gui_entry_move_pos(1);
		gui_entry_erase(1);
	}
}
Esempio n. 4
0
void gui_entry_erase_word(GUI_ENTRY_REC *entry, int to_space, CUTBUFFER_UPDATE_OP cutbuffer_op)
{
	int to;

        g_return_if_fail(entry != NULL);
	if (entry->pos == 0)
		return;

	to = entry->pos - 1;

	if (to_space) {
		while (entry->text[to] == ' ' && to > 0)
			to--;
		while (entry->text[to] != ' ' && to > 0)
			to--;
	} else {
		while (!i_isalnum(entry->text[to]) && to > 0)
			to--;
		while (i_isalnum(entry->text[to]) && to > 0)
			to--;
	}
	if (to > 0) to++;

	gui_entry_erase(entry, entry->pos-to, CUTBUFFER_UPDATE_REPLACE);
}
Esempio n. 5
0
void gui_entry_erase_to(GUI_ENTRY_REC *entry, int pos, int update_cutbuffer)
{
	int newpos, size = 0;

	g_return_if_fail(entry != NULL);

	for (newpos = gui_entry_get_pos(entry); newpos > pos; size++)
		newpos = newpos - 1;
	gui_entry_erase(entry, size, update_cutbuffer);
}
Esempio n. 6
0
static void key_erase_to_beg_of_line(void)
{
	int pos;

	pos = gui_entry_get_pos();
	g_free_not_null(cutbuffer);
	cutbuffer = g_strndup(gui_entry_get_text(), pos);

	gui_entry_erase(pos);
}
Esempio n. 7
0
static void key_erase_to_end_of_line(void)
{
	int pos;

	pos = gui_entry_get_pos();
	g_free_not_null(cutbuffer);
	cutbuffer = g_strdup(gui_entry_get_text()+pos);

	gui_entry_set_pos(strlen(gui_entry_get_text()));
	gui_entry_erase(strlen(gui_entry_get_text()) - pos);
}
Esempio n. 8
0
static void key_transpose_characters(void)
{
	char *line, c;
	int pos;

	pos = gui_entry_get_pos();
	line = gui_entry_get_text();
	if (pos == 0 || strlen(line) < 2)
		return;

	if (line[pos] != '\0')
		gui_entry_move_pos(1);
	c = line[gui_entry_get_pos()-1];
        gui_entry_erase(1);
	gui_entry_move_pos(-1);
	gui_entry_insert_char(c);
        gui_entry_set_pos(pos);
}
Esempio n. 9
0
static void key_backspace(void)
{
	gui_entry_erase(1);
}