1
0
Fork 0

- prevented moving selected message when updating a timeline.

This commit is contained in:
cage 2021-09-10 17:34:03 +02:00
parent fdd73cdd9d
commit ae266982cb
7 changed files with 236 additions and 19 deletions

175
ChangeLog
View File

@ -1,3 +1,178 @@
2021-09-09 cage
- added a command to open all the attachments of a post.
- prevented quitting program when users does not input a valid
answer at prompt asking for deleting temp files.
- prevented quitting program when users does not input a valid
answer at prompt asking for deleting pleroma messages.
2021-09-04 cage
- removed useless comment.
- added group-id property to all gemtext elements.
- changed function name from 'header-group-id' to 'current-header-group-id'.
2021-09-03 cage
- [gemini] added 'pre-group-id' slot to gemini text preformatted
line; this changes fixed the selection of a TOC entry when reading
a gemini text too.
2021-09-03 cage
- highlighted current TOC entry while browsing gemini page/gempub;
- added hook:*before-rendering-message-visible-rows*;
- changed default: appending hooks by default in hook:add-hook.
2021-09-02 cage
- updated Italian translation.
- updated version of croatoan installed by the building script;
- updated makefile rule to recompile the binary if asdf file is modified.
2021-08-29 cage
- forced colors to selected line in line oriented-window.
- improved search command apropos.
- removed debug message.
2021-08-28 cage
- added command to show bookmarks also to global keymap;
- switched to gemini keymap when opening a gemini page from memory.
- fixed 'valid-results-p' when a global search is performed.
- added 'apropos-help-global'.
- updated manpage and docstring relative to gempub and tour mode.
- fixed position of cursor when expanding abbreviations.
- added more terms when searching gempub metadata ('<', '>', '<=',
'<=', '=' '!=').
- allowed line-oriented-window to render unselected items with
different color than foreground; - captured parsing errors when
querying gempub library.
- updated Italian translation;
- updated welcome window's text.
- added 'open-manual'.
- allowed a custom init.lisp file in the config user home.
2021-08-27 cage
- prevented non local links to be in tour mode when opening a
gempub.
- automatically add a tour mode to browse the contents when
opening a gempub.
- defined alias for 'zip-file-p' as 'gempub-file-p'.
2021-08-26 cage
- wrote selected gempub entry in bold.
- fixed comment.
- used default path for gempub library.
- added TOC when a gemini file is loaded from a local file.
- respected index metadata when opening a gempub file.
- prevented crash when probing for a zip file which size is less
than the maximum size of end of central directory registry.
- ensured 'gempub-metadata-find' returns a single row; - ensured
gempub paths are normalized before adding in the library; - added
opening of gempub files from gempub library window.
2021-08-25 cage
- added a window to show gempub file's library.
2021-08-23 cage
- added a directory to store gempub, the software will sync the
directory's contents with its internal metadata database.
2021-08-22 cage
- [gempub] added extraction of metadata from gempub;
- added table to save gempub's metadata.
- removed exiting from configure if unzip is not found.
- fixed test to add gempub-support in features.
- added gempub-support in *features*;
- removed generated file config.lisp.in.
2021-08-21 cage
- added zip-info:list-entries.
2021-08-20 cage
- fixed typo.
- sorted directory entries when rendering a directory using tinmop.
- added draft of gpub support; - updated translation template files
and Italian translation.
- added 'temporary-directory'.
- added dependency on 'unzip';
- added 'unzip-file';
- fixed zip-info constant name.
- added function 'zip-file-p' to recognize zip files.
2021-08-16 cage
- set open-message-link-window.close-after-select to 'yes'.
- prevented crash when opening tour mode links and configuration
directive 'open-message-link-window.close-after-select' values
'yes'.
- added deletion of bookmark's entries.
- added a title to bookmark page.
- started with gemini link bookmark.
2021-08-15 cage
- prevented a race condition occurring when accessing the database
on program quit.
2021-08-14 cage
- move cursor to the end of the string when browsing command
line's history.
- complete in a different way things that looks like local paths
when opening gemini address. - prevented a crash when opening a
directory that does not exists on local file system.
- fixed Italian format string.
- fixed regression: command apropos works again.
- prevented two messages with the same message-index presents in
the same folder and timeline.
- refactored gemlog updating event.
- ignored error when refreshing gemlogs.
2021-08-13 cage
- forced resizing of suggestion window when terminal is resized.
- improved macro 'when-window-shown' to prevent crash of the
program when terminal window is too small.
2021-08-12 cage
- added loading module for abbreviation by default in config file.
- prevented crash when terminal height was to small to fits suggestion window.
- changed abbreviation.
- updated italian translation.
- made gemlog's updating non blocking.
2021-08-07 cage
- updated docs for module.
- prevented crash when suggestion windows are shown when the width
of the terminal was too thin paginating the suggestions failed.
- updated Makefile.in to include new module.
2021-08-06 cage
- instructed Makefile to install module 'expand-abbrev-command-window'.
- removed nobase in Makefile.am.
- added keychord to opening gemini certificate window from global
keymap.
- allowed switching off abbreviations on the command-window.
- added a module to expand abbreviations for the command window.
2021-08-05 cage
- prevented stripping of directory for data and doc files;
- updated Changelog.
2021-08-03 cage
* src/package.lisp,

