Comments (9)
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.
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 exampledaem
- 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.
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.
@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.
@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.
No problem, will play around a little bit, thank you for the quick answers :D
from grumble.
@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.
I tested the PR, the issue is fixed and the autocomplete is working perfectly. Looks good to me.
from grumble.
Thank you for the help again. The issue has been fixed in master
from grumble.
Related Issues (20)
- [Q]how to implement persistence configuration with grumble? HOT 5
- How to pass arg string value which starts with '-' or '--' to command HOT 1
- Println arbitrarily prints line after the prompt HOT 15
- how do i delete a command? HOT 9
- Println arbitrarily prints line after the prompt HOT 4
- Add optional values to the flag field of the command command HOT 9
- Hello, can you set args completion HOT 1
- terminal cursor move display HOT 1
- grumble.NewWithReadline()? HOT 3
- enable or disable commands during execution HOT 2
- Sometimes the D key and F key cannot be entered HOT 2
- Undefined behaviour when prompt has newline HOT 1
- how can w readline from shell withour execute any command? HOT 1
- support required/optional flags
- How to login to the command line using telnet? HOT 2
- Is there any way we can log the command line?
- Is there a way to retrieve the parameter list or flags list of a command? HOT 2
- Provide the option to not completely override the original completer
- Command args accept hex value ?
- Histoty File not Exist
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grumble.