|
|
@@ -36,6 +36,9 @@ struct app keybind_delete_char(struct app app, union keybind_args args);
|
|
|
struct app keybind_mv_cur_word(struct app app, union keybind_args args);
|
|
|
struct app keybind_delete_word(struct app app, union keybind_args args);
|
|
|
|
|
|
+struct app keybind_mv_cur_beg_line(struct app app, union keybind_args args);
|
|
|
+struct app keybind_mv_cur_end_line(struct app app, union keybind_args args);
|
|
|
+
|
|
|
struct app keybind_insert_newline(struct app app, union keybind_args args);
|
|
|
|
|
|
|
|
|
@@ -141,6 +144,42 @@ keybind_delete_word(struct app app, union keybind_args args)
|
|
|
return app;
|
|
|
}
|
|
|
|
|
|
+struct app
|
|
|
+keybind_mv_cur_beg_line(struct app app, union keybind_args args)
|
|
|
+{
|
|
|
+ (void) args;
|
|
|
+ size_t index;
|
|
|
+ enum buffer_err err;
|
|
|
+ RET_UNWRAP2(index, err, struct ret_size_t_err,
|
|
|
+ buffer_index_bw_char(app.buf, app.buf.cur - 1, '\n'));
|
|
|
+ if ( err != BUFFER_ERR_OK ) {
|
|
|
+ if ( err == BUFFER_ERR_NOT_FOUND ) {
|
|
|
+ app.buf.cur = 0;
|
|
|
+ }
|
|
|
+ return app;
|
|
|
+ }
|
|
|
+ app.buf.cur = index + 1;
|
|
|
+ return app;
|
|
|
+}
|
|
|
+
|
|
|
+struct app
|
|
|
+keybind_mv_cur_end_line(struct app app, union keybind_args args)
|
|
|
+{
|
|
|
+ (void) args;
|
|
|
+ size_t index;
|
|
|
+ enum buffer_err err;
|
|
|
+ RET_UNWRAP2(index, err, struct ret_size_t_err,
|
|
|
+ buffer_index_fw_char(app.buf, app.buf.cur + 1, '\n'));
|
|
|
+ if ( err != BUFFER_ERR_OK ) {
|
|
|
+ if ( err == BUFFER_ERR_NOT_FOUND ) {
|
|
|
+ app.buf.cur = app.buf.data.size;
|
|
|
+ }
|
|
|
+ return app;
|
|
|
+ }
|
|
|
+ app.buf.cur = index;
|
|
|
+ return app;
|
|
|
+}
|
|
|
+
|
|
|
struct app
|
|
|
keybind_insert_newline(struct app app, union keybind_args args)
|
|
|
{
|