GNOME Bugzilla – Bug 107904
code-editor line-wrap mode?
Last modified: 2004-12-22 21:47:04 UTC
I have line-wrap enabled in gedit, and when I'm using the up or down keys to move through my document, it should only hit each logical line once, even if it is wrapped. If this description is not clear, here's a way to see it nicely... 1) Open a document. 2) Turn on line numbering and line wrapping. 3) Find a line that's been wrapped, and move to the first character of the logical line. 4) Notice that the line numbering has skipped over numbering the wrapped text. 5) Hit the down arrow. You are still on the same numbered line, though you are in a different visible place. I would expect you to be on the next numbered, logical line. I've more or less adapted to expecting it to exhibit its current behavior of hitting wrapped lines as many times as they are wrapped, but it's particularly annoying when I'm, say, adjusting the tab indents over a range of lines. Hitting down, left, and delete over and over can be done relatively quickly, but I have to pause every line to check to make sure I'm not deleting characters within a wrapped line. I suppose a usability discussion is in order. I'll probably drop a note to usability@ -jag
This is a GtkTextView problem.
See also: http://mail.gnome.org/archives/usability/2003-March/msg00018.html
When you realize that a line is a paragraph when editing normal paragraph-based human-readable text, it's obvious that the current behavior is definitely correct in that case. So the default for gedit should very clearly be the current behavior IMO, as gedit is supposed to in part be the "notepad" type of app for GNOME. Maybe the behavior should be different when editing source code, though.
Excellent point, Havoc. So what's the best way to get the widget to have flexible behavior? Or is the solution to do as David Lazaro suggested (http://mail.gnome.org/archives/usability/2003-March/msg00020.html) and try to have the application include mass-editing functions when editing code? It's obvious that the needs of a simple text widget and a code editor widget conflict here. -jag
Well, you can probably already rebind your arrow keys in gtkrc to do paragraph-based logical rather than visual navigation; the text widget does have logical navigation already just not bound to the arrow keys. Some programmatic way to do this would be nice, so an editor could do it automatically in "C mode" vs. "text mode"
As indicated by Paolo Maggi in http://mail.gnome.org/archives/usability/2003-March/msg00022.html, gedit already has available the functionality I suggested in a plug- in. So maybe this bug can be marked as an enhancement. This c-mode vs. text-mode idea intrigues me, though... but I don't know if it would be appropriate for the 2.x time frame.
IMO, code editors should simply add a horizontal scrollbar when the line becomes too long ... having manual line wrapping mixed together with automatic line wrapping is extremely confusing. I don't think anybody wants to work with automatically line wrapped code. Either you make your window wider or your reformat it barrow. But leaving it open as a request-for-enhancement.
Owen - In many cases I can see how it would merely amplify confusion, but some dedicated editors (e.g. Bluefish) have been doing this since GTK 1.x days... Perhaps this would be appropriate for the gtksourceview widget... I don't know... -jag
This was a serious *bug* in the GTK+-1.2 text widget. I rejoiced the day we implemented the correct behavior for GtkTextView.
Owen - No problem them... kindly ignore the RFE... -jag