Pārlūkot izejas kodu

[keybind.h] Adding keybind func for deleting line

Vinicius Teshima 1 gadu atpakaļ
vecāks
revīzija
79e9b4bb3b
1 mainītis faili ar 15 papildinājumiem un 0 dzēšanām
  1. 15 0
      src/keybind.h

+ 15 - 0
src/keybind.h

@@ -16,6 +16,7 @@ void keybind_delete_word(struct app *app, enum keybind_dir dir);
 
 void keybind_mv_cur_line(struct app *app, enum keybind_dir dir);
 void keybind_mv_cur_edg_line(struct app *app, enum keybind_dir dir);
+void keybind_delete_line(struct app *app, enum keybind_dir dir);
 void keybind_delete_to_edg_line(struct app *app, enum keybind_dir dir);
 
 void keybind_insert_newline(struct app *app, enum keybind_dir dir);
@@ -175,6 +176,20 @@ keybind_mv_cur_edg_line(struct app *app, enum keybind_dir dir)
 	app->cbuf->high_col = buffer_calc_cur_col(app->cbuf);
 }
 
+void
+keybind_delete_line(struct app *app, enum keybind_dir dir)
+{
+	(void) dir;
+	struct buffer_line l = buffer_find_line(app->cbuf, app->cbuf->cur);
+	enum buffer_err err;
+	l.end += (l.end+1 < app->cbuf->data.size);
+	buffer_remove_between(app->cbuf, l.start, l.end, &err);
+	if ( err != BUFFER_ERR_OK ) {
+		return;
+	}
+	app->cbuf->high_col = buffer_calc_cur_col(app->cbuf);
+}
+
 void
 keybind_delete_to_edg_line(struct app *app, enum keybind_dir dir)
 {