Skip to content

Commit

Permalink
Fix use of encoding in Document::open()
Browse files Browse the repository at this point in the history
  • Loading branch information
kirawi committed Jul 15, 2021
1 parent 2a4b3d0 commit 5ac6b38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion helix-syntax/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ fn build_library(src_path: &Path, language: &str) -> Result<()> {
if !recompile {
return Ok(());
}
let build_dir = std::env::var("OUT_DIR").unwrap();
let mut config = cc::Build::new();
config.cpp(true).opt_level(2).cargo_metadata(false);
let compiler = config.get_compiler();
let mut command = Command::new(compiler.path());
command.current_dir(src_path);
command.current_dir(Path::new(&build_dir).join(src_path));
for (key, value) in compiler.env() {
command.env(key, value);
}
Expand Down
3 changes: 2 additions & 1 deletion helix-view/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ impl Document {
std::fs::File::open(&path).context(format!("unable to open {:?}", path))?;
from_reader(&mut file, encoding)?
} else {
(Rope::from(DEFAULT_LINE_ENDING.as_str()), encoding_rs::UTF_8)
let encoding = encoding.unwrap_or(encoding_rs::UTF_8);
(Rope::from(DEFAULT_LINE_ENDING.as_str()), encoding)
};

let line_ending = with_line_ending(&mut rope);
Expand Down

0 comments on commit 5ac6b38

Please sign in to comment.