Author Topic: Some tab group improvements  (Read 269 times)

asandler

  • Senior Community Member
  • Posts: 303
  • Hero Points: 27
Some tab group improvements
« on: September 04, 2019, 07:42:11 pm »
Hello,

I will appreciate if you can make few minor tweaks and improvements to the way tab groups work.

1. I occasionally use tab groups to have two pieces of similar code next to each other. When I open tab group (Window->Split Vertically). SE then opens current file in both tab groups, labeling them as file:1 and file:2. What bugs me is that when I browse through file:2, navigate somewhere and jump back, SE jumps back in file:1. It should jump back to file:2. Otherwise if I am looking at some code in file:1 and navigate in file:2, I am loosing the code I've been looking at in file:1 and have to find it again.
I currently work around this by making sure that I do navigation in file:1 only.

2. There is a command to cycle through buffers and a command to cycle through tab groups, but there is no command to cycle through tabs inside of tab group.

3. It could be helpful if there was an option to open tab groups without having any of the files open. Similarly, have an option not to close tab group when last tab in the group is closed.

Thanks!

Graeme

  • Senior Community Member
  • Posts: 2340
  • Hero Points: 307
Re: Some tab group improvements
« Reply #1 on: September 05, 2019, 11:28:17 am »
I think you're missing some commands
next-buff-tab
prev-buff-tab
next-doc-tab
prev-doc-tab
new-horizontal-tab-group-below
new-horizontal-tab-group-above
new-vertical-tab-group-on-left
new-vertical-tab-group-on-right
My xxutils macros have commands to create a new floating edit window if you need floating windows.
https://community.slickedit.com/index.php/topic,16598.msg64005.html#msg64005

Also slick has
save-named-files
save-named-layout
save-named-state

Why do you want to keep a tab group open when it has no files open?  You could probably write your own version of "close buffer" that refused to close the buffer if it was the last tab.

asandler

  • Senior Community Member
  • Posts: 303
  • Hero Points: 27
Re: Some tab group improvements
« Reply #2 on: September 05, 2019, 03:10:40 pm »
next-buff-tab, prev-buff-tab, next-doc-tab and prev-doc-tab cycle through all tabs. I would like to have a command to cycle through tabs in current tab group.
Next four commands that you gave create tab groups. I already use them to create a tab group.
I am not familiar with save-named-XXX commands. I'll check them out. Also, will check your xxutils. Thanks for pointing those out.

My typical workflow for multiple tab groups is when I have a piece of code and I want to use it as example when writing a piece of similar code. I open two tab groups, one for original code and one for new code. Lets say I have a.c and I want to write similar code in b.c.
The workflow is this:
1. Open a.c.
2. Call new-vertical-tab-group-on-right to create new tab group. It opens another copy of a.c.
3. Navigate to b.c in second tab group.
4. Close a.c in second tab group (I still have it open in first tab group).

The bit where I have another copy of a.c that I close is annoying. I want SE to just open an empty tab group, or may-be have a command that opens a file in a new tab group. For instance, if you press Shift+Enter in smart open dialog, it will open the file in new tab group.
I could use two instances of SE for this workflow. SE supports +new switch that opens another window. The problem with this is that if I change a.c in both instances, one of them will pop up a dialog asking if I want to reload the file. So I can open two files side by side, but if one of the files is open in two instances of SE and I edit the file in one instance, second instance will throw a pop up window.

Another issue is when I navigate the code using two tab groups. Ideally, when push-tag and pop-bookmark, SE should open files in current tab group and not jump between tab groups.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4796
  • Hero Points: 388
Re: Some tab group improvements
« Reply #3 on: September 05, 2019, 04:14:55 pm »
I think the better way to do this is just open a.c and b.c in the same tab group. Then drag one of the files to create a window below or above (drag/drop Document tab).

An open-below/open-above command will be useful though.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4796
  • Hero Points: 388
