GNOME Bugzilla – Bug 796226
Add displaying of vertical lines after n characters
Last modified: 2021-06-10 21:24:33 UTC
Different use cases like programming or writing commit messages have different requirements on line breaks which users might want to do manually. The creation of text in such use cases could be supported by vertical lines in different colors, e.g. one at 50 characters for the ideal summary length of git commit message for GNOME and 72 characters for the recommended max. line length of commit messages. The character offset and color could be configurable for each profile.
Thanks for this request! See also bug 791216 and the stackexchange link from that. I myself actually used to have a background image with a vertical line after column 80, for exactly this purpose, way back when gnome-terminal supported background image. And another one (another profile) with the line at 100 – these were the margins we had to keep while coding, depending on the programming language. (And of course I couldn't zoom the terminal because then these were no longer correct.) I have some problems, making me unsure whether your proposal is the right way of addressing this. One is that (as per the aforementioned other bug) you can imagine multiple similar requests, e.g. horizontal lines at some places, or alternating backgrounds. I can't see why we should arbitrarily pick some, or how we could reasonably support all (with a decent prefs page). The second is: I remember I spent quite some time coming up with a design that was prominent enough to help me keep the margin, yet not distracting whenever I didn't need that. I can't imagine how we could do it generally, so that it looks great for most people on all possible background colors. Having to keep changing a profile manually, or toggling a setting isn't too user friendly either. By the way, it also stops working correctly at vertical splits, whether it's tmux splitting or the text editor itself (or displaying sub-windows) or what not. I believe a much better approach is to configure your favorite text editor to switch to e.g. a slightly different background color there; or file a feature request against them if they don't support it yet. That way, you could even make it automatic: the line would appear and disappear automatically, exactly at the position relevant to the current context. And would work in vertical splits, too. Another approach could be for us to resurrect background image support, or for you to look for a VTE-based emulator that supports it; and then do the hack I used to do. Maybe they could even be extended to rescale the image based on VTE's zoom factor (I'm not entirely sure if the data is exported via our API, we might need to add a new method or property). I'm afraid that explicit support in vte + gnome-terminal for your particular request (and the other one linked from here) would be way too specific, and I'm even more afraid that we probably couldn't come up with a look that almost all users find pleasant. That's why _if_ we do anything in gnome-terminal, I'd vote for going the way more generic way with arbitrary backgrounds (and add the missing bits, e.g. vertical scrolling along with the contents) rather than this specific one. But still, I believe this isn't the best place to deal with this issue, the best place is the text editor.
I understand the concern. Plugins sound like a good future project to deal with this and the other mentioned issues, both the variety as well as the compromises which have to be found for the design. It'll be hard to make the step towards it, especially, if there're only few small concerns which leave a plug-in infrastructure in YAGNI state.
Egmont couldn't this be done by VTE emulators using the new background draw capability added to VTE 0.52? In tilix when I use this feature I'm assuming complete control over drawing the background, I think it would be really trivial to drawn a thin margin line at user defined stops (i.e. column 50, column 80, etc). It would essentially a more robust version of your background image approach. I'll play around with it when I get a chance but does this make sense to you, anything captain obvious that I'm missing?
Ignore the above, I implemented it and it works fine albeit with all the limitations Egmont noted above (tmux, shortcut to active, etc).
I'd love to have a look. Is the change available through the build stream setup provided by gnome-build-meta?
(Along with vertical splits, let's also mention that most text editors allow you to prefix the lines with the line number. Yet another case where the margin would be off.)
See also bug 758368 comment 15 for a possible approach.
You can see a screenshot of the tilix approach here: https://user-images.githubusercontent.com/9358238/40271643-dd529f5a-5b6d-11e8-81ff-db8eb09f7de5.png It simply uses the foreground color to draw the line and lightens or darkens the color (depending on whether it is considered a bright or dark color using luminance) by an arbitrary percentage. Cycling through a few different color themes it seems to work well enough from a color perspective. Should this issue be a VTE issue rather then gnome-terminal, if it were to be implemented I think it would be something that most VTE terminal emulators would find useful? One other option that VTE could bring to the table is only drawing the margin line when in alternate screen mode.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-terminal/-/issues/7852.