Use clear for clearing maps (#1923)
This commit is contained in:
1 parent
938e02e126
commit
0e66d02746
3 files changed
+14
-14
No files matched your search
@@ -90,7 +90,7 @@ func (e *setExpr) eval(app *app, args []string) {
|
||||
app.ui.renew()
|
||||
if app.nav.height != app.ui.wins[0].h {
|
||||
app.nav.height = app.ui.wins[0].h
|
||||
app.nav.regCache = make(map[string]*reg)
|
||||
clear(app.nav.regCache)
|
||||
if gOpts.sixel {
|
||||
app.ui.sxScreen.lastFile = ""
|
||||
}
|
||||
@@ -349,7 +349,7 @@ func (e *setExpr) eval(app *app, args []string) {
|
||||
gOpts.ratios = rats
|
||||
app.ui.wins = getWins(app.ui.screen)
|
||||
if gOpts.sixel {
|
||||
app.nav.regCache = make(map[string]*reg)
|
||||
clear(app.nav.regCache)
|
||||
app.ui.sxScreen.lastFile = ""
|
||||
}
|
||||
app.ui.loadFile(app, true)
|
||||
@@ -1293,7 +1293,7 @@ func (e *callExpr) eval(app *app, args []string) {
|
||||
app.ui.sort()
|
||||
case "clearmaps":
|
||||
// leave `:` and cmaps bound so the user can still exit using `:quit`
|
||||
gOpts.keys = make(map[string]expr)
|
||||
clear(gOpts.keys)
|
||||
gOpts.keys[":"] = &callExpr{"read", nil, 1}
|
||||
case "copy":
|
||||
if !app.nav.init {
|
||||
@@ -1416,10 +1416,10 @@ func (e *callExpr) eval(app *app, args []string) {
|
||||
app.ui.screen.Sync()
|
||||
if app.nav.height != app.ui.wins[0].h {
|
||||
app.nav.height = app.ui.wins[0].h
|
||||
app.nav.regCache = make(map[string]*reg)
|
||||
clear(app.nav.regCache)
|
||||
}
|
||||
if gOpts.sixel {
|
||||
app.nav.regCache = make(map[string]*reg)
|
||||
clear(app.nav.regCache)
|
||||
app.ui.sxScreen.lastFile = ""
|
||||
}
|
||||
for _, dir := range app.nav.dirs {
|
||||
|
||||
@@ -666,8 +666,8 @@ func (nav *nav) renew() {
|
||||
}
|
||||
|
||||
func (nav *nav) reload() error {
|
||||
nav.dirCache = make(map[string]*dir)
|
||||
nav.regCache = make(map[string]*reg)
|
||||
clear(nav.dirCache)
|
||||
clear(nav.regCache)
|
||||
|
||||
curr, err := nav.currFile()
|
||||
nav.getDirs(nav.currDir().path)
|
||||
@@ -1307,7 +1307,7 @@ func (nav *nav) invertBelow() {
|
||||
}
|
||||
|
||||
func (nav *nav) unselect() {
|
||||
nav.selections = make(map[string]int)
|
||||
clear(nav.selections)
|
||||
nav.selectionInd = 0
|
||||
}
|
||||
|
||||
@@ -1321,7 +1321,7 @@ func (nav *nav) save(cp bool) error {
|
||||
return err
|
||||
}
|
||||
|
||||
nav.saves = make(map[string]bool)
|
||||
clear(nav.saves)
|
||||
for _, f := range list {
|
||||
nav.saves[f] = cp
|
||||
}
|
||||
@@ -1599,7 +1599,7 @@ func (nav *nav) sync() error {
|
||||
return err
|
||||
}
|
||||
|
||||
nav.saves = make(map[string]bool)
|
||||
clear(nav.saves)
|
||||
for _, f := range list {
|
||||
nav.saves[f] = cp
|
||||
}
|
||||
@@ -1860,7 +1860,7 @@ func (nav *nav) removeMark(mark string) error {
|
||||
}
|
||||
|
||||
func (nav *nav) readMarks() error {
|
||||
nav.marks = make(map[string]string)
|
||||
clear(nav.marks)
|
||||
f, err := os.Open(gMarksPath)
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
@@ -1918,7 +1918,7 @@ func (nav *nav) writeMarks() error {
|
||||
}
|
||||
|
||||
func (nav *nav) readTags() error {
|
||||
nav.tags = make(map[string]string)
|
||||
clear(nav.tags)
|
||||
f, err := os.Open(gTagsPath)
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
|
||||
@@ -110,7 +110,7 @@ func (watch *watch) loop() {
|
||||
dir.sort()
|
||||
watch.dirChan <- dir
|
||||
}
|
||||
watch.loads = make(map[string]bool)
|
||||
clear(watch.loads)
|
||||
case <-watch.updateTimer.C:
|
||||
for path := range watch.updates {
|
||||
if _, err := os.Lstat(path); err != nil {
|
||||
@@ -118,7 +118,7 @@ func (watch *watch) loop() {
|
||||
}
|
||||
watch.fileChan <- newFile(path)
|
||||
}
|
||||
watch.updates = make(map[string]bool)
|
||||
clear(watch.updates)
|
||||
case <-watch.quit:
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user