Author Topic: Go-to line dialog should highlight initial selection (to type over)  (Read 1662 times)

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
When I want to see a specific line# of a file, I bring up the dialog to enter a line number by pressing Ctrl-J.

In windows, the initial selection is highlighted, which is good because I can just start typing the line number.

But in Linux, the initial selection is not highlighted, so if I start typing then I am pre-pending the existing selection, which sometimes I don't realize is happening (because I am used to the windows way), and I hit enter without realizing it and go to the wrong line#.  This wastes time.

Therefore in Linux, I need more keystrokes to erase the old selection in order to start typing the new one.  I also need to remember to do it.  This also wastes time.

I'd like if Linux would behave like Windows and highlight the initial selection so I can just start typing the line# I am looking for.

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: Go-to line dialog should highlight initial selection (to type over)
« Reply #1 on: December 21, 2013, 11:18:28 PM »
I'd like if Linux would behave like Windows and highlight the initial selection so I can just start typing the line# I am looking for.

You could try using the command line to enter a line number  - press escape and type the line number.  You could also easily create your own form with a textbox on it.

You could also take a look at this code in the show() function and see if you can see why the textbox isn't getting the focus.  Add a call to say() and see what's happening.

Code: [Select]
   int focus=_get_focus();
   if (focus && (focus.p_object==OI_TEXT_BOX || focus.p_object==OI_COMBO_BOX) && focus.p_auto_select) {
      focus._set_sel(1,length(focus.p_text)+1);
   }

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: Go-to line dialog should highlight initial selection (to type over)
« Reply #2 on: December 22, 2013, 01:18:42 AM »
You could try using the command line to enter a line number  - press escape and type the line number. 

Thanks Graeme!  I did not know this could be done.  I'll use it from now on instead of Ctrl-J.

But I still think that SlickEdit should be modified so that this dialog box has the same behavior in Windows vs. Linux.

On Linux, the text box does have focus, but the contents of it are not highlighted/selected, whereas in Windows the contents are highlighted/selected.

So for example, if I am currently on line 335, and I press Ctrl-J, it shows 335 in the dialog, but not highlighted in Linux (but is highlighted in Windows).

Then, if I want to go to line 12, if I wanted to just type 12 without doing anything, the textbox will show 12335 (inserting it before the current line #).

On windows, the 335 is highlighted so as soon as I start typing its gone and replaced by whatever I'm typing.

I'd rather have the windows behavior, but I won't be using Ctrl-J anymore and will use "Esc" and your method.

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: Go-to line dialog should highlight initial selection (to type over)
« Reply #3 on: December 22, 2013, 01:36:16 AM »
The code I posted was actually from an older version of slickedit.  Slick v18 has this
Code: [Select]
   if (!keep_hidden) {
      wid.p_visible=1;
      int focus=_get_focus();
      if (def_focus_select && focus && (focus.p_object==OI_TEXT_BOX || focus.p_object==OI_COMBO_BOX) && focus.p_auto_select) {
         focus._set_sel(1,length(focus.p_text)+1);
      }
   }

The focus.set_sel call is supposed to highlight the existing text.
So try checking the value of def_focus_select - on the Macro menu, select "set macro variable" and type in the name.  If it's zero, set it to one.
focus.p_auto_select might also be false - don't know why it would be different on Linux though.
The show function is used for many things so it's probably worth investigating.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: Go-to line dialog should highlight initial selection (to type over)
« Reply #4 on: December 22, 2013, 02:23:16 AM »
The code I posted was actually from an older version of slickedit.  Slick v18 has this
Code: [Select]
   if (!keep_hidden) {
      wid.p_visible=1;
      int focus=_get_focus();
      if (def_focus_select && focus && (focus.p_object==OI_TEXT_BOX || focus.p_object==OI_COMBO_BOX) && focus.p_auto_select) {
         focus._set_sel(1,length(focus.p_text)+1);
      }
   }

The focus.set_sel call is supposed to highlight the existing text.
So try checking the value of def_focus_select - on the Macro menu, select "set macro variable" and type in the name.  If it's zero, set it to one.
focus.p_auto_select might also be false - don't know why it would be different on Linux though.
The show function is used for many things so it's probably worth investigating.

Graeme:  You were right.  My def_focus_select was set to 0 in Linux, don't know why.  I changed it to 1, and now the text in the text box gets highlighted!

Thanks Graeme!