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 344874 - Keep cursor visible when size changes
Keep cursor visible when size changes
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
2.9.x
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-06-14 14:02 UTC by Michael Natterer
Modified: 2006-06-27 07:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch implementing the above (1.14 KB, patch)
2006-06-14 14:06 UTC, Michael Natterer
none Details | Review

Description Michael Natterer 2006-06-14 14:02:33 UTC
Attached small patch from maemo-gtk keeps the cursor visible
upon size_allocate(). It IMHO feels very natural: with the patch,
try tests/testtext and see yourself.
Comment 1 Michael Natterer 2006-06-14 14:06:06 UTC
Created attachment 67341 [details] [review]
Patch implementing the above
Comment 2 Matthias Clasen 2006-06-20 04:41:41 UTC
Looks reasonable to me
Comment 3 Michael Natterer 2006-06-22 14:39:49 UTC
Fixed in CVS:

2006-06-22  Michael Natterer  <mitch@imendio.com>

	* gtk/gtktextview.c (gtk_text_view_size_allocate): keep the cursor
	visible when the size changes. Fixes bug #344874.
Comment 4 Yevgen Muntyan 2006-06-23 09:48:39 UTC
Please revert it, it's a break, not a fix. Just insert two screens of text, put cursor in the beginning, scroll to bottom, and resize the window to see what I mean. It's probably good to scroll to cursor in case when cursor is initially visible and *user* resizes the window so that cursor becomes invisible, but it's not as simple as "just scroll".

Note that scrolling, and then resizing is a very common use case: you get some text, you scroll to find something, you fail to find it immediately and you maximize it (well, maybe *very* is not a really good word here, but it's really very common if you compare it to cases when you resize and cursor disappears and you need to scroll back).
Also, if you have cursor in the most right position, and make window narrower, and get ugly jumping.
Also, if you called gtk_text_view_scroll_to_mark before that (e.g. when widget is not realized yet), your scroll goes to trash. 
Comment 5 Yevgen Muntyan 2006-06-23 09:57:57 UTC
One more case: you certainly don't want to scroll to cursor if it's not visible.
Comment 6 Michael Natterer 2006-06-24 17:41:38 UTC
Very well :) comitting seemed to be the only way to get opinions.

I guess you are right and we should revert it. Opinions?
Comment 7 Paolo Borelli 2006-06-24 18:42:32 UTC
since muntyan asked my opinion on irc, for what is worth I agree that it should be reverted.
Comment 8 Matthias Clasen 2006-06-25 08:19:52 UTC
Mitch, seems best to revert it then; maybe we need to make this optional
(and change the code to only keep the cursor visible when it was before),
or maybe it is just not worth it....
Comment 9 Michael Natterer 2006-06-26 13:04:27 UTC
Reverted. I don't think we need to make this configurable since it's
easy enough to connect_after() to size_allocate and do it manually
if it's absolutely needed.

2006-06-26  Michael Natterer  <mitch@imendio.com>

	* gtk/gtktextview.c (gtk_text_view_size_allocate): revert "keep
	cursor visible when size changes" since it breaks things (#344874).
Comment 10 Matthias Clasen 2006-06-27 07:30:54 UTC
Maybe we can find a place in the docs for this as a useful trick.
Don't know if it qualifies as a "frequently answered question"...