This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch main
in repository elaro.
View the commit online.
commit 108e6ada87e0104fee3abbce7a769ca74670330d
Author: Alastair Poole <[email protected]>
AuthorDate: Sat Nov 28 14:50:14 2026 +0000
links: highlight in titles
---
NEWS | 1 +
data/themes/widgets.edc | 5 ++++
src/fe-efl/ui/elaro_ui.c | 1 +
src/fe-efl/ui/elaro_ui_buffers.c | 2 +-
src/fe-efl/ui/elaro_ui_links.c | 21 +++++++++++--
src/fe-efl/ui/elaro_ui_text.c | 18 +++++++++++
src/fe-efl/ui/elaro_ui_text.h | 4 +++
tests/fe-efl/meson.build | 4 ++-
tests/fe-efl/test-links.c | 65 ++++++++++++++++++++++++++++++++++++++--
9 files changed, 113 insertions(+), 8 deletions(-)
diff --git a/NEWS b/NEWS
index ff3431e..38b6a06 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Elaro 0.1.4
* Chat nicknames appear without angle brackets and use colors from the active theme’s palette.
* Nicknames in server messages use the same colors as chat nicknames.
* Chat history timestamps appear without square brackets.
+ * Links in channel topics are highlighted and clickable, just like links in chat.
* Default Elementary popups use a compact, flat close button in the top-right corner.
* Image previews fill the available space and can open the original image in the browser.
diff --git a/data/themes/widgets.edc b/data/themes/widgets.edc
index 5dbbd4e..76e835f 100644
--- a/data/themes/widgets.edc
+++ b/data/themes/widgets.edc
@@ -720,6 +720,11 @@ group { name: "elm/entry/base-single/default";
}
}
+group { name: "elm/entry/base-single/elaro/topic";
+ inherit: "elm/entry/base-single/default";
+ parts { part { name: "elm.text"; source6: "elm/entry/anchor/default"; } }
+}
+
group { name: "elm/entry/base-single-noedit/combobox_vertical/default";
inherit: "elm/entry/base-single/default";
parts { part { name: "elm.text"; entry_mode: PLAIN; source4: ""; } }
diff --git a/src/fe-efl/ui/elaro_ui.c b/src/fe-efl/ui/elaro_ui.c
index 28025d9..b7ed42f 100644
--- a/src/fe-efl/ui/elaro_ui.c
+++ b/src/fe-efl/ui/elaro_ui.c
@@ -392,6 +392,7 @@ elaro_ui_run(int argc, char **argv)
elm_object_part_content_set(right, "left", conversation);
ui.topic = elaro_ui_entry_add(conversation, EINA_FALSE);
+ elm_object_style_set(ui.topic, "elaro/topic");
elm_entry_single_line_set(ui.topic, EINA_TRUE);
elm_entry_scrollable_set(ui.topic, EINA_TRUE);
elaro_ui_entry_auto_scroll_enable(ui.topic);
diff --git a/src/fe-efl/ui/elaro_ui_buffers.c b/src/fe-efl/ui/elaro_ui_buffers.c
index 0190497..1bce217 100644
--- a/src/fe-efl/ui/elaro_ui_buffers.c
+++ b/src/fe-efl/ui/elaro_ui_buffers.c
@@ -405,7 +405,7 @@ _topic_update(Elaro_Ui *ui)
if (!ui->user_panel_animator) _user_panel_animate(ui, 1.0);
}
}
- safe = elm_entry_utf8_to_markup(b && b->topic ? b->topic : "");
+ safe = elaro_ui_text_links_markup(b && b->topic ? b->topic : "");
elm_entry_entry_set(ui->topic, safe);
free(safe);
elm_object_part_text_set(ui->topic, "guide", b && b->channel ? _("Topic — Enter to set") : "");
diff --git a/src/fe-efl/ui/elaro_ui_links.c b/src/fe-efl/ui/elaro_ui_links.c
index d69a7be..02ab8c5 100644
--- a/src/fe-efl/ui/elaro_ui_links.c
+++ b/src/fe-efl/ui/elaro_ui_links.c
@@ -193,6 +193,15 @@ _link_clicked_cb(void *data, Evas_Object *obj, void *info)
anchor = info;
if (!anchor || anchor->button != 1 || !anchor->name) return;
+ if (obj == ui->topic)
+ {
+ char *text = elaro_ui_field_text_get(obj);
+ Eina_Bool confirmed = ui->current && ui->current->topic &&
+ text && !strcmp(text, ui->current->topic);
+
+ free(text);
+ if (!confirmed) return;
+ }
image = eina_str_has_prefix(anchor->name, "image:");
audio = eina_str_has_prefix(anchor->name, "audio:");
@@ -233,12 +242,18 @@ void
elaro_ui_links_reset(Elaro_Ui *ui)
{
elm_object_cursor_set(ui->history, ELM_CURSOR_XTERM);
+ elm_object_cursor_set(ui->topic, ELM_CURSOR_XTERM);
}
void
elaro_ui_links_init(Elaro_Ui *ui)
{
- evas_object_smart_callback_add(ui->history, "anchor,clicked", _link_clicked_cb, ui);
- evas_object_smart_callback_add(ui->history, "anchor,in", _link_in_cb, ui);
- evas_object_smart_callback_add(ui->history, "anchor,out", _link_out_cb, ui);
+ Evas_Object *entries[] = { ui->history, ui->topic };
+
+ for (unsigned int i = 0; i < EINA_C_ARRAY_LENGTH(entries); i++)
+ {
+ evas_object_smart_callback_add(entries[i], "anchor,clicked", _link_clicked_cb, ui);
+ evas_object_smart_callback_add(entries[i], "anchor,in", _link_in_cb, ui);
+ evas_object_smart_callback_add(entries[i], "anchor,out", _link_out_cb, ui);
+ }
}
diff --git a/src/fe-efl/ui/elaro_ui_text.c b/src/fe-efl/ui/elaro_ui_text.c
index 86400bc..a653d5c 100644
--- a/src/fe-efl/ui/elaro_ui_text.c
+++ b/src/fe-efl/ui/elaro_ui_text.c
@@ -262,6 +262,24 @@ allocation_failed:
return NULL;
}
+char *
+elaro_ui_text_links_markup(const char *text)
+{
+ Eina_Strbuf *out = eina_strbuf_new();
+ Eina_Strbuf *run = eina_strbuf_new();
+ char *markup = NULL;
+
+ if (out && run)
+ {
+ eina_strbuf_append(run, text);
+ _append_text(out, run, NULL, NULL);
+ markup = eina_strbuf_release(out);
+ }
+ else if (out) eina_strbuf_free(out);
+ if (run) eina_strbuf_free(run);
+ return markup;
+}
+
char *
elaro_ui_text_markup(const char *text)
{
diff --git a/src/fe-efl/ui/elaro_ui_text.h b/src/fe-efl/ui/elaro_ui_text.h
index 6dbb6a6..2faa9fc 100644
--- a/src/fe-efl/ui/elaro_ui_text.h
+++ b/src/fe-efl/ui/elaro_ui_text.h
@@ -1,5 +1,6 @@
#ifndef ELARO_UI_TEXT_H
#define ELARO_UI_TEXT_H
+
#include "../elaro_util.h"
#include "../../engine/elaro_nick_match.h"
Eina_Bool
@@ -8,6 +9,9 @@ elaro_ui_text_audio_url_check(const char *url);
Eina_Bool
elaro_ui_text_image_url_check(const char *url);
+char *
+elaro_ui_text_links_markup(const char *text);
+
/* Convert IRC formatting into escaped, balanced Elementary text markup. */
char *
elaro_ui_text_markup(const char *text);
diff --git a/tests/fe-efl/meson.build b/tests/fe-efl/meson.build
index 1269c4c..914634d 100644
--- a/tests/fe-efl/meson.build
+++ b/tests/fe-efl/meson.build
@@ -75,12 +75,14 @@ test('Music playback helper', python,
links_test = executable('test-links', 'test-links.c',
'../../src/fe-efl/ui/elaro_ui_image.c',
+ '../../src/fe-efl/ui/elaro_ui_text.c',
'../../src/fe-efl/ui/elaro_ui_util.c',
include_directories : rootinc,
link_with : config_lib,
dependencies : [dep[0], elementary_dep, eet_dep, ecore_file_dep])
test('External link confirmation', python,
- args : [files('isolated.py'), links_test, files('../../data/images/elaro-128.png')], timeout : 15,
+ args : [files('isolated.py'), links_test, files('../../data/images/elaro-128.png'), elaro_assets[1]],
+ timeout : 15,
env : ['ELM_ENGINE=buffer', 'ECORE_NO_SYSTEM_MODULES=1', 'EINA_LOG_LEVEL=0'])
ecore_dep = dependency('ecore')
diff --git a/tests/fe-efl/test-links.c b/tests/fe-efl/test-links.c
index 5ccadb3..ee4c344 100644
--- a/tests/fe-efl/test-links.c
+++ b/tests/fe-efl/test-links.c
@@ -32,14 +32,65 @@ static Ecore_Exe *capture_spawn(const char *command, Ecore_Exe_Flags flags, cons
#undef ecore_exe_pipe_run
void elaro_ui_music_show(Elaro_Ui *ui, const char *url) {}
-Eina_Bool elaro_ui_text_image_url_check(const char *url) { return FALSE; }
-Eina_Bool elaro_ui_text_audio_url_check(const char *url) { return FALSE; }
static void click(const char *part)
{
evas_object_smart_callback_call(elm_object_part_content_get(popup, part), "clicked", NULL);
}
+static void check_topic_link(Elaro_Ui *ui)
+{
+ Elaro_Ui_Buffer channel = { .channel = EINA_TRUE, .topic = "https://example.org/topic" };
+ ui->topic = elaro_ui_entry_add(ui->win, EINA_FALSE);
+ elm_object_style_set(ui->topic, "elaro/topic");
+ ui->history = elm_entry_add(ui->win);
+ ui->current = &channel;
+ elaro_ui_links_init(ui);
+ elm_win_resize_object_add(ui->win, ui->topic);
+ elm_entry_single_line_set(ui->topic, EINA_TRUE);
+ elm_entry_scrollable_set(ui->topic, EINA_TRUE);
+ char *markup = elaro_ui_text_links_markup(channel.topic);
+ elm_entry_entry_set(ui->topic, markup);
+ free(markup);
+ char *plain = elaro_ui_field_text_get(ui->topic);
+ g_assert_cmpstr(plain, ==, channel.topic);
+ free(plain);
+ evas_object_show(ui->topic);
+ evas_object_show(ui->win);
+ Evas *canvas = evas_object_evas_get(ui->win);
+ for (unsigned int i = 0; i < 10; i++) {
+ ecore_main_loop_iterate_may_block(EINA_FALSE);
+ evas_render(canvas);
+ }
+ Evas_Object *text = elm_entry_textblock_get(ui->topic);
+ if (ui->theme_path) {
+ const char *group = NULL;
+ edje_object_file_get(evas_object_smart_parent_get(text), NULL, &group);
+ g_assert_cmpstr(group, ==, "elm/entry/base-single/elaro/topic");
+ }
+ Evas_Textblock_Cursor *cursor = evas_object_textblock_cursor_new(text);
+ evas_textblock_cursor_pos_set(cursor, 3);
+ int x, y, char_x, char_y, w, h;
+ evas_object_geometry_get(text, &x, &y, NULL, NULL);
+ evas_textblock_cursor_char_geometry_get(cursor, &char_x, &char_y, &w, &h);
+ evas_textblock_cursor_free(cursor);
+ g_assert_cmpint(w, >, 0);
+ popup = NULL;
+ evas_event_feed_mouse_in(canvas, 0, NULL);
+ evas_event_feed_mouse_move(canvas, x + char_x + w / 2, y + char_y + h / 2, 0, NULL);
+ evas_event_feed_mouse_down(canvas, 1, EVAS_BUTTON_NONE, 0, NULL);
+ evas_event_feed_mouse_up(canvas, 1, EVAS_BUTTON_NONE, 0, NULL);
+ for (unsigned int i = 0; !popup && i < 10; i++)
+ ecore_main_loop_iterate_may_block(EINA_FALSE);
+ g_assert_nonnull(popup);
+ g_assert_cmpstr(elm_object_part_text_get(popup, "title,text"), ==, "Open link in browser?");
+ click("button2");
+ evas_object_del(ui->topic);
+ evas_object_del(ui->history);
+ ui->topic = ui->history = NULL;
+ ui->current = NULL;
+}
+
static void check_image_preview(Elaro_Ui *ui, const char *path)
{
evas_object_resize(ui->win, 800, 650);
@@ -96,8 +147,16 @@ int main(int argc, char **argv)
click("button2");
g_assert_cmpuint(launches, ==, 0);
g_assert_false(ui.config->always_allow_external_links);
- g_assert_cmpint(argc, ==, 2);
+ g_assert_cmpint(argc, ==, 3);
check_image_preview(&ui, argv[1]);
+ check_topic_link(&ui);
+ ui.theme_path = realpath(argv[2], NULL);
+ g_assert_nonnull(ui.theme_path);
+ elm_theme_overlay_add(NULL, ui.theme_path);
+ check_topic_link(&ui);
+ elm_theme_overlay_del(NULL, ui.theme_path);
+ free(ui.theme_path);
+ ui.theme_path = NULL;
g_assert_cmpuint(launches, ==, 0);
_external_confirm(&ui, test_url);
click("button1");
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.