summaryrefslogtreecommitdiff
path: root/code/fe310/eos/eve/widget/text.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2020-07-03 02:02:27 +0200
committerUros Majstorovic <majstor@majstor.org>2020-07-03 02:02:27 +0200
commitd8ced7b070beaa010f557c4c244c5c386d4e6efd (patch)
tree9f676f5ec4654f5d4b306393b2c35c34e50bdfe4 /code/fe310/eos/eve/widget/text.c
parentf550a31fda2cb7d76e917ab69d075daa1557bf99 (diff)
str widget draw selection and cursor implemented
Diffstat (limited to 'code/fe310/eos/eve/widget/text.c')
-rw-r--r--code/fe310/eos/eve/widget/text.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/code/fe310/eos/eve/widget/text.c b/code/fe310/eos/eve/widget/text.c
index a389fa7..0537e3d 100644
--- a/code/fe310/eos/eve/widget/text.c
+++ b/code/fe310/eos/eve/widget/text.c
@@ -157,7 +157,7 @@ static void _draw_line(EVETextWidget *widget, uint16_t l, uint16_t ch, uint16_t
eve_cmd_dl(END());
if (len) {
if (s) eve_cmd_dl(COLOR_RGB(0, 0, 0));
- eve_cmd(CMD_TEXT, "hhhhpb", _widget->g.x, _widget->g.y + l * widget->font->h, widget->font->id, 0, widget->text + ch, len, 0);
+ eve_cmd(CMD_TEXT, "hhhhpb", _widget->g.x + x1, _widget->g.y + l * widget->font->h, widget->font->id, 0, widget->text + ch, len, 0);
if (s) eve_cmd_dl(COLOR_RGB(255, 255, 255));
}
}
@@ -291,6 +291,8 @@ void eve_textw_putc(void *_page, int c) {
return;
}
+ if (!cursor1->on) return;
+
if (cursor2->on) {
EVETextCursor *c1;
EVETextCursor *c2;
@@ -318,7 +320,7 @@ void eve_textw_putc(void *_page, int c) {
ins_c = clipb ? strlen(clipb) : 0;
if (ins_c) {
if (widget->text_len >= widget->text_size - (ins_c - del_c)) ins_c = widget->text_size - widget->text_len + del_c - 1;
- ch_w = eve_font_bufw(widget->font, clipb, ins_c);
+ ch_w = eve_font_buf_w(widget->font, clipb, ins_c);
}
}
if (ins_c != del_c) memmove(text + ins_c, text + del_c, widget->text_len - c2->ch + 1);
@@ -332,7 +334,7 @@ void eve_textw_putc(void *_page, int c) {
}
if (c1 == cursor2) widget->cursor1 = widget->cursor2;
eve_textw_cursor_clear(widget, cursor2);
- } else if (cursor1->on) {
+ } else {
text = widget->text + cursor1->ch;
switch (c) {