sled

Једноставни уређивач текста
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување 6fd20578e5b13afc2da8801b722f4f60edc7650e
родитељ 75fd506b13629e7c87156b9db41ad0d891b750f4
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Mon, 21 Feb 2022 15:33:47 +0100

Correct create_file declaration; add check to move_down

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
Msled.c | 4+++-
измењених датотека: 1, додавања: 3(+), брисања: 1(-)

diff --git a/sled.c b/sled.c @@ -53,7 +53,7 @@ void reread_callback(struct DrawState* state, struct tb_event* ev); void quit_callback(struct DrawState* state, struct tb_event* ev); struct BufferLine* load_info(struct DrawState* state); struct DrawState* load_msgstr(struct DrawState* state); -int create_file(struct DrawState* dstate, long* lineno, long* col); +int create_file(struct DrawState* dstate); int load_file(struct DrawState* dstate, long* lineno, long* col); int save_file(struct DrawState* state); struct DrawState* join_lines(struct DrawState* state, size_t first_line, @@ -444,6 +444,8 @@ move_up(struct DrawState* state) int move_down(struct DrawState* state) { + if (state->row == state->rows_count - 1) + return 0; if (state->row < state->rows_count - 1) state->row++; if (state->first_shown_row + (state->maxy - 2) < state->row)