GNOME Bugzilla – Bug 342795
Sort plugin: "start from column" not usable with order selection
Last modified: 2019-03-23 20:52:26 UTC
pbor said in bug #34117 comment #9: Apart from that, while testing I found another pretty major bug in the plugin: when you change the start from column spinbox, the spin box entry takes focus and the selection in the text is lost, so it's not possible to order just a selection. Example: try to sort the three middle lines of fffe ddde dddr ddda fffa (ie the ddd ones) with "start from column: 4" gives fffa ddda ddde fffe dddr
Being the dialog modal, I think this bug is quite easy to fix.
Created attachment 68982 [details] [review] Changed modal to false This is the first patch I've ever made, not sure if it's in the right format. I just changed the dialog's modal setting so that you can change the focus between the dialog and its parent. This might not a desired solution.
sorry for the late response, I though to have commented in this one but it must have happened only in my head... Changing the dialog to to not be modal is not a suitable solution, the dialog must remain modal. What comment 1 meant, is that since the dialog is modal it should be possible to work around this issue.
The text selection being lost is a consequence of bug 334060. Mark as dependency?
Why do you say it's easy beacause the dialog is modal?
Created attachment 83138 [details] [review] Set combo as not editable
The patch is very simple and probably not the best solution. But it just works and is my first patch ever. So you guys should Congratulate me anyway. ;)
Congrats Eduardo :) However the patch doesn't look correct, the spin button should be editable or there is no point in having it there. What we meant by saying that the fact that the dialog is modal should allow to work around the issue is that since when the dialog is up the user cannot interact with the text, you can save the start and end of the selection when the dialog is built and then restore it before applying the sorting. A bit of a hack but it should work...
As i said I'm very early on all this hacking thing. And know almost nothing about gtk, glib and such. But it doesn't seem so hard to do. I'll try to do that on weekend Thanks a bunch
Created attachment 156069 [details] [review] save the start and end of the selection/document
patch looks good to me, could you just add a small comment along the lines of /* store the selection range since focusing the spinbox in the combo unsects it. NOTE: this works becouse the dialog is modal (see bug 342795) */ Since if the modality is ever removed we have an hint about the assumption we are making Also, can you create the patch with git format-patch and a proper commit message, so that I can credit you properly? Thanks a lot for your help!
Actually I added the comment myself, slightly changed a couple of style details and committed. Thanks for the patch!