mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 22:41:30 +03:00
Return message to client when textarea is modified.
This commit is contained in:
parent
8b253a2151
commit
838359194e
@ -160,6 +160,7 @@ static void textarea_normalise_text(struct textarea *ta,
|
|||||||
unsigned int b_start, unsigned int b_len)
|
unsigned int b_start, unsigned int b_len)
|
||||||
{
|
{
|
||||||
bool multi = (ta->flags & TEXTAREA_MULTILINE) ? true : false;
|
bool multi = (ta->flags & TEXTAREA_MULTILINE) ? true : false;
|
||||||
|
struct textarea_msg msg;
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
|
|
||||||
/* Remove CR characters. If it's a CRLF pair delete the CR, or replace
|
/* Remove CR characters. If it's a CRLF pair delete the CR, or replace
|
||||||
@ -187,6 +188,14 @@ static void textarea_normalise_text(struct textarea *ta,
|
|||||||
ta->text.data[b_start + index] = ' ';
|
ta->text.data[b_start + index] = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Build text modified message */
|
||||||
|
msg.ta = ta;
|
||||||
|
msg.type = TEXTAREA_MSG_TEXT_MODIFIED;
|
||||||
|
msg.data.modified.text = ta->text.data;
|
||||||
|
msg.data.modified.len = ta->text.len;
|
||||||
|
|
||||||
|
/* Pass message to client */
|
||||||
|
ta->callback(ta->data, &msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,8 @@ typedef enum {
|
|||||||
TEXTAREA_MSG_DRAG_REPORT, /**< Textarea drag start/end report */
|
TEXTAREA_MSG_DRAG_REPORT, /**< Textarea drag start/end report */
|
||||||
TEXTAREA_MSG_SELECTION_REPORT, /**< Textarea text selection presence */
|
TEXTAREA_MSG_SELECTION_REPORT, /**< Textarea text selection presence */
|
||||||
TEXTAREA_MSG_REDRAW_REQUEST, /**< Textarea redraw request */
|
TEXTAREA_MSG_REDRAW_REQUEST, /**< Textarea redraw request */
|
||||||
TEXTAREA_MSG_CARET_UPDATE /**< Textarea caret */
|
TEXTAREA_MSG_CARET_UPDATE, /**< Textarea caret */
|
||||||
|
TEXTAREA_MSG_TEXT_MODIFIED /**< Textarea text modified */
|
||||||
} textarea_msg_type;
|
} textarea_msg_type;
|
||||||
|
|
||||||
struct textarea_msg {
|
struct textarea_msg {
|
||||||
@ -77,6 +78,10 @@ struct textarea_msg {
|
|||||||
struct rect *clip; /**< Carret clip rect */
|
struct rect *clip; /**< Carret clip rect */
|
||||||
} pos; /**< With _CARET_SET_POS */
|
} pos; /**< With _CARET_SET_POS */
|
||||||
} caret; /**< With _CARET_UPDATE */
|
} caret; /**< With _CARET_UPDATE */
|
||||||
|
struct {
|
||||||
|
const char *text; /**< UTF8 text */
|
||||||
|
unsigned int len; /**< Byte length of text */
|
||||||
|
} modified; /**< With _TEXT_MODIFIED */
|
||||||
} data; /**< Depends on msg type */
|
} data; /**< Depends on msg type */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -204,6 +204,10 @@ static void box_textarea_callback(void *data, struct textarea_msg *msg)
|
|||||||
msg->data.caret.pos.clip);
|
msg->data.caret.pos.clip);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TEXTAREA_MSG_TEXT_MODIFIED:
|
||||||
|
/* TODO */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user