toolstack / Folio

A beautiful markdown note-taking app for GNOME (forked from Paper)
GNU General Public License v3.0
132 stars 12 forks source link

Allow for smaller minimum width #37

Closed frandavid100 closed 4 months ago

frandavid100 commented 4 months ago

Notes' width doesn't seem to adjust to the window:

Captura desde 2024-03-07 22-50-53

Is this a bug?

toolstack commented 4 months ago

I assume you haven't change the "Limit note width" setting? If so then this is mostly expected, though I agree that it should probably be able to go smaller than the fixed width, just not larger.

toolstack commented 4 months ago

Ok, so I looked into this and it appears to be expected behaviour with GTK4/Adwaita apps and the SourceView control that Folio uses.

Basically "Limit note width" is mislabelled, it should be "Set fixed note width".

Trying to auto re-size the widget would go against several of the GTK4/Adwaita principals so I'm not going to attempt that as it will just break again in the future more than likely.

Instead I'm going to commit two changes to resolve this issue:

alice-mkh commented 4 months ago

libadwaita maintainer here, someone pinged me to take a look at this issue and I have no idea what principles you mean.

  1. AdwClampScrollable
  2. While looking at it I noticed that there's a toast overlay inside the scrolled window?.. Why? Put it right into the window instead
  3. GtkSourceView inside a GtkViewport (or AdwToastOverlay, for that matter) is not supported, so you likely broken scrolling on large notes right now. AdwClampScrollable should fix that too
toolstack commented 4 months ago

@alice-mkh thanks, I'm new to GTK/libadwaita but from what I saw it looks like monitoring window size changes is discouraged, which seemed to be the only way to reset the size of the sourceview widget if it was set to a fixed width instead of letting it fill the window.

I'll take a look at AdwClampScrollable.

alice-mkh commented 4 months ago

You don't need to monitor window sizes here, no.

if it was set to a fixed width

Right, don't do this. And you have to get rid of that toast overlay too (and of viewport if you added it manually, clamp scrollable replaces that)

toolstack commented 4 months ago

The primary notes area, by default, has a fixed with, so I can't just undo that easily without breaking existing behaviour. As such I've implemented an alternate solution that works for Folio.

I'll probably look at changing the default to non-fixed width in a future release though.

I took a quick look at clamp scrollable and don't think it will fit within the app at the moment, but I do have to do a major change at some point as Folio currently uses a lot of deprecated widgets, so I'll look more at it when I get to that.

alice-mkh commented 4 months ago

The primary notes area, by default, has a fixed with

Yes, which results in horizontal scrolling right with default window size. That's a bug, not something to preserve.