Skip to content

Commit a34121e

Browse files
authored
FIXED: parent shortcut didn't work if folder was empty, fixes #89 (#92)
1 parent 33cffea commit a34121e

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

src/components/FileTable.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -731,16 +731,8 @@ export class FileTableClass extends React.Component<IProps, IState> {
731731
break;
732732

733733
case KEYS.Backspace:
734-
// TODO: this is used in Log as well, share the code !
735-
const { nodes } = this.state;
736-
737-
if (!this.editingElement && nodes.length) {
738-
const node = nodes[0];
739-
const file = node.nodeData as File;
740-
741-
if (!fileCache.isRoot(file.dir)) {
742-
this.cache.openParentDirectory();
743-
}
734+
if (!this.editingElement && !this.cache.isRoot()) {
735+
this.cache.openParentDirectory();
744736
}
745737
break;
746738
}

src/components/Toolbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ export class ToolbarClass extends React.Component<IProps, PathInputState> {
411411
const intent = status === -1 ? 'danger' : 'none';
412412
const count = selected.length;
413413

414-
const isRoot = fileCache.isRoot(fileCache.path);
414+
const isRoot = fileCache.isRoot();
415415

416416
return (
417417
<ControlGroup className="toolbar">

src/state/fileState.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ export class FileState {
562562
});
563563
}
564564

565-
isRoot(path: string): boolean {
566-
return this.api ? this.api.isRoot(path) : false;
565+
isRoot(path = this.path): boolean {
566+
return this.api ? path && this.api.isRoot(path) : false;
567567
}
568568
}

0 commit comments

Comments
 (0)