summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-18 13:09:04 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-18 13:09:04 +0200
commit3ec5dbd52ed34e48fefee989b4ea9d095ab094a7 (patch)
tree52605e662f17fc023abab267350c96dec4b83e56 /clients
parentc6869bb32bd0031118d9bdf8b8ce8a562eb18f8f (diff)
downloadbokf-3acfedade632e34cd0615819a1aa405307b8aacc.tar.gz
bokf-3acfedade632e34cd0615819a1aa405307b8aacc.zip
bokftui: caret follows field_pos in header fields (template/voucher forms)v0.1.20
Namn/Serie/Text (and the voucher date) drew the caret at the end of the string; editing worked but the cursor never appeared to move.
Diffstat (limited to 'clients')
-rw-r--r--clients/bokftui.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/clients/bokftui.c b/clients/bokftui.c
index ceaf525..4895704 100644
--- a/clients/bokftui.c
+++ b/clients/bokftui.c
@@ -1738,7 +1738,12 @@ static int64_t vouchers_new(struct app *a)
if (field == k) {
attron(A_REVERSE);
caret_y = hy[k];
- int cw = disp_width(hvals[k]);
+ size_t slen = strlen(hvals[k]);
+ size_t cp = (field_fresh || field_pos == (size_t)-1 ||
+ field_pos > slen)
+ ? slen
+ : field_pos;
+ int cw = (int)disp_width_n(hvals[k], cp);
caret_x = hx[k] + (cw > w ? w : cw);
}
mvaddstr(hy[k], hx[k], padded);
@@ -2888,7 +2893,12 @@ static int template_form(struct app *a, const char *load_name)
if (field == k) {
attron(A_REVERSE);
caret_y = hy[k];
- int cw = disp_width(hvals[k]);
+ size_t slen = strlen(hvals[k]);
+ size_t cp = (field_fresh || field_pos == (size_t)-1 ||
+ field_pos > slen)
+ ? slen
+ : field_pos;
+ int cw = (int)disp_width_n(hvals[k], cp);
caret_x = hx[k] + (cw > w ? w : cw);
}
mvaddstr(hy[k], hx[k], padded);