чување 5cf1c3e993b795e94f2831818cf3843b574f37c5
родитељ 7a8e79afe7e405ed2fe508a8fc856dbe91ea12ee
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Fri, 9 Jul 2021 20:55:57 +0200
More small fixes
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 4, додавања: 13(+), брисања: 3(-)
diff --git a/draw.c b/draw.c
@@ -103,6 +103,8 @@ init_drawstate(struct DrawState* state, char* error, char* filename,
state->prompt_callback = NULL;
state->running = 1;
state->dirty = 0;
+ state->dirty_before_edit = 0;
+ state->fuzzy_before_edit = 0;
state->in_prompt = 0;
state->show_help = 0;
state->show_edit = 0;
@@ -728,6 +730,8 @@ draw_status(const struct DrawState* state)
else
while (pseg < status_segments + LEN(status_segments))
{
+ int last = pseg-status_segments ==
+ LEN(status_segments)-1;
buf[0] = 0;
if (pseg->callback)
pseg->callback(buf, MAXBUFLINE, pseg->format,
@@ -739,7 +743,8 @@ draw_status(const struct DrawState* state)
seg_size = state->maxx-1 - current_start;
if (!draw_string(current_start, state->maxy-1, pseg->fg,
pseg->bg, buf,
- MIN(seg_size, strlen(buf)+2), seg_size,
+ MIN(seg_size, strlen(buf)+2),
+ last ? seg_size+1 : seg_size,
1, 1, pseg->alignment, 0, 1, NULL,
0, 0))
return NULL;
diff --git a/draw.h b/draw.h
@@ -59,6 +59,7 @@ struct DrawState {
int running;
int dirty;
int dirty_before_edit;
+ size_t fuzzy_before_edit;
int in_prompt;
int show_help;
int show_edit;
diff --git a/po.c b/po.c
@@ -963,6 +963,7 @@ parse_po_line(const char* line, struct DrawState* dstate,
FL_FUZZY]))
{
(*current_entry)->flags |= FL_FUZZY;
+ dstate->fuzzy_count++;
ptoken += strlen(flag_strings[
FL_FUZZY]);
}
diff --git a/poe.c b/poe.c
@@ -448,6 +448,7 @@ cancel_msgstr(struct DrawState* state)
free(state->info_buffer);
state->info_buffer = NULL;
state->dirty = state->dirty_before_edit;
+ state->fuzzy_count = state->fuzzy_before_edit;
}
void
@@ -738,6 +739,7 @@ next_untranslated(struct DrawState* state)
{
save_msgstr(state);
state->dirty_before_edit = state->dirty;
+ state->fuzzy_before_edit = state->fuzzy_count;
}
state->msgid_number = e + 1;
@@ -789,6 +791,7 @@ next_fuzzy(struct DrawState* state)
{
save_msgstr(state);
state->dirty_before_edit = state->dirty;
+ state->fuzzy_before_edit = state->fuzzy_count;
}
state->msgid_number = e + 1;
@@ -1204,8 +1207,6 @@ erase_forward(struct DrawState* state)
strcpy(state->error, errors[ERR_CANT_ALLOC]);
state->running = 0;
}
- else
- ;
}
}
@@ -1411,6 +1412,7 @@ handle_editbox_key_event(struct tb_event* ev, struct DrawState* state)
{
save_msgstr(state);
state->dirty_before_edit = state->dirty;
+ state->fuzzy_before_edit = state->fuzzy_count;
move_list_down(state);
state->msgstr_index = 0;
load_msgstr(state);
@@ -1558,6 +1560,7 @@ handle_key_event(struct tb_event* ev, struct DrawState* state)
if (load_msgstr(state) && load_info(state))
{
state->dirty_before_edit = state->dirty;
+ state->fuzzy_before_edit = state->fuzzy_count;
state->show_edit = 1;
state->input_row = 0;
state->input_first_shown_row = 0;