чување 4eee4739e9db4d25351e45b803aa0d7edf606157
родитељ 293cc92e603b6a20af5d0845d9592c77ff66a089
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Thu, 24 Feb 2022 08:19:35 +0100
Fix dimensions in drawing routines
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 3, додавања: 8(+), брисања: 6(-)
diff --git a/AUTHORS b/AUTHORS
@@ -0,0 +1 @@
+Strahinya Radich <contact@strahinja.org>
diff --git a/draw.c b/draw.c
@@ -31,6 +31,7 @@ static const char* help[] = {
"G or End - Go to last entry",
"z or C-Z - Toggle fuzzy flag",
"q or C-Q - Quit",
+ "",
"See the manual (man poe) for full help."};
static const char* editbox_title = "Edit translation";
const char* errors[] = {
@@ -557,10 +558,10 @@ draw_help(const struct DrawState* state)
int maxy = state->maxy;
startx = w > maxx ? 0 : (maxx - w) / 2;
- endx = w > maxx ? maxx - 1 : maxx - startx;
+ endx = w > maxx ? maxx - 1 : startx + w;
starty = h > maxy - 1 ? 0 : (maxy - h) / 2;
- endy = h > maxy - 1 ? maxy - 2 : maxy - starty;
+ endy = h > maxy - 1 ? maxy - 2 : starty + h;
draw_box(startx, endx, starty, endy, DLG_FG, DLG_BG);
if (!draw_string(startx, starty, TITLE_FG, TITLE_BG, help_title,
@@ -598,10 +599,10 @@ draw_editbox(const struct DrawState* state)
strcpy(flags_buf + 2 + MAXFLAGSBUF - 1, " ]");
startx = w > maxx ? 0 : (maxx - w) / 2;
- endx = w > maxx ? maxx - 1 : maxx - startx;
+ endx = w > maxx ? maxx - 1 : startx + w;
starty = h > maxy - 1 ? 0 : (maxy - h) / 2;
- endy = h > maxy - 1 ? maxy - 2 : maxy - starty;
+ endy = h > maxy - 1 ? maxy - 2 : starty + h;
draw_box(startx, endx, starty, endy, DLG_FG, DLG_BG);
if (!draw_string(startx + 1, starty, TITLE_FG, TITLE_BG, editbox_title,
@@ -701,7 +702,7 @@ draw_search(const struct DrawState* state)
size_t dlen = 0;
startx = w > maxx ? 0 : (maxx - w) / 2;
- endx = w > maxx ? maxx - 1 : maxx - startx;
+ endx = w > maxx ? maxx - 1 : startx + w;
starty = maxy - 1 - h;
endy = maxy - 1;
diff --git a/draw.h b/draw.h
@@ -13,7 +13,7 @@
#define EDIT_WIDTH 70
#define EDIT_HEIGHT 20
#define HELP_WIDTH 50
-#define HELP_HEIGHT 21
+#define HELP_HEIGHT 22
#define SEARCH_WIDTH 20
#define SEARCH_HEIGHT 4
#define TAB_SIZE 8