Git Product home page Git Product logo

Comments (14)

i-am-shodan avatar i-am-shodan commented on September 26, 2024 1

I'm going to be out for a while but in general variables are treated as environment variables if they are not null. If bash is your shell type.

var TEST123="hello";

then run the command
export

You'll see that TEST123 is now an env variable.

from shell.

i-am-shodan avatar i-am-shodan commented on September 26, 2024 1

Looks like I’m going to have to break out the quality Linux UI experience when I get back.

from shell.

i-am-shodan avatar i-am-shodan commented on September 26, 2024 1

New cursor keys in https://github.com/dotnet-shell/Shell/releases/tag/v1.0.0.8

from shell.

MostHated avatar MostHated commented on September 26, 2024

You mentioned being out for a while, so no worries about replying until you are back.

It's a total hack, and will probably end up messing something up down the road, but I got my prompt fixed up using the below. I am not sure where those characters are coming from, exactly.

// -- Before -----
%{%}~%{%}
zsh %{%}>%{%}
// ---------------

string CleanString(string inputStr)
{
    HashSet<char> removeChars = new HashSet<char>("{}%");
    StringBuilder result = new StringBuilder(inputStr.Length);
    foreach (char c in inputStr)
        if (!removeChars.Contains(c))
            result.Append(c);
    var str = result.ToString();
    if (str.Contains("zsh ")) str = str.Replace("zsh ", "dotnet ");
    return str;
}

// ...
return ColorString.FromRawANSI(CleanString(prompt));

// -- After -----
~
dotnet >
// --------------

The thing I actually wanted to report, though, is that while messing around with that, I noticed that in dotnet-shell, no terminal input that uses a modifier work. Such as ctrl+c to interrupt or clear the current terminal input. As well as ctrl, or alt + left or right arrow to move the cursor.

Left or Right on their own work to move a character at a time, and ctrl+shift+v works to paste (slowly), but that and standard character input are all that seem to work.

To make sure it wasn't something wrong with Alacritty, I tried in a few terminals, including the default Gnome Terminal, and all of that seemed to have the same symptoms.

from shell.

i-am-shodan avatar i-am-shodan commented on September 26, 2024

Interesting. I use dotnet-shell via Windows Terminal and WSL2. Ctrl+C and Ctrl+Z definitely work for me there as well as running in Windows conhost.

Can you try Ctrl+Z as that explicitly uses a Linux interrupt handler from mono and is needed for backgrounding processes. If that is working it looks like that needs to be extended to SIGINT.

The dotnet console implementation is pretty poor and there is an issue to make handling more consistent in the dotnet project.

from shell.

MostHated avatar MostHated commented on September 26, 2024

Hitting ctrl + Z looks like it makes the current cursor go to a new line.

from shell.

MostHated avatar MostHated commented on September 26, 2024

If it helps any, I fully intend on trying to use this as my daily driver. Being able to use C# for my desktop scripting needs has been at the top of my "can't wait until one-day" list for years.

from shell.

i-am-shodan avatar i-am-shodan commented on September 26, 2024

It does help! I got so annoyed with bash I wrote this!

Pretty sure it will be a simple fix with a debugger attached.

from shell.

i-am-shodan avatar i-am-shodan commented on September 26, 2024

I have news. I have installed Ubuntu 20.04 and the latest version of dotnet-shell without tmux. Using the default Ubuntu terminal which I'm assuming is Gnome-terminal I don't see any issues. Here is my test:

dotnet-shell
ping 8.8.8.8

hit Control-C - ping correctly terminates

ping 8.8.8.8

hit Control-Z - ping is correctly backgrounded

fg

ping resumes and can be killed with Control-C

I tested with starship in case that was the issue - still worked.

Reading through your bug report again I think the issue you are having is also the reason why you are getting garbage characters that you have to clean. In my distro - clean install of Ubuntu - I don't get any of those garbage characters so there is something wrong there.

I recorded a video to demonstrate what I see although the fonts are a bit screwed and for some reason asciinema doesn't show the prompt correctly at the start it all looks good on my terminal.

To set your config file you should be able to use

var STARSHIP_CONFIG=Path.Combine(Shell.HomeDirectory,".config/starship/starship.toml");

If you put that in the Shell.Prompt function before you call starship is will create a temporary environmental variable which starship will be able to see.

from shell.

MostHated avatar MostHated commented on September 26, 2024

I have tmux, I installed it as soon as you mentioned it was ideal to have it and not having it is what caused the initial issue I ran into. I will remove it and see if that makes a difference.

Edit - I removed it, tried it, then added tmux back again and it looks like Ctrl + C works for stopping ping, etc, but if I begin to type a command in the terminal, then hit Ctrl + C to clear out the line, that doesn't work. It looks like it's the same both with and without tmux. I suppose I assumed that since it didn't clear out the line of text, it seemed like it wasn't doing anything, so that is my bad. I use the Ctrl + C to clear out text pretty regularly, though.

Then, while not the end of the world, but particularly useful with long commands/lines of text, holding Ctrl while pressing left or right arrow to skip words when moving the cursor was really the only other thing that "popped out" in terms of usability. Mixing those two together, if you paste a long line of text, not only can you not Ctrl + C to get rid of it, you can't delete entire words at once quickly, you just have to sit there holding or repeatedly pressing backspace. It ends up being faster to just close the terminal all together and start up a new one, lol.

from shell.

i-am-shodan avatar i-am-shodan commented on September 26, 2024

It shouldn't be difficult to clear the line on Ctrl+C I will check

from shell.

MostHated avatar MostHated commented on September 26, 2024

Awesome, just tested it out. Works great. 👍

I know I have been asking a lot and I feel bad about it, but one last thing that can go on the backburner for whenever, as its not as important and would be a "nice to have" would be similar to ctrl + arrow, being able to ctrl + backspace to delete words backwards. That's hopefully the last thing I will have to bother you about, lol.

from shell.

i-am-shodan avatar i-am-shodan commented on September 26, 2024

The console implementation is quite easy to adapt so Ctrl backspace should be quite easy.

If you have a look at the change it was something like 40 lines. I’ll see if I can bash something out.

from shell.

i-am-shodan avatar i-am-shodan commented on September 26, 2024

In latest version

from shell.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.