From e8da10c0483341ed03702acc7c2dde32763f3093 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 12 Feb 2017 23:47:53 +0400 Subject: [PATCH 1/3] fix console focus issue --- plugins/c9.ide.console/console.js | 51 +++++++++++++++---------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/plugins/c9.ide.console/console.js b/plugins/c9.ide.console/console.js index 8df091c8..3aa30085 100644 --- a/plugins/c9.ide.console/console.js +++ b/plugins/c9.ide.console/console.js @@ -42,17 +42,12 @@ define(function(require, module, exports) { group: "Panels", bindKey: { mac: "Ctrl-Esc", win: "F6" }, exec: function(editor, args) { - var el; if (hidden || args.show) { show(); - el = container; + focusConsole(); } else { hide(); - el = tabs.container; } - var pane = tabs.findPane(container.$activePaneName); - var tab = pane && pane.activeTab || tabs.getTabs(el)[0]; - tabs.focusTab(tab); } }, plugin); @@ -294,12 +289,21 @@ define(function(require, module, exports) { var oldFocus = tabs.focussedTab; if (oldFocus && getPanes().indexOf(oldFocus.pane) != -1) return tabs.focusTab(oldFocus); - getPanes().some(function(pane) { - if (pane.getTab()) { - tabs.focusTab(pane.getTab()); - return true; - } - }) || tabs.focusTab(null); + + focusActiveTabInContainer(container); + } + + function focusActiveTabInContainer(containerEl) { + var pane = tabs.findPane(containerEl.$activePaneName); + var tab = pane && pane.activeTab; + if (!tab) { + tabs.getPanes(containerEl).every(function(pane) { + tab = pane.activeTab; + return !tab; + }); + } + tabs.focusTab(tab); + return tab; } function hide(immediate) { show(immediate, true); } @@ -319,8 +323,15 @@ define(function(require, module, exports) { pane._visible = !shouldHide; }); - if (!shouldHide && !tabs.focussedTab) - focusConsole(); + if (!shouldHide) { + if (!tabs.focussedTab) + focusConsole(); + } + else if (tabs.focussedTab && getPanes().indexOf(tabs.focussedTab.pane) > -1) { + // If the focussed tab is in the console, make the first + // tab we can find inside the tabs the focussed tab. + focusActiveTabInContainer(tabs.container); + } var finish = function() { if (onFinishTimer) @@ -329,18 +340,6 @@ define(function(require, module, exports) { onFinishTimer = setTimeout(function() { if (shouldHide) { container.hide(); - - // If the focussed tab is in the console, make the first - // tab we can find inside the tabs the focussed tab. - if (tabs.focussedTab - && getPanes().indexOf(tabs.focussedTab.pane) > -1) { - var tab; - tabs.getPanes(tabs.container).every(function(pane) { - tab = pane.activeTab; - return !tab; - }); - tabs.focusTab(tab); - } } else { container.$ext.style.minHeight = minHeight + "px"; From 5f330150091f447972212d189897bee0c3ba2847 Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 13 Feb 2017 20:32:13 +0400 Subject: [PATCH 2/3] fix +14663 Environment variables popup scrollbar is hidden --- .../ace_tree/lib/ace_tree/virtual_renderer.js | 9 +++++---- plugins/c9.ide.run/output.js | 16 +++++++++------- plugins/c9.ide.run/style.css | 1 - 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/node_modules/ace_tree/lib/ace_tree/virtual_renderer.js b/node_modules/ace_tree/lib/ace_tree/virtual_renderer.js index a48b1181..fb683b4e 100644 --- a/node_modules/ace_tree/lib/ace_tree/virtual_renderer.js +++ b/node_modules/ace_tree/lib/ace_tree/virtual_renderer.js @@ -567,10 +567,6 @@ var VirtualRenderer = function(container, cellWidth, cellHeight) { var vertical = this.$treeLayer; var horizontal = this.$horHeadingLayer; - var top = Math.max(this.scrollTop, 0); - var vRange = provider.getRange(top, top + this.$size.height); - var hRange = {size: 0}// horizontal.getRange(this.scrollLeft, this.scrollLeft + this.$size.width); - var minHeight = this.$size.scrollerHeight; var maxHeight = provider.getTotalHeight(); @@ -604,6 +600,11 @@ var VirtualRenderer = function(container, cellWidth, cellHeight) { if (this.provider.getScrollTop() != this.scrollTop) this.scrollTop = this.provider.getScrollTop(); + + var top = Math.max(this.scrollTop, 0); + var vRange = provider.getRange(top, top + this.$size.height); + var hRange = { size: 0 };// horizontal.getRange(this.scrollLeft, this.scrollLeft + this.$size.width); + var vOffset = this.scrollTop - vRange.size; var hOffset = this.scrollLeft - hRange.size; diff --git a/plugins/c9.ide.run/output.js b/plugins/c9.ide.run/output.js index 00c9df7f..f5abf0eb 100644 --- a/plugins/c9.ide.run/output.js +++ b/plugins/c9.ide.run/output.js @@ -483,10 +483,9 @@ define(function(require, exports, module) { layout.on("eachTheme", function(e) { var height = parseInt(ui.getStyleRule(".blackdg .row", "height"), 10) || 24; - model.rowHeightInner = height - 1; model.rowHeight = height; - if (e.changed) (datagrid).resize(true); + if (e.changed) datagrid.resize(true); }); model.$sorted = false; @@ -510,7 +509,6 @@ define(function(require, exports, module) { datagrid = new Tree(div); datagrid.renderer.setTheme({ cssClass: "blackdg" }); - datagrid.setOption("maxLines", 200); datagrid.setDataProvider(model); datagrid.edit = new TreeEditor(datagrid); @@ -818,14 +816,18 @@ define(function(require, exports, module) { return; drawEnv(); - datagrid.resize(); - model.session = currentSession; if (!model.session.config.env) model.session.config.env = {}; - reloadModel(); - + + var rect = mnuEnv.opener.$ext.getBoundingClientRect(); + var top = rect.top; + var bottom = window.innerHeight - rect.bottom; + + var maxRows = Math.floor(Math.max(top, bottom) / datagrid.model.rowHeight) - 2; + datagrid.setOption("maxLines", maxRows); + datagrid.resize(); mnuEnv.resize(); var node = datagrid.getFirstNode(); diff --git a/plugins/c9.ide.run/style.css b/plugins/c9.ide.run/style.css index e9f93b1d..48de0972 100644 --- a/plugins/c9.ide.run/style.css +++ b/plugins/c9.ide.run/style.css @@ -94,7 +94,6 @@ } .envcontainer .blackdg{ border-top: 1px solid #363636; - max-height : 300px; } .tree-row.newenv:not(.selected) { color: rgb(151, 151, 151); From 31ab6ca2ac7b422a6284e99ff3517b783fdc5ba4 Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 13 Feb 2017 22:05:00 +0400 Subject: [PATCH 3/3] fix dialog keyhandler regression --- plugins/c9.ide.dialog/dialog.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/plugins/c9.ide.dialog/dialog.js b/plugins/c9.ide.dialog/dialog.js index 651a57cc..61e49f02 100644 --- a/plugins/c9.ide.dialog/dialog.js +++ b/plugins/c9.ide.dialog/dialog.js @@ -133,15 +133,20 @@ define(function(require, module, exports) { emit("resize"); }); var escHandler = function(e) { - dialog.dispatchEvent("keydown", e); + if (dialog.visible) { + dialog.dispatchEvent("keydown", e); + if (e.keyCode == 27) e.stopPropagation(); + } }; - document.body.addEventListener("keydown", escHandler, true); - plugin.on("hide", function() { - document.removeEventListener("keydown", escHandler, true); - }); - plugin.on("unload", function() { - document.removeEventListener("keydown", escHandler, true); - }); + var addEscHandler = function() { + document.body.addEventListener("keydown", escHandler, true); + }; + var removeEscHandler = function() { + document.body.removeEventListener("keydown", escHandler, true); + }; + plugin.on("show", addEscHandler); + plugin.on("hide", removeEscHandler); + plugin.on("unload", removeEscHandler); titles = plugin.getElement("titles"); buttons = plugin.getElement("buttons");