diff -pruN 0.0~git20171006.a221f2f-1/AUTHORS 0.0~git20190212.5c58b4e-1/AUTHORS
--- 0.0~git20171006.a221f2f-1/AUTHORS	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/AUTHORS	2019-02-12 01:53:32.000000000 +0000
@@ -1,4 +1,2 @@
 Garrett D'Amore <garrett@damore.org>
 Zachary Yedidia <zyedidia@gmail.com>
-Junegunn Choi <junegunn.c@gmail.com>
-Collin Warren <anatoly@somethinghub.com>
diff -pruN 0.0~git20171006.a221f2f-1/color.go 0.0~git20190212.5c58b4e-1/color.go
--- 0.0~git20171006.a221f2f-1/color.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/color.go	2019-02-12 01:53:32.000000000 +0000
@@ -435,8 +435,7 @@ const (
 	ColorSlateGrey      = ColorSlateGray
 )
 
-// ColorValues maps color constants to their RGB values.
-var ColorValues = map[Color]int32{
+var colorValues = map[Color]int32{
 	ColorBlack:                0x000000,
 	ColorMaroon:               0x800000,
 	ColorGreen:                0x008000,
@@ -818,9 +817,7 @@ var ColorValues = map[Color]int32{
 	ColorYellowGreen:          0x9ACD32,
 }
 
-// ColorNames holds the written names of colors. Useful to present a list of
-// recognized named colors.
-var ColorNames = map[string]Color{
+var colorNames = map[string]Color{
 	"black":                ColorBlack,
 	"maroon":               ColorMaroon,
 	"green":                ColorGreen,
@@ -976,7 +973,7 @@ func (c Color) Hex() int32 {
 	if c&ColorIsRGB != 0 {
 		return (int32(c) & 0xffffff)
 	}
-	if v, ok := ColorValues[c]; ok {
+	if v, ok := colorValues[c]; ok {
 		return v
 	}
 	return -1
@@ -1007,7 +1004,7 @@ func NewHexColor(v int32) Color {
 // GetColor creates a Color from a color name (W3C name). A hex value may
 // be supplied as a string in the format "#ffffff".
 func GetColor(name string) Color {
-	if c, ok := ColorNames[name]; ok {
+	if c, ok := colorNames[name]; ok {
 		return c
 	}
 	if len(name) == 7 && name[0] == '#' {
diff -pruN 0.0~git20171006.a221f2f-1/console_win.go 0.0~git20190212.5c58b4e-1/console_win.go
--- 0.0~git20171006.a221f2f-1/console_win.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/console_win.go	2019-02-12 01:53:32.000000000 +0000
@@ -17,7 +17,6 @@
 package tcell
 
 import (
-	"errors"
 	"sync"
 	"syscall"
 	"unicode/utf16"
@@ -25,18 +24,16 @@ import (
 )
 
 type cScreen struct {
-	in         syscall.Handle
-	out        syscall.Handle
-	cancelflag syscall.Handle
-	title      syscall.Handle
-	scandone   chan struct{}
-	evch       chan Event
-	quit       chan struct{}
-	curx       int
-	cury       int
-	style      Style
-	clear      bool
-	fini       bool
+	in    syscall.Handle
+	out   syscall.Handle
+	title syscall.Handle
+	evch  chan Event
+	quit  chan struct{}
+	curx  int
+	cury  int
+	style Style
+	clear bool
+	fini  bool
 
 	w int
 	h int
@@ -99,11 +96,11 @@ var k32 = syscall.NewLazyDLL("kernel32.d
 // Note that Windows appends some functions with W to indicate that wide
 // characters (Unicode) are in use.  The documentation refers to them
 // without this suffix, as the resolution is made via preprocessor.
+// We have to bring in the kernel32.dll directly, so we can get access to some
+// system calls that the core Go API lacks.
+
 var (
 	procReadConsoleInput           = k32.NewProc("ReadConsoleInputW")
-	procWaitForMultipleObjects     = k32.NewProc("WaitForMultipleObjects")
-	procCreateEvent                = k32.NewProc("CreateEventW")
-	procSetEvent                   = k32.NewProc("SetEvent")
 	procGetConsoleCursorInfo       = k32.NewProc("GetConsoleCursorInfo")
 	procSetConsoleCursorInfo       = k32.NewProc("SetConsoleCursorInfo")
 	procSetConsoleCursorPosition   = k32.NewProc("SetConsoleCursorPosition")
@@ -118,11 +115,6 @@ var (
 	procSetConsoleTitle            = k32.NewProc("SetConsoleTitleW")
 )
 
-const (
-	w32Infinite    = ^uintptr(0)
-	w32WaitObject0 = uintptr(0)
-)
-
 // 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.
@@ -131,9 +123,9 @@ func NewConsoleScreen() (Screen, error)
 }
 
 func (s *cScreen) Init() error {
+
 	s.evch = make(chan Event, 10)
 	s.quit = make(chan struct{})
-	s.scandone = make(chan struct{})
 
 	in, e := syscall.Open("CONIN$", syscall.O_RDWR, 0)
 	if e != nil {
@@ -147,16 +139,6 @@ func (s *cScreen) Init() error {
 	}
 	s.out = out
 
-	cf, _, e := procCreateEvent.Call(
-		uintptr(0),
-		uintptr(1),
-		uintptr(0),
-		uintptr(0))
-	if cf == uintptr(0) {
-		return e
-	}
-	s.cancelflag = syscall.Handle(cf)
-
 	s.Lock()
 
 	s.curx = -1
@@ -214,10 +196,6 @@ func (s *cScreen) Fini() {
 		uintptr(s.mapStyle(StyleDefault)))
 
 	close(s.quit)
-	procSetEvent.Call(uintptr(s.cancelflag))
-	// Block until scanInput returns; this prevents a race condition on Win 8+
-	// which causes syscall.Close to block until another keypress is read.
-	<-s.scandone
 	syscall.Close(s.in)
 	syscall.Close(s.out)
 }
@@ -523,101 +501,79 @@ func mrec2btns(mbtns, flags uint32) Butt
 }
 
 func (s *cScreen) getConsoleInput() error {
-	// cancelFlag comes first as WaitForMultipleObjects returns the lowest index
-	// in the event that both events are signalled.
-	waitObjects := []syscall.Handle{s.cancelflag, s.in}
-	// As arrays are contiguous in memory, a pointer to the first object is the
-	// same as a pointer to the array itself.
-	pWaitObjects := unsafe.Pointer(&waitObjects[0])
-
-	rv, _, er := procWaitForMultipleObjects.Call(
-		uintptr(len(waitObjects)),
-		uintptr(pWaitObjects),
-		uintptr(0),
-		w32Infinite)
-	// WaitForMultipleObjects returns WAIT_OBJECT_0 + the index.
-	switch rv {
-	case w32WaitObject0: // s.cancelFlag
-		return errors.New("cancelled")
-	case w32WaitObject0 + 1: // s.in
-		rec := &inputRecord{}
-		var nrec int32
-		rv, _, er := procReadConsoleInput.Call(
-			uintptr(s.in),
-			uintptr(unsafe.Pointer(rec)),
-			uintptr(1),
-			uintptr(unsafe.Pointer(&nrec)))
-		if rv == 0 {
-			return er
-		}
-		if nrec != 1 {
+	rec := &inputRecord{}
+	var nrec int32
+	rv, _, er := procReadConsoleInput.Call(
+		uintptr(s.in),
+		uintptr(unsafe.Pointer(rec)),
+		uintptr(1),
+		uintptr(unsafe.Pointer(&nrec)))
+	if rv == 0 {
+		return er
+	}
+	if nrec != 1 {
+		return nil
+	}
+	switch rec.typ {
+	case keyEvent:
+		krec := &keyRecord{}
+		krec.isdown = geti32(rec.data[0:])
+		krec.repeat = getu16(rec.data[4:])
+		krec.kcode = getu16(rec.data[6:])
+		krec.scode = getu16(rec.data[8:])
+		krec.ch = getu16(rec.data[10:])
+		krec.mod = getu32(rec.data[12:])
+
+		if krec.isdown == 0 || krec.repeat < 1 {
+			// its a key release event, ignore it
 			return nil
 		}
-		switch rec.typ {
-		case keyEvent:
-			krec := &keyRecord{}
-			krec.isdown = geti32(rec.data[0:])
-			krec.repeat = getu16(rec.data[4:])
-			krec.kcode = getu16(rec.data[6:])
-			krec.scode = getu16(rec.data[8:])
-			krec.ch = getu16(rec.data[10:])
-			krec.mod = getu32(rec.data[12:])
-
-			if krec.isdown == 0 || krec.repeat < 1 {
-				// its a key release event, ignore it
-				return nil
-			}
-			if krec.ch != 0 {
-				// synthesized key code
-				for krec.repeat > 0 {
-					s.PostEvent(NewEventKey(KeyRune, rune(krec.ch),
-						mod2mask(krec.mod)))
-					krec.repeat--
-				}
-				return nil
-			}
-			key := KeyNUL // impossible on Windows
-			ok := false
-			if key, ok = vkKeys[krec.kcode]; !ok {
-				return nil
-			}
+		if krec.ch != 0 {
+			// synthesized key code
 			for krec.repeat > 0 {
-				s.PostEvent(NewEventKey(key, rune(krec.ch),
+				s.PostEvent(NewEventKey(KeyRune, rune(krec.ch),
 					mod2mask(krec.mod)))
 				krec.repeat--
 			}
+			return nil
+		}
+		key := KeyNUL // impossible on Windows
+		ok := false
+		if key, ok = vkKeys[krec.kcode]; !ok {
+			return nil
+		}
+		for krec.repeat > 0 {
+			s.PostEvent(NewEventKey(key, rune(krec.ch),
+				mod2mask(krec.mod)))
+			krec.repeat--
+		}
 
-		case mouseEvent:
-			var mrec mouseRecord
-			mrec.x = geti16(rec.data[0:])
-			mrec.y = geti16(rec.data[2:])
-			mrec.btns = getu32(rec.data[4:])
-			mrec.mod = getu32(rec.data[8:])
-			mrec.flags = getu32(rec.data[12:])
-			btns := mrec2btns(mrec.btns, mrec.flags)
-			// we ignore double click, events are delivered normally
-			s.PostEvent(NewEventMouse(int(mrec.x), int(mrec.y), btns,
-				mod2mask(mrec.mod)))
-
-		case resizeEvent:
-			var rrec resizeRecord
-			rrec.x = geti16(rec.data[0:])
-			rrec.y = geti16(rec.data[2:])
-			s.PostEvent(NewEventResize(int(rrec.x), int(rrec.y)))
+	case mouseEvent:
+		var mrec mouseRecord
+		mrec.x = geti16(rec.data[0:])
+		mrec.y = geti16(rec.data[2:])
+		mrec.btns = getu32(rec.data[4:])
+		mrec.mod = getu32(rec.data[8:])
+		mrec.flags = getu32(rec.data[12:])
+		btns := mrec2btns(mrec.btns, mrec.flags)
+		// we ignore double click, events are delivered normally
+		s.PostEvent(NewEventMouse(int(mrec.x), int(mrec.y), btns,
+			mod2mask(mrec.mod), false))
+
+	case resizeEvent:
+		var rrec resizeRecord
+		rrec.x = geti16(rec.data[0:])
+		rrec.y = geti16(rec.data[2:])
+		s.PostEvent(NewEventResize(int(rrec.x), int(rrec.y)))
 
-		default:
-		}
 	default:
-		return er
 	}
-
 	return nil
 }
 
 func (s *cScreen) scanInput() {
 	for {
 		if e := s.getConsoleInput(); e != nil {
-			close(s.scandone)
 			return
 		}
 	}
@@ -649,6 +605,7 @@ var vgaColors = map[Color]uint16{
 
 // Windows uses RGB signals
 func mapColor2RGB(c Color) uint16 {
+
 	winLock.Lock()
 	if v, ok := winColors[c]; ok {
 		c = v
@@ -702,6 +659,7 @@ func (s *cScreen) mapStyle(style Style)
 }
 
 func (s *cScreen) SetCell(x, y int, style Style, ch ...rune) {
+
 	if len(ch) > 0 {
 		s.SetContent(x, y, ch[0], ch[1:], style)
 	} else {
@@ -754,6 +712,7 @@ func (s *cScreen) draw() {
 
 	for y := 0; y < int(s.h); y++ {
 		for x := 0; x < int(s.w); x++ {
+
 			mainc, combc, style, width := s.cells.GetContent(x, y)
 			dirty := s.cells.Dirty(x, y)
 			if style == StyleDefault {
@@ -857,6 +816,7 @@ func (s *cScreen) setBufferSize(x, y int
 }
 
 func (s *cScreen) Size() (int, int) {
+
 	s.Lock()
 	w, h := s.w, s.h
 	s.Unlock()
@@ -865,6 +825,7 @@ func (s *cScreen) Size() (int, int) {
 }
 
 func (s *cScreen) resize() {
+
 	info := consoleInfo{}
 	s.getConsoleInfo(&info)
 
@@ -991,6 +952,7 @@ func (s *cScreen) HasMouse() bool {
 func (s *cScreen) Resize(int, int, int, int) {}
 
 func (s *cScreen) HasKey(k Key) bool {
+
 	// Microsoft has codes for some keys, but they are unusual,
 	// so we don't include them.  We include all the typical
 	// 101, 105 key layout keys.
diff -pruN 0.0~git20171006.a221f2f-1/database.go 0.0~git20190212.5c58b4e-1/database.go
--- 0.0~git20171006.a221f2f-1/database.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/database.go	2019-02-12 01:53:32.000000000 +0000
@@ -1409,64 +1409,104 @@ func init() {
 		KeyF20:       "\x1b[34~",
 	})
 	AddTerminfo(&Terminfo{
-		Name:         "linux",
-		Columns:      -1,
-		Lines:        -1,
-		Colors:       8,
-		Bell:         "\a",
-		Clear:        "\x1b[H\x1b[J",
-		ShowCursor:   "\x1b[?25h\x1b[?0c",
-		HideCursor:   "\x1b[?25l\x1b[?1c",
-		AttrOff:      "\x1b[0;10m",
-		Underline:    "\x1b[4m",
-		Bold:         "\x1b[1m",
-		Dim:          "\x1b[2m",
-		Blink:        "\x1b[5m",
-		Reverse:      "\x1b[7m",
-		SetFg:        "\x1b[3%p1%dm",
-		SetBg:        "\x1b[4%p1%dm",
-		SetFgBg:      "\x1b[3%p1%d;4%p2%dm",
-		PadChar:      "\x00",
-		AltChars:     "+\x10,\x11-\x18.\x190\xdb`\x04a\xb1f\xf8g\xf1h\xb0i\xcej\xd9k\xbfl\xdam\xc0n\xc5o~p\xc4q\xc4r\xc4s_t\xc3u\xb4v\xc1w\xc2x\xb3y\xf3z\xf2{\xe3|\xd8}\x9c~\xfe",
-		EnterAcs:     "\x1b[11m",
-		ExitAcs:      "\x1b[10m",
-		Mouse:        "\x1b[M",
-		MouseMode:    "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c",
-		SetCursor:    "\x1b[%i%p1%d;%p2%dH",
-		CursorBack1:  "\b",
-		CursorUp1:    "\x1b[A",
-		KeyUp:        "\x1b[A",
-		KeyDown:      "\x1b[B",
-		KeyRight:     "\x1b[C",
-		KeyLeft:      "\x1b[D",
-		KeyInsert:    "\x1b[2~",
-		KeyDelete:    "\x1b[3~",
-		KeyBackspace: "\u007f",
-		KeyHome:      "\x1b[1~",
-		KeyEnd:       "\x1b[4~",
-		KeyPgUp:      "\x1b[5~",
-		KeyPgDn:      "\x1b[6~",
-		KeyF1:        "\x1b[[A",
-		KeyF2:        "\x1b[[B",
-		KeyF3:        "\x1b[[C",
-		KeyF4:        "\x1b[[D",
-		KeyF5:        "\x1b[[E",
-		KeyF6:        "\x1b[17~",
-		KeyF7:        "\x1b[18~",
-		KeyF8:        "\x1b[19~",
-		KeyF9:        "\x1b[20~",
-		KeyF10:       "\x1b[21~",
-		KeyF11:       "\x1b[23~",
-		KeyF12:       "\x1b[24~",
-		KeyF13:       "\x1b[25~",
-		KeyF14:       "\x1b[26~",
-		KeyF15:       "\x1b[28~",
-		KeyF16:       "\x1b[29~",
-		KeyF17:       "\x1b[31~",
-		KeyF18:       "\x1b[32~",
-		KeyF19:       "\x1b[33~",
-		KeyF20:       "\x1b[34~",
-		KeyBacktab:   "\x1b[Z",
+		Name:            "linux",
+		Columns:         -1,
+		Lines:           -1,
+		Colors:          8,
+		Bell:            "\a",
+		Clear:           "\x1b[H\x1b[J",
+		ShowCursor:      "\x1b[?25h\x1b[?0c",
+		HideCursor:      "\x1b[?25l\x1b[?1c",
+		AttrOff:         "\x1b[0;10m",
+		Underline:       "\x1b[4m",
+		Bold:            "\x1b[1m",
+		Dim:             "\x1b[2m",
+		Blink:           "\x1b[5m",
+		Reverse:         "\x1b[7m",
+		SetFg:           "\x1b[3%p1%dm",
+		SetBg:           "\x1b[4%p1%dm",
+		SetFgBg:         "\x1b[3%p1%d;4%p2%dm",
+		PadChar:         "\x00",
+		AltChars:        "+\x10,\x11-\x18.\x190\xdb`\x04a\xb1f\xf8g\xf1h\xb0i\xcej\xd9k\xbfl\xdam\xc0n\xc5o~p\xc4q\xc4r\xc4s_t\xc3u\xb4v\xc1w\xc2x\xb3y\xf3z\xf2{\xe3|\xd8}\x9c~\xfe",
+		EnterAcs:        "\x1b[11m",
+		ExitAcs:         "\x1b[10m",
+		Mouse:           "\x1b[M",
+		MouseMode:       "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c",
+		SetCursor:       "\x1b[%i%p1%d;%p2%dH",
+		CursorBack1:     "\b",
+		CursorUp1:       "\x1b[A",
+		KeyUp:           "\x1b[A",
+		KeyDown:         "\x1b[B",
+		KeyRight:        "\x1b[C",
+		KeyLeft:         "\x1b[D",
+		KeyInsert:       "\x1b[2~",
+		KeyDelete:       "\x1b[3~",
+		KeyBackspace:    "\u007f",
+		KeyHome:         "\x1b[1~",
+		KeyEnd:          "\x1b[4~",
+		KeyPgUp:         "\x1b[5~",
+		KeyPgDn:         "\x1b[6~",
+		KeyF1:           "\x1b[[A",
+		KeyF2:           "\x1b[[B",
+		KeyF3:           "\x1b[[C",
+		KeyF4:           "\x1b[[D",
+		KeyF5:           "\x1b[[E",
+		KeyF6:           "\x1b[17~",
+		KeyF7:           "\x1b[18~",
+		KeyF8:           "\x1b[19~",
+		KeyF9:           "\x1b[20~",
+		KeyF10:          "\x1b[21~",
+		KeyF11:          "\x1b[23~",
+		KeyF12:          "\x1b[24~",
+		KeyF13:          "\x1b[25~",
+		KeyF14:          "\x1b[26~",
+		KeyF15:          "\x1b[28~",
+		KeyF16:          "\x1b[29~",
+		KeyF17:          "\x1b[31~",
+		KeyF18:          "\x1b[32~",
+		KeyF19:          "\x1b[33~",
+		KeyF20:          "\x1b[34~",
+		KeyBacktab:      "\x1b[Z",
+		KeyShfLeft:      "\x1b[1;2D",
+		KeyShfRight:     "\x1b[1;2C",
+		KeyShfUp:        "\x1b[1;2A",
+		KeyShfDown:      "\x1b[1;2B",
+		KeyCtrlLeft:     "\x1b[1;5D",
+		KeyCtrlRight:    "\x1b[1;5C",
+		KeyCtrlUp:       "\x1b[1;5A",
+		KeyCtrlDown:     "\x1b[1;5B",
+		KeyMetaLeft:     "\x1b[1;9D",
+		KeyMetaRight:    "\x1b[1;9C",
+		KeyMetaUp:       "\x1b[1;9A",
+		KeyMetaDown:     "\x1b[1;9B",
+		KeyAltLeft:      "\x1b[1;3D",
+		KeyAltRight:     "\x1b[1;3C",
+		KeyAltUp:        "\x1b[1;3A",
+		KeyAltDown:      "\x1b[1;3B",
+		KeyAltShfLeft:   "\x1b[1;4D",
+		KeyAltShfRight:  "\x1b[1;4C",
+		KeyAltShfUp:     "\x1b[1;4A",
+		KeyAltShfDown:   "\x1b[1;4B",
+		KeyMetaShfLeft:  "\x1b[1;10D",
+		KeyMetaShfRight: "\x1b[1;10C",
+		KeyMetaShfUp:    "\x1b[1;10A",
+		KeyMetaShfDown:  "\x1b[1;10B",
+		KeyCtrlShfLeft:  "\x1b[1;6D",
+		KeyCtrlShfRight: "\x1b[1;6C",
+		KeyCtrlShfUp:    "\x1b[1;6A",
+		KeyCtrlShfDown:  "\x1b[1;6B",
+		KeyShfHome:      "\x1b[1;2H",
+		KeyShfEnd:       "\x1b[1;2F",
+		KeyCtrlHome:     "\x1b[1;5H",
+		KeyCtrlEnd:      "\x1b[1;5F",
+		KeyAltHome:      "\x1b[1;9H",
+		KeyAltEnd:       "\x1b[1;9F",
+		KeyCtrlShfHome:  "\x1b[1;6H",
+		KeyCtrlShfEnd:   "\x1b[1;6F",
+		KeyMetaShfHome:  "\x1b[1;10H",
+		KeyMetaShfEnd:   "\x1b[1;10F",
+		KeyAltShfHome:   "\x1b[1;4H",
+		KeyAltShfEnd:    "\x1b[1;4F",
 	})
 	AddTerminfo(&Terminfo{
 		Name:         "pcansi",
diff -pruN 0.0~git20171006.a221f2f-1/debian/changelog 0.0~git20190212.5c58b4e-1/debian/changelog
--- 0.0~git20171006.a221f2f-1/debian/changelog	2018-12-10 18:57:29.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/debian/changelog	2019-02-12 02:14:25.000000000 +0000
@@ -1,3 +1,12 @@
+golang-github-zyedidia-tcell (0.0~git20190212.5c58b4e-1) unstable; urgency=medium
+
+  * all: New upstream version release
+  * d/control: Bump Standards-Version to 4.3.0 (no changes needed)
+  * d/patches: Apply patch to fix the EventInterrupt implementation error
+  * d/patches: Remove patch (applied by upstream)
+
+ -- Jongmin Kim <jmkim@pukyong.ac.kr>  Tue, 12 Feb 2019 11:14:25 +0900
+
 golang-github-zyedidia-tcell (0.0~git20171006.a221f2f-1) unstable; urgency=medium
 
   * Initial release (Closes: #904666)
diff -pruN 0.0~git20171006.a221f2f-1/debian/control 0.0~git20190212.5c58b4e-1/debian/control
--- 0.0~git20171006.a221f2f-1/debian/control	2018-12-10 18:57:29.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/debian/control	2019-02-12 02:14:25.000000000 +0000
@@ -11,7 +11,7 @@ Build-Depends: debhelper (>= 11),
                golang-x-text-dev,
                golang-github-gdamore-encoding-dev,
                golang-github-lucasb-eyer-go-colorful-dev
-Standards-Version: 4.2.1
+Standards-Version: 4.3.0
 Homepage: https://github.com/zyedidia/tcell
 Vcs-Browser: https://salsa.debian.org/go-team/packages/golang-github-zyedidia-tcell
 Vcs-Git: https://salsa.debian.org/go-team/packages/golang-github-zyedidia-tcell.git
diff -pruN 0.0~git20171006.a221f2f-1/encoding.go 0.0~git20190212.5c58b4e-1/encoding.go
--- 0.0~git20171006.a221f2f-1/encoding.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/encoding.go	2019-02-12 01:53:32.000000000 +0000
@@ -46,7 +46,7 @@ var encodingFallback EncodingFallback =
 // Aliases can be registered as well, for example "8859-15" could be an alias
 // for "ISO8859-15".
 //
-// For POSIX systems, the tcell package will check the environment variables
+// For POSIX systems, the tcell pacakge will check the environment variables
 // LC_ALL, LC_CTYPE,  and LANG (in that order) to determine the character set.
 // These are expected to have the following pattern:
 //
diff -pruN 0.0~git20171006.a221f2f-1/event.go 0.0~git20190212.5c58b4e-1/event.go
--- 0.0~git20171006.a221f2f-1/event.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/event.go	2019-02-12 01:53:32.000000000 +0000
@@ -23,6 +23,7 @@ import (
 type Event interface {
 	// When reports the time when the event was generated.
 	When() time.Time
+	EscSeq() string
 }
 
 // EventTime is a simple base event class, suitable for easy reuse.
@@ -36,6 +37,10 @@ func (e *EventTime) When() time.Time {
 	return e.when
 }
 
+func (e *EventTime) EscSeq() string {
+	return ""
+}
+
 // SetEventTime sets the time of occurrence for the event.
 func (e *EventTime) SetEventTime(t time.Time) {
 	e.when = t
diff -pruN 0.0~git20171006.a221f2f-1/.gitignore 0.0~git20190212.5c58b4e-1/.gitignore
--- 0.0~git20171006.a221f2f-1/.gitignore	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/.gitignore	1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-coverage.txt
diff -pruN 0.0~git20171006.a221f2f-1/interrupt.go 0.0~git20190212.5c58b4e-1/interrupt.go
--- 0.0~git20171006.a221f2f-1/interrupt.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/interrupt.go	2019-02-12 01:53:32.000000000 +0000
@@ -23,6 +23,7 @@ import (
 type EventInterrupt struct {
 	t time.Time
 	v interface{}
+        esc string
 }
 
 // When returns the time when this event was created.
@@ -30,6 +31,10 @@ func (ev *EventInterrupt) When() time.Ti
 	return ev.t
 }
 
+func (ev *EventInterrupt) EscSeq() string {
+	return ev.esc
+}
+
 // Data is used to obtain the opaque event payload.
 func (ev *EventInterrupt) Data() interface{} {
 	return ev.v
diff -pruN 0.0~git20171006.a221f2f-1/key.go 0.0~git20190212.5c58b4e-1/key.go
--- 0.0~git20171006.a221f2f-1/key.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/key.go	2019-02-12 01:53:32.000000000 +0000
@@ -47,6 +47,7 @@ type EventKey struct {
 	mod ModMask
 	key Key
 	ch  rune
+	esc string
 }
 
 // When returns the time when this Event was created, which should closely
@@ -55,6 +56,10 @@ func (ev *EventKey) When() time.Time {
 	return ev.t
 }
 
+func (ev *EventKey) EscSeq() string {
+	return ev.esc
+}
+
 // Rune returns the rune corresponding to the key press, if it makes sense.
 // The result is only defined if the value of Key() is KeyRune.
 func (ev *EventKey) Rune() rune {
@@ -78,9 +83,7 @@ func (ev *EventKey) Modifiers() ModMask
 	return ev.mod
 }
 
-// KeyNames holds the written names of special keys. Useful to echo back a key
-// name, or to look up a key from a string value.
-var KeyNames = map[Key]string{
+var keyNames = map[Key]string{
 	KeyEnter:          "Enter",
 	KeyBackspace:      "Backspace",
 	KeyTab:            "Tab",
@@ -122,8 +125,6 @@ var KeyNames = map[Key]string{
 	KeyCenter:         "Center",
 	KeyPgDn:           "PgDn",
 	KeyPgUp:           "PgUp",
-	KeyCtrlPgUp:       "CtrlPgUp",
-	KeyCtrlPgDn:       "CtrlPgDn",
 	KeyClear:          "Clear",
 	KeyExit:           "Exit",
 	KeyCancel:         "Cancel",
@@ -242,7 +243,7 @@ func (ev *EventKey) Name() string {
 	}
 
 	ok := false
-	if s, ok = KeyNames[ev.key]; !ok {
+	if s, ok = keyNames[ev.key]; !ok {
 		if ev.key == KeyRune {
 			s = "Rune[" + string(ev.ch) + "]"
 		} else {
diff -pruN 0.0~git20171006.a221f2f-1/mkdatabase.sh 0.0~git20190212.5c58b4e-1/mkdatabase.sh
--- 0.0~git20171006.a221f2f-1/mkdatabase.sh	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/mkdatabase.sh	2019-02-12 01:53:32.000000000 +0000
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/ksh
 
 # Copyright 2015 The TCell Authors
 #
diff -pruN 0.0~git20171006.a221f2f-1/mkinfo.go 0.0~git20190212.5c58b4e-1/mkinfo.go
--- 0.0~git20171006.a221f2f-1/mkinfo.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/mkinfo.go	2019-02-12 01:53:32.000000000 +0000
@@ -93,8 +93,8 @@ func setupterm(name string) error {
 	}
 	plist = append(plist, "")
 	rsn := C.int(0)
-
-	for _, p := range plist {
+	
+	for _, p := range(plist) {
 		// Override environment
 		if p == "" {
 			os.Unsetenv("TERMINFO")
@@ -145,7 +145,7 @@ func getinfo(name string) (*tcell.Termin
 		if strings.HasSuffix(name, "-truecolor") {
 			base := name[:len(name)-len("-truecolor")]
 			// Probably -256color is closest to what we want
-			if err = setupterm(base + "-256color"); err != nil {
+			if err = setupterm(base+"-256color"); err != nil {
 				err = setupterm(base)
 			}
 			if err == nil {
@@ -638,7 +638,7 @@ func main() {
 			}
 		} else {
 			tdata[t.Name] = t
-			if t2, e := getinfo(term + "-256color"); e == nil {
+			if t2, e := getinfo(term+"-256color"); e == nil {
 				tdata[t2.Name] = t2
 			}
 		}
diff -pruN 0.0~git20171006.a221f2f-1/mouse.go 0.0~git20190212.5c58b4e-1/mouse.go
--- 0.0~git20171006.a221f2f-1/mouse.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/mouse.go	2019-02-12 01:53:32.000000000 +0000
@@ -41,6 +41,7 @@ type EventMouse struct {
 	motion bool
 	x      int
 	y      int
+	esc    string
 }
 
 // When returns the time when this EventMouse was created.
@@ -59,6 +60,10 @@ func (ev *EventMouse) Modifiers() ModMas
 	return ev.mod
 }
 
+func (e *EventMouse) EscSeq() string {
+	return e.esc
+}
+
 // Position returns the mouse position in character cells.  The origin
 // 0, 0 is at the upper left corner.
 func (ev *EventMouse) Position() (int, int) {
diff -pruN 0.0~git20171006.a221f2f-1/paste.go 0.0~git20190212.5c58b4e-1/paste.go
--- 0.0~git20171006.a221f2f-1/paste.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/paste.go	2019-02-12 01:53:32.000000000 +0000
@@ -20,6 +20,7 @@ import "time"
 type EventPaste struct {
 	t    time.Time
 	text string
+	esc  string
 }
 
 // When returns the time when this Event was created, which should closely
@@ -28,6 +29,10 @@ func (e *EventPaste) When() time.Time {
 	return e.t
 }
 
+func (e *EventPaste) EscSeq() string {
+	return e.esc
+}
+
 // Text returns the text that was pasted
 func (e *EventPaste) Text() string {
 	return e.text
diff -pruN 0.0~git20171006.a221f2f-1/raw.go 0.0~git20190212.5c58b4e-1/raw.go
--- 0.0~git20171006.a221f2f-1/raw.go	1970-01-01 00:00:00.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/raw.go	2019-02-12 01:53:32.000000000 +0000
@@ -0,0 +1,24 @@
+package tcell
+
+import "time"
+
+type EventRaw struct {
+	t   time.Time
+	esc string // The escape code
+}
+
+// When returns the time when this EventMouse was created.
+func (ev *EventRaw) When() time.Time {
+	return ev.t
+}
+
+func (ev *EventRaw) EscSeq() string {
+	return ev.esc
+}
+
+func NewEventRaw(code string) *EventRaw {
+	return &EventRaw{
+		t:   time.Now(),
+		esc: code,
+	}
+}
diff -pruN 0.0~git20171006.a221f2f-1/README.md 0.0~git20190212.5c58b4e-1/README.md
--- 0.0~git20171006.a221f2f-1/README.md	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/README.md	2019-02-12 01:53:32.000000000 +0000
@@ -8,8 +8,6 @@ This is a fork of [tcell](https://github
 [![Gitter](https://img.shields.io/badge/gitter-join-brightgreen.svg)](https://gitter.im/gdamore/tcell)
 [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/gdamore/tcell)
 [![Go Report Card](http://goreportcard.com/badge/gdamore/tcell)](http://goreportcard.com/report/gdamore/tcell)
-[![codecov](https://codecov.io/gh/gdamore/tcell/branch/master/graph/badge.svg)](https://codecov.io/gh/gdamore/tcell)
-
 
 > _Tcell is a work in progress (Gamma).
 > Please use with caution; interfaces may change in before final release.
@@ -28,7 +26,6 @@ ways.  It also adds substantial function
 * mouse demo - [screenshot](http://2.bp.blogspot.com/-fWvW5opT0es/VhIdItdKqJI/AAAAAAAAATE/7Ojc0L1SpB0/s1600/Screen%2BShot%2B2015-10-04%2Bat%2B11.47.13%2BPM.png) - included mouse test
 * [gomatrix](https://github.com/gdamore/gomatrix) - converted from Termbox
 * [micro](https://github.com/zyedidia/micro/) - lightweight text editor with syntax-highlighting and themes
-* [godu](https://github.com/viktomas/godu) - simple golang utility helping to discover large files/folders.
 
 ## Pure Go Terminfo Database
 
@@ -40,7 +37,7 @@ when Go provides standard support for te
 all POSIX platforms.)  The database itself, while built using CGO, as well
 as the parser for it, is implemented in Pure Go.
 
-The database is also flexible & extensible, and can modified by either running a
+The database is also flexible & extensibel, and can modified by either running a
 program to build the database, or hand editing of simple JSON files.
 
 ## More Portable
@@ -232,14 +229,8 @@ and examine "physical" screen contents.
 ### Systems (Linux, FreeBSD, MacOS, Solaris, etc.)
 
 On POSIX systems, a POSIX termios implementation with /dev/tty is required.
-On a small subset of these platforms (such as Solaris/illumos), we require
-cgo to run, in order to access termios.  (Note that Linux and BSD systems
-do not require CGO for most purposes.)
-
-(Note: CGO support is required if you wish to rebuild the terminal database
-from the system's native terminfo binary files.  This is because we use the
-system's native libterminfo to access that binary data.  We probably could
-eliminate that in the future by using a terminfo decompiler such as infocmp.)
+It also requires functional CGO to run.  As of this writing, CGO is available
+on all POSIX Go 1.5 platforms.
 
 ### Windows
 
@@ -253,7 +244,7 @@ I haven't figured out how to cleanly res
 style termios and the Windows Console API; it seems that perhaps nobody else
 has either.  If anyone has suggestions, let me know!  Really, if you're
 using a Windows application, you should use the native Windows console or a
-fully compatible console implementation.  Hopefully the Windows 10 console
+fully compatible consule implementation.  Hopefully the Windows 10 console
 is more functional in this regard.
 
 ### Plan9 and Native Client (Nacl)
diff -pruN 0.0~git20171006.a221f2f-1/resize.go 0.0~git20190212.5c58b4e-1/resize.go
--- 0.0~git20171006.a221f2f-1/resize.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/resize.go	2019-02-12 01:53:32.000000000 +0000
@@ -20,9 +20,10 @@ import (
 
 // EventResize is sent when the window size changes.
 type EventResize struct {
-	t time.Time
-	w int
-	h int
+	t   time.Time
+	w   int
+	h   int
+	esc string
 }
 
 // NewEventResize creates an EventResize with the new updated window size,
@@ -31,6 +32,10 @@ func NewEventResize(width, height int) *
 	return &EventResize{t: time.Now(), w: width, h: height}
 }
 
+func (ev *EventResize) EscSeq() string {
+	return ev.esc
+}
+
 // When returns the time when the Event was created.
 func (ev *EventResize) When() time.Time {
 	return ev.t
diff -pruN 0.0~git20171006.a221f2f-1/screen.go 0.0~git20190212.5c58b4e-1/screen.go
--- 0.0~git20171006.a221f2f-1/screen.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/screen.go	2019-02-12 01:53:32.000000000 +0000
@@ -133,7 +133,7 @@ type Screen interface {
 	Sync()
 
 	// CharacterSet returns information about the character set.
-	// This isn't the full locale, but it does give us the input/output
+	// This isn't the full locale, but it does give us the input/ouput
 	// character set.  Note that this is just for diagnostic purposes,
 	// we normally translate input/output to/from UTF-8, regardless of
 	// what the user's environment is.
diff -pruN 0.0~git20171006.a221f2f-1/simulation.go 0.0~git20190212.5c58b4e-1/simulation.go
--- 0.0~git20171006.a221f2f-1/simulation.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/simulation.go	2019-02-12 01:53:32.000000000 +0000
@@ -417,7 +417,7 @@ outer:
 		continue
 	}
 
-	return !failed
+	return failed == false
 }
 
 func (s *simscreen) Sync() {
diff -pruN 0.0~git20171006.a221f2f-1/terminfo.go 0.0~git20190212.5c58b4e-1/terminfo.go
--- 0.0~git20171006.a221f2f-1/terminfo.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/terminfo.go	2019-02-12 01:53:32.000000000 +0000
@@ -727,7 +727,7 @@ func loadFromFile(fname string, term str
 	}
 }
 
-// LookupTerminfo attempts to find a definition for the named $TERM.
+// LookupTerminfo attemps to find a definition for the named $TERM.
 // It first looks in the builtin database, which should cover just about
 // everyone.  If it can't find one there, then it will attempt to read
 // one from the JSON file located in either $TCELLDB, $HOME/.tcelldb
diff -pruN 0.0~git20171006.a221f2f-1/.travis.yml 0.0~git20190212.5c58b4e-1/.travis.yml
--- 0.0~git20171006.a221f2f-1/.travis.yml	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/.travis.yml	2019-02-12 01:53:32.000000000 +0000
@@ -1,17 +1,6 @@
 language: go
 
 go:
-  - 1.5.x
-  - 1.6.x
-  - 1.7.x
-  - 1.8.x
-  - master
-
-before_install:
-  - go get -t -v ./...
-
-script:
-  - go test -race -coverprofile=coverage.txt -covermode=atomic
-
-after_success:
-  - bash <(curl -s https://codecov.io/bash)
+  - 1.3
+  - 1.5
+  - tip
diff -pruN 0.0~git20171006.a221f2f-1/tscreen_bsd.go 0.0~git20190212.5c58b4e-1/tscreen_bsd.go
--- 0.0~git20171006.a221f2f-1/tscreen_bsd.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/tscreen_bsd.go	2019-02-12 01:53:32.000000000 +0000
@@ -1,6 +1,6 @@
-// +build darwin freebsd netbsd openbsd dragonfly
+// +build freebsd netbsd openbsd dragonfly
 
-// Copyright 2017 The TCell Authors
+// Copyright 2015 The TCell Authors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use file except in compliance with the License.
@@ -61,6 +61,9 @@ func (t *tScreen) termioInit() error {
 	newtios.Cflag &^= syscall.CSIZE | syscall.PARENB
 	newtios.Cflag |= syscall.CS8
 
+	// We wake up only when at least 1 byte has arrived
+	newtios.Cc[syscall.VMIN] = 1
+	newtios.Cc[syscall.VTIME] = 0
 	tios = uintptr(unsafe.Pointer(&newtios))
 
 	ioc = uintptr(syscall.TIOCSETA)
@@ -79,7 +82,7 @@ func (t *tScreen) termioInit() error {
 
 failed:
 	if t.in != nil {
-		t.in.Close()
+		t.in.(*os.File).Close()
 	}
 	if t.out != nil {
 		t.out.(*os.File).Close()
@@ -101,7 +104,7 @@ func (t *tScreen) termioFini() {
 		t.out.(*os.File).Close()
 	}
 	if t.in != nil {
-		t.in.Close()
+		t.in.(*os.File).Close()
 	}
 }
 
diff -pruN 0.0~git20171006.a221f2f-1/tscreen_darwin.go 0.0~git20190212.5c58b4e-1/tscreen_darwin.go
--- 0.0~git20171006.a221f2f-1/tscreen_darwin.go	1970-01-01 00:00:00.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/tscreen_darwin.go	2019-02-12 01:53:32.000000000 +0000
@@ -0,0 +1,123 @@
+// +build darwin freebsd netbsd openbsd dragonfly
+
+// Copyright 2015 The TCell Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use file except in compliance with the License.
+// You may obtain a copy of the license at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package tcell
+
+import (
+	"os/signal"
+	"syscall"
+	"unsafe"
+
+	"github.com/zyedidia/poller"
+)
+
+type termiosPrivate syscall.Termios
+
+func (t *tScreen) termioInit() error {
+	var e error
+	var newtios termiosPrivate
+	var fd uintptr
+	var tios uintptr
+	var ioc uintptr
+	t.tiosp = &termiosPrivate{}
+
+	if t.in, e = poller.Open("/dev/tty", poller.O_RO); e != nil {
+		goto failed
+	}
+	if t.out, e = poller.Open("/dev/tty", poller.O_WO); e != nil {
+		goto failed
+	}
+
+	tios = uintptr(unsafe.Pointer(t.tiosp))
+	ioc = uintptr(syscall.TIOCGETA)
+	fd = uintptr(t.out.(*poller.FD).Sysfd())
+	if _, _, e1 := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioc, tios, 0, 0, 0); e1 != 0 {
+		e = e1
+		goto failed
+	}
+
+	// On this platform (FreeBSD and family), the baud rate is stored
+	// directly as an integer in termios.c_ospeed.  No bitmasking required.
+	t.baud = int(t.tiosp.Ospeed)
+	newtios = *t.tiosp
+	newtios.Iflag &^= syscall.IGNBRK | syscall.BRKINT | syscall.PARMRK |
+		syscall.ISTRIP | syscall.INLCR | syscall.IGNCR |
+		syscall.ICRNL | syscall.IXON
+	newtios.Oflag &^= syscall.OPOST
+	newtios.Lflag &^= syscall.ECHO | syscall.ECHONL | syscall.ICANON |
+		syscall.ISIG | syscall.IEXTEN
+	newtios.Cflag &^= syscall.CSIZE | syscall.PARENB
+	newtios.Cflag |= syscall.CS8
+
+	// We wake up only when at least 1 byte has arrived
+	newtios.Cc[syscall.VMIN] = 1
+	newtios.Cc[syscall.VTIME] = 0
+	tios = uintptr(unsafe.Pointer(&newtios))
+
+	ioc = uintptr(syscall.TIOCSETA)
+	if _, _, e1 := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioc, tios, 0, 0, 0); e1 != 0 {
+		e = e1
+		goto failed
+	}
+
+	signal.Notify(t.sigwinch, syscall.SIGWINCH)
+
+	if w, h, e := t.getWinSize(); e == nil && w != 0 && h != 0 {
+		t.cells.Resize(w, h)
+	}
+
+	return nil
+
+failed:
+	if t.in != nil {
+		t.in.(*poller.FD).Close()
+	}
+	if t.out != nil {
+		t.out.(*poller.FD).Close()
+	}
+	return e
+}
+
+func (t *tScreen) termioFini() {
+
+	signal.Stop(t.sigwinch)
+
+	<-t.indoneq
+
+	if t.out != nil {
+		fd := uintptr(t.out.(*poller.FD).Sysfd())
+		ioc := uintptr(syscall.TIOCSETAF)
+		tios := uintptr(unsafe.Pointer(t.tiosp))
+		syscall.Syscall6(syscall.SYS_IOCTL, fd, ioc, tios, 0, 0, 0)
+		t.out.(*poller.FD).Close()
+	}
+	if t.in != nil {
+		t.in.(*poller.FD).Close()
+	}
+}
+
+func (t *tScreen) getWinSize() (int, int, error) {
+
+	fd := uintptr(t.out.(*poller.FD).Sysfd())
+	dim := [4]uint16{}
+	dimp := uintptr(unsafe.Pointer(&dim))
+	ioc := uintptr(syscall.TIOCGWINSZ)
+	if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL,
+		fd, ioc, dimp, 0, 0, 0); err != 0 {
+		return -1, -1, err
+	}
+	return int(dim[1]), int(dim[0]), nil
+}
diff -pruN 0.0~git20171006.a221f2f-1/tscreen.go 0.0~git20190212.5c58b4e-1/tscreen.go
--- 0.0~git20171006.a221f2f-1/tscreen.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/tscreen.go	2019-02-12 01:53:32.000000000 +0000
@@ -1,4 +1,4 @@
-// Copyright 2017 The TCell Authors
+// Copyright 2016 The TCell Authors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use file except in compliance with the License.
@@ -28,6 +28,8 @@ import (
 	"golang.org/x/text/transform"
 )
 
+var escseq string
+
 // NewTerminfoScreen returns a Screen that uses the stock TTY interface
 // and POSIX termios, combined with a terminfo description taken from
 // the $TERM environment variable.  It returns an error if the terminal
@@ -72,7 +74,7 @@ type tScreen struct {
 	w           int
 	fini        bool
 	cells       CellBuffer
-	in          *os.File
+	in          io.Reader
 	out         io.Writer
 	curstyle    Style
 	style       Style
@@ -80,11 +82,9 @@ type tScreen struct {
 	sigwinch    chan os.Signal
 	quit        chan struct{}
 	indoneq     chan struct{}
+	inputchan   chan InputPacket
 	keyexist    map[Key]bool
 	keycodes    map[string]*tKeyCode
-	keychan     chan []byte
-	keytimer    *time.Timer
-	keyexpire   time.Time
 	cx          int
 	cy          int
 	mouse       []byte
@@ -109,11 +109,17 @@ type tScreen struct {
 	sync.Mutex
 }
 
+// An InputPacket represents the data that the terminal sends us when
+// there is an event.
+type InputPacket struct {
+	n     int
+	e     error
+	chunk []byte
+}
+
 func (t *tScreen) Init() error {
 	t.evch = make(chan Event, 10)
 	t.indoneq = make(chan struct{})
-	t.keychan = make(chan []byte, 10)
-	t.keytimer = time.NewTimer(time.Millisecond * 50)
 	t.charset = "UTF-8"
 
 	t.charset = getCharset()
@@ -174,7 +180,6 @@ func (t *tScreen) Init() error {
 	t.resize()
 	t.Unlock()
 
-	go t.mainLoop()
 	go t.inputLoop()
 
 	return nil
@@ -357,41 +362,8 @@ func (t *tScreen) prepareKeys() {
 		t.prepareKey(KeyLeft, "\x1bOD")
 		t.prepareKey(KeyHome, "\x1bOH")
 
-		// Extra arrow key commands
-		t.prepareKey(KeyAltUp, "\x1b[1;9A")
-		t.prepareKey(KeyAltDown, "\x1b[1;9B")
-		t.prepareKey(KeyAltLeft, "\x1b[1;9D")
-		t.prepareKey(KeyAltRight, "\x1b[1;9C")
-		t.prepareKey(KeyAltUp, "\x1b\x1b[A")
-		t.prepareKey(KeyAltDown, "\x1b\x1b[B")
-		t.prepareKey(KeyAltLeft, "\x1b\x1b[D")
-		t.prepareKey(KeyAltRight, "\x1b\x1b[C")
-		t.prepareKey(KeyAltUp, "\x1b[1;3A")
-		t.prepareKey(KeyAltDown, "\x1b[1;3B")
-		t.prepareKey(KeyAltLeft, "\x1b[1;3D")
-		t.prepareKey(KeyAltRight, "\x1b[1;3C")
-		t.prepareKey(KeyShiftUp, "\x1b[1;2A")
-		t.prepareKey(KeyShiftDown, "\x1b[1;2B")
-		t.prepareKey(KeyShiftLeft, "\x1b[1;2D")
-		t.prepareKey(KeyShiftRight, "\x1b[1;2C")
-		t.prepareKey(KeyCtrlUp, "\x1b[1;5A")
-		t.prepareKey(KeyCtrlDown, "\x1b[1;5B")
-		t.prepareKey(KeyCtrlLeft, "\x1b[1;5D")
-		t.prepareKey(KeyCtrlRight, "\x1b[1;5C")
-		t.prepareKey(KeyAltShiftUp, "\x1b[1;10A")
-		t.prepareKey(KeyAltShiftDown, "\x1b[1;10B")
-		t.prepareKey(KeyAltShiftLeft, "\x1b[1;10D")
-		t.prepareKey(KeyAltShiftRight, "\x1b[1;10C")
-		t.prepareKey(KeyAltShiftUp, "\x1b[1;4A")
-		t.prepareKey(KeyAltShiftDown, "\x1b[1;4B")
-		t.prepareKey(KeyAltShiftLeft, "\x1b[1;4D")
-		t.prepareKey(KeyAltShiftRight, "\x1b[1;4C")
-		t.prepareKey(KeyCtrlShiftUp, "\x1b[1;6A")
-		t.prepareKey(KeyCtrlShiftDown, "\x1b[1;6B")
-		t.prepareKey(KeyCtrlShiftLeft, "\x1b[1;6D")
-		t.prepareKey(KeyCtrlShiftRight, "\x1b[1;6C")
-		t.prepareKeyMod(KeyCtrlPgUp, ModCtrl, "\x1b[5;5~")
-		t.prepareKeyMod(KeyCtrlPgDn, ModCtrl, "\x1b[6;5~")
+		// t.prepareKeyMod(KeyCtrlPgUp, ModCtrl, "\x1b[5;5~")
+		// t.prepareKeyMod(KeyCtrlPgDn, ModCtrl, "\x1b[6;5~")
 	}
 
 outer:
@@ -556,7 +528,7 @@ func (t *tScreen) sendFgBg(fg Color, bg
 					int(r), int(g), int(b)))
 			}
 			if bg != ColorDefault && ti.SetBgRGB != "" {
-				r, g, b := bg.RGB()
+				r, g, b := fg.RGB()
 				t.TPuts(ti.TParm(ti.SetBgRGB,
 					int(r), int(g), int(b)))
 			}
@@ -768,12 +740,13 @@ func (t *tScreen) draw() {
 		}
 	}
 
+	// restore the cursor
+	t.showCursor()
+
 	// Send everything to the terminal
 	t.out = out
 	io.WriteString(t.out, buf.String())
 
-	// restore the cursor
-	t.showCursor()
 }
 
 func (t *tScreen) EnableMouse() {
@@ -983,6 +956,7 @@ func (t *tScreen) postMouseEvent(x, y, b
 	x, y = t.clip(x, y)
 
 	ev := NewEventMouse(x, y, button, mod, motion)
+	ev.esc = escseq
 	t.PostEvent(ev)
 }
 
@@ -1101,6 +1075,9 @@ func (t *tScreen) parseSgrMouse(buf *byt
 			}
 			t.postMouseEvent(x, y, btn, motion)
 			return true, true
+		default:
+			// Not a character that is in a mouse esc sequence
+			return false, false
 		}
 	}
 
@@ -1184,6 +1161,7 @@ func (t *tScreen) parseFunctionKey(buf *
 				t.escaped = false
 			}
 			ev := NewEventKey(k.key, r, mod)
+			ev.esc = escseq
 			t.PostEvent(ev)
 			for i := 0; i < len(esc); i++ {
 				buf.ReadByte()
@@ -1207,6 +1185,7 @@ func (t *tScreen) parseRune(buf *bytes.B
 			t.escaped = false
 		}
 		ev := NewEventKey(KeyRune, rune(b[0]), mod)
+		ev.esc = escseq
 		t.PostEvent(ev)
 		buf.ReadByte()
 		return true, true
@@ -1233,6 +1212,7 @@ func (t *tScreen) parseRune(buf *bytes.B
 					t.escaped = false
 				}
 				ev := NewEventKey(KeyRune, r, mod)
+				ev.esc = escseq
 				t.PostEvent(ev)
 			}
 			for nin > 0 {
@@ -1257,6 +1237,7 @@ func (t *tScreen) parseBracketedPaste(bu
 			// The bracketed paste has ended
 			// Strip out the start and end sequences
 			ev := NewEventPaste(str[6 : len(b)-6])
+			ev.esc = escseq
 			t.PostEvent(ev)
 			for i := 0; i < len(b); i++ {
 				buf.ReadByte()
@@ -1280,23 +1261,27 @@ func (t *tScreen) scanInput(buf *bytes.B
 			buf.Reset()
 			return
 		}
-		if !bytes.Contains(b, []byte("\x1b")) && utf8.RuneCount(b) > 1 {
-			ev := &EventPaste{t: time.Now(), text: string(bytes.Replace(b, []byte("\r"), []byte("\n"), -1))}
-			t.PostEvent(ev)
-			for i := 0; i < len(b); i++ {
-				buf.ReadByte()
-			}
-			continue
-		}
+
+		escseq = buf.String()
 
 		partials := 0
 
+		pastePartial := false
 		if part, comp := t.parseBracketedPaste(buf); comp {
 			continue
 		} else if part {
+			pastePartial = true
 			partials++
 		}
 
+		if !bytes.Contains(b, []byte("\x1b")) && utf8.RuneCount(b) > 1 {
+			ev := &EventPaste{t: time.Now(), text: string(bytes.Replace(b, []byte("\r"), []byte("\n"), -1))}
+			ev.esc = escseq
+			t.PostEvent(ev)
+			buf.Reset()
+			continue
+		}
+
 		if part, comp := t.parseRune(buf); comp {
 			continue
 		} else if part {
@@ -1326,44 +1311,81 @@ func (t *tScreen) scanInput(buf *bytes.B
 			}
 		}
 
-		if partials == 0 || expire {
-			// Nothing was going to match, or we timed out
-			// waiting for more data -- just deliver the characters
-			// to the app & let them sort it out.  Possibly we
-			// should only do this for control characters like ESC.
-			if b[0] == '\x1b' {
-				if len(b) == 1 {
-					ev := NewEventKey(KeyEsc, 0, ModNone)
-					t.PostEvent(ev)
-					t.escaped = false
-				} else {
-					t.escaped = true
-				}
-				buf.ReadByte()
-				continue
+		// Handle Alt keys
+		if b[0] == '\x1b' && (len(b) == 2 || len(b) == 1) {
+			if partials != 0 && !expire {
+				// We need more data
+				// For example, if the sequence is `\x1b[`, this could
+				// be alt-[ or it could be the beginning of a mouse sequence
+				break
 			}
 
-			by, _ := buf.ReadByte()
-			mod := ModNone
-			if t.escaped {
+			if len(b) == 1 {
+				ev := NewEventKey(KeyEsc, 0, ModNone)
+				ev.esc = escseq
+				t.PostEvent(ev)
 				t.escaped = false
-				mod = ModAlt
+			} else {
+				t.escaped = true
+			}
+			buf.ReadByte()
+
+			if len(b) == 2 {
+				by, _ := buf.ReadByte()
+				mod := ModNone
+				if t.escaped {
+					t.escaped = false
+					mod = ModAlt
+				}
+				ev := NewEventKey(KeyRune, rune(by), mod)
+				ev.esc = escseq
+				t.PostEvent(ev)
 			}
-			ev := NewEventKey(KeyRune, rune(by), mod)
-			t.PostEvent(ev)
 			continue
 		}
 
+		if expire || partials == 0 || (!pastePartial && len(b) > 64) {
+			ev := NewEventRaw(buf.String())
+			ev.esc = escseq
+			t.PostEvent(ev)
+
+			buf.Reset()
+			return
+		}
+
 		// well we have some partial data, wait until we get
 		// some more
 		break
 	}
 }
 
-func (t *tScreen) mainLoop() {
+func (t *tScreen) inputLoop() {
+	t.inputchan = make(chan InputPacket)
 	buf := &bytes.Buffer{}
+
+	go func() {
+		chunk := make([]byte, 128)
+		for {
+			n, e := t.in.Read(chunk)
+			t.inputchan <- InputPacket{n, e, chunk}
+			time.Sleep(10 * time.Millisecond)
+
+			if e != nil && e != io.EOF {
+				close(t.inputchan)
+				return
+			}
+		}
+	}()
+
 	for {
 		select {
+		case <-time.After(50 * time.Millisecond):
+			if buf.Len() > 0 {
+				// After 200 milliseconds of nothing time out and parse
+				// whatever was last sent by the terminal
+				t.scanInput(buf, true)
+			}
+			continue
 		case <-t.quit:
 			close(t.indoneq)
 			return
@@ -1376,56 +1398,29 @@ func (t *tScreen) mainLoop() {
 			t.draw()
 			t.Unlock()
 			continue
-		case <-t.keytimer.C:
-			// If the timer fired, and the current time
-			// is after the expiration of the escape sequence,
-			// then we assume the escape sequence reached it's
-			// conclusion, and process the chunk independently.
-			// This lets us detect conflicts such as a lone ESC.
-			if buf.Len() > 0 {
-				if time.Now().After(t.keyexpire) {
+		case in, ok := <-t.inputchan:
+			if !ok {
+				return
+			}
+			n, e, chunk := in.n, in.e, in.chunk
+			switch e {
+			case io.EOF:
+				// If we timeout waiting for more bytes, then it's
+				// time to give up on it.  Even at 300 baud it takes
+				// less than 0.5 ms to transmit a whole byte.
+				if buf.Len() > 0 {
 					t.scanInput(buf, true)
 				}
+				continue
+			case nil:
+			default:
+				close(t.indoneq)
+				return
 			}
-			if buf.Len() > 0 {
-				if !t.keytimer.Stop() {
-					select {
-					case <-t.keytimer.C:
-					default:
-					}
-				}
-				t.keytimer.Reset(time.Millisecond * 50)
-			}
-		case chunk := <-t.keychan:
-			buf.Write(chunk)
-			t.keyexpire = time.Now().Add(time.Millisecond * 50)
+			buf.Write(chunk[:n])
+			// Now we need to parse the input buffer for events
 			t.scanInput(buf, false)
-			if !t.keytimer.Stop() {
-				select {
-				case <-t.keytimer.C:
-				default:
-				}
-			}
-			if buf.Len() > 0 {
-				t.keytimer.Reset(time.Millisecond * 50)
-			}
-		}
-	}
-}
-
-func (t *tScreen) inputLoop() {
-
-	chunk := make([]byte, 128)
-	for {
-		n, e := t.in.Read(chunk)
-		switch e {
-		case io.EOF:
-		case nil:
-		default:
-			t.PostEvent(NewEventError(e))
-			return
 		}
-		t.keychan <- chunk[:n]
 	}
 }
 
diff -pruN 0.0~git20171006.a221f2f-1/tscreen_linux.go 0.0~git20190212.5c58b4e-1/tscreen_linux.go
--- 0.0~git20171006.a221f2f-1/tscreen_linux.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/tscreen_linux.go	2019-02-12 01:53:32.000000000 +0000
@@ -1,6 +1,6 @@
 // +build linux
 
-// Copyright 2017 The TCell Authors
+// Copyright 2015 The TCell Authors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use file except in compliance with the License.
@@ -61,13 +61,9 @@ func (t *tScreen) termioInit() error {
 	newtios.Cflag &^= syscall.CSIZE | syscall.PARENB
 	newtios.Cflag |= syscall.CS8
 
-	// This is setup for blocking reads.  In the past we attempted to
-	// use non-blocking reads, but now a separate input loop and timer
-	// copes with the problems we had on some systems (BSD/Darwin)
-	// where close hung forever.
+	// We wake up only when at least 1 byte has arrived
 	newtios.Cc[syscall.VMIN] = 1
 	newtios.Cc[syscall.VTIME] = 0
-
 	tios = uintptr(unsafe.Pointer(&newtios))
 
 	// Well this kind of sucks, because we don't have TCSETSF, but only
@@ -88,7 +84,7 @@ func (t *tScreen) termioInit() error {
 
 failed:
 	if t.in != nil {
-		t.in.Close()
+		t.in.(*os.File).Close()
 	}
 	if t.out != nil {
 		t.out.(*os.File).Close()
@@ -111,7 +107,7 @@ func (t *tScreen) termioFini() {
 		t.out.(*os.File).Close()
 	}
 	if t.in != nil {
-		t.in.Close()
+		t.in.(*os.File).Close()
 	}
 }
 
diff -pruN 0.0~git20171006.a221f2f-1/tscreen_posix.go 0.0~git20190212.5c58b4e-1/tscreen_posix.go
--- 0.0~git20171006.a221f2f-1/tscreen_posix.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/tscreen_posix.go	2019-02-12 01:53:32.000000000 +0000
@@ -1,6 +1,6 @@
 // +build solaris
 
-// Copyright 2017 The TCell Authors
+// Copyright 2015 The TCell Authors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use file except in compliance with the License.
@@ -137,7 +137,7 @@ func (t *tScreen) termioInit() error {
 
 	t.tiosp = &termiosPrivate{}
 
-	fd = C.int(t.out.(*os.File).Fd())
+	fd = C.int(t.out.Fd())
 	if rv, e = C.tcgetattr(fd, &t.tiosp.tios); rv != 0 {
 		goto failed
 	}
@@ -152,12 +152,9 @@ func (t *tScreen) termioInit() error {
 	newtios.c_cflag &^= C.CSIZE | C.PARENB
 	newtios.c_cflag |= C.CS8
 
-	// This is setup for blocking reads.  In the past we attempted to
-	// use non-blocking reads, but now a separate input loop and timer
-	// copes with the problems we had on some systems (BSD/Darwin)
-	// where close hung forever.
-	newtios.Cc[syscall.VMIN] = 1
-	newtios.Cc[syscall.VTIME] = 0
+	// We wake up only when at least 1 byte has arrived
+	newtios.c_cc[C.VMIN] = 1
+	newtios.c_cc[C.VTIME] = 0
 
 	if rv, e = C.tcsetattr(fd, C.TCSANOW|C.TCSAFLUSH, &newtios); rv != 0 {
 		goto failed
@@ -176,7 +173,7 @@ failed:
 		t.in.Close()
 	}
 	if t.out != nil {
-		t.out.(*os.File).Close()
+		t.out.Close()
 	}
 	return e
 }
@@ -188,9 +185,9 @@ func (t *tScreen) termioFini() {
 	<-t.indoneq
 
 	if t.out != nil {
-		fd := C.int(t.out.(*os.File).Fd())
+		fd := C.int(t.out.Fd())
 		C.tcsetattr(fd, C.TCSANOW|C.TCSAFLUSH, &t.tiosp.tios)
-		t.out.(*os.File).Close()
+		t.out.Close()
 	}
 	if t.in != nil {
 		t.in.Close()
@@ -199,7 +196,7 @@ func (t *tScreen) termioFini() {
 
 func (t *tScreen) getWinSize() (int, int, error) {
 	var cx, cy C.int
-	if r, e := C.getwinsize(C.int(t.out.(*os.File).Fd()), &cx, &cy); r != 0 {
+	if r, e := C.getwinsize(C.int(t.out.Fd()), &cx, &cy); r != 0 {
 		return 0, 0, e
 	}
 	return int(cx), int(cy), nil
diff -pruN 0.0~git20171006.a221f2f-1/views/boxlayout.go 0.0~git20190212.5c58b4e-1/views/boxlayout.go
--- 0.0~git20171006.a221f2f-1/views/boxlayout.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/views/boxlayout.go	2019-02-12 01:53:32.000000000 +0000
@@ -99,7 +99,6 @@ func (b *BoxLayout) hLayout() {
 		cw += c.pad
 
 		c.view.Resize(x, y, cw, h)
-		c.widget.Resize()
 		x += xinc
 	}
 }
@@ -163,7 +162,6 @@ func (b *BoxLayout) vLayout() {
 		yinc = ch + c.pad
 		ch += c.pad
 		c.view.Resize(x, y, w, ch)
-		c.widget.Resize()
 		y += yinc
 	}
 }
@@ -291,16 +289,12 @@ func (b *BoxLayout) InsertWidget(index i
 
 // RemoveWidget removes a Widget from the layout.
 func (b *BoxLayout) RemoveWidget(widget Widget) {
-	changed := false
 	for i := 0; i < len(b.cells); i++ {
 		if b.cells[i].widget == widget {
 			b.cells = append(b.cells[:i], b.cells[i+1:]...)
-			changed = true
+			return
 		}
 	}
-	if !changed {
-		return
-	}
 	b.changed = true
 	widget.Unwatch(b)
 	b.layout()
diff -pruN 0.0~git20171006.a221f2f-1/views/cellarea.go 0.0~git20190212.5c58b4e-1/views/cellarea.go
--- 0.0~git20171006.a221f2f-1/views/cellarea.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/views/cellarea.go	2019-02-12 01:53:32.000000000 +0000
@@ -76,7 +76,6 @@ func (a *CellView) Draw() {
 		ey = vy
 	}
 
-	cx, cy, en, sh := a.model.GetCursor()
 	for y := 0; y < ey; y++ {
 		for x := 0; x < ex; x++ {
 			ch, style, comb, wid := model.GetCell(x, y)
@@ -84,6 +83,7 @@ func (a *CellView) Draw() {
 				ch = ' '
 				style = a.style
 			}
+			cx, cy, en, sh := a.model.GetCursor()
 			if en && x == cx && y == cy && sh {
 				style = style.Reverse(true)
 			}
diff -pruN 0.0~git20171006.a221f2f-1/views/_demos/cellview.go 0.0~git20190212.5c58b4e-1/views/_demos/cellview.go
--- 0.0~git20171006.a221f2f-1/views/_demos/cellview.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/views/_demos/cellview.go	2019-02-12 01:53:32.000000000 +0000
@@ -101,6 +101,7 @@ func (m *model) GetCell(x, y int) (rune,
 }
 
 type mainWindow struct {
+	view   views.View
 	main   *views.CellView
 	keybar *views.SimpleStyledText
 	status *views.SimpleStyledTextBar
@@ -184,6 +185,7 @@ func main() {
 	window.keybar.RegisterStyle('A', tcell.StyleDefault.
 		Background(tcell.ColorSilver).
 		Foreground(tcell.ColorRed))
+	window.keybar.SetMarkup("[%AQ%N] Quit")
 
 	window.status = views.NewSimpleStyledTextBar()
 	window.status.SetStyle(tcell.StyleDefault.
diff -pruN 0.0~git20171006.a221f2f-1/views/textarea.go 0.0~git20190212.5c58b4e-1/views/textarea.go
--- 0.0~git20171006.a221f2f-1/views/textarea.go	2017-10-06 16:59:52.000000000 +0000
+++ 0.0~git20190212.5c58b4e-1/views/textarea.go	2019-02-12 01:53:32.000000000 +0000
@@ -57,20 +57,19 @@ func (m *linesModel) GetBounds() (int, i
 }
 
 func (m *linesModel) limitCursor() {
-	if m.x > m.width-1 {
-		m.x = m.width - 1
-	}
-	if m.y > m.height-1 {
-		m.y = m.height - 1
-	}
 	if m.x < 0 {
 		m.x = 0
 	}
 	if m.y < 0 {
 		m.y = 0
 	}
+	if m.x > m.width-1 {
+		m.x = m.width - 1
+	}
+	if m.y > m.height-1 {
+		m.y = m.height - 1
+	}
 }
-
 func (m *linesModel) SetCursor(x, y int) {
 	m.x = x
 	m.y = y
