This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efm2.
View the commit online.
commit 27c3b61c7ddef5b0e54e3444fd634625ed512106
Author: Carsten Haitzler (Rasterman) <[email protected]>
AuthorDate: Thu Feb 5 20:07:34 2026 +0000
typebuf - know how to hilight cmd args nicely too
---
src/efm/efm_typebuf.c | 45 +++++++++++++++++++++++++++++++++++++++------
1 file changed, 39 insertions(+), 6 deletions(-)
diff --git a/src/efm/efm_typebuf.c b/src/efm/efm_typebuf.c
index 3ae4ccf..266f2e3 100644
--- a/src/efm/efm_typebuf.c
+++ b/src/efm/efm_typebuf.c
@@ -57,12 +57,45 @@ _typebuf_command_str_build_args(Eina_Strbuf *buf, const char *str,
int cmdendpos)
{ // process arguments after cmd and put them back in the string
// e.g. hilight them as appropriate. here just dumbly appending
- char *s = strdup(str + cmdendpos - 1);
- char *s2 = elm_entry_utf8_to_markup(s);
+ char *markup, *p;
+ Eina_Bool in_opt = EINA_FALSE;
+ Eina_Bool prev_space = EINA_FALSE;
- eina_strbuf_append(buf, s2);
- free(s);
- free(s2);
+ markup = elm_entry_utf8_to_markup(str + cmdendpos - 1);
+ if (!markup) return;
+
+ for (p = markup; *p; p++)
+ {
+ char ch = *p;
+
+ if (in_opt)
+ { // we are in an option now
+ if ((ch == '=') || (ch == ' '))
+ { // options end with a space or might be --opt=x so hilite to =
+ eina_strbuf_append(buf, "</>");
+ in_opt = EINA_FALSE;
+ }
+ eina_strbuf_append_char(buf, ch);
+ }
+ else
+ {
+ if ((prev_space) && (ch == '-'))
+ { // common options srtart with - so start hilighting them
+ eina_strbuf_append(buf, "<hilight>");
+ eina_strbuf_append_char(buf, ch);
+ in_opt = EINA_TRUE;
+ }
+ else if (ch == '/')
+ { // path separators - hilight them
+ eina_strbuf_append(buf, "<hilight>");
+ eina_strbuf_append_char(buf, ch);
+ eina_strbuf_append(buf, "</>");
+ }
+ else eina_strbuf_append_char(buf, ch);
+ }
+ prev_space = (ch == ' '); // prev_space set if ch was a space
+ }
+ free(markup);
}
static void
@@ -405,7 +438,7 @@ _path_user_complete(Smart_Data *sd, const char *str)
rest = strchr(str, '/');
if (!rest) goto done;
rest++;
- // make new home string that has just ~/ or ~user/ withotu the rest
+ // make new home string that has just ~/ or ~user/ without the rest
home = strdup(str);
if (!home) goto done;
h = strchr(home, '/');
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.