Skip to content

Commit 5ad5e59

Browse files
committed
Update CHANGELOG and Rebuild nuklear.h
1 parent aedc337 commit 5ad5e59

File tree

3 files changed

+25
-15
lines changed

3 files changed

+25
-15
lines changed

clib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nuklear",
3-
"version": "4.12.8",
3+
"version": "4.12.9",
44
"repo": "Immediate-Mode-UI/Nuklear",
55
"description": "A small ANSI C gui toolkit",
66
"keywords": ["gl", "ui", "toolkit"],

nuklear.h

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8926,12 +8926,12 @@ nk_str_insert_at_rune(struct nk_str *str, int pos, const char *cstr, int len)
89268926
NK_API int
89278927
nk_str_insert_text_char(struct nk_str *str, int pos, const char *text, int len)
89288928
{
8929-
return nk_str_insert_text_utf8(str, pos, text, len);
8929+
return nk_str_insert_at_rune(str, pos, text, len) ? len : 0;
89308930
}
89318931
NK_API int
89328932
nk_str_insert_str_char(struct nk_str *str, int pos, const char *text)
89338933
{
8934-
return nk_str_insert_text_utf8(str, pos, text, nk_strlen(text));
8934+
return nk_str_insert_text_char(str, pos, text, nk_strlen(text));
89358935
}
89368936
NK_API int
89378937
nk_str_insert_text_utf8(struct nk_str *str, int pos, const char *text, int len)
@@ -27150,7 +27150,7 @@ nk_textedit_paste(struct nk_text_edit *state, char const *ctext, int len)
2715027150
glyphs = nk_utf_len(ctext, len);
2715127151
if (nk_str_insert_text_char(&state->string, state->cursor, text, len)) {
2715227152
nk_textedit_makeundo_insert(state, state->cursor, glyphs);
27153-
state->cursor += len;
27153+
state->cursor += glyphs;
2715427154
state->has_preferred_x = 0;
2715527155
return 1;
2715627156
}
@@ -28109,17 +28109,19 @@ nk_do_edit(nk_flags *state, struct nk_command_buffer *out,
2810928109
int cut = nk_input_is_key_pressed(in, NK_KEY_CUT);
2811028110
if ((copy || cut) && (flags & NK_EDIT_CLIPBOARD))
2811128111
{
28112-
int glyph_len;
28113-
nk_rune unicode;
28114-
const char *text;
28115-
int b = edit->select_start;
28116-
int e = edit->select_end;
28117-
28118-
int begin = NK_MIN(b, e);
28119-
int end = NK_MAX(b, e);
28120-
text = nk_str_at_const(&edit->string, begin, &unicode, &glyph_len);
28121-
if (edit->clip.copy)
28122-
edit->clip.copy(edit->clip.userdata, text, end - begin);
28112+
int begin = NK_MIN(edit->select_start, edit->select_end);
28113+
int end = NK_MAX(edit->select_start, edit->select_end);
28114+
28115+
if (edit->clip.copy) {
28116+
int glyph_len;
28117+
nk_rune unicode;
28118+
const char *text_begin, *text_end;
28119+
text_begin = nk_str_at_const(&edit->string, begin, &unicode, &glyph_len);
28120+
/*Reuse temporary variables (unicode, glyph_len)*/
28121+
text_end = nk_str_at_const(&edit->string, end, &unicode, &glyph_len);
28122+
28123+
edit->clip.copy(edit->clip.userdata, text_begin, text_end - text_begin);
28124+
}
2812328125
if (cut && !(flags & NK_EDIT_READ_ONLY)){
2812428126
nk_textedit_cut(edit);
2812528127
cursor_follow = nk_true;
@@ -30729,6 +30731,10 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args)
3072930731
/// - [y]: Minor version with non-breaking API and library changes
3073030732
/// - [z]: Patch version with no direct changes to the API
3073130733
///
30734+
/// - 2025/10/18 (4.12.9) - Fix clipboard handling(BREAKING CHANGE for custom backend):
30735+
/// (1) length as byte count in copy callback(nk_do_edit), see #841
30736+
/// (2) Fix nk_str_insert_text_char and nk_str_insert_str_char, see #840
30737+
/// (3) Fix UTF-8 cursor(nk_textedit_paste), see #841
3073230738
/// - 2025/10/08 (4.12.8) - Fix nk_widget_text to use NK_TEXT_ALIGN_LEFT by default,
3073330739
/// instead of silently failing when no x-axis alignment is provided,
3073430740
/// and refactor this function to keep the code style consistent

src/CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
/// - [y]: Minor version with non-breaking API and library changes
88
/// - [z]: Patch version with no direct changes to the API
99
///
10+
/// - 2025/10/18 (4.12.9) - Fix clipboard handling(BREAKING CHANGE for custom backend):
11+
/// (1) length as byte count in copy callback(nk_do_edit), see #841
12+
/// (2) Fix nk_str_insert_text_char and nk_str_insert_str_char, see #840
13+
/// (3) Fix UTF-8 cursor(nk_textedit_paste), see #841
1014
/// - 2025/10/08 (4.12.8) - Fix nk_widget_text to use NK_TEXT_ALIGN_LEFT by default,
1115
/// instead of silently failing when no x-axis alignment is provided,
1216
/// and refactor this function to keep the code style consistent

0 commit comments

Comments
 (0)