Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/littlevgl/lvgl
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed Dec 16, 2019
2 parents 1e4883f + 7567679 commit 4405ab9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lv_objx/lv_spinbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,15 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox)
char buf[LV_SPINBOX_MAX_DIGIT_COUNT + 8];
memset(buf, 0, sizeof(buf));
char * buf_p = buf;
uint8_t cur_shift_left = 0;

if (ext->range_min < 0) { // hide sign if there are only positive values
/*Add the sign*/
(*buf_p) = ext->value >= 0 ? '+' : '-';
buf_p++;
} else {
/*Cursor need shift to left*/
cur_shift_left++;
}

int32_t i;
Expand Down Expand Up @@ -467,7 +471,7 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox)

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);
}
Expand Down

0 comments on commit 4405ab9

Please sign in to comment.