mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-25 20:41:49 +03:00
fix line completion with prefix
There's a bug in current line completion, fix it. Signed-off-by: Tw <tw19881113@gmail.com>
This commit is contained in:
parent
5696ed02e4
commit
41833d7b7d
@ -348,7 +348,7 @@ InsertCompletion complete_line(const SelectionList& sels,
|
||||
const ColumnCount tabstop = options["tabstop"].get<int>();
|
||||
const ColumnCount column = get_column(buffer, tabstop, cursor_pos);
|
||||
|
||||
StringView prefix = trim_indent(buffer[cursor_pos.line].substr(0_byte, cursor_pos.column));
|
||||
String prefix = trim_indent(buffer[cursor_pos.line].substr(0_byte, cursor_pos.column));
|
||||
BufferCoord replace_begin = buffer.advance(cursor_pos, -prefix.length());
|
||||
InsertCompletion::CandidateList candidates;
|
||||
|
||||
@ -358,15 +358,15 @@ InsertCompletion complete_line(const SelectionList& sels,
|
||||
if (buf.name() == buffer.name() && l == cursor_pos.line)
|
||||
continue;
|
||||
|
||||
const StringView line = trim_indent(buf[l]);
|
||||
String line = trim_indent(buf[l]);
|
||||
|
||||
if (line.length() == 0)
|
||||
continue;
|
||||
|
||||
if (prefix == line.substr(0_byte, prefix.length()))
|
||||
{
|
||||
StringView candidate = trim_indent(line.substr(0_byte, line.length()));
|
||||
candidates.push_back({candidate.str(), "", {expand_tabs(candidate, tabstop, column), {}} });
|
||||
String candidate = trim_indent(line.substr(0_byte, line.length()));
|
||||
candidates.push_back({candidate, "", {expand_tabs(candidate, tabstop, column), {}} });
|
||||
// perf: it's unlikely the user intends to search among >10 candidates anyway
|
||||
if (candidates.size() == 100)
|
||||
break;
|
||||
|
@ -1 +1 @@
|
||||
gjA<c-x>l<c-n><c-n><esc>
|
||||
gjA<c-x>l<c-n><esc>
|
||||
|
@ -1,4 +1,4 @@
|
||||
w111111
|
||||
|
||||
w222222
|
||||
|
||||
w2
|
||||
|
Loading…
Reference in New Issue
Block a user