Author Topic: Comment Editing in Visual Basic  (Read 9109 times)

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
Comment Editing in Visual Basic
« on: March 03, 2008, 04:00:40 PM »
Comment editing behavior doesn't seem to match the extension options configuration for .vb/.bas files.  (I'm using se 12.0.3 rev31 and have done little to change the default settings for vb.)

My settings are:
  • Split line comments: true
  • Extend line comments: true
  • Join comments when joining lines: true

The behavior is:
  • Splitting a line comment by hitting the enter key in the middle causes the new line to be aligned with the comment character of the original line, but without a comment character.
  • Likewise, extending a line comment in the by hitting the enter key at the end causes the new line to be aligned with the comment character of the original line, but without a comment character.
  • Joining comment lines by pressing delete at the end of one does correctly removing leading whitespace from the joined line, but the comment character is only removed if the joined line was at the same indent level as the first line. (Found that by accident due to the next issue - see below.)

Additionally, when pasting lines from one comment to another, the pasted lines are indented at their original level rather than at the level of the existing comment, while the next line following the pasted line (comment or otherwise) gets unindentend to column 1.  My Comment line Location setting is: At level of indent.

I didn't find anything in the forum about this.  Presumably not too many people bother with se for vb, but I find it useful for some purposes (like comment editing), because of better handling of background colors.  However, this issue is making that a moot point.

Thanks for any help anyone can offer.




Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6864
  • Hero Points: 528
Re: Comment Editing in Visual Basic
« Reply #1 on: March 03, 2008, 04:57:24 PM »
I fixed the Enter key problem.  Thanks for finding this.

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
Re: Comment Editing in Visual Basic
« Reply #2 on: March 04, 2008, 08:30:39 PM »
Thanks Clark.  Will that be in a hotfix?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6864
  • Hero Points: 528
Re: Comment Editing in Visual Basic
« Reply #3 on: March 06, 2008, 03:16:23 PM »
No, there won't be a hot fix for this.

Backup your msqbas.e.  Edit msqbas.e and replace the qbasic_enter() function code with the following code:

_command void qbasic_enter() name_info(','VSARG2_CMDLINE|VSARG2_ICON|VSARG2_REQUIRES_EDITORCTL|VSARG2_READ_ONLY)
{
   if (ispf_common_enter()) return;
   typeless expand,first_indent;
   parse name_info(_edit_window().p_index) with . expand . . . first_indent . ;
   if ( command_state() || p_window_state:=='I' ||
        p_SyntaxIndent<0 || p_indent_style!=INDENT_SMART ||
        _in_comment(1) ) {
      call_root_key(ENTER);
   } else if (_maybeSplitLineComment()) {
      return;
   } else if (qbasic_expand_enter(p_SyntaxIndent,expand,first_indent)) {
      call_root_key(ENTER);
   } else {
      _undo('S');
   }
}

I hope the above code doesn't get munged by this forum processor.  You will need to load the new modified msqbas.e (Macro->Load Module...).

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
Re: Comment Editing in Visual Basic
« Reply #4 on: March 06, 2008, 04:49:40 PM »
That does the trick.  Thanks Clark.

Phil Barila

  • Senior Community Member
  • Posts: 745
  • Hero Points: 61
Re: Comment Editing in Visual Basic
« Reply #5 on: March 06, 2008, 07:37:31 PM »
I hope the above code doesn't get munged by this forum processor.  You will need to load the new modified msqbas.e (Macro->Load Module...).
That's what the code tag is for.  It's the button with the '#' on it.