GNOME Bugzilla – Bug 559132
Auto-indent long lines (smart line wrapping)
Last modified: 2019-02-11 15:00:07 UTC
When we write a line longer than the screen width, it would be great that gedit auto-indent it. See the attached screen shot that compare gedit and kate comportment. Other information:
Created attachment 121884 [details] gedit and kate with a long line Here's a screen shot that shows what I mean with "auto-indent a long line". See the kate comportment.
Is it rather a gtksourceview request?
Belongs to GtkTextView itself: http://library.gnome.org/devel/gtk/unstable/GtkTextView.html#gtk-text-view-set-wrap-mode A new GtkWrapMode would have to be defined and implemented: http://library.gnome.org/devel/gtk/unstable/GtkTextTag.html#GtkWrapMode (BTW such feature exists, as extension, for vim as well: http://beta.arcig.cz/~eudoxos/vim7/breakindent2.png)
I would like to join Jean-Philippe Fleury in his request: this is an important missing feature -- to the extent I really wonder why it is not default. The lack of this is my main reason to use Kate, Kile, ... over gedit. But that's not without trouble on a gnome ubuntu. So I'd really like to see this feature in gedit too.
I agree with Jean-Philippe Fleury
IMHO that feature is useful for some programming languages but not for others or simple text documents. In spanish a paragraph starts with a tab and the next lines has not indentation (like the gedit screenshot), perhaps this should be a specific language option but not for all file types.
Created attachment 170141 [details] editor preferences with autoindent option auto indentation is an option
sry for the short comment, i wasn't familiar w/ the 'add attachment' functionality of bugzilla. (In reply to comment #6) > IMHO that feature is useful for some programming languages but not for others > or simple text documents. In spanish a paragraph starts with a tab and the next > lines has not indentation (like the gedit screenshot), perhaps this should be a > specific language option but not for all file types. hi, Well, you can choose whether you want to auto-indent or not, see <a href="https://bugzilla.gnome.org/attachment.cgi?id=170141">here</a> I only use it when I'm writing some programming language. The issue that i believe this bug is about, is that long lines will not be wrapped conforming to the auto-indentation. If there is a new line, then the auto-indent works fine. cheers, WBL
Created attachment 178669 [details] Line wrapping in Geany Here's a screen shot illustrating how Geany (a GTK+ text editor) wraps long lines conforming to indentation.
*** Bug 326821 has been marked as a duplicate of this bug. ***
See the screenshot http://bugzilla-attachments.gnome.org/attachment.cgi?id=57272 for an example with Quanta.
Just wanted to mention that this one bug is the only thing keeping me from switching the Side Effects Software docs department to using gedit to edit the online documentation for Houdini (3D animation package for film and games effects and animation), so I hope it gets fixed soon. It seems so strange to me that gedit has so many advanced features but gets this wrong.
Is there some accepted way in place to "incentivize" Gnome devs to fix this? I could trade work on the docs, or maybe get my company to pay for some developer time, although that would take time and involve lawyers :/
(In reply to comment #13) > Is there some accepted way in place to "incentivize" Gnome devs to fix this? You can try the gedit mailing list: https://mail.gnome.org/mailman/listinfo/gedit-list and the #gedit channel on irc.gnome.org
Here are some find outs from a quick research that I made today. First of all we need to touch almost all the layers to have this working, so if somebody is brave enough to make it here are the steps: 1) Get the size of a tab "\t" from the gtktextlayout.c. For this we can either check if there is a way to get it from the pango layout or we could as well move the tab-width property from GtkSourceView to GtkTextView. 2) From the gtktextlayout.c we need to detect the indentation of the paragraph, counting the number of tabs and get the size in a pango scale. 3) For that layout we need to set the indentation level for the wrapped text. For this we can already do it by setting a negative value to the pango layout indent value (i.e set_indent(-20)). Although I think the right thing to do here is to set a new set/get_indent_wrapped_text, which will do the same as the indent value but just for the wrapped text. 4) We need to add a setting into gedit, either in the preferences dialog or at this point it could be easily done with a plugin. (A setting in the dialog I think it would be better though). So if somebody wants to have some fun feel free to go fixing each of those steps, and if you have any question we are like always in the irc channel spotted in the previous comment.
Ignacio Casal Quinteiro (nacho) wrote: >4) We need to add a setting into gedit, either in the preferences dialog or at >this point it could be easily done with a plugin. (A setting in the dialog I >think it would be better though). I'm not sure if i understand this correctly. Do you mean that a user should choose whether indented long lines should be wrapped when he already chose "auto indent" and "text wrapping"? If so, then i would disagree, because the user already chose to do this.
Well, I guess you are right on this. Although we still would have to modify gedit to set the right option in gtktextview when this case happens...
*** Bug 493439 has been marked as a duplicate of this bug. ***
Just a comment but wouldn't we also want to do this for multiple spaces? For example when the user has checked replace tabs with spaces in settings, then the size of a tab would be irrelevant. Also would want this to be possible for multiple tabs. So maybe we would have to get what the combined width of the tabs/spaces before the line? I might try to do this sometime soon, I am not sure if I have the knowledge though.
Yes, this is talking about wrapping lines with the proper indentation, whether the line was indented with spaces or tabs or both.
It's unlikely that this feature is ever going to be implemented, so I close the bug.