Skip to content

Commit

Permalink
Changed alltofile to search by regex rather than find an exact match.…
Browse files Browse the repository at this point in the history
… Passes my own tests, needs programmatic ones.
  • Loading branch information
camsn0w committed Jan 11, 2022
1 parent a9b2934 commit e286f0a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions ecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ type ToOEB struct {
r string
}

func alltofile(w *Window, tp *ToOEB) {
func alltofile(w *Window, tp *ToOEB, filenameregex *AcmeRegexp) {
if tp.oeb != nil {
return
}
Expand All @@ -1078,8 +1078,9 @@ func alltofile(w *Window, tp *ToOEB) {
return
}
// if w.nopen[QWevent] > 0 {
// return;
if tp.r == t.file.Name() {
// return

if filenameregex.FindString(t.file.Name()) != "" {
tp.oeb = t.file
}
}
Expand All @@ -1089,9 +1090,15 @@ func toOEB(r string) *file.ObservableEditableBuffer {

t.r = strings.TrimLeft(r, " \t\n")
t.oeb = nil
global.row.AllWindows(func(w *Window) { alltofile(w, &t) })

filenameregex, err := rxcompile(t.r)
if err != nil {
editerror("match not found for\"%v\"", t.r)
}

global.row.AllWindows(func(w *Window) { alltofile(w, &t, filenameregex) })
if t.oeb == nil {
editerror("no such file\"%v\"", t.r)
editerror("match not found for\"%v\"", t.r)
}
return t.oeb
}
Expand Down

0 comments on commit e286f0a

Please sign in to comment.