Repository: jesseduffield/lazygit (language: go)

Issue:
Mouse becomes unusable after quitting lazygit
**Describe the bug**
After quitting `lazygit`, the mouse became unusable the next time I started `vim`.
The cursor does not move when I click the mouse.

This seems to be due to #1713 that I submitted earlier.
It seems that, terminal's mouse related state is not restored correctly.

I submitted an MR to gdamore/tcell here gdamore/tcell#512. 

**To Reproduce**
Steps to reproduce the behavior:
1. start and quit `lazygit`
2. open some file with `vim`
3. enable mouse mode by set mouse=a
5. clicking the mouse always moves the cursor to the beginning of the center line.

**Expected behavior**
The cursor moves to the position where you click the mouse. 

**Desktop (please complete the following information):**
 - linux VM on Chomebook and Windows
 - Lazygit Version 0.32.2
 - f4011643dda14c6da522dcd172b66b2d2cadb02b



Discussion / hints:

Fix patch:
diff --git a/go.mod b/go.mod
index 860b7e6dbc0..6d72ea3b80f 100644
--- a/go.mod
+++ b/go.mod
@@ -11,10 +11,10 @@ require (
 	github.com/creack/pty v1.1.11
 	github.com/fatih/color v1.9.0 // indirect
 	github.com/fsnotify/fsnotify v1.4.7
-	github.com/gdamore/tcell/v2 v2.4.1-0.20210926162909-66f061b1fc9b // indirect
+	github.com/gdamore/tcell/v2 v2.4.1-0.20220313203054-2a1a1b586447 // indirect
 	github.com/go-errors/errors v1.4.1
 	github.com/go-logfmt/logfmt v0.5.0 // indirect
-	github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
+	github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 // indirect
 	github.com/golang/protobuf v1.3.2 // indirect
 	github.com/google/go-cmp v0.5.6 // indirect
 	github.com/gookit/color v1.4.2
diff --git a/go.sum b/go.sum
index 69871e0ab17..fe2bffe740d 100644
--- a/go.sum
+++ b/go.sum
@@ -37,6 +37,8 @@ github.com/gdamore/tcell/v2 v2.4.0 h1:W6dxJEmaxYvhICFoTY3WrLLEXsQ11SaFnKGVEXW57K
 github.com/gdamore/tcell/v2 v2.4.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
 github.com/gdamore/tcell/v2 v2.4.1-0.20210926162909-66f061b1fc9b h1:eoaSI4eEwM5eTx/HvmRSwmicxuMhL73AyoEfM1oCJLc=
 github.com/gdamore/tcell/v2 v2.4.1-0.20210926162909-66f061b1fc9b/go.mod h1:ZPwXnysybtQqdqKcWMWXux9aGdtMHe+kr+cwEZEe+A4=
+github.com/gdamore/tcell/v2 v2.4.1-0.20220313203054-2a1a1b586447 h1:4idf9699cuWAc7ZIB+2RzuDWU30oRkB0X/FZTUlWOVY=
+github.com/gdamore/tcell/v2 v2.4.1-0.20220313203054-2a1a1b586447/go.mod h1:I8YJFI9gzgl4dHi9UlRDZosCW+jYkDA37AXmXvL51w4=
 github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
 github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
 github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs=
@@ -184,6 +186,7 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w
 golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211113001501-0c823b97ae02/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
 golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
diff --git a/vendor/github.com/gdamore/tcell/v2/README.md b/vendor/github.com/gdamore/tcell/v2/README.md
index 1d422e9842f..75f24569f98 100644
--- a/vendor/github.com/gdamore/tcell/v2/README.md
+++ b/vendor/github.com/gdamore/tcell/v2/README.md
@@ -1,6 +1,8 @@
 
 # ![Tcell](logos/tcell.png)
 
+Please see [here](UKRAINE.md) for an important message for the people of Russia.
+
 _Tcell_ is a _Go_ package that provides a cell based view for text terminals, like _XTerm_.
 It was inspired by _termbox_, but includes many additional improvements.
 
@@ -17,6 +19,7 @@ Version 1.x remains available using the import `github.com/gdamore/tcell`.
 ## Tutorial
 
 A brief, and still somewhat rough, [tutorial](TUTORIAL.md) is available.
+
 ## Examples
 
 * [proxima5](https://github.com/gdamore/proxima5) - space shooter ([video](https://youtu.be/jNxKTCmY_bQ))
@@ -45,6 +48,7 @@ A brief, and still somewhat rough, [tutorial](TUTORIAL.md) is available.
 * [gorss](https://github.com/lallassu/gorss) - RSS/Atom feed reader
 * [memoryalike](https://github.com/Bios-Marcel/memoryalike) - memorization game
 * [lf](https://github.com/gokcehan/lf) - file manager
+* [goful](https://github.com/anmitsu/goful) - CUI file manager
 * [gokeybr](https://github.com/bunyk/gokeybr) - deliberately practice your typing
 * [gonano](https://github.com/jbaramidze/gonano) - editor, mimics _nano_
 * [uchess](https://github.com/tmountain/uchess) - UCI chess client
@@ -53,9 +57,10 @@ A brief, and still somewhat rough, [tutorial](TUTORIAL.md) is available.
 * [tmux-wormhole](https://github.com/gcla/tmux-wormhole) - _tmux_ plugin to transfer files
 * [gruid-tcell](https://github.com/anaseto/gruid-tcell) - driver for the grid based UI and game framework
 * [aretext](https://github.com/aretext/aretext) - minimalist text editor with _vim_ key bindings
-* [sync](https://github.com/kyprifog/sync) - github repo synchronization tool
+* [sync](https://github.com/kyprifog/sync) - GitHub repo synchronization tool
 * [statusbar](https://github.com/kyprifog/statusbar) - statusbar motivation tool for tracking periodic tasks/goals
 * [todo](https://github.com/kyprifog/todo) - simple todo app
+* [gosnakego](https://github.com/liweiyi88/gosnakego) - a snake game
 
 
 ## Pure Go Terminfo Database
diff --git a/vendor/github.com/gdamore/tcell/v2/UKRAINE.md b/vendor/github.com/gdamore/tcell/v2/UKRAINE.md
new file mode 100644
index 00000000000..d86d3e126dd
--- /dev/null
+++ b/vendor/github.com/gdamore/tcell/v2/UKRAINE.md
@@ -0,0 +1,77 @@
+# Ukraine, Russia, and a World Tragedy
+
+## A message to those inside Russia
+
+### Written March 4, 2022.
+
+It is with a very heavy heart that I write this.  I am normally opposed to the use of open source
+projects to communicate political positions or advocate for things outside the immediate relevancy
+to that project.
+
+However, the events occurring in Ukraine, and specifically the unprecedented invasion of Ukraine by
+Russian forces operating under orders from Russian President Vladimir Putin compel me to speak out.
+
+Those who know me, know that I have family, friends, and colleagues in Russia, and Ukraine both.  My closest friends
+have historically been Russian friends my wife's hometown of Chelyabinsk.  I myself have in the past
+frequently traveled to Russia, and indeed operated a software development firm with offices in St. Petersburg.
+I had a special kinship with Russia and its people.
+
+I say "had", because I fear that the actions of Putin, and the massive disinformation campaign that his regime
+has waged inside Russia, mean that it's likely that I won't see those friends again.  At present, I'm not sure
+my wife will see her own mother again.  We no longer feel it's safe for either of us to return Russia given
+actions taken by the regime to crack down on those who express disagreement.
+
+Russian citizens are being led to believe it is acting purely defensively, and that only legitimate military
+targets are being targeted, and that all the information we have received in the West are fakes.
+
+I am confident that nothing could be further from the truth.
+
+This has caused many in Russia, including people whom I respect and believe to be smarter than this, to
+stand by Putin, and endorse his actions. The claim is that the entirety of NATO is operating at the behest
+of the USA, and that the entirety of Europe was poised to attack Russia. While this is clearly absurd to those
+of us with any understanding of western politics, Russian citizens are being fed this lie, and believing it.
+
+If you're reading this from inside Russia -- YOU are the person that I hope this message reaches.  Your
+government is LYING to you.  Of course, all governments lie all the time.  But consider this.  Almost the
+entire world has condemned the invasion of Ukraine as criminal, and has applied sanctions.  Even countries
+which have poor relations with the US sanctioning Russia, as well as nations which historically have remained
+neutral.  (Famously neutral -- even during World War II, Switzerland has acted to apply sanctions in
+concert with the rest of the world.)
+
+Ask yourself, why does Putin fear a free press so much, if what he says is true?  Why the crack-downs on
+children expressing only a desire for peace with Ukraine?  Why would the entire world unified against him,
+if Putin was in the right?  Why would the only countries that stood with Russia against
+the UN resolution to condemn these acts as crimes be Belarus, North Korea, and Syria?  Even countries normally
+allied to Russia could not bring themselves to do more than abstain from the vote to condemn it.
+
+To be clear, I do not claim that the actions taken by the West or by the Ukrainian government were completely
+blameless.  On the contrary, I understand that Western media is biased, and the truth is rarely exactly
+as reported.  I believe that there is a kernel of truth in the claims of fascists and ultra-nationalist
+militias operating in Ukraine and specifically Donbas.  However, I am also equally certain that Putin's
+response is out of proportion, and that concerns about such militias are principally just a pretext to justify
+an invasion.
+
+Europe is at war, unlike we've seen in my lifetime.  The world is more divided, and closer to nuclear holocaust
+than it has been since the Cold War. And that is 100% the fault of Putin.
+
+While Putin remains in power, there cannot really be any way for Russian international relations to return
+to normal. Putin has set your country on a path to return to the Cold War, likely because he fancies himself
+to be a new Stalin.  However, unlike the Soviet Union, the Russian economy does not have the wherewithal to
+stand on its own, and the invasion of Ukraine has fully ensured that Russia will not find any friends anywhere
+else in Europe, and probably few places in Asia.
+
+The *only* paths forward for Russia are either a Russia without Putin (and those who would support his agenda),
+or a complete breakdown of Russian prosperity, likely followed by the increasing international conflict that will
+be the natural escalation from a country that is isolated and impoverished. Those of us observing from the West are
+gravely concerned, because we cannot see any end to this madness that does not result in nuclear conflict,
+unless from within.
+
+In the meantime, the worst prices will be paid for by innocents in Ukraine, and by young Russian mean
+forced to carry out the orders of Putin's corrupt regime.
+
+And *that* is why I write this -- to appeal to those within Russia to open your eyes, and think with
+your minds.  It is right and proper to be proud of your country and its rich heritage.  But it is also
+right and proper to look for ways to save it from the ruinous path that its current leadership has set it upon,
+and to recognize when that leadership is no longer acting in interest of the country or its people.
+
+  - Garrett D'Amore, March 4, 2022
\ No newline at end of file
diff --git a/vendor/github.com/gdamore/tcell/v2/console_win.go b/vendor/github.com/gdamore/tcell/v2/console_win.go
index a901a1255db..16be4e2fc85 100644
--- a/vendor/github.com/gdamore/tcell/v2/console_win.go
+++ b/vendor/github.com/gdamore/tcell/v2/console_win.go
@@ -46,11 +46,12 @@ type cScreen struct {
 	w int
 	h int
 
-	oscreen consoleInfo
-	ocursor cursorInfo
-	oimode  uint32
-	oomode  uint32
-	cells   CellBuffer
+	oscreen     consoleInfo
+	ocursor     cursorInfo
+	cursorStyle CursorStyle
+	oimode      uint32
+	oomode      uint32
+	cells       CellBuffer
 
 	finiOnce sync.Once
 
@@ -138,20 +139,37 @@ const (
 
 const (
 	// VT100/XTerm escapes understood by the console
-	vtShowCursor = "\x1b[?25h"
-	vtHideCursor = "\x1b[?25l"
-	vtCursorPos  = "\x1b[%d;%dH" // Note that it is Y then X
-	vtSgr0       = "\x1b[0m"
-	vtBold       = "\x1b[1m"
-	vtUnderline  = "\x1b[4m"
-	vtBlink      = "\x1b[5m" // Not sure this is processed
-	vtReverse    = "\x1b[7m"
-	vtSetFg      = "\x1b[38;5;%dm"
-	vtSetBg      = "\x1b[48;5;%dm"
-	vtSetFgRGB   = "\x1b[38;2;%d;%d;%dm" // RGB
-	vtSetBgRGB   = "\x1b[48;2;%d;%d;%dm" // RGB
+	vtShowCursor              = "\x1b[?25h"
+	vtHideCursor              = "\x1b[?25l"
+	vtCursorPos               = "\x1b[%d;%dH" // Note that it is Y then X
+	vtSgr0                    = "\x1b[0m"
+	vtBold                    = "\x1b[1m"
+	vtUnderline               = "\x1b[4m"
+	vtBlink                   = "\x1b[5m" // Not sure this is processed
+	vtReverse                 = "\x1b[7m"
+	vtSetFg                   = "\x1b[38;5;%dm"
+	vtSetBg                   = "\x1b[48;5;%dm"
+	vtSetFgRGB                = "\x1b[38;2;%d;%d;%dm" // RGB
+	vtSetBgRGB                = "\x1b[48;2;%d;%d;%dm" // RGB
+	vtCursorDefault           = "\x1b[0 q"
+	vtCursorBlinkingBlock     = "\x1b[1 q"
+	vtCursorSteadyBlock       = "\x1b[2 q"
+	vtCursorBlinkingUnderline = "\x1b[3 q"
+	vtCursorSteadyUnderline   = "\x1b[4 q"
+	vtCursorBlinkingBar       = "\x1b[5 q"
+	vtCursorSteadyBar         = "\x1b[6 q"
 )
 
+var vtCursorStyles = map[CursorStyle]string{
+	CursorStyleDefault:           vtCursorDefault,
+	CursorStyleBlinkingBlock:     vtCursorBlinkingBlock,
+	CursorStyleSteadyBlock:       vtCursorSteadyBlock,
+	CursorStyleBlinkingUnderline: vtCursorBlinkingUnderline,
+	CursorStyleSteadyUnderline:   vtCursorSteadyUnderline,
+	CursorStyleBlinkingBar:       vtCursorBlinkingBar,
+	CursorStyleSteadyBar:         vtCursorSteadyBar,
+}
+
 // NewConsoleScreen returns a Screen for the Windows console associated
 // with the current process.  The Screen makes use of the Windows Console
 // API to display content and read events.
@@ -280,6 +298,9 @@ func (s *cScreen) disengage() {
 
 	s.wg.Wait()
 
+	if s.vten {
+		s.emitVtString(vtCursorStyles[CursorStyleDefault])
+	}
 	s.setInMode(s.oimode)
 	s.setOutMode(s.oomode)
 	s.setBufferSize(int(s.oscreen.size.x), int(s.oscreen.size.y))
@@ -406,6 +427,7 @@ func (s *cScreen) emitVtString(vs string) {
 func (s *cScreen) showCursor() {
 	if s.vten {
 		s.emitVtString(vtShowCursor)
+		s.emitVtString(vtCursorStyles[s.cursorStyle])
 	} else {
 		s.setCursorInfo(&cursorInfo{size: 100, visible: 1})
 	}
@@ -429,6 +451,17 @@ func (s *cScreen) ShowCursor(x, y int) {
 	s.Unlock()
 }
 
+func (s *cScreen) SetCursorStyle(cs CursorStyle) {
+	s.Lock()
+	if !s.fini {
+		if _, ok := vtCursorStyles[cs]; ok {
+			s.cursorStyle = cs
+			s.doCursor()
+		}
+	}
+	s.Unlock()
+}
+
 func (s *cScreen) doCursor() {
 	x, y := s.curx, s.cury
 
diff --git a/vendor/github.com/gdamore/tcell/v2/go.mod b/vendor/github.com/gdamore/tcell/v2/go.mod
index ac4b10db458..4b10eda4e5c 100644
--- a/vendor/github.com/gdamore/tcell/v2/go.mod
+++ b/vendor/github.com/gdamore/tcell/v2/go.mod
@@ -6,7 +6,7 @@ require (
 	github.com/gdamore/encoding v1.0.0
 	github.com/lucasb-eyer/go-colorful v1.2.0
 	github.com/mattn/go-runewidth v0.0.13
-	golang.org/x/sys v0.0.0-20201119102817-f84b799fce68
+	golang.org/x/sys v0.0.0-20211113001501-0c823b97ae02
 	golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf
 	golang.org/x/text v0.3.7
 )
diff --git a/vendor/github.com/gdamore/tcell/v2/go.sum b/vendor/github.com/gdamore/tcell/v2/go.sum
index b25da2aa5ae..84e8300d6f5 100644
--- a/vendor/github.com/gdamore/tcell/v2/go.sum
+++ b/vendor/github.com/gdamore/tcell/v2/go.sum
@@ -6,8 +6,9 @@ github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4
 github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
 github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
 github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
-golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
 golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20211113001501-0c823b97ae02 h1:7NCfEGl0sfUojmX78nK9pBJuUlSZWEJA/TwASvfiPLo=
+golang.org/x/sys v0.0.0-20211113001501-0c823b97ae02/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M=
 golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
diff --git a/vendor/github.com/gdamore/tcell/v2/screen.go b/vendor/github.com/gdamore/tcell/v2/screen.go
index 15cfbf02224..272c8fdf822 100644
--- a/vendor/github.com/gdamore/tcell/v2/screen.go
+++ b/vendor/github.com/gdamore/tcell/v2/screen.go
@@ -71,9 +71,14 @@ type Screen interface {
 	ShowCursor(x int, y int)
 
 	// HideCursor is used to hide the cursor.  Its an alias for
-	// ShowCursor(-1, -1).
+	// ShowCursor(-1, -1).sim
 	HideCursor()
 
+	// SetCursorStyle is used to set the cursor style.  If the style
+	// is not supported (or cursor styles are not supported at all),
+	// then this will have no effect.
+	SetCursorStyle(CursorStyle)
+
 	// Size returns the screen size as width, height.  This changes in
 	// response to a call to Clear or Flush.
 	Size() (width, height int)
@@ -258,3 +263,17 @@ const (
 	MouseDragEvents   = MouseFlags(2) // Click-drag events (includes button events)
 	MouseMotionEvents = MouseFlags(4) // All mouse events (includes click and drag events)
 )
+
+// CursorStyle represents a given cursor style, which can include the shape and
+// whether the cursor blinks or is solid.  Support for changing these is not universal.
+type CursorStyle int
+
+const (
+	CursorStyleDefault = CursorStyle(iota) // The default
+	CursorStyleBlinkingBlock
+	CursorStyleSteadyBlock
+	CursorStyleBlinkingUnderline
+	CursorStyleSteadyUnderline
+	CursorStyleBlinkingBar
+	CursorStyleSteadyBar
+)
\ No newline at end of file
diff --git a/vendor/github.com/gdamore/tcell/v2/simulation.go b/vendor/github.com/gdamore/tcell/v2/simulation.go
index 451460be250..f8b1c0a221c 100644
--- a/vendor/github.com/gdamore/tcell/v2/simulation.go
+++ b/vendor/github.com/gdamore/tcell/v2/simulation.go
@@ -281,6 +281,8 @@ func (s *simscreen) hideCursor() {
 	s.cursorvis = false
 }
 
+func (s *simscreen) SetCursorStyle(CursorStyle) {}
+
 func (s *simscreen) Show() {
 	s.Lock()
 	s.resize()
diff --git a/vendor/github.com/gdamore/tcell/v2/terminfo/f/foot/foot.go b/vendor/github.com/gdamore/tcell/v2/terminfo/f/foot/foot.go
index fb734cbdc2d..3197d828535 100644
--- a/vendor/github.com/gdamore/tcell/v2/terminfo/f/foot/foot.go
+++ b/vendor/github.com/gdamore/tcell/v2/terminfo/f/foot/foot.go
@@ -9,6 +9,7 @@ func init() {
 	// foot terminal emulator
 	terminfo.AddTerminfo(&terminfo.Terminfo{
 		Name:         "foot",
+		Aliases:      []string{"foot-extra"},
 		Columns:      80,
 		Lines:        24,
 		Colors:       256,
diff --git a/vendor/github.com/gdamore/tcell/v2/terminfo/terminfo.go b/vendor/github.com/gdamore/tcell/v2/terminfo/terminfo.go
index 7e17352cc48..193e06e39d3 100644
--- a/vendor/github.com/gdamore/tcell/v2/terminfo/terminfo.go
+++ b/vendor/github.com/gdamore/tcell/v2/terminfo/terminfo.go
@@ -167,59 +167,66 @@ type Terminfo struct {
 	// Terminal support for these are going to vary amongst XTerm
 	// emulations, so don't depend too much on them in your application.
 
-	StrikeThrough   string // smxx
-	SetFgBg         string // setfgbg
-	SetFgBgRGB      string // setfgbgrgb
-	SetFgRGB        string // setfrgb
-	SetBgRGB        string // setbrgb
-	KeyShfUp        string // shift-up
-	KeyShfDown      string // shift-down
-	KeyShfPgUp      string // shift-kpp
-	KeyShfPgDn      string // shift-knp
-	KeyCtrlUp       string // ctrl-up
-	KeyCtrlDown     string // ctrl-left
-	KeyCtrlRight    string // ctrl-right
-	KeyCtrlLeft     string // ctrl-left
-	KeyMetaUp       string // meta-up
-	KeyMetaDown     string // meta-left
-	KeyMetaRight    string // meta-right
-	KeyMetaLeft     string // meta-left
-	KeyAltUp        string // alt-up
-	KeyAltDown      string // alt-left
-	KeyAltRight     string // alt-right
-	KeyAltLeft      string // alt-left
-	KeyCtrlHome     string
-	KeyCtrlEnd      string
-	KeyMetaHome     string
-	KeyMetaEnd      string
-	KeyAltHome      string
-	KeyAltEnd       string
-	KeyAltShfUp     string
-	KeyAltShfDown   string
-	KeyAltShfLeft   string
-	KeyAltShfRight  string
-	KeyMetaShfUp    string
-	KeyMetaShfDown  string
-	KeyMetaShfLeft  string
-	KeyMetaShfRight string
-	KeyCtrlShfUp    string
-	KeyCtrlShfDown  string
-	KeyCtrlShfLeft  string
-	KeyCtrlShfRight string
-	KeyCtrlShfHome  string
-	KeyCtrlShfEnd   string
-	KeyAltShfHome   string
-	KeyAltShfEnd    string
-	KeyMetaShfHome  string
-	KeyMetaShfEnd   string
-	EnablePaste     string // bracketed paste mode
-	DisablePaste    string
-	PasteStart      string
-	PasteEnd        string
-	Modifiers       int
-	InsertChar      string // string to insert a character (ich1)
-	AutoMargin      bool   // true if writing to last cell in line advances
-	TrueColor       bool   // true if the terminal supports direct color
+	StrikeThrough           string // smxx
+	SetFgBg                 string // setfgbg
+	SetFgBgRGB              string // setfgbgrgb
+	SetFgRGB                string // setfrgb
+	SetBgRGB                string // setbrgb
+	KeyShfUp                string // shift-up
+	KeyShfDown              string // shift-down
+	KeyShfPgUp              string // shift-kpp
+	KeyShfPgDn              string // shift-knp
+	KeyCtrlUp               string // ctrl-up
+	KeyCtrlDown             string // ctrl-left
+	KeyCtrlRight            string // ctrl-right
+	KeyCtrlLeft             string // ctrl-left
+	KeyMetaUp               string // meta-up
+	KeyMetaDown             string // meta-left
+	KeyMetaRight            string // meta-right
+	KeyMetaLeft             string // meta-left
+	KeyAltUp                string // alt-up
+	KeyAltDown              string // alt-left
+	KeyAltRight             string // alt-right
+	KeyAltLeft              string // alt-left
+	KeyCtrlHome             string
+	KeyCtrlEnd              string
+	KeyMetaHome             string
+	KeyMetaEnd              string
+	KeyAltHome              string
+	KeyAltEnd               string
+	KeyAltShfUp             string
+	KeyAltShfDown           string
+	KeyAltShfLeft           string
+	KeyAltShfRight          string
+	KeyMetaShfUp            string
+	KeyMetaShfDown          string
+	KeyMetaShfLeft          string
+	KeyMetaShfRight         string
+	KeyCtrlShfUp            string
+	KeyCtrlShfDown          string
+	KeyCtrlShfLeft          string
+	KeyCtrlShfRight         string
+	KeyCtrlShfHome          string
+	KeyCtrlShfEnd           string
+	KeyAltShfHome           string
+	KeyAltShfEnd            string
+	KeyMetaShfHome          string
+	KeyMetaShfEnd           string
+	EnablePaste             string // bracketed paste mode
+	DisablePaste            string
+	PasteStart              string
+	PasteEnd                string
+	Modifiers               int
+	InsertChar              string // string to insert a character (ich1)
+	AutoMargin              bool   // true if writing to last cell in line advances
+	TrueColor               bool   // true if the terminal supports direct color
+	CursorDefault           string
+	CursorBlinkingBlock     string
+	CursorSteadyBlock       string
+	CursorBlinkingUnderline string
+	CursorSteadyUnderline   string
+	CursorBlinkingBar       string
+	CursorSteadyBar         string
 }
 
 const (
diff --git a/vendor/github.com/gdamore/tcell/v2/tscreen.go b/vendor/github.com/gdamore/tcell/v2/tscreen.go
index d0f73e54e40..8def2616393 100644
--- a/vendor/github.com/gdamore/tcell/v2/tscreen.go
+++ b/vendor/github.com/gdamore/tcell/v2/tscreen.go
@@ -148,6 +148,8 @@ type tScreen struct {
 	finiOnce     sync.Once
 	enablePaste  string
 	disablePaste string
+	cursorStyles map[CursorStyle]string
+	cursorStyle  CursorStyle
 	saved        *term.State
 	stopQ        chan struct{}
 	running      bool
@@ -332,6 +334,34 @@ func (t *tScreen) prepareBracketedPaste() {
 	}
 }
 
+func (t *tScreen) prepareCursorStyles() {
+	// Another workaround for lack of reporting in terminfo.
+	// We assume if the terminal has a mouse entry, that it
+	// offers bracketed paste.  But we allow specific overrides
+	// via our terminal database.
+	if t.ti.CursorDefault != "" {
+		t.cursorStyles = map[CursorStyle]string{
+			CursorStyleDefault:           t.ti.CursorDefault,
+			CursorStyleBlinkingBlock:     t.ti.CursorBlinkingBlock,
+			CursorStyleSteadyBlock:       t.ti.CursorSteadyBlock,
+			CursorStyleBlinkingUnderline: t.ti.CursorBlinkingUnderline,
+			CursorStyleSteadyUnderline:   t.ti.CursorSteadyUnderline,
+			CursorStyleBlinkingBar:       t.ti.CursorBlinkingBar,
+			CursorStyleSteadyBar:         t.ti.CursorSteadyBar,
+		}
+	} else if t.ti.Mouse != "" {
+		t.cursorStyles = map[CursorStyle]string{
+			CursorStyleDefault:           "\x1b[0 q",
+			CursorStyleBlinkingBlock:     "\x1b[1 q",
+			CursorStyleSteadyBlock:       "\x1b[2 q",
+			CursorStyleBlinkingUnderline: "\x1b[3 q",
+			CursorStyleSteadyUnderline:   "\x1b[4 q",
+			CursorStyleBlinkingBar:       "\x1b[5 q",
+			CursorStyleSteadyBar:         "\x1b[6 q",
+		}
+	}
+}
+
 func (t *tScreen) prepareKey(key Key, val string) {
 	t.prepareKeyMod(key, ModNone, val)
 }
@@ -471,6 +501,7 @@ func (t *tScreen) prepareKeys() {
 	t.prepareKey(keyPasteEnd, ti.PasteEnd)
 	t.prepareXtermModifiers()
 	t.prepareBracketedPaste()
+	t.prepareCursorStyles()
 
 outer:
 	// Add key mappings for control keys.
@@ -517,6 +548,18 @@ func (t *tScreen) SetStyle(style Style) {
 
 func (t *tScreen) Clear() {
 	t.Fill(' ', t.style)
+	t.Lock()
+	t.clear = true
+	w, h := t.cells.Size()
+	// because we are going to clear (see t.clear) in the next cycle,
+	// let's also unmark the dirty bit so that we don't waste cycles
+	// drawing things that are already dealt with via the clear escape sequence.
+	for row := 0; row < h; row++ {
+		for col := 0; col < w; col++ {
+			t.cells.SetDirty(col, row, false)
+		}
+	}
+	t.Unlock()
 }
 
 func (t *tScreen) Fill(r rune, style Style) {
@@ -754,6 +797,12 @@ func (t *tScreen) ShowCursor(x, y int) {
 	t.Unlock()
 }
 
+func (t *tScreen) SetCursorStyle(cs CursorStyle) {
+	t.Lock()
+	t.cursorStyle = cs
+	t.Unlock()
+}
+
 func (t *tScreen) HideCursor() {
 	t.ShowCursor(-1, -1)
 }
@@ -768,6 +817,11 @@ func (t *tScreen) showCursor() {
 	}
 	t.TPuts(t.ti.TGoto(x, y))
 	t.TPuts(t.ti.ShowCursor)
+	if t.cursorStyles != nil {
+		if esc, ok := t.cursorStyles[t.cursorStyle]; ok {
+			t.TPuts(esc)
+		}
+	}
 	t.cx = x
 	t.cy = y
 }
@@ -894,8 +948,9 @@ func (t *tScreen) enableMouse(f MouseFlags) {
 		if f&MouseMotionEvents != 0 {
 			t.TPuts("\x1b[?1003h")
 		}
-
-		t.TPuts("\x1b[?1006h")
+		if f&(MouseButtonEvents|MouseDragEvents|MouseMotionEvents) != 0 {
+			t.TPuts("\x1b[?1006h")
+		}
 	}
 
 }
@@ -1737,6 +1792,9 @@ func (t *tScreen) disengage() {
 	ti := t.ti
 	t.cells.Resize(0, 0)
 	t.TPuts(ti.ShowCursor)
+	if t.cursorStyles != nil && t.cursorStyle != CursorStyleDefault {
+		t.TPuts(t.cursorStyles[t.cursorStyle])
+	}
 	t.TPuts(ti.ResetFgBg)
 	t.TPuts(ti.AttrOff)
 	t.TPuts(ti.Clear)
diff --git a/vendor/github.com/gdamore/tcell/v2/tty_unix.go b/vendor/github.com/gdamore/tcell/v2/tty_unix.go
index dbd961bbff8..aa6b7d5a830 100644
--- a/vendor/github.com/gdamore/tcell/v2/tty_unix.go
+++ b/vendor/github.com/gdamore/tcell/v2/tty_unix.go
@@ -72,7 +72,6 @@ func (tty *devTty) Start() error {
 	if tty.f, err = os.OpenFile(tty.dev, os.O_RDWR, 0); err != nil {
 		return err
 	}
-	tty.fd = int(tty.f.Fd())
 
 	if !term.IsTerminal(tty.fd) {
 		return errors.New("device is not a terminal")
diff --git a/vendor/github.com/golang-collections/collections/LICENSE b/vendor/github.com/golang-collections/collections/LICENSE
deleted file mode 100644
index 863a984dad2..00000000000
--- a/vendor/github.com/golang-collections/collections/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2012 Caleb Doxsey
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/vendor/github.com/golang-collections/collections/stack/stack.go b/vendor/github.com/golang-collections/collections/stack/stack.go
deleted file mode 100644
index 11f472a9ba2..00000000000
--- a/vendor/github.com/golang-collections/collections/stack/stack.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package stack
-
-type (
-	Stack struct {
-		top *node
-		length int
-	}
-	node struct {
-		value interface{}
-		prev *node
-	}	
-)
-// Create a new stack
-func New() *Stack {
-	return &Stack{nil,0}
-}
-// Return the number of items in the stack
-func (this *Stack) Len() int {
-	return this.length
-}
-// View the top item on the stack
-func (this *Stack) Peek() interface{} {
-	if this.length == 0 {
-		return nil
-	}
-	return this.top.value
-}
-// Pop the top item of the stack and return it
-func (this *Stack) Pop() interface{} {
-	if this.length == 0 {
-		return nil
-	}
-	
-	n := this.top
-	this.top = n.prev
-	this.length--
-	return n.value
-}
-// Push a value onto the top of the stack
-func (this *Stack) Push(value interface{}) {
-	n := &node{value,this.top}
-	this.top = n
-	this.length++
-}
\ No newline at end of file
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 020eb54b197..ef60705da2d 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -33,7 +33,7 @@ github.com/fatih/color
 github.com/fsnotify/fsnotify
 # github.com/gdamore/encoding v1.0.0
 github.com/gdamore/encoding
-# github.com/gdamore/tcell/v2 v2.4.1-0.20210926162909-66f061b1fc9b
+# github.com/gdamore/tcell/v2 v2.4.1-0.20220313203054-2a1a1b586447
 ## explicit
 github.com/gdamore/tcell/v2
 github.com/gdamore/tcell/v2/terminfo
@@ -102,7 +102,6 @@ github.com/gobwas/glob/util/runes
 github.com/gobwas/glob/util/strings
 # github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
 ## explicit
-github.com/golang-collections/collections/stack
 # github.com/golang/protobuf v1.3.2
 ## explicit
 # github.com/google/go-cmp v0.5.6


Test patch: