Skip to content

Commit c72c846

Browse files
authored
fixes backspace behavior (#91)
1 parent fdc532c commit c72c846

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

Diff for: components/ResultsTable.go

+16-8
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ func (table *ResultsTable) WithEditor() *ResultsTable {
134134
editor := NewSQLEditor()
135135
editorPages := tview.NewPages()
136136

137+
editor.SetFocusFunc(func() {
138+
table.SetIsEditing(true)
139+
})
140+
141+
editor.SetBlurFunc(func() {
142+
table.SetIsEditing(false)
143+
})
144+
137145
table.Editor = editor
138146

139147
table.Wrapper.Clear()
@@ -303,13 +311,7 @@ func (table *ResultsTable) tableInputCapture(event *tcell.EventKey) *tcell.Event
303311
})
304312

305313
}
306-
}
307-
308-
if rowCount == 1 || colCount == 0 {
309-
return nil
310-
}
311-
312-
if command == commands.Search {
314+
} else if command == commands.Search {
313315
if table.Editor != nil {
314316
App.SetFocus(table.Editor)
315317
table.Editor.Highlight()
@@ -407,7 +409,13 @@ func (table *ResultsTable) tableInputCapture(event *tcell.EventKey) *tcell.Event
407409
})
408410

409411
table.SetInputCapture(nil)
410-
} else if command == commands.Edit {
412+
}
413+
414+
if rowCount == 1 || colCount == 0 {
415+
return nil
416+
}
417+
418+
if command == commands.Edit {
411419
table.StartEditingCell(selectedRowIndex, selectedColumnIndex, func(newValue string, row, col int) {
412420
cellReference := table.GetCell(row, 0).GetReference()
413421

0 commit comments

Comments
 (0)