GNOME Bugzilla – Bug 604558
Cursor is lost or is placed in wrong position.
Last modified: 2009-12-29 20:21:32 UTC
Steps to reproduce: 1. Run gnome-commander. 2. Press TAB key to switch to left panel. 3. Open /etc directory(or Open a directory that has many files or directories like /bin, /dev and so on) 4. Position the cursor on a file that is in the lower part of file list.(For example, place the cursor on a file which starts with x, y, z or something if the file list is sorted in alphabetical order) 5. Press TAB key to switch to right panel. 6. Open /boot direcoty(or Open a directory that has few files or directories like /mnt, /media, /opt and so on. And the directory should be different from the directory that is opened in the left panel) 7. Press "Ctrl + ->" to copy the current working directory from the active right file list to the left one. 8. Press TAB key to switch to left panel. 9. Then you will see the cursor is lost or is placed in wrong position. I tried to find why this problem occurs. And I found the reason. Because the member variable cur_file of GnomeCmdFileList::Private is not reset to 0 when "Ctrl + ->" is pressed. The value of focus_row of GTK_CLIST is reset to -1, but old value of cur_file is reamined. So the cursur is placed in wrong position. I think the value of cur_file needs to be 0 to resolve this bug. In gnome-cmd-file-selector.cc:1023, the focus_row is set to -1. So also cur_file needs to be 0 in the same place like the focus_row. But, the cur_file is not accessible from out side of gnome-cmd-file-list.cc. Some function, which provides the cur_file accessibility to the out side of gnome-cmd-file-list.cc, can be made. But I think that this modification is not accompanied with the design policy of gnome-commander. So I changed the GnomeCmdFileList::select_row() alternatively. I attached a patch. It is a very short patch. Please refer to the attached if you want to see in more detail. Other informations GNOME Commander version: 1.2.8.4 OS: Ubuntu januty
Sorry, I wrote something wrong. I wrote 'left' and 'right' reversely. So the right way to reproduce steps is like the followings... 1. Run gnome-commander. 2. Press TAB key to switch to right panel. 3. Open /etc directory(or Open a directory that has many files or directories like /bin, /dev and so on) 4. Position the cursor on a file that is in the lower part of file list.(For example, place the cursor on a file which starts with x, y, z or something if the file list is sorted in alphabetical order) 5. Press TAB key to switch to left panel. 6. Open /boot direcoty(or Open a directory that has few files or directories like /mnt, /media, /opt and so on. And the directory should be different from the directory that is opened in the left panel) 7. Press "Ctrl + ->" to copy the current working directory from the active left file list to the right one. 8. Press TAB key to switch to right panel. 9. Then you will see the cursor is lost or is placed in wrong position.
Created attachment 149711 [details] [review] fix-a-bug-with-lost-cursor.diff.gz
Bug confirmed
Comment on attachment 149711 [details] [review] fix-a-bug-with-lost-cursor.diff.gz Unfortunately, the patch introduces regression: when CTRL+LEFT (RIGHT respectively) it always sets cursor to the file list top.
Yes. The patch makes cursor is always set to the file list top. In my opinion, additionaly, the voffset of GnomeCmdDir should be always 0 when new directory is opened. Because it is more natural if the cursor is set to the top. But I think that you want that GNOME Commander remembers where the cursor was. Is it true? If you intend to do it, the patch I made is not right.
Your patch does NOT introduce any regression - the problem with resetting cursor to file list top is present also without the patch. Sorry for the ado about nothing. The fix will go into the next, 1.2.8.5 release. Thank you for your bug report.