[Bug] Prompt path incorrect after clearing console
ianyepan opened this issue · comments
Despite the current directory we're in, after the "clear" command the prompt will always show that we're in "root".
Steps to reproduce:
In the terminal, type
- "cd projects" or "cd skills"
- "clear"
Nevertheless, great project! I've learned a lot by browsing your code structure and implementing more advanced options for "ls" and "cd". If you're interested, you can check out my fork.
I solved it by changing the clearConsole() function to the following:
clearConsole() {
const getDirectory = () => localStorage.directory;
const dir = getDirectory();
$('#terminal').html(
`<p class="hidden">
<span class="prompt">
<span class="root">${dir}</span>
<span class="tick">$</span>
</span>
<span contenteditable="true" class="input"></span>
</p>`
);
$('.input').focus();
}@ianpan870102 hey thanks! would you want to send a PR?
@codebytere I'd love to, but since I've already forked your project (with too many personal customisations), it might be hard a.t.m. to pull request with this certain commit. I don't mind at all if you take the piece of function and commit under your name.
What do you say?
Works for me!
Closed in 1201b65.