mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
Cursor need shift to left after merge pull request #1220
This commit is contained in:
parent
b6b5b68d2c
commit
30539a51ec
@ -405,11 +405,15 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox)
|
|||||||
char buf[LV_SPINBOX_MAX_DIGIT_COUNT + 8];
|
char buf[LV_SPINBOX_MAX_DIGIT_COUNT + 8];
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
char * buf_p = buf;
|
char * buf_p = buf;
|
||||||
|
uint8_t cur_shift_left = 0;
|
||||||
|
|
||||||
if (ext->range_min < 0) { // hide sign if there are only positive values
|
if (ext->range_min < 0) { // hide sign if there are only positive values
|
||||||
/*Add the sign*/
|
/*Add the sign*/
|
||||||
(*buf_p) = ext->value >= 0 ? '+' : '-';
|
(*buf_p) = ext->value >= 0 ? '+' : '-';
|
||||||
buf_p++;
|
buf_p++;
|
||||||
|
} else {
|
||||||
|
/*Cursor need shift to left*/
|
||||||
|
cur_shift_left++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t i;
|
int32_t i;
|
||||||
@ -467,7 +471,7 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox)
|
|||||||
|
|
||||||
if(cur_pos > intDigits) cur_pos++; /*Skip teh decimal point*/
|
if(cur_pos > intDigits) cur_pos++; /*Skip teh decimal point*/
|
||||||
|
|
||||||
cur_pos += ext->digit_padding_left;
|
cur_pos += (ext->digit_padding_left - cur_shift_left);
|
||||||
|
|
||||||
lv_ta_set_cursor_pos(spinbox, cur_pos);
|
lv_ta_set_cursor_pos(spinbox, cur_pos);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user