Exemple #1
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);
	}
}
Exemple #2
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);
}
Exemple #3
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);
}
Exemple #4
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);
}
Exemple #5
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);
}
Exemple #6
0
static void key_check_replaces(void)
{
	char *line;
	int pos;

	pos = gui_entry_get_pos();

	line = auto_word_complete(gui_entry_get_text(), &pos);
	if (line != NULL) {
		gui_entry_set_text(line);
		gui_entry_set_pos(pos);
		g_free(line);
	}
}
Exemple #7
0
static void key_word_completion(void)
{
	char *line;
	int pos;

	pos = gui_entry_get_pos();

	line = word_complete(active_win, gui_entry_get_text(), &pos);
	if (line != NULL) {
		gui_entry_set_text(line);
		gui_entry_set_pos(pos);
		g_free(line);
	}
}