stylus icon indicating copy to clipboard operation
stylus copied to clipboard

Open style sheet editor in new window don't remember the last place it was opened and the size i chose for it

Open decembre opened this issue 2 years ago • 21 comments

Bug Report

Bug Description

As the title say, the editor open always in the same place, but: It don't remember its last place where i put it (in my 2nd screen) it don't remember too its last size.

Before the update, no problem about that.

System Information

tested With Chrome and Waterfox Classic

  • OS: Win10
  • Browser: Chrome / Waterfox Classic
  • Stylus Version: 1.5.25

Additional Context

OPTIONS: "Open in a new window" and "Open simple window" checked or checked only "Open in a new window" give the result. Open style sheet editor in new window without tab bars

decembre avatar Jun 04 '22 12:06 decembre

It certainly works for me but I only have one display. Please open devtools console of the editor window and run the following code: [screenX, screenY], then paste the result here.

tophf avatar Jun 04 '22 12:06 tophf

Test in Chrome:

  • 1 - Open in the first display and resize it [screenX, screenY] (2) [0, 450]
  • 2 - Reopen it (it self open on the First display and keep its vertical size but not its horizontal size) and without moving on the 2nd display: [screenX, screenY] (2) [0, 367]
  • 3 - Reopen and moving on the 2nd display: [screenX, screenY] (2) [2139, 367]

Dev Console provide an Error message:

  1. A page or script is accessing at least one of navigator.userAgent, navigator.appVersion, and navigator.platform. Starting in Chrome 101, the amount of information available in the User Agent string will be reduced.

    To fix this issue, replace the usage of navigator.userAgent, navigator.appVersion, and navigator.platform with feature detection, progressive enhancement, or migrate to navigator.userAgentData.

    Note that for performance reasons, only the first access to one of the properties is shown.

  2. RESSOURCES AFFECTÉES
    1. 1 source
      1. codemirror.js:1

decembre avatar Jun 04 '22 13:06 decembre

Test with Waterfox Classic: 1 - Result when first open it in the principal display: [screenX, screenY] Array [ 0, 99 ] 2 - After moving to the 2nd display and changing its size: [screenX, screenY] Array [ 2069, 282 ] 3 - Result after closed and reopening the edoter: It keep its last size but Stay at its last place... on the wrong display (the Principal not the 2nd as expected): Dev console: [screenX, screenY] Array [ 0, 282 ]

decembre avatar Jun 04 '22 13:06 decembre

Same result with Firefox Quantum: 1 - First open: [screenX, screenY] Array [ 0, 282 ] 2 - Reopen after place it on the 2nd display: Keep its size but open on the wrong display: [screenX, screenY] Array [ 31, 391 ]

decembre avatar Jun 04 '22 13:06 decembre

Hmm.

  1. Please also run prefs.values.windowPosition in devtools console after moving the editor.
  2. Maybe the browsers started to limit the position of the window... Try installing an older version of Stylus (after backing up the styles) in your current browser and see if it saves the position.

tophf avatar Jun 04 '22 13:06 tophf

Test prefs.values.windowPosition in Quantum: First open: { "left": 31, "top": 391, "width": 1042, "height": 582 } After moving (couplet result): Object { left: 31, top: 391, width: 1042, height: 582 } ​ height: 582 ​ left: 31 ​ top: 391 ​ width: 1042 ​ : Object { … } ​​ defineGetter: function defineGetter() ​​ defineSetter: function defineSetter() ​​ lookupGetter: function lookupGetter() ​​ lookupSetter: function lookupSetter() ​​ proto: ​​ constructor: function Object() ​​ hasOwnProperty: function hasOwnProperty() ​​ isPrototypeOf: function isPrototypeOf() ​​ propertyIsEnumerable: function propertyIsEnumerable() ​​ toLocaleString: function toLocaleString() ​​ toString: function toString() ​​ valueOf: function valueOf() ​​ <get proto()>: function proto() ​​ <set proto()>: function proto()

decembre avatar Jun 04 '22 13:06 decembre

Quick test with an other Quantum's profile with Stylus not updated: All work perfectly

decembre avatar Jun 04 '22 13:06 decembre

So which version of Stylus works?

tophf avatar Jun 04 '22 13:06 tophf

It seems the v.1.5.11 ....

decembre avatar Jun 04 '22 14:06 decembre

It's an old version so it's hard to pinpoint the problem at once especially since I can't debug it myself.

Run editor.isWindowed in devtools console and see if it prints true.

Run the following code in devtools console after moving the window, then re-open it:

  prefs.set('windowPosition', {
    left: screenX,
    top: screenY,
    width: outerWidth,
    height: outerHeight,
  });

tophf avatar Jun 04 '22 14:06 tophf

