From a0ab368082fe390e35bff9b871a78a03cf7165fe Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 30 Aug 2008 03:12:14 +0000 Subject: [PATCH] output an error message on :cd - if there is no alternate directory --- content/io.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/content/io.js b/content/io.js index fcaa3613..1d327374 100644 --- a/content/io.js +++ b/content/io.js @@ -78,7 +78,21 @@ liberator.IO = function () //{{{ function (args) { if (!args) + { args = "~"; + } + else if (args == "-") + { + if (oldcwd) + { + args = oldcwd; + } + else + { + liberator.echoerr("E186: No previous directory"); + return; + } + } if (liberator.io.setCurrentDirectory(args)) liberator.echo(liberator.io.getCurrentDirectory()); @@ -297,7 +311,7 @@ liberator.IO = function () //{{{ if (newdir == "-") { - [cwd, oldcwd] = [oldcwd, cwd]; + [cwd, oldcwd] = [oldcwd, this.getCurrentDirectory()]; } else { @@ -308,7 +322,7 @@ liberator.IO = function () //{{{ liberator.echoerr("E344: Can't find directory \"" + newdir + "\" in path"); return null; } - [cwd, oldcwd] = [newdir, cwd]; + [cwd, oldcwd] = [newdir, this.getCurrentDirectory()]; } return ioManager.getCurrentDirectory(); },