Improving the design
This commit is contained in:
@@ -9,7 +9,7 @@ void CommandWindowInit() {
|
||||
window->draw_line_numbers = false;
|
||||
window->draw_scrollbar = false;
|
||||
window->draw_darker = true;
|
||||
window->draw_line_highlight = false;
|
||||
window->draw_line_highlight = true;
|
||||
window->layout = false;
|
||||
window->visible = false;
|
||||
window->sync_visibility_with_focus = true;
|
||||
@@ -27,8 +27,6 @@ void CommandWindowLayout(Rect2I *rect, Int wx, Int wy) {
|
||||
n->document_rect = n->total_rect = CutBottom(rect, barsize);
|
||||
}
|
||||
|
||||
const Int FuzzyCloserWordBegin = 5;
|
||||
const Int FuzzyConsecutiveMultiplier = 3;
|
||||
Int FuzzyRate(String16 string, String16 with) {
|
||||
ProfileFunction();
|
||||
if (with.len == 0) return 0;
|
||||
@@ -36,20 +34,18 @@ Int FuzzyRate(String16 string, String16 with) {
|
||||
Int consecutive = 0;
|
||||
Int with_i = 0;
|
||||
for (Int i = 0; i < string.len; i++) {
|
||||
if (string.data[i] == with[with_i]) {
|
||||
Int closer_begin = ClampBottom((Int)0, FuzzyCloserWordBegin - i);
|
||||
points += closer_begin;
|
||||
consecutive++;
|
||||
if (ToLowerCase(string.data[i]) == ToLowerCase(with[with_i])) {
|
||||
consecutive += 1;
|
||||
with_i += 1;
|
||||
} else {
|
||||
points += consecutive * FuzzyConsecutiveMultiplier;
|
||||
with_i = 0;
|
||||
points += consecutive * consecutive;
|
||||
consecutive = 0;
|
||||
with_i = 0;
|
||||
}
|
||||
|
||||
if (with_i >= with.len) with_i = 0;
|
||||
}
|
||||
points += consecutive * FuzzyConsecutiveMultiplier;
|
||||
points += consecutive * consecutive;
|
||||
return points;
|
||||
}
|
||||
|
||||
@@ -145,7 +141,7 @@ void Command_ShowDebugBufferList() {
|
||||
ActiveWindowID = command_bar.window->id;
|
||||
ResetBuffer(command_bar.buffer);
|
||||
For (Buffers) {
|
||||
RawAppendf(command_bar.buffer, "\n%-80S || %S", SkipToLastSlash(it->name), it->name);
|
||||
RawAppendf(command_bar.buffer, "\n%S", it->name);
|
||||
}
|
||||
command_bar.view->update_scroll = true;
|
||||
SelectRange(command_bar.view, GetBufferBeginAsRange(command_bar.buffer));
|
||||
@@ -167,7 +163,7 @@ void Command_ShowBufferList() {
|
||||
if (it->special) {
|
||||
continue;
|
||||
}
|
||||
RawAppendf(command_bar.buffer, "\n%-80S || %S", SkipToLastSlash(it->name), it->name);
|
||||
RawAppendf(command_bar.buffer, "\n%S", it->name);
|
||||
}
|
||||
command_bar.view->update_scroll = true;
|
||||
SelectRange(command_bar.view, GetBufferBeginAsRange(command_bar.buffer));
|
||||
|
||||
Reference in New Issue
Block a user