Coder Social home page Coder Social logo

Comments (9)

skaldesh avatar skaldesh commented on August 21, 2024 1

I was being stupid. This bug has nothing to do with backsearch. The problem is that grumble can not handle the case that somebody types a command, say daemon, then moves the cursor back to the start of the word and hits Tab. This crashes as well. Good thing you discovered this @h4ng3r

from grumble.

skaldesh avatar skaldesh commented on August 21, 2024

Hi,

I could reproduce your bug by doing the following:

  • go run sample/simple/main.go
  • run the daemon command once
  • then press Ctrl+r for back-search and enter for example daem
  • hit Tab
  • crash

To me, it seems like it is critical that the command that will be completed by the back-search is also in the command history of grumble. I could not reproduce the bug with a fresh start and directly doing the back-search. I had to run the command in question at least once. Can you confirm that @h4ng3r?

@r0l1 and I will take a look at your suggested changes, thank you for submitting and reporting the issue, very much appreciated.

from grumble.

h4ng3r avatar h4ng3r commented on August 21, 2024

Hi @skaldesh,

Yep that's true you need a match in the back search, you need to hit TAB on a match otherwise it won't crash. Nice catch.

Thanks,

from grumble.

skaldesh avatar skaldesh commented on August 21, 2024

@h4ng3r I played around with your proposed fix, but I think the len(line) > pos prevents the auto completion for me to work generally. Typing dae and hitting Tab then does no longer auto complete, since the line is dae, pos is 2 (the end) and the expression evaluates to false then.

In addition, when using the backsearch, which then autocompletes daemon, position is still 0, which causes grumble to append a dash - in front of daemon. This happens, since the auto completer is presented with the line daemon and therefore wants to start suggesting flags... I will propose some solution for this soon

from grumble.

h4ng3r avatar h4ng3r commented on August 21, 2024

@skaldesh yep, that's true I realized yesterday that my solution was disabling auto completion. Still not sure how to fix it properly, sorry.

from grumble.

skaldesh avatar skaldesh commented on August 21, 2024

No problem, will play around a little bit, thank you for the quick answers :D

from grumble.

skaldesh avatar skaldesh commented on August 21, 2024

@h4ng3r I created a PR. Can you, @h4ng3r , check it out and see, if it fixes your problem and hopefully does not cause any further bugs? :)

from grumble.

h4ng3r avatar h4ng3r commented on August 21, 2024

I tested the PR, the issue is fixed and the autocomplete is working perfectly. Looks good to me.

from grumble.

skaldesh avatar skaldesh commented on August 21, 2024

Thank you for the help again. The issue has been fixed in master

from grumble.

Related Issues (20)

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.