Skip to content

Commit

Permalink
Fixed selection hover on list view
Browse files Browse the repository at this point in the history
  • Loading branch information
grrlopes committed Aug 15, 2023
1 parent b4532fc commit e4f981c
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions ui/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,15 @@ func (m ModelHome) Update(msg tea.Msg) (*ModelHome, tea.Cmd) {
case finderCountMsg:
if *m.home.Count != int(msg) {
m.home.Pagination.Page = 0
m.home.Cursor = 0
}
if int(msg) == 0 {
m.home.Pagination.SetTotalPages(1)
}
*m.home.Count = int(msg)
case finderMsg:
m.home.Store = msg
m.home.PageTotal = len(msg)
case tea.KeyMsg:
if m.home.Finder.Focused() {
switch msg.String() {
Expand Down Expand Up @@ -225,10 +227,8 @@ func (m *ModelHome) updatepagination() (int, int) {

func (m *ModelHome) GetDataView() string {
var (
pagey = m.home.PageTotal - 1
selecty = m.home.Content
maxLen = m.home.Viewport.Width
result []string
maxLen = m.home.Viewport.Width
result []string
)

if !m.home.Finder.Focused() {
Expand All @@ -238,15 +238,11 @@ func (m *ModelHome) GetDataView() string {
m.home.Pagination.SetTotalPages(*m.home.Count)

for i, v := range m.home.Store {
if m.home.Cursor == i && selecty == "arrow" {
if m.home.Cursor == i {
m.home.Selected = v.Cmd
v.Cmd = SelecRow.Render(v.Cmd)
}

if pagey == i && selecty == "window" {
v.Cmd = SelecRow.Render(v.Cmd)
}

if len(v.Cmd) > maxLen {
title := ShrinkWordMiddle(v.Cmd, maxLen)
v.Cmd = title
Expand Down

0 comments on commit e4f981c

Please sign in to comment.