Author Topic: How do I change the underline cursor to block?  (Read 6809 times)

jonny

  • Community Member
  • Posts: 6
  • Hero Points: 0
How do I change the underline cursor to block?
« on: January 26, 2008, 12:30:22 pm »
Hi All;

I'm new to slickedit and I'm using the VI emulation. I want to change the underline cursor in the Normal mode to block cursor. I know how to do this in the command line by executing the following

1. CTRL-A  //this bring up the command entry
2. cursor-shape  and enter
3. change all the values (750 1000 750 1000 750 1000 750 1000) to (1000 1000 1000 1000 1000 1000 1000 1000)

I got the block cursor in Normal mode. But once I changed to Edit mode and then back to Normal mode. The block cursor changed to underline again.

I did some search on this community and someone recommend putting this function in a macro
         _cursor_shape('1000 1000 1000 1000 1000 1000 1000 1000');

I copy this file and put it in a file "foo.e". I loaded this file up using the drop down menu "Load Macro" but I got the following error message
          foo.e 1 13:Expecting declaration

What else do I need to add to the foo.e file so I can load this macro? Ultimately, what else do I need to do so I can keep block cursor in Normal mode all the time?

Thanks in advanced!!!

-Jonny



hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: How do I change the underline cursor to block?
« Reply #1 on: January 26, 2008, 01:34:40 pm »
Add #include 'slick.sh' to the module

Edit: And wrap the function with a command to be executed on commandline as one possibilty.
Example: (gets 'set-cursor-shape' on cmdline)
Code: [Select]
_command void set_cursor_shape ()
{
   _cursor_shape ('824 1000 100 1000 500 1000 100 600')
}

You need to set the cursor shape just once and save your settings e.g. on exit or by using 'gui-save-config' on cmdline.

HS2
« Last Edit: January 26, 2008, 01:41:12 pm by hs2 »

jonny

  • Community Member
  • Posts: 6
  • Hero Points: 0
Re: How do I change the underline cursor to block?
« Reply #2 on: January 27, 2008, 12:22:50 am »
Thanks hs2 for the response. I tried your suggestion but I'm still having problems of getting the block cursor. Here are the steps that I performed:

1. Create a file "foo2.e" with your suggestions. Here is the content of the file
     #include "slick.sh"
     _command void set_cursor_shape()
     {
         _cursor_shape ('1000 1000 1000 1000 1000 1000 1000 1000')
     }

2. Load the module a using the drop-down menu "Macro->Load Module"
3. CTRL-A //invoke the command line entry
4. set-cursor-shape  //this change the underline cursor to block cursor, which is good
5. CTRL-A
6. gui-save-config  //this give pop-up window and ask me to save configuration and I selected YES
7. Exit slickedit
8. Re-invoke slicked  and the cursor changed to underline again.

Did you see any error in my steps above? Any suggestions?

Thanks in advanced!!

Jonny




hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: How do I change the underline cursor to block?
« Reply #3 on: January 27, 2008, 02:15:37 am »
Hmm .. please add:
Code: [Select]
  _config_modify_flags(CFGMODIFY_DEFVAR|CFGMODIFY_OPTION);below the '_cursor_shape' call to ensure that SE saves the changed part of the configuration (maybe CFGMODIFY_DEFVAR is not required, but it doesn't matter).
Re-load the macro and repeat the steps you already did.
That should work in case SE could save the config and there is no access right problem or something.
You can verify your <SE-config-dir>/config/vusrdefs.e file which contains (almost) all config. items as (very cool) Slick-C code.
There you should find a '_cursor_shape (..)' line with your parameters. Check 'Help>About' for your config dir location.
BTW: There is also a 'Use block cursor' checkbox in 'Tools>Options>General: More tab'.
It's checked in my configuration although I'm using my own cursor shape. To be honest I'm not sure if it's related - maybe not...

Good luck,
HS2

jonny

  • Community Member
  • Posts: 6
  • Hero Points: 0
Re: How do I change the underline cursor to block?
« Reply #4 on: February 15, 2008, 07:14:36 am »
I still can't change the underline cursor to block. Can some Slickedit developers shed some light?

Again, the version of slickedit I'm using is v12.0.3 for linux.

Thanks;
-Jing

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: How do I change the underline cursor to block?
« Reply #5 on: February 15, 2008, 11:11:04 am »
@jonny: Wanderer found out (see http://community.slickedit.com/index.php?topic=2582.msg10656#msg10656) that the cursor shape in vi mode is explicitely set in 'vicmode.e' to hardwired values.
So you'd need to patch this module accordingly and load it. That should solve your issue.
vicmode.e -  [line 27]:
Code: [Select]
// Cursor definitions for Vim
_str VI_INSERT_CURSOR='-v 750 1000 750 1000 750 1000 750 1000';
_str VI_COMMAND_CURSOR='750 1000 750 1000 750 1000 750 1000';
Good luck,
HS2

jonny

  • Community Member
  • Posts: 6
  • Hero Points: 0
Re: How do I change the underline cursor to block?
« Reply #6 on: February 18, 2008, 08:09:54 am »
hs2, thank you for your response. I have tried this trick from wanderer before but that didn't work for me. Here is what I added to the vicmode.e file

// Cursor definitions for Vim
//_str VI_INSERT_CURSOR='-v 750 1000 750 1000 750 1000 750 1000';
//_str VI_INSERT_CURSOR='-v 1000 1000 1000 1000 1000 1000 1000 1000';
_str VI_INSERT_CURSOR='1000 1000 1000 1000 1000 1000 1000 1000';
_str VI_COMMAND_CURSOR='1000 1000 1000 1000 1000 1000 1000 1000';

I reload the module and I still do not get the block cursor. One thing I notice Wanderer mentioned in his post about "hide mouse pointer", for example,

In Options->General->More I have "Use block cursor" and "Hide mouse pointer" checked.  I don't know if there are other options that affect the cursor, or if the vi emu monkeys with it

But I don't see that option available in my version. We both using v12.0.3, but he is using Winxp and I'm using Linux.

I have attached the screen capture of the "general options".

Any suggestions?

Thanks;

-Jonny