Skip to content

Commit

Permalink
Prevent closing FileBrowser with ESC on warning
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanrhu committed Nov 29, 2021
1 parent a1041c7 commit 8d54215
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions frontend/components/FileBrowser/js/FileBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
data.items = [];
data.current = -1;
data.pathUpdateRefreshTimout = 0;
data.dont_close_on_esc = false;

var is_first_refresh = true;
var dont_auto_refresh = false;
Expand Down Expand Up @@ -107,9 +108,12 @@
if (result_json.error) {
if (result_json.error.not_exists) {
if (!parameters.ignoreNotFound) {
data.dont_close_on_esc = true;

GDBFrontend.showMessageBox({
text: 'Path not found.',
on_close: function () {
data.dont_close_on_esc = false;
$fileBrowser_window_box_header_path_input_rI.focus();
}
});
Expand Down Expand Up @@ -234,9 +238,12 @@
data.is_passive = false;
},
error: function () {
data.dont_close_on_esc = true;

GDBFrontend.showMessageBox({
text: 'Path not found.',
on_close: function () {
data.dont_close_on_esc = false;
$fileBrowser_window_box_header_path_input_rI.focus();
}
});
Expand All @@ -261,6 +268,10 @@
if (keycode == 27) {
event.stopPropagation();

if (data.dont_close_on_esc) {
return;
}

if (data.current > -1) {
data.clearSelected();
} else {
Expand Down Expand Up @@ -316,6 +327,10 @@

var keycode = event.keyCode ? event.keyCode : event.which;
if (keycode == 27) {
if (data.dont_close_on_esc) {
return;
}

if (data.current > -1) {
data.clearSelected();
} else {
Expand Down

0 comments on commit 8d54215

Please sign in to comment.