Compare commits

..

2 commits

Author SHA1 Message Date
hippoz
e23f917f02
Remove option to use tag content as array 2021-07-20 02:14:56 +03:00
hippoz
d0e3ca7e21
Add markdown support 2021-07-20 02:14:20 +03:00
3 changed files with 8 additions and 10 deletions

View file

@ -1,7 +1,3 @@
--[[ utility functions ]]--
--
--[[ page module ]]-- --[[ page module ]]--
page = {} page = {}
@ -12,11 +8,11 @@ end
function page.Append(content) function page.Append(content)
for i, v in pairs(content) do for i, v in pairs(content) do
__ext_pageview_append_tag("t", v[1] or v) __ext_pageview_append_tag("t", v)
end end
end end
function page.Commit(content) function page.Commit(content)
page.Set("") page.Set("")
page.Append(content) page.Append(content)
end end

View file

@ -1,3 +1,5 @@
page.Commit{ page.Commit{
"yeah" "<span foreground='blue' size='x-large'>Blue text</span> is <i>cool</i>!",
} "\n",
"so true"
}

4
ui.c
View file

@ -34,9 +34,9 @@ void page_application_show(struct application_state* state) {
void page_application_text_buffer_append_text(struct application_state* state, const char* display_text) { void page_application_text_buffer_append_text(struct application_state* state, const char* display_text) {
GtkTextIter iter; GtkTextIter iter;
gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(state->pageview_buffer), &iter); gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(state->pageview_buffer), &iter);
gtk_text_buffer_insert(GTK_TEXT_BUFFER(state->pageview_buffer), &iter, display_text, -1); gtk_text_buffer_insert_markup(GTK_TEXT_BUFFER(state->pageview_buffer), &iter, display_text, -1);
} }
void page_application_text_buffer_set_text(struct application_state* state, const char* text) { void page_application_text_buffer_set_text(struct application_state* state, const char* text) {
gtk_text_buffer_set_text(state->pageview_buffer, text, -1); gtk_text_buffer_set_text(state->pageview_buffer, text, -1);
} }