From d49f35817e781ed4f5cd085f014a89802bca2b39 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 26 Apr 2013 20:18:16 +0200 Subject: [PATCH] fix handling of ~ in filenames so that :edit ~ does not open a file named '~' --- src/file.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/file.cc b/src/file.cc index 1e9b7327..2366c2c4 100644 --- a/src/file.cc +++ b/src/file.cc @@ -19,8 +19,9 @@ namespace Kakoune String parse_filename(const String& filename) { - if (filename.length() >= 2 and filename[0] == '~' and filename[1] == '/') - return parse_filename("$HOME/" + filename.substr(2_byte)); + if (filename.length() >= 1 and filename[0] == '~' and + (filename.length() == 1 or filename[1] == '/')) + return parse_filename("$HOME" + filename.substr(1_byte)); ByteCount pos = 0; String result;