From 1122154e32aba82ae72074e63493a28f1e4bbd47 Mon Sep 17 00:00:00 2001 From: taynpg Date: Thu, 9 Jan 2025 09:31:05 +0800 Subject: [PATCH] =?UTF-8?q?readme=EF=BC=9A=E8=AF=B4=E6=98=8E=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +++- filecomplete.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 904d3cf..e8a51e3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # 简介 -在控制台程序中,可以补全文件路径。 +在控制台程序中,读取用户输入的时候,实现`tab`补全文件路径或者在输入时有补全提示(显示首个匹配项)。 + +`tab`键补全仅命中唯一项时可以直接补全,所以需要配合补全提示,两者配合能达到一个基本够用的状态(本项目达到此目标即结束,不开发更复杂的补全和提示)。 本项目修改自 [https://github.com/DieTime/cli-autocomplete](https://github.com/DieTime/cli-autocomplete) 。 \ No newline at end of file diff --git a/filecomplete.cpp b/filecomplete.cpp index 2edcaef..16d6414 100644 --- a/filecomplete.cpp +++ b/filecomplete.cpp @@ -274,7 +274,7 @@ char* readline() // Print current buffer color_print(buffer, DEFAULT_MAIN_COLOR); - // Move cursor to buffer end + // Move cursor int cur_pos{}; for (int i = 0; i < buf.size() && i < wo; ++i) { cur_pos += static_cast(buf[i].size());