GNOME Bugzilla – Bug 90435
Highlighting problem
Last modified: 2011-02-04 16:11:56 UTC
Can't demonstrate the problem other than that sorry, Fire up gedit 2 enter a letter "a" then press 2 enters, insert another "a" open the find dialog and search for "a" from the beginning the letter'll be highlighted press find again and u'll see what i mean it highlights the whole line above it yes it's a gtk bug cause it's a problem with a text editor i'm working on and sure i didn't rip code from gedit ;)
Created attachment 10410 [details] screen shot of the problem in gedit 2
Can you attach a small compilable test case showing how the highlighting is done?
Attached a C code, press "search" 2 times it seems that the problem is with empty lines.
Created attachment 11508 [details] C code to demonstrate
*** Bug 81848 has been marked as a duplicate of this bug. ***
The dup has a slightly better description of how to repro, but no screenshot or description.
*** Bug 98440 has been marked as a duplicate of this bug. ***
Created attachment 13202 [details] [review] patch
The patch fixes the problem which is caused by the call to gtk_text_iter_forward_to_line_end() inadvertedly moving to the end of the next line when called on an empty lines. The fix is to call that function only when not already at a line end. Looking at other uses of gtk_text_iter_forward_to_line_end(), 90% of all calls are protected like this, so maybe there should be a utility function for this. The second part of the patch makes sure that empty lines *are* highlighted when they are contained in a selection. This also fixes bug 90582.
Looks good, thanks.
*** Bug 75859 has been marked as a duplicate of this bug. ***