From 668411297221393cf4f33f70a1d5751a0531e1ba Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 15 Aug 2021 03:36:45 -0700 Subject: missing code: selecting a thread in channel view Test required. And a clean fixture. --- browse-slack/environment.mu | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'browse-slack') diff --git a/browse-slack/environment.mu b/browse-slack/environment.mu index 1ffd787b..8b9c4a9c 100644 --- a/browse-slack/environment.mu +++ b/browse-slack/environment.mu @@ -922,7 +922,7 @@ fn new-thread-tab _env: (addr environment), users: (addr array user), channels: copy-to *tab-item-index-addr, final-post-comment-index } -fn item-index _tab: (addr tab), channels: (addr array channel) -> _/ecx: int { +fn item-index _tab: (addr tab), _channels: (addr array channel) -> _/ecx: int { var tab/esi: (addr tab) <- copy _tab var tab-type/eax: (addr int) <- get tab, type { @@ -934,8 +934,16 @@ fn item-index _tab: (addr tab), channels: (addr array channel) -> _/ecx: int { { compare *tab-type, 1/channel break-if-!= - var tab-channel-index/eax: (addr int) <- get tab, channel-index - var channel-item-index/ecx: (addr int) <- get tab, item-index + var channel-index-addr/eax: (addr int) <- get tab, channel-index + var channel-index/eax: int <- copy *channel-index-addr + var channels/ecx: (addr array channel) <- copy _channels + var channel-offset/eax: (offset channel) <- compute-offset channels, channel-index + var current-channel/eax: (addr channel) <- index channels, channel-offset + var current-channel-posts-ah/eax: (addr handle array int) <- get current-channel, posts + var current-channel-posts/eax: (addr array int) <- lookup *current-channel-posts-ah + var channel-item-index-addr/ecx: (addr int) <- get tab, item-index + var channel-item-index/ecx: int <- copy *channel-item-index-addr + var channel-item-index/eax: (addr int) <- index current-channel-posts, channel-item-index return *channel-item-index } { -- cgit 1.4.1-2-gfad0