In this old Quantum's profile, i installing the previous version 1.5.24 (before the last update): All work fine. You want i test "editor.isWindowed" in this one now?

decembre avatar Jun 04 '22 14:06 decembre

In Chrome 1- First test (editor.isWindowed): true 2 - 2nd test ( after moving the window, then re-open it): undefined See an error in it before i test you code: Uncaught TypeError: Cannot read properties of null (reading 'offsetWidth') at header-resizer.js:6:26 at header-resizer.js:48:3

decembre avatar Jun 04 '22 14:06 decembre

1.5.24 is the same as 1.5.25 in regards to the editor window position, so if 24 works but 25 doesn't, can only mean there's a bug in the browser, but judging by editor.isWindowed difference the bug is in Stylus and it should be present in both versions.

tophf avatar Jun 04 '22 14:06 tophf

Strange...

decembre avatar Jun 04 '22 14:06 decembre

editor.isWindowed difference occurs only when re-opening the editor via Ctrl-Shift-T and it's a bug in Chrome. It doesn't happen when the editor is opened normally. Try fully reinstalling the extension in your main profile.

tophf avatar Jun 04 '22 14:06 tophf

I dot it with Quantum: Same problem...

decembre avatar Jun 04 '22 17:06 decembre

So 1.5.24 works in this main profile or in another profile?

tophf avatar Jun 04 '22 18:06 tophf

I an other old Quantum's profile. In this one i do: 1 - Test Stylus before any update (was the v.1.5.11) Work fine 2 - Always in this profile, i installing the previous version 1.5.24 Work fine 3 - Remove Stylus and install its last version(v.1.5.25): Problem

decembre avatar Jun 04 '22 18:06 decembre

Since there's no difference in the code between 24 and 25 I guess the only explanation is a bug in the profile itself :-)

tophf avatar Jun 04 '22 18:06 tophf

But the problem persist after the last update (with any type of profile) with Chrome / Firefox Quantum and Waterfox Classic.....

But maybe it's me, if i am the only one with 2 display which have this problem..... ;-)

decembre avatar Jun 04 '22 19:06 decembre

I don't understand or maybe i explain not very well...

At the opposite of you said, there is a big difference:

With Chrome / Firefox Quantum and Waterfox Classic (and any sort of profiles) 1 - version 1.5.24 and previous v.1.5.11 Work fine 2 - version 1.5.25 Problem

Hmmm, but yes, it's not "reproducible" if you have only one display. :-)

decembre avatar Jun 04 '22 20:06 decembre

I return on this problem: Nobody, with 2 display, can test if it's only a problem of my side ?

decembre avatar Jan 20 '23 13:01 decembre

v.1.5.11 works fine. Downgraded without even backing up. Suffered this bug for idk how long til now.

Stylus window kept opening in the same page as page I wanted to mod the style, and also all of its inner section were minimized to about 80px of height, in a window about 200px high.

v.1.5.11 opens in the last used location and display, with a fix height (W 1698px by H 962px) just as it's supposed to :)

I really don't think I'll upgrade any soon. (I'm running 4 display/monitors)

Ghis1964 avatar Feb 07 '23 20:02 Ghis1964

This old version didn't check the correctness of a saved window position, so evidently our current verification is incorrect. I guess in a multi-display setup there's a common virtual coordinate space, so the saved position may be outside the bounds of the active display. I guess the solution would be to pass the coordinates as-is and if the call fails, change them then, not beforehand.

tophf avatar Feb 07 '23 20:02 tophf

edit: By curiosity, I have just updated Stylus to see if the bug came back. It did not. Seems to me that downgrade and then upgrade was enough to put things back in order (all without backing up)

Ghis1964 avatar Feb 07 '23 21:02 Ghis1964

downgrade and then upgrade was enough

It probably cleared windowPosition in prefs.

tophf avatar Feb 22 '23 13:02 tophf

downgrade and then upgrade was enough

Tested with Waterfox: No change for me (not remember in which display it should be open). How to downgrade with chrome (i don't see version in Chrome store)? Note: If you want test the downgrade don't forget to backup your userstyles before...

decembre avatar Feb 22 '23 15:02 decembre

With Chrome you can simply install the latest development version that fixed the bug properly. As an unpacked extension.

tophf avatar Feb 22 '23 15:02 tophf

Thanks for the info. But as it seems a little bit complicated vs the urge: i can certainly wait your next update :-)

Install Chrome extension form outside the Chrome Web Store

decembre avatar Feb 22 '23 17:02 decembre

It's really trivial, just enable the checkbox and drag'n'drop the extracted directory into chrome://extensions page. Takes a few seconds.

tophf avatar Feb 22 '23 17:02 tophf