чување 9c8786f11b3d0fdcb6bffa39cf460d01136baa47
родитељ 60ae95cfabd52ccccecedc28f979cfeda93b94c7
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Mon, 17 Jun 2024 20:43:10 +0200
Bugfix: typing inside the line not growing line properly
Diffstat:
измењених датотека: 1, додавања: 7(+), брисања: 6(-)
diff --git a/sled.c b/sled.c
@@ -1035,9 +1035,9 @@ insert_char(struct DrawState* state, uint32_t ch)
ENSURE_SIZE(state->buffer[state->coord.row].text, ptext,
state->buffer[state->coord.row].size,
- (size_t)(state->coord.col + 2),
- state->coord.col + LINE_ALLOC_DELTA, insert_char_error,
- uint32_t);
+ state->buffer[state->coord.row].length + 2,
+ state->buffer[state->coord.row].size + LINE_ALLOC_DELTA,
+ insert_char_error, uint32_t);
if (SEL_NOT_EMPTY(state))
{
@@ -1071,11 +1071,12 @@ insert_char(struct DrawState* state, uint32_t ch)
int saved_column = state->coord.col;
buffer_line = state->buffer + state->coord.row;
state->coord.col = buffer_length(buffer_line->text, WRAP_WIDTH);
+ /* clang-format off */
while (state->coord.col > 0
- && !u32_is_word_boundary(buffer_line->text[state->coord.col
- - 1],
- 1))
+ && !u32_is_word_boundary(
+ buffer_line->text[state->coord.col - 1], 1))
state->coord.col--;
+ /* clang-format on */
if (state->coord.col == 0)
{
state->coord.col = saved_column;