JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.52k stars 2.4k forks source link

[fish] Please do not fire `accept-autosuggestion` if transient prompt is not enabled #5760

Closed kkebo closed 1 month ago

kkebo commented 1 month ago

Code of Conduct

What would you like to see added?

accept-autosuggestion is really annoying for me because I'm not using transient prompt.

Before #5070 was merged, oh-my-posh fired accept-autosuggestion only if test "::TRANSIENT::" = "true" was true.

So is it possible to revert back to the previous behavior regarding accept-autosuggestion?

kkebo commented 1 month ago

Here is my idea, but I don't know whether this breaks other features.

diff --git a/src/shell/scripts/omp.fish b/src/shell/scripts/omp.fish
index 95637657..1bd8ec7e 100644
--- a/src/shell/scripts/omp.fish
+++ b/src/shell/scripts/omp.fish
@@ -186,7 +186,7 @@ end
 # transient prompt

 function _omp_enter_key_handler
-    if commandline --paging-mode
+    if test "::TRANSIENT::" = "true" && commandline --paging-mode
         commandline --function accept-autosuggestion
         return
     end
JanDeDobbeleer commented 1 month ago

@kkebo test "::TRANSIENT::" this syntax is no longer supported. We would need to adjust it to test "$_omp_transient" = 1.

@lewis-yeung any pointers on the change requested above?

lewis-yeung commented 1 month ago

@JanDeDobbeleer @kkebo We should change commandline --function accept-autosuggestion to commandline --function execute so that everything works fine. I'll make a PR.