Author Topic: Buffer list  (Read 13978 times)

cdouble

  • Community Member
  • Posts: 43
  • Hero Points: 0
Buffer list
« on: September 24, 2006, 04:33:13 AM »
This may already be in there... :)

1. If I have 50 files open and display a buffer list, I type a letter and the cursor does not move. Is this intentional?
2. Same 50 files and i use the buffer list to open a file that begins with "z". When i open the buffer list again, the list doesn't go back to the file i had open instead of leaving the highlight at "a". Is that intentional?

Thanks,

CD

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Buffer list
« Reply #1 on: September 24, 2006, 01:40:32 PM »
You are using the good old 'list-buffers' macro too ?
Unfortunately it's like you described...
That was the reason why I did a nasty hack to which provides 'type ahead find' and pre-selecting the current buffer and such.
(Same applies to other list-... macros b/c the list itself is managed by common code.)
I think these maros are depreceated and the Slickteam works (?) on a replacement for that.
Or they should improve e.g. the 'Defs' tab a little bit.

@Slickteam:
If 'Defs' is collapsed displaying the open buffers only the type-ahead find shouldn't step into the tags of the current buffer again.
In other words I think it could be a good idea if the type ahead-find is restricted to the currently selected (tree-)level (maybe common for all tree widgets).
But I afraid there are some good points against that, right ?
Unfortunately the current implementation requires mouse-ing for that frequently used functionality of switching buffers.
This is a bit inconvenient (at least for me) and also the reason why I still stick to my hacked listproc/sellist stuff -> no mouse needed.

What do you think ?

HS2

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Buffer list
« Reply #2 on: September 25, 2006, 03:15:08 PM »
There seems to be some code in list_buffers for supporting incremental searching.  From the SlickEdit command line type "fp list_buffers".  Change the "#if 1" to "#if 0" to turn on the other code path.  Then type "load" on the command line (or load the macro from macro>Load Module).

Some newer ways to incrementally search files don't have key bindings.  Project>Open Files From Project and Project>Open Files From Workspace.

sdayts

  • Community Member
  • Posts: 42
  • Hero Points: 5
Re: Buffer list
« Reply #3 on: September 25, 2006, 04:33:26 PM »
This works!
I wish I knew about this trick earlier.
This should be the default behavior.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Buffer list
« Reply #4 on: September 25, 2006, 04:42:33 PM »
The current behavior of list buffers is dated.  It was designed this way to emulate editors like Brief and the old text mode SlickEdit.  If anyone gathered here has any objections to this holly change, speak now or forever hold your peace :-)

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Buffer list
« Reply #5 on: September 25, 2006, 05:00:23 PM »
That confirms my 'depreceated' assumption...
This also means that my patch (which uses the change described w/ some further enhancements) will work forever b/c the affected modules won't change dramatically ;)

No problem with that, but is there any chance to get a similar functionality using the 'modern' GUI ?
(please @see my prev. post)

HS2

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Buffer list
« Reply #6 on: September 25, 2006, 06:56:49 PM »
(hs2) I didn't even know the Defs tab incremental searched :-)  Seems reasonable to me for the Defs tab to incremental search the current level. I'll ask Dennis about this one.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Buffer list
« Reply #7 on: September 25, 2006, 08:24:04 PM »
This would be great !
Since I'm a customer (v7) I asked for that.
The pre-v11 versions only took 1 char into account.
And then you 've to use/work with C++-code where all classes start with 'C' or 'Q' ...

I hope I didn't miss an important use-case.

(Did a quick check with (my) most important toolbars: Defs/Classes/Projects/Open)
At first glance it's ok (and of course an improvement) for 'Classes'.
And I think it's also fine for the other ones.

It seems that isearch already works fine at the deepest tree-level (no more expands possible).
At higher (collapsed) level(s) it doesn't step further if there are entries starting with the same prefix (e.g. 'Projects -> Autofolder -> Package View').

However, this can be easily cross-checked with e.g. 'Windows Explorer' where applicable.

There is one add. feature which could be useful too: isearch with wildcard(s).
E.g. if you start isearching w/ a leading '*' you can omit typing the whole leading prefix all the time.
It's a bit exotic, but its helpful if there is a longer 'common prefix'.
(It's not my idea: 'TotalCommander' @ http://www.ghisler.com/ provides that.)

HS2

PS: I hope that Dennis is in a good mood ;)

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: Buffer list
« Reply #8 on: September 26, 2006, 08:09:10 PM »
Heh, I'm always in a good mood, except when I'm not...   ;D

I'll file a feature request about the regular expression searching.  I agree that could be useful.

As far as searching the tree recursively, that could be tricky, a good thing in some circumstances, potentially confusing in other instances.  The class browser fills in the tree dynamically, the search would have to be restricted to unexpanded nodes.

buggyfunbunny

  • Senior Community Member
  • Posts: 233
  • Hero Points: 4
