Esempio n. 1
0
File: vis.c Progetto: tycho/vis
const char *vis_keys_push(Vis *vis, const char *input) {
	if (!input)
		return NULL;

	if (vis->recording)
		macro_append(vis->recording, input);
	if (vis->macro_operator)
		macro_append(vis->macro_operator, input);

	if (!buffer_append0(&vis->input_queue, input)) {
		buffer_truncate(&vis->input_queue);
		return NULL;
	}

	return vis_keys_raw(vis, &vis->input_queue, input);
}
Esempio n. 2
0
File: vis.c Progetto: ewqasd200g/vis
void vis_keys_feed(Vis *vis, const char *input) {
	if (!input)
		return;
	if (vis->recording)
		macro_append(vis->recording, input);
	if (vis->macro_operator)
		macro_append(vis->macro_operator, input);
	if (!buffer_append0(vis->keys, input))
		buffer_truncate(vis->keys);
	/* if we are being called from within a keyhandler then appending
	 * the new keys to the end of the input queue is enough. they will
	 * be interpreted once the key handler returns and control reaches
	 * back to the vis_keys_process function. */
	if (!vis->keyhandler)
		vis_keys_process(vis);
}
Esempio n. 3
0
File: vis.c Progetto: tycho/vis
bool vis_keys_inject(Vis *vis, const char *pos, const char *input) {
	Buffer *buf = vis->keys;
	if (!buf)
		return false;
	if (pos < buf->data || pos > buf->data + buf->len)
		return false;
	size_t off = pos - buf->data;
	buffer_insert0(buf, off, input);
	if (vis->macro_operator)
		macro_append(vis->macro_operator, input);
	return true;
}