Skip to content

Commit

Permalink
FIXED: parent shortcut didn't work if folder was empty, fixes #89 (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
warpdesign committed Nov 18, 2019
1 parent 33cffea commit a34121e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
12 changes: 2 additions & 10 deletions src/components/FileTable.tsx
Expand Up @@ -731,16 +731,8 @@ export class FileTableClass extends React.Component<IProps, IState> {
break;

case KEYS.Backspace:
// TODO: this is used in Log as well, share the code !
const { nodes } = this.state;

if (!this.editingElement && nodes.length) {
const node = nodes[0];
const file = node.nodeData as File;

if (!fileCache.isRoot(file.dir)) {
this.cache.openParentDirectory();
}
if (!this.editingElement && !this.cache.isRoot()) {
this.cache.openParentDirectory();
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Toolbar.tsx
Expand Up @@ -411,7 +411,7 @@ export class ToolbarClass extends React.Component<IProps, PathInputState> {
const intent = status === -1 ? 'danger' : 'none';
const count = selected.length;

const isRoot = fileCache.isRoot(fileCache.path);
const isRoot = fileCache.isRoot();

return (
<ControlGroup className="toolbar">
Expand Down
4 changes: 2 additions & 2 deletions src/state/fileState.ts
Expand Up @@ -562,7 +562,7 @@ export class FileState {
});
}

isRoot(path: string): boolean {
return this.api ? this.api.isRoot(path) : false;
isRoot(path = this.path): boolean {
return this.api ? path && this.api.isRoot(path) : false;
}
}

0 comments on commit a34121e

Please sign in to comment.