чување aff945aaa3738fe7823a95fa75d5a5510cbe8b58
родитељ 97757d2f9db85ceae3097e70621827ea4e1b7d1b
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Tue, 14 Feb 2023 22:24:21 +0100
Fix: In overwrite mode, entering text at the end of line doesn't increase the length of line
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 2, додавања: 2(+), брисања: 2(-)
diff --git a/TODO b/TODO
@@ -3,7 +3,7 @@
[ ] "Replace text" dialog (patch)
- [ ] In overwrite mode, pressing TAB on empty row doesn't insert tab
+ [x] In overwrite mode, pressing TAB on empty row doesn't insert tab
< > CLI interface? Example:
sled -c '^\G$^\\nSome text at the end^\^L10\ng/text\n' file.txt
diff --git a/sled.c b/sled.c
@@ -407,7 +407,7 @@ insert_char(struct DrawState* state, uint32_t ch)
i--;
}
buffer_line->text[state->coord.col] = ch;
- if (!IN(state->mode, M_OVERWRITE))
+ if (state->coord.col == len || !IN(state->mode, M_OVERWRITE))
buffer_line->length++;
position_to(state, state->coord.row, state->coord.col + 1);
if (add_null)