Re: Some tab group improvements
« Reply #4 on: September 05, 2019, 04:29:03 pm »
Another issue is when I navigate the code using two tab groups. Ideally, when push-tag and pop-bookmark, SE should open files in current tab group and not jump between tab groups.
This could be configured. However, it's a global setting. It would simple not find the existing file instance if it's not in the current tab group. The option is not on a dialog though. You just may end up with multiple views of the same file.

Add the following property setting to the misc.options profile to your user.cfg.xml:
Code: [Select]
    <default_find_window_options v="VG,G"/>

The whole profile looks like this:

Code: [Select]
<misc.options n="misc.options" version="1">
     <default_find_window_options v="VG,G"/>
</misc.options>

Best not to have multiple instances of the same profile in your user.cfg.xml. That could confuse the config system.



« Last Edit: September 07, 2019, 01:51:20 pm by Clark »

Graeme

  • Senior Community Member
  • Posts: 2340
  • Hero Points: 307
Re: Some tab group improvements
« Reply #5 on: September 07, 2019, 12:07:08 pm »
Quote
The workflow is this:
1. Open a.c.
2. Call new-vertical-tab-group-on-right to create new tab group. It opens another copy of a.c.

For me, this does not open a second copy of a.c.  - a.c gets moved to the new tab group.  I'm using Win 10 with slick V23.0.1.

You could give these commands a try.

Code: [Select]
static int GetEditorCtlWid(int wid)
{
   int editorctl_wid = wid._MDIGetActiveMDIChild();
   if ( editorctl_wid != null && _iswindow_valid(editorctl_wid) && editorctl_wid._isEditorCtl()) {
      return editorctl_wid;
   }
   if (_no_child_windows())
      return -1;

   return _mdi.p_child;
}

_command void next_buffer_in_group() name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL)
{
   editorctl_wid := GetEditorCtlWid(_mdi.p_child);
   if ( editorctl_wid > 0) {
      if ( editorctl_wid == _MDINextDocumentWindow(editorctl_wid, 'Z', false))
         edit( _maybe_quote_filename(_MDINextDocumentWindow(editorctl_wid, 'F', false).p_buf_name));
      else
         edit( _maybe_quote_filename(_MDINextDocumentWindow(editorctl_wid, '1', false).p_buf_name));
   }
}


_command void prev_buffer_in_group() name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL)
{
   editorctl_wid := GetEditorCtlWid(_mdi.p_child);
   if ( editorctl_wid > 0) {
      if ( editorctl_wid == _MDINextDocumentWindow(editorctl_wid, 'F', false))
         edit( _maybe_quote_filename(_MDINextDocumentWindow(editorctl_wid, 'Z', false).p_buf_name));
      else
         edit( _maybe_quote_filename(_MDINextDocumentWindow(editorctl_wid, '2', false).p_buf_name));
   }
}


asandler

  • Senior Community Member
  • Posts: 303
  • Hero Points: 27
Re: Some tab group improvements
« Reply #6 on: September 07, 2019, 01:42:01 pm »
Quote
For me, this does not open a second copy of a.c.  - a.c gets moved to the new tab group.  I'm using Win 10 with slick V23.0.1.
Interesting. I made a mistake. For some reason new-vertical-tab-group-on-right and friends are disabled in my setup. Appropriate options are disabled in Window menu as well. The command I use to split windows is vsplit-window. It could be that having two views of the same file is how vsplit-window works by default...
I am using Ubuntu 19.04 with SE 23.0.2 and hotfix 2.

Quote
You could give these commands a try.
Thank you! Will do.

asandler

  • Senior Community Member
  • Posts: 303
  • Hero Points: 27
Re: Some tab group improvements
« Reply #7 on: September 10, 2019, 03:37:42 pm »
OK. I think I understand why new-vertical-tab-group-on-right is not always available. It moves current buffer to new tab group and if you have only one open file, moving the file will make the new group empty which is not allowed. So new-vertical-tab-group-on-right and friends are disabled unless you have two or more files open.