PaperWM icon indicating copy to clipboard operation
PaperWM copied to clipboard

fixing warnings..

Open tflori opened this issue 4 years ago • 0 comments

Hi I love this extension and currently I'm working on another extension I saw some errors of this extension in the log and though it would be worse to solve it. I'm to lazy to fork but here is my suggested diff:

Index: scratch.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- scratch.js	(revision ac54a572db0963628d442955093ad643a951c842)
+++ scratch.js	(date 1592117683000)
@@ -143,7 +143,7 @@
 }
 
 function isScratchWindow(metaWindow) {
-    return metaWindow && metaWindow[float];
+    return metaWindow && metaWindow.hasOwnProperty(float) && metaWindow[float];
 }
 
 /** Return scratch windows in MRU order */
Index: app.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app.js	(revision ac54a572db0963628d442955093ad643a951c842)
+++ app.js	(date 1592117514000)
@@ -159,7 +159,7 @@
     let space  = workspace ? Tiling.spaces.get(workspace) : Tiling.spaces.selectedSpace;
 
     let dir = space.settings.get_string("directory");
-    if (dir[0] === "~") {
+    if (dir.length > 0 && dir[0] === "~") {
         dir = GLib.getenv("HOME") + dir.slice(1);
     }
     return dir;
Index: settings.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- settings.js	(revision ac54a572db0963628d442955093ad643a951c842)
+++ settings.js	(date 1592119388000)
@@ -313,7 +313,7 @@
     let props = winprops.filter(
         winprop_match_p.bind(null, meta_window));
 
-    return props[0];
+    return props.length > 0 ? props[0] : undefined;
 }
 
 function defwinprop(spec) {
Index: tiling.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- tiling.js	(revision ac54a572db0963628d442955093ad643a951c842)
+++ tiling.js	(date 1592118207000)
@@ -320,7 +320,8 @@
                 mw.get_maximized() !== Meta.MaximizeFlags.BOTH;
 
             if (resizable) {
-                const hasNewTarget = mw._targetWidth !== targetWidth || mw._targetHeight !== targetHeight;
+                const hasNewTarget = mw.hasOwnProperty('_targetWidth') && mw._targetWidth !== targetWidth ||
+                  mw.hasOwnProperty('_targetHeight') && mw._targetHeight !== targetHeight;
                 const targetReached = f.width === targetWidth && f.height === targetHeight;
 
                 // Update targets (NB: must happen before resize request)
@@ -462,7 +463,7 @@
                 this.targetX = min + Math.round((workArea.width - width)/2);
             } else if (this.targetX + width < min + workArea.width) {
                 this.targetX = min + workArea.width - width;
-            } else if (this.targetX > workArea.min ) {
+            } else if (workArea.hasOwnProperty('min') && this.targetX > workArea.min ) {
                 this.targetX = workArea.x;
             }
             Tweener.addTween(this.cloneContainer,

tflori avatar Jun 14 '20 07:06 tflori