~rjarry/aerc-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH aerc] ui: add select-last-message option

Details
Message ID
<20240514210129.2783155-1-koni.marti@gmail.com>
DKIM signature
pass
Download raw message
Patch: +22 -1
Add a [ui].select-last-message option to position the cursor at the
bottom of the message list view.

Fixes: https://todo.sr.ht/~rjarry/aerc/254
Changelog-added: Add `[ui].select-last-message` option to position
 cursor at the bottom of the view.
Suggested-by: Bence Ferdinandy <bence@ferdinandy.com>
Requested-by: tk
Signed-off-by: Koni Marti <koni.marti@gmail.com>
---
 app/account.go        | 1 +
 config/aerc.conf      | 6 ++++++
 config/ui.go          | 1 +
 doc/aerc-config.5.scd | 6 ++++++
 lib/msgstore.go       | 9 ++++++++-
 5 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/app/account.go b/app/account.go
index ab5793bc..07c6801d 100644
--- a/app/account.go
+++ b/app/account.go
@@ -247,6 +247,7 @@ func (acct *AccountView) newStore(name string) *lib.MessageStore {
		uiConf.ThreadingEnabled,
		uiConf.ForceClientThreads,
		uiConf.ClientThreadsDelay,
		uiConf.SelectLast,
		uiConf.ReverseOrder,
		uiConf.ReverseThreadOrder,
		uiConf.SortThreadSiblings,
diff --git a/config/aerc.conf b/config/aerc.conf
index ccfbe748..a7d763d7 100644
--- a/config/aerc.conf
+++ b/config/aerc.conf
@@ -371,6 +371,12 @@
# Default: false
#reverse-thread-order=false

# Positions the cursor on the last message in the message list (at the
# bottom of the view) when opening a new folder.
#
# Default: false
#select-last-message=false

# Sort the thread siblings according to the sort criteria for the messages. If
# sort-thread-siblings is false, the thread siblings will be sorted based on
# the message UID in ascending order. This option is only applicable for
diff --git a/config/ui.go b/config/ui.go
index 7da365d6..7c7f1869 100644
--- a/config/ui.go
+++ b/config/ui.go
@@ -80,6 +80,7 @@ type UIConfig struct {
	BorderCharVertical   rune `ini:"border-char-vertical" default:"│" type:"rune"`
	BorderCharHorizontal rune `ini:"border-char-horizontal" default:"─" type:"rune"`

	SelectLast         bool `ini:"select-last-message" default:"false"`
	ReverseOrder       bool `ini:"reverse-msglist-order"`
	ReverseThreadOrder bool `ini:"reverse-thread-order"`
	SortThreadSiblings bool `ini:"sort-thread-siblings"`
diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd
index c8c7604c..17cea5ff 100644
--- a/doc/aerc-config.5.scd
+++ b/doc/aerc-config.5.scd
@@ -469,6 +469,12 @@ These options are configured in the *[ui]* section of _aerc.conf_.

	Default: _false_

*select-last-message* = _true_|_false_
	Positions the cursor on the last message in the message list (at the
	bottom of the view) when opening a new folder.

	Default: _false_

*sort-thread-siblings* = _true_|_false_
	Sort the thread siblings according to the sort criteria for the messages. If
	sort-thread-siblings is false, the thread siblings will be sorted based on
diff --git a/lib/msgstore.go b/lib/msgstore.go
index 8f626eb8..09ceb3c3 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -48,6 +48,7 @@ type MessageStore struct {
	sortDefault  []*types.SortCriterion

	threadedView       bool
	selectLast         bool
	reverseThreadOrder bool
	threadContext      bool
	sortThreadSiblings bool
@@ -89,6 +90,7 @@ const MagicUid = 0xFFFFFFFF
func NewMessageStore(worker *types.Worker,
	defaultSortCriteria []*types.SortCriterion,
	thread bool, clientThreads bool, clientThreadsDelay time.Duration,
	selectTop bool,
	reverseOrder bool, reverseThreadOrder bool, sortThreadSiblings bool,
	triggerNewEmail func(*models.MessageInfo),
	triggerDirectoryChange func(), triggerMailDeleted func(),
@@ -116,6 +118,7 @@ func NewMessageStore(worker *types.Worker,
		threadedView:       thread,
		buildThreads:       clientThreads,
		threadContext:      threadContext,
		selectLast:         selectTop,
		reverseThreadOrder: reverseThreadOrder,
		sortThreadSiblings: sortThreadSiblings,

@@ -745,7 +748,11 @@ func (store *MessageStore) Selected() *models.MessageInfo {
func (store *MessageStore) SelectedUid() uint32 {
	if store.selectedUid == MagicUid && len(store.Uids()) > 0 {
		iter := store.UidsIterator()
		store.Select(store.Uids()[iter.StartIndex()])
		idx := iter.StartIndex()
		if store.selectLast {
			idx = iter.EndIndex()
		}
		store.Select(store.Uids()[idx])
	}
	return store.selectedUid
}
-- 
2.44.0

[aerc/patches] build failed

builds.sr.ht <builds@sr.ht>
Details
Message ID
<D19O74J58LT0.0H18QVGIMOCE@fra01>
In-Reply-To
<20240514210129.2783155-1-koni.marti@gmail.com> (view parent)
DKIM signature
missing
Download raw message
aerc/patches: FAILED in 1m57s

[ui: add select-last-message option][0] from [Koni Marti][1]

[0]: https://lists.sr.ht/~rjarry/aerc-devel/patches/51859
[1]: koni.marti@gmail.com

✗ #1220799 FAILED  aerc/patches/openbsd.yml     https://builds.sr.ht/~rjarry/job/1220799
✓ #1220798 SUCCESS aerc/patches/alpine-edge.yml https://builds.sr.ht/~rjarry/job/1220798
Details
Message ID
<D19OWGBGEEK0.1U25JWP8GI0CV@gmail.com>
In-Reply-To
<20240514210129.2783155-1-koni.marti@gmail.com> (view parent)
DKIM signature
pass
Download raw message
On Tue May 14, 2024 at 11:01 PM CEST, Koni Marti wrote:
> diff --git a/lib/msgstore.go b/lib/msgstore.go
> index 8f626eb8..09ceb3c3 100644
> --- a/lib/msgstore.go
> +++ b/lib/msgstore.go
> @@ -48,6 +48,7 @@ type MessageStore struct {
>  	sortDefault  []*types.SortCriterion
>  
>  	threadedView       bool
> +	selectLast         bool
>  	reverseThreadOrder bool
>  	threadContext      bool
>  	sortThreadSiblings bool
> @@ -89,6 +90,7 @@ const MagicUid = 0xFFFFFFFF
>  func NewMessageStore(worker *types.Worker,
>  	defaultSortCriteria []*types.SortCriterion,
>  	thread bool, clientThreads bool, clientThreadsDelay time.Duration,
> +	selectTop bool,

I forgot to clean up a variable name here (it should be 'selectLast' not
'selecTop').

This does not impact the functionality of the patch but names are
important. I'll send a v2.

>  	reverseOrder bool, reverseThreadOrder bool, sortThreadSiblings bool,
>  	triggerNewEmail func(*models.MessageInfo),
>  	triggerDirectoryChange func(), triggerMailDeleted func(),
> @@ -116,6 +118,7 @@ func NewMessageStore(worker *types.Worker,
>  		threadedView:       thread,
>  		buildThreads:       clientThreads,
>  		threadContext:      threadContext,
> +		selectLast:         selectTop,

Same.
Details
Message ID
<D19OYH5JMXPP.YAD6S2BPMVDU@kramkow.ski>
In-Reply-To
<20240514210129.2783155-1-koni.marti@gmail.com> (view parent)
DKIM signature
pass
Download raw message
On Tue May 14, 2024 at 10:01 PM BST, Koni Marti wrote:
> Add a [ui].select-last-message option to position the cursor at the
> bottom of the message list view.
>
> Fixes: https://todo.sr.ht/~rjarry/aerc/254
> Changelog-added: Add `[ui].select-last-message` option to position
>  cursor at the bottom of the view.
> Suggested-by: Bence Ferdinandy <bence@ferdinandy.com>
> Requested-by: tk
> Signed-off-by: Koni Marti <koni.marti@gmail.com>
> ---

Tested-by: Tomasz Kramkowski <tomasz@kramkow.ski>

I tested on top of 0.17.0 and current master.

Thanks!

-- 
Tomasz Kramkowski
Reply to thread Export thread (mbox)