Skip to content

Commit

Permalink
Fix num_selections context
Browse files Browse the repository at this point in the history
  • Loading branch information
quarnster committed Apr 17, 2013
1 parent 448fe91 commit 26d408e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
7 changes: 5 additions & 2 deletions backend/editor.go
Expand Up @@ -107,8 +107,6 @@ func GetEditor() *Editor {
log4go.Global.Close()
log4go.Global.AddFilter("console", log4go.DEBUG, newMyLogWriter())
go ed.inputthread()
ed.loadKeybindings()
ed.loadSettings()
// initBasicCommands()
}
return ed
Expand All @@ -122,6 +120,11 @@ func (e *Editor) SetFrontend(f Frontend) {
e.frontend = f
}

func (e *Editor) Init() {
ed.loadKeybindings()
ed.loadSettings()
}

func (e *Editor) loadKeybinding(fn string) {
if d, err := ioutil.ReadFile(fn); err != nil {
log4go.Error("Couldn't load file %s: %s", fn, err)
Expand Down
4 changes: 3 additions & 1 deletion backend/events.go
Expand Up @@ -84,7 +84,9 @@ func init() {
}
return False
} else if key == "num_selections" {
op, _ := operand.(int)
opf, _ := operand.(float64)
op := int(opf)

switch operator {
case OpEqual:
if op == v.Sel().Len() {
Expand Down
2 changes: 1 addition & 1 deletion build/python.go
Expand Up @@ -426,7 +426,7 @@ func main() {
sn),
},
{"../backend/sublime/sublime_api.go", generatemethodsEx(reflect.TypeOf(backend.GetEditor()),
regexp.MustCompile("Info|HandleInput|CommandHandler|Windows|Frontend|Console|SetActiveWindow").MatchString,
regexp.MustCompile("Info|HandleInput|CommandHandler|Windows|Frontend|Console|SetActiveWindow|Init").MatchString,
"backend.GetEditor().",
sn),
},
Expand Down
2 changes: 2 additions & 0 deletions frontend/termbox/main.go
Expand Up @@ -603,7 +603,9 @@ func (t *tbfe) loop() {
}

func main() {
ed := backend.GetEditor()
log4go.AddFilter("file", log4go.FINEST, log4go.NewFileLogWriter("debug.log", true))
ed.Init()
defer func() {
py.NewLock()
py.Finalize()
Expand Down

0 comments on commit 26d408e

Please sign in to comment.