xxxserxxx / gotop

A terminal based graphical activity monitor inspired by gtop and vtop
Other
2.69k stars 138 forks source link

Selection fails to highlight #226

Closed hackedXD closed 1 year ago

hackedXD commented 1 year ago

gotop version - gotop v4.1.4.r0.gcd0cf0f os - Arch Linux 5.18.11-zen1-1-zen Alacritty on Wayland

5.18.11-zen1-1-zen

image image

fanitriastowo commented 1 year ago

Same here. It was fine before I upgrade to v4.1.4

gotop version: gotop v4.1.4 (Hadean) os: manjaro kernel 5.15.54-1 terminal: konsole display: X11 image

bbjubjub2494 commented 1 year ago

Same here. I bisected it to these 4 commits cd44aab6, 3c148a4d97, c3aeb753d and 387c463eeeff. It looks like it comes from termui or another dependency.

Version: gotop v4.1.4 (Hadean) (via Nixpkgs) OS: Linux 5.15.55, NixOS, 22.05 (Quokka), 22.05.20220718.3eb3df0 Terminal Emulator: ate Display: X11 (dwm, picom)

image

EDIT: I also tried another TE (kitty), it's visible but it still looks different than v4.1.3.

image

JC-Morph commented 1 year ago

same issue OS: Artix Linux x86_64 Kernel: 5.18.12-artix1-1 Terminal: st pic-selected-220726-1845-27

mclang commented 1 year ago

Arch, and i3 here... None of the color schemes work with Alacritty, Tilix or XFCE term.

cmalvi commented 1 year ago

same with gnome terminal

bbjubjub2494 commented 1 year ago

Still an issue in 4.2.0 (similar environment)

image

ChausseBenjamin commented 1 year ago

Same with ST here (on4.2.0): 2022-12-05-113724_1051x1046_scrot

gardockt commented 1 year ago

Oddly enough, this patch makes the selection work again for me:

diff --git a/termui/table.go b/termui/table.go
index 29e4c3f..e914a5d 100644
--- a/termui/table.go
+++ b/termui/table.go
@@ -98,7 +98,7 @@ func (self *Table) Draw(buf *Buffer) {
                if self.ShowCursor {
                        if (self.SelectedItem == "" && rowNum == self.SelectedRow) || (self.SelectedItem != "" && self.SelectedItem == row[self.UniqueCol]) {
                                style.Fg = self.CursorColor
-                               style.Modifier = ModifierReverse
+                               style.Modifier = 1 << 15
                                for _, width := range self.ColWidths {
                                        if width == 0 {
                                                continue

This issue seems to begin with commit c3aeb753d9355fcf3d5e6cbbdb892e61470e5abf, as a result of termbox-go dependency bump - reverting it resolves the issue. I couldn't, however, manage to replicate the issue with a simple program, as reverse modifier in this code works fine:

package main

import (
    "image"
    "log"

    ui "github.com/gizak/termui/v3"
)

type Table struct {
    *ui.Block
}

func NewTable() *Table {
    return &Table{
        Block:       ui.NewBlock(),
    }
}

func (self *Table) Draw(buf *ui.Buffer) {
    self.Block.Draw(buf)

    style := ui.NewStyle(4)
    style.Modifier = ui.ModifierReverse
    buf.SetString(
        "hello",
        style,
        image.Pt(self.Inner.Min.X, self.Inner.Min.Y),
    )
}

func main() {
    if err := ui.Init(); err != nil {
        log.Fatalf("failed to initialize termui: %v", err)
    }
    defer ui.Close()

    p := NewTable()
    p.SetRect(0, 0, 50, 25)

    ui.Render(p)

    for e := range ui.PollEvents() {
        if e.Type == ui.KeyboardEvent {
            break
        }
    }
}
Geometer1729 commented 1 year ago

@gardockt's fix works for me too