summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--render/textinput.c4
-rw-r--r--riscos/font.c15
2 files changed, 16 insertions, 3 deletions
diff --git a/render/textinput.c b/render/textinput.c
index 71b4e53e0..5fa33c7cf 100644
--- a/render/textinput.c
+++ b/render/textinput.c
@@ -1385,7 +1385,7 @@ bool textinput_textarea_callback(struct browser_window *bw, uint32_t key,
bool success;
gui_get_clipboard(&buff, &buff_len);
- if (utf8 == NULL)
+ if (buff == NULL)
return false;
success = browser_window_paste_text(bw, buff, buff_len, true);
@@ -2032,7 +2032,7 @@ bool textinput_input_callback(struct browser_window *bw, uint32_t key,
bool success;
gui_get_clipboard(&buff, &buff_len);
- if (utf8 == NULL)
+ if (buff == NULL)
return false;
success = browser_window_paste_text(bw, buff, buff_len, true);
diff --git a/riscos/font.c b/riscos/font.c
index d92d5b521..326cca973 100644
--- a/riscos/font.c
+++ b/riscos/font.c
@@ -358,10 +358,23 @@ bool nsfont_split(const plot_font_style_t *fstyle,
return false;
}
- if (*char_offset != length)
+ if (*char_offset != length) {
+ /* we found something to split at */
+ size_t orig = *char_offset;
+
+ /* ensure a space at <= the split point we found */
while (*char_offset && string[*char_offset] != ' ')
(*char_offset)--;
+ /* nothing valid found <= split point, advance to next space */
+ if (*char_offset == 0) {
+ *char_offset = orig;
+ while (*char_offset != length &&
+ string[*char_offset] != ' ')
+ (*char_offset)++;
+ }
+ }
+
code = rufl_width(font_family, font_style, font_size,
string, *char_offset,
actual_x);