Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selection fails to highlight #226

Closed
hackedXD opened this issue Jul 18, 2022 · 12 comments · Fixed by #247
Closed

Selection fails to highlight #226

hackedXD opened this issue Jul 18, 2022 · 12 comments · Fixed by #247

Comments

@hackedXD
Copy link

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
Copy link

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
Copy link

bbjubjub2494 commented Jul 20, 2022

Same here. I bisected it to these 4 commits cd44aab, 3c148a4, c3aeb75 and 387c463. 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
Copy link

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

@mclang
Copy link

mclang commented Aug 4, 2022

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

@cmalvi
Copy link

cmalvi commented Sep 3, 2022

same with gnome terminal

@bbjubjub2494
Copy link

Still an issue in 4.2.0 (similar environment)

image

@ChausseBenjamin
Copy link

ChausseBenjamin commented Dec 5, 2022

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

@gardockt
Copy link

gardockt commented Feb 1, 2023

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 c3aeb75, 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
Copy link

@gardockt's fix works for me too

@DaL31
Copy link

DaL31 commented Sep 13, 2024

Arch and i3 here. Problem still persists even though I have the newest version with the pr. Any ideas?

@xxxserxxx
Copy link
Owner

Yeah, I got a regression on my side too. I'm just commenting that I'm aware of the issue and am neither dead, nor ignoring it; I simply haven't had time to context switch back to gotop in a while.

@LouDnl
Copy link

LouDnl commented Sep 17, 2024

Same issue here on different systems with the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.