Page MenuHome GnuPG

pinentry-curses-chinese.patch

Authored By
chyen
Jul 1 2019, 3:20 PM
Size
1 KB
Subscribers
None

pinentry-curses-chinese.patch

diff --git a/pinentry/pinentry-curses.c b/pinentry/pinentry-curses.c
index cfc1abd..cc21eaf 100644
--- a/pinentry/pinentry-curses.c
+++ b/pinentry/pinentry-curses.c
@@ -137,7 +137,7 @@ typedef char CH;
there is a forced line break. A full line is returned and will be
continued in the next line. */
static void
-collect_line (int maxwidth, CH **start_p, int *len_p)
+collect_line (int maxwidth, CH **start_p, int *len_p, int *width_p)
{
int last_space = 0;
int len = *len_p;
@@ -160,6 +160,7 @@ collect_line (int maxwidth, CH **start_p, int *len_p)
if (*end == SPCH)
last_space = len;
width += CHWIDTH (*end);
+ fprintf(stderr, "%d %d ", *end, width);
}
if (*end != NULLCH && *end != NLCH && last_space != 0)
@@ -171,6 +172,10 @@ collect_line (int maxwidth, CH **start_p, int *len_p)
(*start_p)[len] = NLCH;
}
*len_p = len + 1;
+ if (width_p)
+ {
+ *width_p = width + 1;
+ }
}
#ifdef HAVE_NCURSESW
@@ -339,12 +344,13 @@ dialog_create (pinentry_t pinentry, dialog_t dialog)
{
CH *start = description;
int len = 0;
+ int description_width = 0;
do
{
- collect_line (size_x - 4, &start, &len);
- if (len > description_x)
- description_x = len;
+ collect_line (size_x - 4, &start, &len, &description_width);
+ if (description_width > description_x)
+ description_x = description_width;
y++;
}
while (start[len - 1]);
@@ -475,7 +481,7 @@ dialog_create (pinentry_t pinentry, dialog_t dialog)
move (ypos, xpos);
addch (ACS_VLINE);
addch (' ');
- collect_line (size_x - 4, &start, &len);
+ collect_line (size_x - 4, &start, &len, NULL);
for (i = 0; i < len - 1; i++)
{
ADDCH (start[i]);

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
474728

Event Timeline