Re: changing background colour on the current line only

kuzn-Z+4OxV1pPnQgONJHhpZ/[email protected]
Newsgroups gmane.editors.nedit.user
Message-ID <[email protected]>
Hi,>
> I worked for a company once which was using nedit, and had a macro which
> would toggle the background colour on the current line between normal ->
> yellow -> orange -> red -> normal.

To highlight the current line you must patch the NEdit.
See Patch Collection
http://sourceforge.net/tracker/index.php?func=detail&aid=1058246&group_id=11005&atid=311005
This patch produces highlighting you want (without the color rotating) and
many other features.

> This was really handy to tag the areas of code you were working on,
> especially when editing a few select lines within thousands of lines of
> code
> (i.e quick small bug fixes).
>
> Is this a script available somewhere? else I can't seem to find the macro
> subroutine to change the background colour.. it shouldn't be too hard to
> rewrite such a macro.. any pointers would be appreciated.
>

You can try following macros.

Cheers,
Alexey Kuznetsov

$line_marking = $empty_array
$line_marking["\n"] = $empty_array

define mark_line {
	file = $file_path $file_name
	if(!(file in $line_marking)) {
		$line_marking[file] = rangeset_create()
		$line_marking["\n"][file] = "yellow"
		rangeset_set_color($line_marking[file], $line_marking["\n"][file])
	}
	if($selection_start >= 0 && $selection_left < 0) { # Mark selection
		rangeset_add($line_marking[file])
		return
	} # Mark current line.
	rangeset_add($line_marking[file],\
					search("^", $cursor, "regex", "backward"),\
					search("$", $cursor, "regex"))
}

define unmark_line {
	file = $file_path $file_name
	if(file in $line_marking) {
		i = rangeset_includes($line_marking[file], $cursor)
		if(i) {
			range = rangeset_range($line_marking[file], i)
			rangeset_subtract($line_marking[file], range["start"], range["end"])
		}
	}
}

define rotate_color {
	file = $file_path $file_name
	if(file in $line_marking["\n"]) {
		if($line_marking["\n"][file] == "")
			$line_marking["\n"][file] = "yellow"
		else if($line_marking["\n"][file] == "yellow")
			$line_marking["\n"][file] = "orange"
		else if($line_marking["\n"][file] == "orange")
			$line_marking["\n"][file] = "red"
		else if($line_marking["\n"][file] == "red")
			$line_marking["\n"][file] = ""
		rangeset_set_color($line_marking[file], $line_marking["\n"][file])
	}
}



-- 
NEdit Discuss mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.