Fix function $0 param, scope positional args locally, follow symlinks in completion, expose SHED_VI_MODE variable, and clean up test helpers
This commit is contained in:
@@ -226,7 +226,7 @@ fn complete_filename(start: &str) -> Vec<String> {
|
||||
let mut full_path = dir.join(&file_name);
|
||||
|
||||
// Add trailing slash for directories
|
||||
if entry.file_type().map(|ft| ft.is_dir()).unwrap_or(false) {
|
||||
if entry.metadata().map(|m| m.is_dir()).unwrap_or(false) {
|
||||
full_path.push(""); // adds trailing /
|
||||
}
|
||||
|
||||
|
||||
@@ -488,6 +488,16 @@ impl ShedVi {
|
||||
self.needs_redraw = true;
|
||||
self.completer.reset();
|
||||
|
||||
write_vars(|v| {
|
||||
v.set_var(
|
||||
"SHED_VI_MODE",
|
||||
VarKind::Str(self.mode.report_mode().to_string()),
|
||||
VarFlags::NONE,
|
||||
)
|
||||
})
|
||||
.ok();
|
||||
self.prompt.refresh();
|
||||
|
||||
with_vars([("_COMP_CANDIDATE".into(), candidate.clone())], || {
|
||||
post_cmds.exec_with(&candidate);
|
||||
});
|
||||
@@ -642,6 +652,13 @@ impl ShedVi {
|
||||
.update_pending_cmd((self.editor.as_str(), self.editor.cursor.get()));
|
||||
let hint = self.history.get_hint();
|
||||
self.editor.set_hint(hint);
|
||||
write_vars(|v| {
|
||||
v.set_var(
|
||||
"SHED_VI_MODE",
|
||||
VarKind::Str(self.mode.report_mode().to_string()),
|
||||
VarFlags::NONE,
|
||||
)
|
||||
}).ok();
|
||||
|
||||
// If we are here, we hit a case where pressing tab returned a single candidate
|
||||
// So we can just go ahead and reset the completer after this
|
||||
|
||||
Reference in New Issue
Block a user