diff --git a/ChangeLog b/ChangeLog index 6ea718e..5156aed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2020-06-14 + * LICENSES.org + * etc/init.lisp + * src/complete.lisp + * src/package.lisp + * src/text-utils.lisp + + - prevented crash that happened when using an invalid regular + expression to complete input. There was no reason to use regular + expression there but valid reasons to not use them. ;) + 2020-06-13 cage * src/db.lisp * src/notify-window.lisp @@ -9,7 +20,7 @@ This could happened when concurrent fetching messages command was launched from the user. - - preventing writing a notification window that completerd his + - preventing writing a notification window that completed his life cycle. 'notify-window:draw-pending' checks if 'life' slot is a positive number before drawing, without the check drawing on a ncurses window pointer pointing to invalid memory was possible. @@ -69,7 +80,7 @@ - moved pleroma specific API to i package :api-pleroma; - renamed function: 'text-utils:left-padding-suffix' to 'text-utils:left-padding-prefix'; - rendered the choice index for poll's choices; - - shown if a poll allows multiple choiches; + - shown if a poll allows multiple choices; - printed an error to the user when trying to vote for a message that does not contains a poll. @@ -156,7 +167,7 @@ - added a class to represent a window with the links that a message contains The links are collected by the new function - text-utils:collect-links applyed on the rendered text of a status. + text-utils:collect-links applied on the rendered text of a status. 2020-05-15 cage - initial release diff --git a/LICENSES.org b/LICENSES.org index 4c30865..c23a83f 100644 --- a/LICENSES.org +++ b/LICENSES.org @@ -44,6 +44,31 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . + + and from cl-str (https://github.com/vindarel/cl-str/blob/master/str.lisp) + + Copyright 2018-2020 vindarel + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + - src/misc-utils.lisp 'defalias' derived from Copyright (c) 2014 Paul M. Rodriguez diff --git a/etc/init.lisp b/etc/init.lisp index ebd5272..3bd30e4 100644 --- a/etc/init.lisp +++ b/etc/init.lisp @@ -201,11 +201,11 @@ (define-key "r" #'reply-message *thread-keymap*) -(define-key "R" #'refresh-thread *thread-keymap*) +(define-key "x" #'refresh-thread *thread-keymap*) (define-key "v" #'open-message-attach *thread-keymap*) -(define-key "V" #'open-message-link *thread-keymap*) +(define-key "l" #'open-message-link *thread-keymap*) (define-key "P" #'poll-vote *thread-keymap*) diff --git a/src/complete.lisp b/src/complete.lisp index 68d9993..3c766e9 100644 --- a/src/complete.lisp +++ b/src/complete.lisp @@ -90,8 +90,8 @@ completed) and the common prefix of the completion string." for entry = (next) while entry collect (funcall namefun entry))) - (re (text-utils:strcat "^" string)) - (candidates (sort (remove-if-not (lambda (a) (cl-ppcre:scan re a)) + (candidates (sort (remove-if-not (lambda (a) + (text-utils:string-starts-with-p string a)) all) (lambda (a b) (< (length a) (length b)))))) @@ -100,7 +100,7 @@ completed) and the common prefix of the completion string." (defun starts-with-clsr (hint) (lambda (a) - (cl-ppcre:scan (text-utils:strcat "^" hint) a))) + (text-utils:string-starts-with-p hint a))) (defun remove-if-hidden (candidates) (remove-if #'db:hidden-recipient-p candidates)) diff --git a/src/package.lisp b/src/package.lisp index daf8888..fbbebf9 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -346,6 +346,7 @@ :flush-left-mono-text :string-empty-p :string-not-empty-p + :string-starts-with-p :find-max-line-length :box-fit-single-column :box-fit-multiple-column diff --git a/src/text-utils.lisp b/src/text-utils.lisp index 56c3e65..5573b4c 100644 --- a/src/text-utils.lisp +++ b/src/text-utils.lisp @@ -223,6 +223,13 @@ (defun string-not-empty-p (s) (not (string-empty-p s))) +(defun string-starts-with-p (start s &key (test #'string=)) + "Return non nil if `s' starts with the substring `start'. + Uses `test' to match strings (default #'string=" + (when (>= (length s) + (length start)) + (funcall test s start :start1 0 :end1 (length start)))) + (defun justify-monospaced-text (text &optional (chars-per-line 30)) (if (null (split-words text)) (list " ")