fix handling of ~ in filenames so that :edit ~ does not open a file named '~'

This commit is contained in:
Maxime Coste 2013-04-26 20:18:16 +02:00
parent 22f31e367c
commit d49f35817e

View File

@ -19,8 +19,9 @@ namespace Kakoune
String parse_filename(const String& filename) String parse_filename(const String& filename)
{ {
if (filename.length() >= 2 and filename[0] == '~' and filename[1] == '/') if (filename.length() >= 1 and filename[0] == '~' and
return parse_filename("$HOME/" + filename.substr(2_byte)); (filename.length() == 1 or filename[1] == '/'))
return parse_filename("$HOME" + filename.substr(1_byte));
ByteCount pos = 0; ByteCount pos = 0;
String result; String result;