Fixed issue with being able to insert chars into the prompt.
[lurk.git] / lurk.el
diff --git a/lurk.el b/lurk.el
index 42f4cdb..675ec0e 100644 (file)
--- a/lurk.el
+++ b/lurk.el
@@ -351,8 +351,10 @@ portion of the source component of the message, as LURK doesn't use this.")
                          "")
                        'face 'lurk-context
                        'read-only t)
-           (propertize (concat lurk-prompt-string " ")
+           (propertize lurk-prompt-string
                        'face 'lurk-prompt
+                       'read-only t)
+           (propertize " " ; Need this to be separate to mark it as rear-nonsticky
                        'read-only t
                        'rear-nonsticky t)))
         (set-marker-insertion-type lurk-input-marker nil))
@@ -976,7 +978,7 @@ in which case they match anything.")
     (lurk-display-notice nil "No current channel.")))
 
 (defun lurk-command-msg (params)
-  (if (and params (>= 2 (length params)))
+  (if (and params (>= (length params) 2))
       (let ((to (car params))
             (text (string-join (cdr params) " ")))
         (lurk-send-msg (lurk-msg nil nil "PRIVMSG" to text))
@@ -1056,12 +1058,13 @@ in which case they match anything.")
                             (re-search-backward " " lurk-input-marker t)))
                (table-row (assoc (upcase cmd-str) lurk-command-table #'equal)))
            (if (and table-row (elt table-row 3))
-               (let ((completions (funcall (elt table-row 3))))
+               (let* ((completions-nospace (funcall (elt table-row 3)))
+                      (completions (mapcar (lambda (el) (concat el " ")) completions-nospace)))
                  (completion-in-region (+ 1 space-idx) (point) completions)))))
         ((rx (: "/" (* (not whitespace)) string-end))
          (message (buffer-substring lurk-input-marker (point)))
          (completion-in-region lurk-input-marker (point)
-                               (mapcar (lambda (row) (string-join (list "/" (car row))))
+                               (mapcar (lambda (row) (concat "/" (car row) " "))
                                        lurk-command-table)))
         (_
          (let* ((end (max lurk-input-marker (point)))