Add xterm-256color as a valid terminal.
[eco.git] / kill.c
blob75f95dce283c902031204aeb4d6e2eff962605df
1 /*
2 * Copyright (C) 2008 Diego Hernan Borghetti.
3 * Eco
4 */
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
10 #include "term.h"
11 #include "screen.h"
12 #include "buffer.h"
13 #include "view.h"
14 #include "eco.h"
17 /* "kill" buffer, all the text that you cut/remove go here. */
18 E_Buffer *kill_buf= NULL;
20 void e_kill_init(void)
22 kill_buf= e_buffer_new("KillBuffer");
23 kill_buf->flag |= BUFFER_NOIDENT;
26 void e_kill_end(void)
28 e_buffer_free(kill_buf);
31 void e_kill_cut(E_Line *ln)
33 int i;
35 if (!ln) {
36 /* only a new line. */
37 e_buffer_newline(kill_buf);
38 return;
41 if (!ln->used) {
42 /* just a \n. */
43 e_buffer_newline(kill_buf);
44 return;
47 for (i= 0; i < ln->used; i++)
48 e_buffer_insert(kill_buf, ln->text[i], 1);
51 void e_kill_paste(E_Buffer *bf)
53 E_Line *p;
55 /* avoid identation. */
56 bf->flag |= BUFFER_NOIDENT;
58 p= kill_buf->lines;
59 while (p) {
60 e_buffer_insert_str(bf, p->text, p->used);
61 e_buffer_newline(bf);
62 p= p->next;
65 /* Remove the flag. */
66 bf->flag &= ~BUFFER_NOIDENT;
69 void e_kill_clean(void)
71 /* just drop the buffer, this is bad, but work ;) */
72 e_kill_end();
73 e_kill_init();