Skip to content

Commit

Permalink
Improved windows experience.
Browse files Browse the repository at this point in the history
  • Loading branch information
aurc committed Aug 13, 2022
1 parent 3160ec9 commit 03827ca
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 23 deletions.
8 changes: 8 additions & 0 deletions internal/char/symbols_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build !windows

package char

const (
SymSearch = "🔎"
SymKey = "🔑"
)
8 changes: 8 additions & 0 deletions internal/char/symbols_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build windows

package char

const (
SymSearch = "ƒ"
SymKey = "≡"
)
5 changes: 3 additions & 2 deletions internal/loggo/filter_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package loggo

import (
"fmt"
"github.com/aurc/loggo/internal/char"
"strings"

"github.com/aurc/loggo/internal/filter"
Expand Down Expand Up @@ -143,7 +144,7 @@ func (t *FilterView) makeLayouts() {
t.Flex.Clear()
filterRow := tview.NewFlex().SetDirection(tview.FlexColumn)
filterField := tview.NewFlex().SetDirection(tview.FlexColumn).
AddItem(tview.NewTextView().SetText("🔎").SetTextAlign(tview.AlignCenter), 4, 1, true).
AddItem(tview.NewTextView().SetText(char.SymSearch).SetTextAlign(tview.AlignCenter), 4, 1, true).
AddItem(t.expressionField, 0, 1, true)
filterField.SetBorder(true)
filterRow.
Expand All @@ -161,7 +162,7 @@ func (t *FilterView) makeLayouts() {
okButton := tview.NewButton("OK").SetSelectedFunc(t.addKey)
okButton.SetBackgroundColor(tcell.ColorGreen)
actionBar := tview.NewFlex().SetDirection(tview.FlexColumn)
actionBar.AddItem(tview.NewTextView().SetText(" 🔑 Finder:"), 12, 0, false)
actionBar.AddItem(tview.NewTextView().SetText(fmt.Sprintf(" %s Finder:", char.SymKey)), 12, 0, false)
actionBar.AddItem(t.keyFinderField, 0, 1, false).
AddItem(tview.NewBox(), 1, 1, false).
AddItem(okButton, 4, 1, false).
Expand Down
1 change: 1 addition & 0 deletions internal/loggo/log_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func NewLogReader(app *LoggoApp, reader reader.Reader) *LogView {
go func() {
time.Sleep(10 * time.Millisecond)
lv.isFollowing = true
lv.app.SetFocus(lv.table)
}()
return lv
}
Expand Down
35 changes: 20 additions & 15 deletions internal/loggo/log_view_nav_menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package loggo

import (
"fmt"
"runtime"

"github.com/aurc/loggo/internal/color"
"github.com/gdamore/tcell/v2"
Expand Down Expand Up @@ -63,7 +64,7 @@ func (l *LogView) populateMenu() {
NewHorizontalSeparator(sepStyle, LineHThick, "Navigation", sepForeground), 1, 2, false).
AddItem(tview.NewTextView().
SetDynamicColors(true).
SetText("[yellow::b] [-::-] View Entry"), 1, 3, false).
SetText("[yellow::b] Enter[-::-] View Entry"), 1, 3, false).
AddItem(tview.NewTextView().
SetDynamicColors(true).
SetText("[yellow::b] ↓ ↑ ← →[-::-] Navigate"), 1, 3, false).
Expand Down Expand Up @@ -94,20 +95,24 @@ func (l *LogView) populateMenu() {
SetText(`[yellow::b] ^f [-::u]["1"]Pg Down[""]`), func() {
l.isFollowing = false
l.table.InputHandler()(tcell.NewEventKey(tcell.KeyPgDn, '0', 0), func(p tview.Primitive) {})
}), 1, 2, false).
//////////////////////////////////////////////////////////////////
// Selection Menu
//////////////////////////////////////////////////////////////////
AddItem(NewHorizontalSeparator(sepStyle, LineHThick, "Selection", sepForeground), 1, 2, false).
AddItem(tview.NewTextView().
SetDynamicColors(true).
SetText("[yellow::b] ⌥ 🖱 [-::-] Horizontal"), 1, 3, false).
AddItem(tview.NewTextView().
SetDynamicColors(true).
SetText("[yellow::b] ⌥ ⌘ 🖱 [-::-] Vertical"), 1, 3, false).
//////////////////////////////////////////////////////////////////
// Application Menu
//////////////////////////////////////////////////////////////////
}), 1, 2, false)
//////////////////////////////////////////////////////////////////
// Selection Menu
//////////////////////////////////////////////////////////////////
if runtime.GOOS != "windows" {
l.navMenu.
AddItem(NewHorizontalSeparator(sepStyle, LineHThick, "Selection", sepForeground), 1, 2, false).
AddItem(tview.NewTextView().
SetDynamicColors(true).
SetText("[yellow::b] ⌥ 🖱 [-::-] Horizontal"), 1, 3, false).
AddItem(tview.NewTextView().
SetDynamicColors(true).
SetText("[yellow::b] ⌥ ⌘ 🖱 [-::-] Vertical"), 1, 3, false)
}
//////////////////////////////////////////////////////////////////
// Application Menu
//////////////////////////////////////////////////////////////////
l.navMenu.
AddItem(NewHorizontalSeparator(sepStyle, LineHThick, "Application", sepForeground), 1, 2, false).
AddItem(l.textViewMenuControl(tview.NewTextView().
SetDynamicColors(true).SetRegions(true).
Expand Down
12 changes: 6 additions & 6 deletions internal/loggo/log_view_table_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ func (d *LogData) GetCell(row, column int) *tview.TableCell {
}
if column == 0 {
if row == 0 {
tc := tview.NewTableCell("[yellow] ☀[white] / [blue]☂ ").
tc := tview.NewTableCell("[yellow] Line # ").
SetAlign(tview.AlignCenter).
SetBackgroundColor(tcell.ColorBlack).
SetSelectable(false)
return tc
} else {
if _, ok := d.logView.finSlice[row-1][config.ParseErr]; ok {
tc := tview.NewTableCell(" ︎ ☂ ").
SetTextColor(tcell.ColorBlue).
SetAlign(tview.AlignCenter).
tc := tview.NewTableCell(fmt.Sprintf("%d ", row)).
SetTextColor(tcell.ColorRed).
SetAlign(tview.AlignRight).
SetBackgroundColor(tcell.ColorBlack)
return tc
} else {
tc := tview.NewTableCell(" ︎☀ ︎ ").
tc := tview.NewTableCell(fmt.Sprintf("%d ", row)).
SetTextColor(tcell.ColorYellow).
SetAlign(tview.AlignCenter).
SetAlign(tview.AlignRight).
SetBackgroundColor(tcell.ColorBlack)
return tc
}
Expand Down

0 comments on commit 03827ca

Please sign in to comment.