Skip to content

Commit 6572ed2

Browse files
committed
Fix env vars in alacritty terminal & fig_api_client
1 parent 378d6d6 commit 6572ed2

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/alacritty_terminal/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ workspace = true
1818
[dependencies]
1919
bitflags.workspace = true
2020
camino.workspace = true
21+
fig_os_shim.workspace = true
2122
serde.workspace = true
2223
serde_yaml = "0.9"
2324
shell-color.workspace = true

crates/alacritty_terminal/src/term/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,8 +833,7 @@ impl<T> Term<T> {
833833
trace!("New command cursor: {:?}", self.shell_state.cmd_cursor);
834834

835835
// Add work around for emojis
836-
if let Ok(cursor_offset) = std::env::var("Q_PROMPT_OFFSET_WORKAROUND") {
837-
// ALLOWED: alacritty_terminal doesn't have fig_os_shim dependency
836+
if let Ok(cursor_offset) = fig_os_shim::Env::new().q_prompt_offset_workaround() {
838837
if let Ok(offset) = cursor_offset.parse::<i32>() {
839838
self.shell_state.cmd_cursor = self.shell_state.cmd_cursor.map(|cursor| Point {
840839
column: Column((cursor.column.0 as i32 - offset).max(0) as usize),

crates/fig_api_client/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ aws-types.workspace = true
2727
bytes.workspace = true
2828
fig_auth.workspace = true
2929
fig_aws_common.workspace = true
30+
fig_os_shim.workspace = true
3031
fig_request.workspace = true
3132
fig_settings.workspace = true
3233
fig_util.workspace = true

crates/fig_api_client/src/clients/streaming_client.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ pub struct StreamingClient {
5858

5959
impl StreamingClient {
6060
pub async fn new() -> Result<Self, Error> {
61-
let client = if fig_util::system_info::in_cloudshell()
62-
|| std::env::var("Q_USE_SENDMESSAGE").is_ok_and(|v| !v.is_empty())
63-
{
64-
// ALLOWED: fig_api_client doesn't have fig_os_shim dependency
61+
let client = if fig_util::system_info::in_cloudshell() || fig_os_shim::Env::new().q_use_sendmessage() {
6562
Self::new_qdeveloper_client(&Endpoint::load_q()).await?
6663
} else {
6764
Self::new_codewhisperer_client(&Endpoint::load_codewhisperer()).await

crates/fig_util/src/system_info/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,12 @@ pub fn in_cloudshell() -> bool {
282282

283283
pub fn in_codespaces() -> bool {
284284
static IN_CODESPACES: OnceLock<bool> = OnceLock::new();
285-
*IN_CODESPACES.get_or_init(|| std::env::var_os("CODESPACES").is_some() || fig_os_shim::Env::new().in_codespaces())
285+
*IN_CODESPACES.get_or_init(|| fig_os_shim::Env::new().in_codespaces())
286286
}
287287

288288
pub fn in_ci() -> bool {
289289
static IN_CI: OnceLock<bool> = OnceLock::new();
290-
*IN_CI.get_or_init(|| std::env::var_os("CI").is_some() || fig_os_shim::Env::new().in_ci())
290+
*IN_CI.get_or_init(|| fig_os_shim::Env::new().in_ci())
291291
}
292292

293293
#[cfg(target_os = "macos")]

0 commit comments

Comments
 (0)