GtkSource View with fixed width of number of characters?

Effectively a novice to C/Vala, writing a GNOME editor application that behaves in some respects like a typewriter: fixed-width 12pt 10-pitch font, fixed virtual page width of 85 characters, with sections of text having various left/right margin settings (and word wrapping) relative to the virtual page which shouldn’t change regardless of editor window sizing.

I have a View in a ScrolledWindow in the application window. I’m able to set the margins relative to the window edges, but can’t find a way to set margins relative to the 85-char virtual page. When I expand the window, the text in the View flows to fill the space.

Eventually I want to be able to scale this editor window while reliably maintaining the page layout.

Any suggestions for how to approach this?

Hi,

Can you please provide a minimal example?
It’s a bit difficult to visualize the expected outcome…

Sorry to be vague - I think I have something that works. I placed the ScrolledWindow and TextView (turns out I don’t need SourceView) in a Paned and can now set the width with Paned.set_position().

1 Like