After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 559132 - Auto-indent long lines (smart line wrapping)
Auto-indent long lines (smart line wrapping)
Status: RESOLVED WONTFIX
Product: gtksourceview
Classification: Platform
Component: General
git master
Other All
: Normal enhancement
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
: 326821 493439 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-11-03 16:04 UTC by Jean-Philippe Fleury
Modified: 2019-02-11 15:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gedit and kate with a long line (57.03 KB, image/png)
2008-11-03 16:15 UTC, Jean-Philippe Fleury
Details
editor preferences with autoindent option (31.55 KB, image/png)
2010-09-13 12:16 UTC, Willy-Bas Loos
Details
Line wrapping in Geany (89.99 KB, image/png)
2011-01-18 21:24 UTC, Jean-Philippe Fleury
Details

Description Jean-Philippe Fleury 2008-11-03 16:04:15 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:
Comment 1 Jean-Philippe Fleury 2008-11-03 16:15:41 UTC
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.
Comment 2 Jean-Philippe Fleury 2008-12-08 02:30:39 UTC
Is it rather a gtksourceview request?
Comment 3 Vaclav Smilauer 2010-01-22 16:07:28 UTC
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)
Comment 4 Peter 2010-05-09 15:13:40 UTC
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.
Comment 5 Willy-Bas Loos 2010-09-10 11:10:08 UTC
I agree with Jean-Philippe Fleury
Comment 6 chuchiperriman 2010-09-11 00:06:09 UTC
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.
Comment 7 Willy-Bas Loos 2010-09-13 12:16:50 UTC
Created attachment 170141 [details]
editor preferences with autoindent option

auto indentation is an option
Comment 8 Willy-Bas Loos 2010-09-13 12:28:17 UTC
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
Comment 9 Jean-Philippe Fleury 2011-01-18 21:24:25 UTC
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.
Comment 10 Patryk Zawadzki 2011-01-20 10:54:31 UTC
*** Bug 326821 has been marked as a duplicate of this bug. ***
Comment 11 Jean-Philippe Fleury 2011-01-20 15:35:31 UTC
See the screenshot http://bugzilla-attachments.gnome.org/attachment.cgi?id=57272 for an example with Quanta.
Comment 12 Matt Chaput 2012-11-11 15:49:39 UTC
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.
Comment 13 Matt Chaput 2012-11-19 18:54:18 UTC
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 :/
Comment 14 Jean-Philippe Fleury 2012-11-20 06:25:20 UTC
(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
Comment 15 Ignacio Casal Quinteiro (nacho) 2012-12-04 17:15:42 UTC
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.
Comment 16 Willy-Bas Loos 2012-12-05 07:34:56 UTC
 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.
Comment 17 Ignacio Casal Quinteiro (nacho) 2012-12-05 07:40:06 UTC
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...
Comment 18 Sébastien Wilmet 2013-03-30 18:09:29 UTC
*** Bug 493439 has been marked as a duplicate of this bug. ***
Comment 19 Dabo Ross 2013-04-21 03:51:59 UTC
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.
Comment 20 Matt Chaput 2013-04-21 03:56:57 UTC
Yes, this is talking about wrapping lines with the proper indentation, whether the line was indented with spaces or tabs or both.
Comment 21 Sébastien Wilmet 2018-05-26 13:46:54 UTC
It's unlikely that this feature is ever going to be implemented, so I close the bug.