Skip to content

Commit 1eafc76

Browse files
committed
better error handling, read-only color
1 parent 5d0cb09 commit 1eafc76

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

internal/dblib/database.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ func determineKeysFromAnalysis(analysis *ViewAnalysis, columns []Column,
231231

232232
return uniqueKeys, nil
233233
}
234+
234235
var ErrNoKeyableColumns = errors.New("no keyable columns found")
235236

236237
func NewRelation(db *sql.DB, dbType DatabaseType, tableName string) (*Relation, error) {
@@ -1856,7 +1857,6 @@ func (rel *Relation) queryRowsCustomSQL(columns []string, sortCol *SortColumn, p
18561857
builder.WriteString(", ")
18571858
}
18581859
}
1859-
18601860
query := builder.String()
18611861

18621862
rows, err := rel.DB.Query(query, params...)

table_view.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ func (tv *TableView) drawDataRow(x, y, tableWidth, rowIdx int) {
715715
baseCellStyle = baseCellStyle.Background(tcell.ColorDarkGreen)
716716
} else if !header.Editable {
717717
// Non-editable column - use grey background
718-
baseCellStyle = baseCellStyle.Background(tv.readOnlyBgColor)
718+
baseCellStyle = baseCellStyle.Foreground(tv.readOnlyBgColor)
719719
}
720720

721721
// Apply selection highlight on top of base style

tui_core.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,10 @@ func runEditor(config *Config, dbname, tablename, sqlStatement string) error {
322322

323323
// Only load data if we have a relation
324324
if displayName != "" {
325-
editor.loadFromRowId(nil, true, 0)
325+
if err := editor.loadFromRowId(nil, true, 0); err != nil {
326+
CaptureError(err)
327+
return err
328+
}
326329
}
327330
editor.setupKeyBindings()
328331
editor.setupStatusBar()

0 commit comments

Comments
 (0)