Coder Social home page Coder Social logo

ushell's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ushell's Issues

Panic when attempting to insert a character when the editor buffer is full

Hi, I'm not sure about the maintenance status of this crate, but I hit a panic when experimenting with one of the examples from the stm32f4xx-hal crate, so I thought I would still report it.

If the editor buffer is full, and the cursor is not at the end of the buffer, then the firmware will panic when it attempts to insert the character into the editor buffer.

I think the fix is probably to update the if statement here:

if self.cursor == self.editor_buf.len() {
to also check whether self.editor_len == self.editor_buf.len()

Changing auto-complete behaviour

Hello,

I'm interested in changing the auto-complete behaviour to make it act more like Linux.

Right now, I have two commands state and status. If I type s and hit tab, it just autocompletes to whichever is first in the StaticAutoComplete object. What I would instead like to have happen is the following:

s <tab>
Autocompletes to stat
<tab> again does nothing
<tab again> lists state status

I hope that makes sense. It's identical behaviour to how my Linux machine operates(bash).

If this behaviour seems like something you'd want, I'm happy to implement it. Just trying to figure out what the Autocomplete trait should look like.

pub trait Autocomplete {
    fn suggest<FO: FnOnce(&str), FM: Fn(&str)>(&self, prefix: &str, one: FO, many: FM);
}

The idea is, you call one if there's a single result, or many if there's more than one result (calling both would be an error). many you'd call once per result. Seems like the most memory-efficient way to do it - even more efficient than the current trait, since it doesn't require instantiating a String<CMD_LEN>

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.