View File

@ -45,6 +45,11 @@
(idx
:initarg :idx
:reader idx))
(:report (lambda (condition stream)
(format stream
"sequence length ~a index ~a"
(length (seq condition))
(idx condition))))
(:documentation "Error when you go out of bound"))
(define-condition length-error (text-error)

View File

@ -164,6 +164,8 @@
(defgeneric rows-remove-if (object function &key &allow-other-keys))
(defgeneric rows-find-if (object function &key &allow-other-keys))
(defgeneric rows-safe-subseq (object start &key end &allow-other-keys))
(defgeneric rows-elt (object index &key &allow-other-keys))
@ -349,6 +351,9 @@ this exact quantity would go beyond the length or rows or zero."
(defmethod rows-remove-if ((object row-oriented-widget) (function function) &key &allow-other-keys)
(remove-if function (rows object)))
(defmethod rows-find-if ((object row-oriented-widget) (predicate function) &key &allow-other-keys)
(find-if predicate (rows object)))
(defmethod rows-safe-subseq ((object row-oriented-widget) start
&key (end nil) &allow-other-keys)
(safe-subseq (rows object) start end))

View File

@ -1948,6 +1948,7 @@
:rows-length
:rows-empty-p
:rows-remove-if
:rows-find-if
:rows-safe-subseq
:rows-elt
:rows-last-elt

View File

@ -560,6 +560,12 @@
:initarg :message-index
:accessor message-index)))
(defclass event-with-message-status-id ()
((message-status-id
:initform nil
:initarg :message-status-id
:accessor message-status-id)))
(defclass event-with-timeline-and-folder ()
((new-folder
:initform nil
@ -572,13 +578,15 @@
(defclass refresh-thread-windows-event (program-event
event-with-message-index
event-with-message-status-id
event-with-timeline-and-folder)
())
(defmethod process-event ((object refresh-thread-windows-event))
(with-accessors ((new-folder new-folder)
(new-timeline new-timeline)
(message-index message-index)) object
(with-accessors ((new-folder new-folder)
(new-timeline new-timeline)
(message-index message-index)
(message-status-id message-status-id)) object
(assert message-index)
(when new-timeline
(setf (thread-window:timeline-type specials:*thread-window*)
@ -587,6 +595,7 @@
(setf (thread-window:timeline-folder specials:*thread-window*)
new-folder))
(line-oriented-window:resync-rows-db specials:*thread-window*
:suggested-status-id message-status-id
:suggested-message-index message-index
:redraw t)))

View File

@ -773,7 +773,7 @@ db:renumber-timeline-message-index."
message-index))))))
(defmethod goto-first-message ((object thread-window))
(goto-message object db:+message-index-start+))
(goto-message object db:+message-index-start+))
(defmethod goto-last-message ((object thread-window))
(with-accessors ((timeline-folder timeline-folder)
@ -781,7 +781,17 @@ db:renumber-timeline-message-index."
(when-let ((last-message-index (db:last-message-index-status timeline-type timeline-folder)))
(goto-message object last-message-index))))
(defmethod resync-rows-db ((object thread-window) &key (redraw t) (suggested-message-index nil))
(defun find-row-with-status-id (thread-window status-id)
(rows-find-if thread-window
(lambda (a) (client:id= status-id (db:row-message-status-id (fields a))))))
(defmethod resync-rows-db ((object thread-window)
&key
(redraw t)
(suggested-message-index nil)
(suggested-status-id nil))
(with-accessors ((row-selected-index row-selected-index)
(rows rows)) object
(when-window-shown (object)
@ -793,11 +803,19 @@ db:renumber-timeline-message-index."
(handler-bind ((conditions:out-of-bounds
(lambda (e)
(invoke-restart 'ignore-selecting-action e))))
(when suggested-status-id
(when-let* ((future-selected-row (find-row-with-status-id object
suggested-status-id))
(future-selected-db-row (fields future-selected-row))
(future-selected-index (db:row-message-index future-selected-db-row)))
(setf first-message-index future-selected-index)))
(multiple-value-bind (tree pos)
(fit-timeline-to-window object first-message-index)
(build-lines object tree pos)
(unselect-all object)
(select-row object saved-row-selected-index)
(if suggested-status-id
(select-row object pos)
(select-row object saved-row-selected-index))
(when redraw
(draw object)))))))
object)

View File

@ -697,21 +697,26 @@ This command also checks notifications about mentioning the user
and (if such mentions exists) download the mentioning toots in the
folder \"mentions\"."
(flet ((update-payload ()
(let* ((timeline (thread-window:timeline-type *thread-window*))
(folder (thread-window:timeline-folder *thread-window*))
(max-id (db:last-pagination-status-id-timeline-folder timeline folder)))
(let* ((timeline (thread-window:timeline-type *thread-window*))
(folder (thread-window:timeline-folder *thread-window*))
(max-id (db:last-pagination-status-id-timeline-folder timeline folder))
(win *thread-window*)
(selected-message (line-oriented-window:selected-row-fields win))
(selected-message-id (db:row-message-status-id selected-message)))
(multiple-value-bind (kind localp)
(timeline->kind timeline)
(with-notify-errors
(client:update-timeline timeline
kind
folder
:recover-from-skipped-statuses t
:recover-count recover-count
:min-id max-id
:local localp)
(client:update-timeline timeline
kind
folder
:recover-from-skipped-statuses t
:recover-count recover-count
:min-id max-id
:local localp)
(let ((update-mentions-event (make-instance 'update-mentions-event))
(refresh-event (make-instance 'refresh-thread-windows-event)))
(refresh-event (make-instance 'refresh-thread-windows-event
:message-status-id
selected-message-id)))
;; updating home also triggers the checks for mentions
(when (eq kind :home)
(push-event update-mentions-event))
@ -742,8 +747,7 @@ Starting from the oldest toot and going back."
(defun expand-status-tree (force)
(flet ((update ()
(when-let* ((selected-message
(line-oriented-window:selected-row-fields *thread-window*))
(when-let* ((selected-message (line-oriented-window:selected-row-fields *thread-window*))
(timeline (thread-window:timeline-type *thread-window*))
(folder (thread-window:timeline-folder *thread-window*))
(status-id (actual-author-message-id selected-message))