summaryrefslogtreecommitdiff
path: root/lib/chessh/ssh/client/menus/select_paginate_poller.ex
diff options
context:
space:
mode:
authorSimponic <loganhunt@simponic.xyz>2023-01-25 12:58:02 -0700
committerSimponic <loganhunt@simponic.xyz>2023-01-25 12:58:02 -0700
commit5220ac5823de6dfb7ddc5112e5a247d70c89d715 (patch)
treeb7dd59b0b6005559f0760a4fc364b91b1f41c030 /lib/chessh/ssh/client/menus/select_paginate_poller.ex
parentab5fc4a077eadcc3dfd28c3af89a762711a6b6b4 (diff)
downloadchessh-5220ac5823de6dfb7ddc5112e5a247d70c89d715.tar.gz
chessh-5220ac5823de6dfb7ddc5112e5a247d70c89d715.zip
Fix initial render when game joined by creating new state in genserver init, also some more color changes
Diffstat (limited to 'lib/chessh/ssh/client/menus/select_paginate_poller.ex')
-rw-r--r--lib/chessh/ssh/client/menus/select_paginate_poller.ex8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/chessh/ssh/client/menus/select_paginate_poller.ex b/lib/chessh/ssh/client/menus/select_paginate_poller.ex
index c6f9e1d..adca697 100644
--- a/lib/chessh/ssh/client/menus/select_paginate_poller.ex
+++ b/lib/chessh/ssh/client/menus/select_paginate_poller.ex
@@ -189,7 +189,7 @@ defmodule Chessh.SSH.Client.SelectPaginatePoller do
title() ++
[""] ++
render_lines(width, height, state) ++
- if dynamic_options(), do: ["", "<= Previous | Next =>"], else: []
+ if dynamic_options(), do: ["", "<- Previous | Next ->"], else: []
{y, x} = Utils.center_rect({min(width, max_box_cols()), length(lines)}, {width, height})
@@ -214,12 +214,12 @@ defmodule Chessh.SSH.Client.SelectPaginatePoller do
Enum.map(
Enum.zip(0..(max_displayed_options() - 1), options),
fn {i, {line, _}} ->
- box_cols = min(max_box_cols(), width)
+ box_cols = min(max_box_cols(), width) - 2
linelen = String.length(line)
line =
if linelen > box_cols do
- delta = max(box_cols - 3 - 1, 0)
+ delta = max(box_cols - 3 - 1 - if(i == selected_option_idx, do: 4, else: 0), 0)
overflow = linelen - delta
start = if i == selected_option_idx, do: rem(tick, overflow), else: 0
"#{String.slice(line, start..(start + delta))}..."
@@ -238,7 +238,7 @@ defmodule Chessh.SSH.Client.SelectPaginatePoller do
end
)
else
- ["Looks like there's nothing here.", "Use Ctrl+b to go back"]
+ ["Looks like there's nothing here.", "Use Ctrl+b to go back."]
end
end