public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: Nicolas Frey <n.frey@proxmox.com>, yew-devel@lists.proxmox.com
Subject: Re: [PATCH proxmox-yew-widget-toolkit 1/5] widget: data table: simplify lookup of keys near the cursor
Date: Mon, 2 Nov 2026 15:12:20 +0100	[thread overview]
Message-ID: <9476957c-b5ea-4957-abb1-abca4e8ad1e5@proxmox.com> (raw)
In-Reply-To: <20261028151517.518742-2-n.frey@proxmox.com>

Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>

On 10/28/26 4:15 PM, Nicolas Frey wrote:
> Signed-off-by: Nicolas Frey <n.frey@proxmox.com>
> ---
>   src/widget/data_table/data_table.rs | 25 +++++++------------------
>   1 file changed, 7 insertions(+), 18 deletions(-)
> 
> diff --git a/src/widget/data_table/data_table.rs b/src/widget/data_table/data_table.rs
> index 5d04173..e846522 100644
> --- a/src/widget/data_table/data_table.rs
> +++ b/src/widget/data_table/data_table.rs
> @@ -620,27 +620,16 @@ impl<S: DataStore> PwtDataTable<S> {
>       // avoid slow search by lookup up keys nearby cursor first
>       fn filtered_record_pos(&self, props: &DataTable<S>, key: &Key) -> Option<usize> {
>           if let Some(Cursor { pos, .. }) = &self.cursor {
> -            let test_pos = *pos;
> -            if let Some(record_key) = props.store.lookup_filtered_record_key(test_pos) {
> -                if &record_key == key {
> +            for test_pos in [Some(*pos), pos.checked_add(1), pos.checked_sub(1)]
> +                .into_iter()
> +                .flatten()
> +            {
> +                if let Some(record_key) = props.store.lookup_filtered_record_key(test_pos)
> +                    && &record_key == key
> +                {
>                       return Some(test_pos);
>                   }
>               }
> -
> -            let test_pos = pos + 1;
> -            if let Some(record_key) = props.store.lookup_filtered_record_key(test_pos) {
> -                if &record_key == key {
> -                    return Some(test_pos);
> -                }
> -            }
> -            if *pos > 0 {
> -                let test_pos = pos - 1;
> -                if let Some(record_key) = props.store.lookup_filtered_record_key(test_pos) {
> -                    if &record_key == key {
> -                        return Some(test_pos);
> -                    }
> -                }
> -            }
>           }
>   
>           props.store.filtered_record_pos(key)





  reply	other threads:[~2026-11-02 14:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 15:15 [PATCH proxmox-yew-widget-toolkit 0/5] add multi-select component Nicolas Frey
2026-10-28 15:15 ` [PATCH proxmox-yew-widget-toolkit 1/5] widget: data table: simplify lookup of keys near the cursor Nicolas Frey
2026-11-02 14:12   ` Dominik Csapak [this message]
2026-10-28 15:15 ` [PATCH proxmox-yew-widget-toolkit 2/5] widget: data table: only extend explicit select all to new rows Nicolas Frey
2026-11-02 14:12   ` Dominik Csapak
2026-10-28 15:15 ` [PATCH proxmox-yew-widget-toolkit 3/5] widget: grid picker: keep selected records hidden by the filter Nicolas Frey
2026-11-02 14:12   ` Dominik Csapak
2026-10-28 15:15 ` [PATCH proxmox-yew-widget-toolkit 4/5] widget: form: implement multi select field Nicolas Frey
2026-11-02 14:12   ` Dominik Csapak
2026-11-02 14:23   ` Dominik Csapak
2026-10-28 15:15 ` [PATCH proxmox-yew-widget-toolkit 5/5] widget: form: combobox: update doc to point to `MultiSelect` Nicolas Frey
2026-11-02 14:12   ` Dominik Csapak
2026-11-02 14:12 ` [PATCH proxmox-yew-widget-toolkit 0/5] add multi-select component Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9476957c-b5ea-4957-abb1-abca4e8ad1e5@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=n.frey@proxmox.com \
    --cc=yew-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal