Permalink
Browse files

Create a Mode type and set modes as constants

  • Loading branch information...
sebashwa committed Oct 25, 2017
1 parent 3590d98 commit 8b1e908f35414837f6f9fc308641b46197a5616d
Showing with 14 additions and 11 deletions.
  1. +2 −1 actions/common.go
  2. +0 −5 main.go
  3. +10 −4 modes/modes.go
  4. +1 −1 state/state.go
  5. +1 −0 types/types.go
@@ -4,10 +4,11 @@ import (
"github.com/nsf/termbox-go"
"github.com/sebashwa/vixl44/state"
"github.com/sebashwa/vixl44/types"
"github.com/sebashwa/vixl44/actions/paint"
)
func SetMode(mode string) {
func SetMode(mode types.Mode) {
state.CurrentMode = mode
}
@@ -105,11 +105,6 @@ func openOrCreateCanvas(filename string, columns, rows int) types.Canvas {
func initializeApp() {
filename, canvasRows, canvasColumns := parseArguments()
modes.NormalMode = "NORMAL"
modes.VisualBlockMode = "VISUAL-BLOCK"
modes.PaletteMode = "PALETTE"
modes.CommandMode = "COMMAND"
state.Canvas = openOrCreateCanvas(filename, canvasColumns, canvasRows)
state.Palette = factory.CreatePalette(state.Canvas.Columns, state.Canvas.Rows)
state.StatusBar = types.StatusBar{
@@ -1,7 +1,13 @@
package modes
var NormalMode string
var VisualBlockMode string
var PaletteMode string
var CommandMode string
import (
"github.com/sebashwa/vixl44/types"
)
const (
NormalMode types.Mode = "NORMAL"
VisualBlockMode types.Mode = "VISUAL-BLOCK"
PaletteMode types.Mode = "PALETTE"
CommandMode types.Mode = "COMMAND"
)
@@ -11,7 +11,7 @@ var Palette types.Palette
var StatusBar types.StatusBar
var Cursor types.Cursor
var SelectedColor termbox.Attribute
var CurrentMode string
var CurrentMode types.Mode
var Filename string
var History types.History
var YankBuffer types.YankBuffer
@@ -5,6 +5,7 @@ import (
)
type Palette [][]termbox.Attribute
type Mode string
type StatusBar struct {
Position int

0 comments on commit 8b1e908

Please sign in to comment.