summary refs log tree commit diff
path: root/complete.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-08 00:01:59 -0500
committerJune McEnroe <june@causal.agency>2020-02-08 00:01:59 -0500
commit58e1d5b4e2fabead1aae356dd060bfc9748bdd5e (patch)
tree81ef7706e6ba1579bb90130bc92c60177adaf06f /complete.c
parentOnly treat the first tab as the alignment point (diff)
downloadcatgirl-58e1d5b4e2fabead1aae356dd060bfc9748bdd5e.tar.gz
catgirl-58e1d5b4e2fabead1aae356dd060bfc9748bdd5e.zip
Handle NICK
Diffstat (limited to '')
-rw-r--r--complete.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/complete.c b/complete.c
index 437bb7d..c194536 100644
--- a/complete.c
+++ b/complete.c
@@ -110,6 +110,27 @@ void completeReject(void) {
 	match = NULL;
 }
 
+size_t completeID(const char *str) {
+	for (match = (match ? match->next : head); match; match = match->next) {
+		if (match->id && !strcmp(match->str, str)) return match->id;
+	}
+	return None;
+}
+
+void completeReplace(size_t id, const char *old, const char *new) {
+	struct Node *next = NULL;
+	for (struct Node *node = head; node; node = node->next) {
+		next = node->next;
+		if (id && node->id != id) continue;
+		if (strcmp(node->str, old)) continue;
+		if (match == node) match = NULL;
+		free(node->str);
+		node->str = strdup(new);
+		if (!node->str) err(EX_OSERR, "strdup");
+		prepend(detach(node));
+	}
+}
+
 void completeRemove(size_t id, const char *str) {
 	struct Node *next = NULL;
 	for (struct Node *node = head; node; node = next) {
ure to send http headersChristian Hesse 2015-08-13Makefile: make "git/config.mak.uname" inclusion optionalJohn Keeping 2015-08-13ui-shared: show full date in tooltip if longer ago than max_relativeJohn Keeping 2015-08-13ui-shared: use common function in print_rel_date()John Keeping 2015-08-13ui-shared: extract date formatting to a functionJohn Keeping 2015-08-13filter: don't use dlsym unnecessarilyJohn Keeping 2015-08-13ui-tree: use "sane" isgraph()John Keeping 2015-08-13cgit.h: move stdbool.h from ui-shared.hJohn Keeping 2015-08-13cache.c: fix header orderJohn Keeping 2015-08-13configfile.c: don't include system headers directlyJohn Keeping 2015-08-13Remove redundant includesJohn Keeping 2015-08-13Makefile: include Git's config.mak.unameJohn Keeping 2015-08-13tests: allow shell to be overriddenJohn Keeping 2015-08-13redirect: cleanlinessJason A. Donenfeld 2015-08-13redirect: be more careful for different cgi setupsJason A. Donenfeld 2015-08-12ui-log: fix double countingJohn Keeping 2015-08-12log: allow users to follow a fileJohn Keeping 2015-08-12shared: make cgit_diff_tree_cb publicJohn Keeping 2015-08-12t0110: Chain together using &&Jason A. Donenfeld 2015-08-12about: always ensure page has a trailing slashJason A. Donenfeld 2015-08-12filters: apply HTML escapingLazaros Koromilas 2015-08-12git: update to v2.5.0Christian Hesse 2015-08-12Fix processing of repo.hide and repo.ignoreDaniel Reichelt