The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
text_edit.c File Reference

idunn: the text, the caret and the selection of an editable text, and the keys that act on them the same way in a text field and a text area. More...

#include "idunn_internal.h"
#include <stdlib.h>
#include <string.h>

Functions

bool idunn_edit_set (idunn_edit_t *e, const char *text, size_t length)
void idunn_edit_free (idunn_edit_t *e)
size_t idunn_edit_start (const idunn_edit_t *e)
size_t idunn_edit_end (const idunn_edit_t *e)
size_t idunn_edit_prev (const idunn_edit_t *e, size_t pos)
size_t idunn_edit_next (const idunn_edit_t *e, size_t pos)
size_t idunn_edit_word_left (const idunn_edit_t *e, size_t pos)
size_t idunn_edit_word_right (const idunn_edit_t *e, size_t pos)
void idunn_edit_move (idunn_edit_t *e, size_t pos, bool extend)
void idunn_edit_select_word (idunn_edit_t *e, size_t pos)
bool idunn_edit_insert (idunn_edit_t *e, const char *text, size_t length)
 replace the selection with text
void idunn_edit_delete (idunn_edit_t *e, bool forward, bool word)
 delete the selection, or a character or a word before or after the caret
idunn_edit_result_t idunn_edit_key (idunn_widget_t *w, idunn_edit_t *e, const idunn_event_t *ev, bool multiline)
 the keys of editing: arrows, Home, End, Backspace, Delete, Ctrl+A/C/X/V, typing
bool idunn_edit_paste (idunn_edit_t *e, const char *text, size_t length, bool multiline)
 insert clipboard text (a single line keeps one line)

Detailed Description

idunn: the text, the caret and the selection of an editable text, and the keys that act on them the same way in a text field and a text area.

offsets are bytes of UTF-8 and always at the start of a character. the selection is from the anchor to the caret (empty when they are equal).

Function Documentation

◆ idunn_edit_set()

bool idunn_edit_set ( idunn_edit_t * e,
const char * text,
size_t length )

◆ idunn_edit_free()

void idunn_edit_free ( idunn_edit_t * e)

◆ idunn_edit_start()

size_t idunn_edit_start ( const idunn_edit_t * e)

◆ idunn_edit_end()

size_t idunn_edit_end ( const idunn_edit_t * e)

◆ idunn_edit_prev()

size_t idunn_edit_prev ( const idunn_edit_t * e,
size_t pos )

◆ idunn_edit_next()

size_t idunn_edit_next ( const idunn_edit_t * e,
size_t pos )

◆ idunn_edit_word_left()

size_t idunn_edit_word_left ( const idunn_edit_t * e,
size_t pos )

◆ idunn_edit_word_right()

size_t idunn_edit_word_right ( const idunn_edit_t * e,
size_t pos )

◆ idunn_edit_move()

void idunn_edit_move ( idunn_edit_t * e,
size_t pos,
bool extend )

◆ idunn_edit_select_word()

void idunn_edit_select_word ( idunn_edit_t * e,
size_t pos )

◆ idunn_edit_insert()

bool idunn_edit_insert ( idunn_edit_t * e,
const char * text,
size_t length )

replace the selection with text

◆ idunn_edit_delete()

void idunn_edit_delete ( idunn_edit_t * e,
bool forward,
bool word )

delete the selection, or a character or a word before or after the caret

◆ idunn_edit_key()

idunn_edit_result_t idunn_edit_key ( idunn_widget_t * w,
idunn_edit_t * e,
const idunn_event_t * ev,
bool multiline )

the keys of editing: arrows, Home, End, Backspace, Delete, Ctrl+A/C/X/V, typing

◆ idunn_edit_paste()

bool idunn_edit_paste ( idunn_edit_t * e,
const char * text,
size_t length,
bool multiline )

insert clipboard text (a single line keeps one line)