View/Edit #50:comment uncomment

Switch to edit mode.

Name(s): comment uncomment
1:  "$verb_editor:comment(uncom*ment) <range>"
2:  "(Un)comment the lines in <range>."
3:  if (!(who = this:loaded(player)))
4:    player:tell(this:nothing_loaded_msg())
5:  elseif (typeof(range = this:parse_range(who, {"_", "1"}, @args)) != $LIST)
6:    player:tell(range)
7:  elseif (range[3])
8:    player:tell("Junk at end of cmd:  ", range[3])
9:  else
10:   v_name = verb[1] == "c" ? "comment" | "uncomment"
11:   oldtext = this.texts[who]
12:   for i in [from = range[1]..to = range[2]]
13:     line = this.texts[who][i]
14:     if (v_name == "comment")
15:       line = strsub(line, "\\", "\\\\")
16:       line = strsub(line, "\"", "\\\"")
17:       this.texts[who][i] = tostr("\"", line, "\"")
18:     elseif (match(line, "^ *\"") && line[$..$] == "\"")
19:       line = strsub(line, "\\\\", "\\")
20:       line = strsub(line, "\\\"", "\"")
21:       line[x = index(line, "\"")..x] = ""
22:       this.texts[who][i] = line[1..$ - 1]
23:     endif
24:   endfor
25:   player:tell($html_utils:literal_text(this.texts[who][from..to]))
26:   player:tell("---Line", to > from ? "s" | "", " ", v_name, "ed.  Insertion point is before line ", to + 1, ".")
27:   this.changes[who] = oldtext
28:   this.times[who] = time()
29:   this.inserting[who] = to + 1
30: endif
31: "Last modified by whiz (#3135) on Mon Aug  7 13:46:13 2006 MDT."

Verb arguments: any any any
Verb perms: Readable NOT-Debug
Verb owned by: Dax (#789)

You are not logged in.

[home | help | who | search | setup | code]