-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a unix like command history to the Tasmota web console #8015
Comments
+1 for this |
Just for my own education I wanted to see how small I could get the code. After renaming some variables and functions I'm able to get the code down to 324 bytes. |
I believe I could use that too. Can you submit a Pull Request with the 324 bytes version? |
And this has sparked interest in me... Cool one. |
I'm not sure how/where in the Tasmota code the Javascript would be inserted. If you can provide that starting point I can investigate. It may just be easier for someone already familiar with the code base to add in this code. |
I didn't see you already had a |
A smaller code has more probability to be included on firmware, now focus on it and reduce it to no more than 99 bytes. 😄 |
Did a little more work and got it down to 266 bytes... anything beyond that and the code won't be readable and hard to maintain. Before I go too much farther I'd like people to test what I have so far to see if it does what people want. Please copy/paste this minified javascript in to your browser's web console (hit F12). Then enter some commands and hit up/down to navigate the history. |
seems it remembers just the last command entered and if I press again the arrows Chrome comes in with his history cache. |
I've tested on Firefox and it correctly remembers the last 20 commands. Anyone else able to test? |
works fine on a Mac in Safari (tested history of 20) and Chrome (tested history of 3 and gave up) |
Will test too today. |
Implemented. It has to fight with the browsers command cache but once you get used to it it works fine at least in Chrome and New Edge |
@arendst you can add |
Add Console command history (arendst#8015)
Add console command history (arendst#7483, arendst#8015)
@scottchiefbaker you don't happen to have some small bulletproof code to differentiate between tablets/phones (autocomplete="on") and PC's (autocomplete="off") do you? |
@arendst easiest thing to do would be to check the screen with via JS. If screen width is less than 700px it's a mobile device. I would think we'd be safe just turning autocomplete off for all platforms. I wouldn't use autocomplete on mobile, but maybe that's just me. |
It might also work if I leave the default (autocomplete on) and as soon as the up arrow or down arrow is detected set the property to off (which, in my eyes can only happen on a keyboard) Testing... |
@arendst that seems like a decent solution, and relatively easy to implement. |
Turn browser autocomplete off and use command history as soon as an arrow key is pressed allowing mobiles and tablets to keep using browser autocomplete. (#8015)
Have you looked for this feature in other issues and in the docs?
Yes. The only reference I found was issue #7483. I believe we can work around the limitations presented in that issue.
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
I'm used to hitting the up arrow to scroll through the command history of my Linux terminal. The Tasmota web console doesn't support this, and it can be problematic. If I'm running
status 8
over and over to check a switch it would be very helpful to be able to just hit the up arrow and enter to run the last command.Describe alternatives you've considered
Copy and paste the same command every time... Limited in that it only stores the last command you ran, and may get overwritten if you use your system for other things.
Additional context
I have written the requisite JavaScript to enable this feature on the web console. You can test this out without modifying your Tasmota installation by navigating to the Tasmota web console and copy and pasting the script below in to your browser's web console.
https://www.perturb.org/code/tasmota_command_history.js
To enable this on Tasmota would simply require including the above Javascript in the
<script>
tag on the web console page.Uncompressed/unminified the code is 1077 bytes. Running the code through JSCompress yields a final size of 471 bytes. I suspect I could save more bytes too if I shortened some variable names, but I have not done that yet. If this code is something you're interested in I can work on shrinking the code even further.
(Please, remember to close the issue when the problem has been addressed)
The text was updated successfully, but these errors were encountered: