added delete command
parent
054e0b02e8
commit
0ebcdc3ad5
|
@ -0,0 +1,12 @@
|
||||||
|
void
|
||||||
|
c_delete(char *c) {
|
||||||
|
Row *line = b_getline(buffer, atoi(c + 2));
|
||||||
|
Row *prev_line = b_getline(buffer, atoi(c + 2) - 1);
|
||||||
|
if (line == NULL || prev_line == NULL) {puts ("invalid line"); return; }
|
||||||
|
|
||||||
|
prev_line->n = line->n;
|
||||||
|
line->n->p = prev_line;
|
||||||
|
free(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
10
commands.c
10
commands.c
|
@ -1,17 +1,15 @@
|
||||||
void (*commands[256])(char *) = {
|
void (*commands[256])(char *) = {
|
||||||
NULL,
|
NULL,
|
||||||
['q'] = c_quit,
|
|
||||||
['O'] = c_open,
|
['O'] = c_open,
|
||||||
['P'] = c_print,
|
|
||||||
['w'] = c_writeline,
|
['w'] = c_writeline,
|
||||||
['q'] = NULL,
|
|
||||||
['Q'] = c_quit,
|
['Q'] = c_quit,
|
||||||
['S'] = c_save,
|
['S'] = c_save,
|
||||||
['i'] = c_insertline,
|
['i'] = c_insertline,
|
||||||
['p'] = NULL,
|
|
||||||
['p'] = c_print,
|
['p'] = c_print,
|
||||||
['P'] = NULL,
|
|
||||||
[']'] = c_indent,
|
|
||||||
['['] = c_unindent,
|
['['] = c_unindent,
|
||||||
|
[']'] = c_indent,
|
||||||
|
['d'] = c_delete,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
2
efn.c
2
efn.c
|
@ -23,4 +23,6 @@
|
||||||
#include "c_save.c"
|
#include "c_save.c"
|
||||||
#include "c_insertline.c"
|
#include "c_insertline.c"
|
||||||
#include "c_indent.c"
|
#include "c_indent.c"
|
||||||
|
#include "c_delete.c"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue