From dd67e0789e717bf6dfca2fbd72abee035544e750 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 23 Aug 2021 15:21:24 +0200 Subject: [PATCH] Auto-complete channel names Closes: https://todo.sr.ht/~emersion/gamja/84 --- components/app.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/app.js b/components/app.js index c1db1c8..46b9cdf 100644 --- a/components/app.js +++ b/components/app.js @@ -1068,6 +1068,17 @@ export default class App extends Component { return repl.map(cmd => "/" + cmd); } + // TODO: consider using the CHANTYPES ISUPPORT token here + if (prefix.startsWith("#")) { + let chanNames = []; + for (const buf of this.state.buffers.values()) { + if (buf.name.startsWith("#")) { + chanNames.push(buf.name); + } + } + return fromList(chanNames, prefix); + } + let buf = this.state.buffers.get(this.state.activeBuffer); if (!buf || !buf.members) { return [];