zyedidia / tcell Goto Github PK
View Code? Open in Web Editor NEWThis project forked from gdamore/tcell
This is a fork of https://github.com/gdamore/tcell
License: Apache License 2.0
This project forked from gdamore/tcell
This is a fork of https://github.com/gdamore/tcell
License: Apache License 2.0
It was brought to my attention that certain key combinations aren't recognized when running micro in foot.
Instead of triggering a key binding, the escape is printed in the terminal:
1 hello world[1;6D]
Examples of non-working key combinations:
shift+arrow works, as does ctrl+arrow and ctrl+home.
All of these work if I set TERM=xterm-256color
, or even TERM=alacritty
.
Foot's terminfo is very similar to xterm's. It does expose all the modifier combinations for e.g. right:
infocmp -x1 foot|grep kRIT
kRIT=\E[1;2C,
kRIT3=\E[1;3C,
kRIT4=\E[1;4C,
kRIT5=\E[1;5C,
kRIT6=\E[1;6C,
kRIT7=\E[1;7C,
We can also look at the diff between xterm-256color
and foot
:
% infocmp -x1 xterm-256color foot
comparing xterm-256color to foot.
comparing booleans.
OTbs: T:F.
mc5i: T:F.
comparing numbers.
comparing strings.
flash: '\E[?5h$<100/>\E[?5l', '\E]555\E\\'.
kbs: '^H', '^?'.
kmous: '\E[<', '\E[M'.
mc0: '\E[i', NULL.
mc4: '\E[4i', NULL.
mc5: '\E[5i', NULL.
meml: '\El', NULL.
memu: '\Em', NULL.
mgc: '\E[?69l', NULL.
oc: '\E]104\007', '\E]104\E\\'.
rs1: '\Ec\E]104\007', '\Ec'.
setab: '\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m', '\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48\:2\:5\:%p1%d%;m'.
setaf: '\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m', '\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38\:2\:5\:%p1%d%;m'.
smglr: '\E[?69h\E[%i%p1%d;%p2%ds', NULL.
Cr: '\E]112\007', '\E]112\E\\'.
Cs: '\E]12;%p1%s\007', '\E]12;%p1%s\E\\'.
Ms: '\E]52;%p1%s;%p2%s\007', '\E]52;%p1%s;%p2%s\E\\'.
Se: '\E[2 q', '\E[ q'.
Sync: NULL, '\EP=%p1%ds\E\\'.
XM: '\E[?1006;1000%?%p1%{1}%=%th%el%;', NULL.
xm: '\E[<%i%p3%d;%p1%d;%p2%d;%?%p4%tM%em%;', NULL.
At least I cannot see anything in there that would/should/could make a difference here. But perhaps there is something in tcell's handling of "builtin" terminfos vs. external ones?
I don't know if this is a tcell or micro bug, anyways, I added a messenger.Message(button)
line to all the cases in switch button
. Scrolling up and down get interpreted as 256
and 512
respectively, however, when scrolling down and getting a 256
, and then moving the cursor it will actually send a 2
. When scrolling up, and then moving the cursor will send a 1
, which is really annoying, because it will activate a selection. This also happense when scrolling -> moving the cursor -> scrolling again (which can be seen in the webm I linked below)
Here is a webm of the the bug in action, look at the message bar for the button codes. (keep in mind I didn't press the left or middle button (aka button1
and button2
) once in this video, the part where it quickly switches between 1 and 2 is actually me just scrolling up and down): https://sr.ht/m_Rw.webm
in my opinion https://github.com/zyedidia/tcell/blob/master/tscreen.go#L870-L881 is most likely to somehow cause this issue, I have no idea though.
I just removed these lines https://github.com/zyedidia/tcell/blob/master/tscreen.go#L870-L881 entirely, and it still seems to happen, this makes me think it has something to do with motion.
#1 fixes the spawning of button1/2 events after scrolling, however, it also disables the button1/2 when clicking, so yeah...
I've been changing 100s of values in tscreen.go, but not luck fixing this issue as of yet. I think something in parseXtermMouse()
is causing this. Changing:
case 3:
btn = int(b[i])
state++
to
case 3:
btn = int(b[i]) - 32
state++
Makes it spawn additional scroll events on motion after scrolling, instead of button1/2 events, so I think changing something in case 3 might fix this somehow...
Does this fork implement the text selection feature?
like issue: gdamore#273
I got some error when I tried to build termbox/compat.go
:
# github.com/zyedidia/tcell/termbox
./compat.go:305:2: impossible type switch case: tev (type tcell.Event) cannot have dynamic type *tcell.EventInterrupt (missing EscSeq method)
./compat.go:351:42: cannot use tcell.NewEventInterrupt(nil) (type *tcell.EventInterrupt) as type tcell.Event in argument to screen.PostEvent:
*tcell.EventInterrupt does not implement tcell.Event (missing EscSeq method)
this is related to zyedidia/micro#1854 (I was testing the solution and it wouldn't launch, I got to this point via delve)
tl;dr if t.TrueColor
will segfault if t is nil
the check for t == nil
should be moved up further
however, the secondary issue here is that it fails to detect the foot
terminal, despite infocmp being present/installed (admittedly in ~/.terminfo
, which is standard (see terminfo(5)'s "Fetching Compiled Descriptions")
I couldn't find (in a reasonable timeframe) exactly where infocmp (or anything similar) is invoked, but this is clearly differing behavior (esp. since infocmp is expected to be installed)
Hi, I found this through micro's go.mod and I'm investigating the library right now -- is there any reason for this fork? It looks like from the diff that you're adding new features/fixing bugs -- but there's no plan to send those upstream? Should this fork be used for production over the main repo (despite the main repo having had more recent releases/commits, and is also still in development)?
I have micro running inside tmux with set clipboard terminal
When I press Ctrl-v micro crashes with the following output:
panic: runtime error: slice bounds out of range [7:6]
goroutine 19 [running]:
github.com/zyedidia/tcell/v2.(*tScreen).parseOSC52Paste(0xc0002b4d80, 0xc00052ef00, 0xc00052edf8, 0xc00025a140)
github.com/zyedidia/tcell/[email protected]/tscreen.go:1402 +0x67d
github.com/zyedidia/tcell/v2.(*tScreen).collectEventsFromInput(0xc0002b4d80, 0xc00052ef00, 0x7ff907197300, 0x0, 0x0, 0x0)
github.com/zyedidia/tcell/[email protected]/tscreen.go:1486 +0x174
github.com/zyedidia/tcell/v2.(*tScreen).scanInput(0xc0002b4d80, 0xc00052ef00, 0xf55300)
github.com/zyedidia/tcell/[email protected]/tscreen.go:1452 +0x45
github.com/zyedidia/tcell/v2.(*tScreen).mainLoop(0xc0002b4d80)
github.com/zyedidia/tcell/[email protected]/tscreen.go:1616 +0x32f
created by github.com/zyedidia/tcell/v2.(*tScreen).Init
github.com/zyedidia/tcell/[email protected]/tscreen.go:207 +0x6ad
And if I don't have anything in paste buffer micro crashes with:
panic: runtime error: index out of range [0] with length 0
goroutine 19 [running]:
github.com/zyedidia/tcell/v2.(*tScreen).parseRune(0xc000234d80, 0xc00005df00, 0xc00005ddf8, 0xc000140001)
github.com/zyedidia/tcell/[email protected]/tscreen.go:1317 +0x7ac
github.com/zyedidia/tcell/v2.(*tScreen).collectEventsFromInput(0xc000234d80, 0xc00005df00, 0x7f366abadb00, 0x0, 0x0, 0x0)
github.com/zyedidia/tcell/[email protected]/tscreen.go:1498 +0x21e
github.com/zyedidia/tcell/v2.(*tScreen).scanInput(0xc000234d80, 0xc00005df00, 0xf55300)
github.com/zyedidia/tcell/[email protected]/tscreen.go:1452 +0x45
github.com/zyedidia/tcell/v2.(*tScreen).mainLoop(0xc000234d80)
github.com/zyedidia/tcell/[email protected]/tscreen.go:1616 +0x32f
created by github.com/zyedidia/tcell/v2.(*tScreen).Init
github.com/zyedidia/tcell/[email protected]/tscreen.go:207 +0x6ad
Also set -s set-clipboard on
is needed in .tmux.conf to enable full clipboard support for applications inside tmux.
However they can be made to work by setting the ENABLE_LVB_GRID_WORLDWIDE 0x0010 flag on initialization. I want to run micro from the Windows console so a fix for this would be nice. See also gdamore#627 .
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.