sled

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

чување 2a8cec6e1b28f77396a1d2b676d934b737b95851
родитељ f865254b291c6bbbf43509de495b037fe4ac405b
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Thu, 28 Apr 2022 16:13:33 +0200

sled.c(next_match,prev_match): Fix positioning; version.do: Comment out redo-always

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

Diffstat:
Msled.c | 28+++++++++++++++++-----------
Mversion.do | 2+-
измењених датотека: 2, додавања: 18(+), брисања: 12(-)

diff --git a/sled.c b/sled.c @@ -1091,10 +1091,10 @@ input_cancel(struct DrawState* state) *state->error = 0; return 0; } - CLEAR(state->mode, M_INPUT); *state->input = 0; if (state->input_update_callback) state->input_update_callback(state); + CLEAR(state->mode, M_INPUT | M_INPUT_NUM); state->input_callback = NULL; state->input_update_callback = NULL; return 0; @@ -1107,10 +1107,12 @@ input_enter(struct DrawState* state) { state->input_callback(state); if (!*state->error) - CLEAR(state->mode, M_INPUT); + CLEAR(state->mode, M_INPUT | M_INPUT_NUM); + state->input_callback = NULL; } else - CLEAR(state->mode, M_INPUT); + CLEAR(state->mode, M_INPUT | M_INPUT_NUM); + state->input_update_callback = NULL; return 0; } @@ -1465,7 +1467,7 @@ next_match(struct DrawState* state) { struct BufferLine* current = NULL; const uint32_t* found = NULL; - size_t xpos; + size_t idelta; if (!state->search || !*state->search) return 0; @@ -1482,11 +1484,13 @@ next_match(struct DrawState* state) found = u32_strstr(found, state->search); if (found) { - xpos = found - (const uint32_t*)current->text; - state->saved_column = xpos; + idelta = found - (const uint32_t*)current->text; + state->saved_column = display_length(state, + current->text, idelta); if (*current->text) { - position_to(state, row, xpos); + position_to(state, row, + state->saved_column); return 0; } } @@ -1603,7 +1607,7 @@ prev_match(struct DrawState* state) { struct BufferLine* current = NULL; const uint32_t* found = NULL; - size_t xpos; + size_t idelta; if (!state->search || !*state->search) return 0; @@ -1620,11 +1624,13 @@ prev_match(struct DrawState* state) found = u32_strstr(found, state->search); if (found) { - xpos = found - (const uint32_t*)current->text; - state->saved_column = xpos; + idelta = found - (const uint32_t*)current->text; + state->saved_column = display_length(state, + current->text, idelta); if (*current->text) { - position_to(state, row - 1, xpos); + position_to(state, row - 1, + state->saved_column); return 0; } } diff --git a/version.do b/version.do @@ -1,5 +1,5 @@ FALLBACKVER=${FALLBACKVER:-unknown} { command -v git >/dev/null 2>&1 && git describe >/dev/null 2>&1; } && \ git describe 2>/dev/null | sed 's/^v//' >$3 || echo $FALLBACKVER >$3 -redo-always +#redo-always redo-stamp <$3