Re: Buffer list
« Reply #9 on: September 26, 2006, 09:09:30 PM »
since the general topic of buffer listing is on the table:  F8 has always been less than useful (or missed named, or...).  the expected (by me of course) behaviour is to toggle between the last two chosen files.  if only two buffers, then that's what you get.  if more than two, then it just keeps cycling through the entire list.  i really don't see why that's useful, given all the other ways to process buffers.  can F8 be made to do a toggle as described?

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Buffer list
« Reply #10 on: September 26, 2006, 09:22:14 PM »
@Dennis: Hey - same for me  8)

Erm ... isearching 'Classes' is already ok in the sense I described.
It steps into the next (deeper) level only for the currently selected and expanded class.

'Defs' and 'Projects' are almost right except that they 'auto-expand' subtrees if there is a match inside.
Simple example for 'Defs':
- 2 buffers open:
+drv.c
+drv.h
drv.c contains a symbol starting w/ 'd'.
(I try to do as much as I can by keyboard)
Ok - I'm in drv.c and want to switch to drv.h (remember - it's just a stupid example).
I do an activate-project-defs -> collaps everything by cursor-left (unfortunately there are no complements to Expand All / Level 1/2) and start typing a 'd'.
This selects the first 'd' entry there -> 'drv.c'.
I type the next 'd' to goto the next 'd' entry (drv.h), but now the 'drv.c' subtree is expanded and the 1st 'd' symbol is selected. Stop.
I never ever reach 'drv.h' this way :(

BTW:
I've noticed that the file list and the dir tree of the 'Open' toolbar is still doing single char isearch.
But I don't use that often.

Hope my lenghty story was even more confusing ;)

But the best thing would be - try it by yourself and do it the way it helps YOU.
I think this will be good for me too...

Hartmut

@buggyfunbunny: What is F8 for you ? I mean which macro is bound to that key in your emulation ?
« Last Edit: September 26, 2006, 09:26:38 PM by hs2 »

buggyfunbunny

  • Senior Community Member
  • Posts: 233
  • Hero Points: 4
Re: Buffer list
« Reply #11 on: September 27, 2006, 03:16:52 AM »
F8 is standard.  and I experienced a brain cramp.  somewhere, and I didn't notice, Ctrl-F8 came along.   ???  nevertheless, a single key toggle as described would be useful.  split window does sort of the same thing, but not quite.  i'll revisit the functions when I get back to CubeLand; open-last-buffer (by some name) may be there.  there are so many  ;D 

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Buffer list
« Reply #12 on: September 27, 2006, 08:13:08 AM »
@ buggyfunbunny:
Re-read your post again and I think I know what you need  ;)
BTW: For me using 'Brief emulation' the std. key binding for F8 is 'last-macro' ...

Anyway, I made this tiny extension. Maybe it's helpful for you too.
I'm sure it's not complete but works in most cases.
For me it's hs2_toggle_buffer - no question !

Code: [Select]
#include 'slick.sh'

static _str old_buffer_name   = '';

// called when Slick calls it's list of _switchbuf_ - callbacks
// It's not working for 'Untitled<NN> buffers ???
_switchbuf_bunny (...)
{
   // bunny_toggle_buffer support
   if ( ( arg(1) != '' ) && ( arg(1) != _mdi.p_child.p_buf_name ) )
   {
      old_buffer_name = arg(1);
   }

   // do more on this callback
   // ...
}

// bind this to a key ...
_command void bunny_toggle_buffer () name_info(','VSARG2_REQUIRES_EDITORCTL)
{
   if ( old_buffer_name != '' )
   {
      _str old2_buffer_name = _mdi.p_child.p_buf_name;
      load_files ('+b 'old_buffer_name);
      old_buffer_name = old2_buffer_name;
   }
   else
   {
      // try to toggle 1st time ... try previous buffer in the ring or comment it
      prev_buffer ();
   }
}

Note that there are also back and forward macros (as know from your web browser).
So if you are used to that, this might be another option.

Have fun,

HS2
« Last Edit: September 27, 2006, 08:31:12 AM by hs2 »

buggyfunbunny

  • Senior Community Member
  • Posts: 233
  • Hero Points: 4
Re: Buffer list
« Reply #13 on: September 27, 2006, 06:38:20 PM »
pretty slick, so to speak.  ::)

cdouble

  • Community Member
  • Posts: 43
  • Hero Points: 0
Re: Buffer list
« Reply #14 on: October 01, 2006, 03:23:20 PM »
Thanks for the #if 0 suggestion. It works but there is one problem though - if i mistype a letter in a word it takes me back to the beginning of the buffer list. Yuck. Also, any chance to get the buffer highlighted to remain the same when reopening the buffer list dialog box?

I agree that this is due for a "tune-up". Having the buffer list dialog box resizable makes sense too. Sort by extension, sort by name, sort by date modified etc. all like a normal dialog box.

Thanks,

CD