Close file

This commit is contained in:
Zachary Yedidia 2019-12-19 10:12:12 -05:00
parent 7f32d31108
commit d29994ada9
3 changed files with 2 additions and 3 deletions

View File

@ -215,7 +215,6 @@ func (h *BufPane) Name() string {
} }
// HandleEvent executes the tcell event properly // HandleEvent executes the tcell event properly
// TODO: multiple actions bound to one key
func (h *BufPane) HandleEvent(event tcell.Event) { func (h *BufPane) HandleEvent(event tcell.Event) {
switch e := event.(type) { switch e := event.(type) {
case *tcell.EventRaw: case *tcell.EventRaw:

View File

@ -353,7 +353,6 @@ func IntOpt(opt interface{}) int {
// coordinate (this is necessary because tabs are 1 char but // coordinate (this is necessary because tabs are 1 char but
// 4 visual spaces) // 4 visual spaces)
func GetCharPosInLine(b []byte, visualPos int, tabsize int) int { func GetCharPosInLine(b []byte, visualPos int, tabsize int) int {
// Scan rune by rune until we exceed the visual width that we are // Scan rune by rune until we exceed the visual width that we are
// looking for. Then we can return the character position we have found // looking for. Then we can return the character position we have found
i := 0 // char pos i := 0 // char pos

View File

@ -717,10 +717,11 @@ func AddTerminfo(t *Terminfo) {
func loadFromFile(fname string, term string) (*Terminfo, error) { func loadFromFile(fname string, term string) (*Terminfo, error) {
var e error var e error
var f io.Reader var f io.ReadCloser
if f, e = os.Open(fname); e != nil { if f, e = os.Open(fname); e != nil {
return nil, e return nil, e
} }
defer f.Close()
if strings.HasSuffix(fname, ".gz") { if strings.HasSuffix(fname, ".gz") {
if f, e = gzip.NewReader(f); e != nil { if f, e = gzip.NewReader(f); e != nil {
return nil, e return nil, e