Bugs item #1731384, was opened at 2007-06-05 15:56
Message generated for change (Comment added) made by yooden
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=111005&aid=1731384&group_id=11005

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: problems with default macros

Initial Comment:
problemNEdit release of Aug 20, 2004

     Built on: Linux, 386, Intel C++
     Built at: May 25 2007, 08:59:17
   With Motif: 2.2.3 [@(#)Motif Version 2.2.4]
Running Motif: 2.2 [unknown]
       Server: The X.Org Foundation 60802000
       Visual: 24-bit TrueColor (ID 0x21, Default)
       Locale: en_US.UTF-8

----------------------------------------

I found these problems by a misclicking:

1) open a C file.
2) selcect a few lines (not commented).
3) select "Bar uncommented" from "Macro".
4) you'll find the selection is deleleted.


Try other uncomment macros (// uncomment and /* uncomment), they also have 
problems.

Thx

----------------------------------------------------------------------

>Comment By: Thorsten Haude (yooden)
Date: 2007-12-28 23:05

Message:
Logged In: YES 
user_id=119143
Originator: NO

I just commited Jörg's fix.

----------------------------------------------------------------------

Comment By: Thorsten Haude (yooden)
Date: 2007-12-28 09:55

Message:
Logged In: YES 
user_id=119143
Originator: NO

File Added: macfix.diff

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2007-06-11 16:41

Message:
Logged In: NO 

Oops - second part of previous post (after "and:") is a rewrite of the
"Comments>Bar Uncomment" macro. 

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2007-06-11 16:34

Message:
Logged In: NO 

Looks like replace_in_string() calls in these macros are missing the
"copy" keyword argument.

Other than that I suggest rewriting:

Comments>/* Uncomment */ -------------------------------

s = get_selection()
a = $selection_start
t = replace_in_string(s, "(?n/\\* ?(.*?) ?\\*/)", \
                         "\\1", "regex", "copy")
if (t != s) {
  replace_selection(t)
  select(a, a + length(t))
}

and:

top = $selection_start
end = $selection_end
s = get_selection()
t = s
pos = 0
while ()
  {
  # look for bar-comments
  ctop = search_string(t, "/\\*\\s*.*\n( \\*.*\n)*\\s*\\*/\n", pos,
"regex")
  if (ctop < 0)
    break
  cbot = $search_end
  r = substring(t, ctop, cbot) # extract each bar-comment part
  # now remove bar
  r = replace_in_string(r, "/\\*\\s*\n", "", "regex", "copy")
  r = replace_in_string(r, "/\\*\\s*", "", "regex", "copy")
  r = replace_in_string(r, "^\\s*\\*/\n", "", "regex", "copy")
  r = replace_in_string(r, "^ \\* ?", "", "regex", "copy")
  t = replace_substring(t, ctop, cbot, r)
  pos = ctop + length(r)
  }
if (s != t)
  {
  replace_selection(t)
  select(top, top + length(t))
  }
return

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=111005&aid=1731384&group_id=11005
-- 
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop

Reply via email to