Gim/internal/core/mode.go
Hayden Hargreaves 6033e58d0e
All checks were successful
Run Test Suite / test (push) Successful in 17s
feat: implement the r action, tested
Began work on replace mode, but not complete.
2026-04-05 22:58:07 -07:00

46 lines
844 B
Go

package core
// Mode constants for editor mode
type Mode int
const (
NormalMode Mode = iota
InsertMode
CommandMode
CommandOutputMode
VisualMode
VisualLineMode
VisualBlockMode
ReplaceMode
)
// Mode.ToString: Returns a human-readable string representation of the mode
// for display in the status bar.
func (m Mode) ToString() string {
switch m {
case NormalMode:
return "NORMAL"
case InsertMode:
return "INSERT"
case CommandMode:
return "COMMAND"
case VisualMode:
return "VISUAL"
case VisualLineMode:
return "V-LINE"
case VisualBlockMode:
return "V-BLOCK"
case ReplaceMode:
return "REPLACE"
default:
return "-----"
}
}
// Mode.IsVisualMode: Returns true if the mode is any visual mode variant.
func (m Mode) IsVisualMode() bool {
return m == VisualMode ||
m == VisualLineMode ||
m == VisualBlockMode
}