! Preferences file for NEdit ! (User settings in X "application defaults" format) ! ! This file is overwritten by the "Save Defaults..." command in NEdit ! and serves only the interactively settable options presented in the NEdit ! "Preferences" menu. To modify other options, such as key bindings, use ! the .Xdefaults file in your home directory (or the X resource ! specification method appropriate to your system). The contents of this ! file can be moved into an X resource file, but since resources in this file ! override their corresponding X resources, either this file should be ! deleted or individual resource lines in the file should be deleted for the ! moved lines to take effect. nedit.fileVersion: 5.5 nedit.shellCommands: \ Utilities>Spell::s:ED:\n\ (cat;echo "") | spell -b\n\ Utilities>Word count::w:ED:\n\ csh -fc 'set wc=`wc`; echo $wc[1] "lines," $wc[2] "words," $wc[3] "characters"'\n\ Utilities>Sort::o:EX:\n\ sort\n\ Make>make (plain)::m:W:\n\ make\n\ Make>make (csh -i)::m:W:\n\ csh -i -c 'set cdDirNames = ":"; alias addcd "echo \\$cwd"; if ( -r .cshcd) source .cshcd; if ( ! $?CC ) source `choose_cc`; make; :'\n\ Make>optimise (csh -i)::m:W:\n\ csh -i -c 'set cdDirNames = ":"; alias addcd "echo \\$cwd"; if ( -r .cshcd) source .cshcd; if ( ! $?CC ) source `choose_cc`; setenv CDEBUGFLAGS "-DNDEBUG -O"; setenv LDEBUGFLAGS ""; make; :'\n\ Make>debug (csh -i)::m:W:\n\ csh -i -c 'set cdDirNames = ":"; alias addcd "echo \\$cwd"; if ( -r .cshcd) source .cshcd; if ( ! $?CC ) source `choose_cc`; setenv CDEBUGFLAGS "-gyz"; setenv LDEBUGFLAGS "-gyz"; make; :'\n\ Make>target (csh -i)::m:IW:\n\ csh -i -c 'set cdDirNames = ":"; alias addcd "echo \\$cwd"; if ( -r .cshcd) source .cshcd; if ( ! $?CC ) source `choose_cc`; make `cat` ; :' 2>&1\n\ Make>target optimise (csh -i)::m:IW:\n\ csh -i -c 'set cdDirNames = ":"; alias addcd "echo \\$cwd"; if ( -r .cshcd) source .cshcd; if ( ! $?CC ) source `choose_cc`; setenv CDEBUGFLAGS "-DNDEBUG -O"; setenv LDEBUGFLAGS ""; make `cat` ; :' 2>&1\n\ Make>target debug (csh -i)::m:IW:\n\ csh -i -c 'set cdDirNames = ":"; alias addcd "echo \\$cwd"; if ( -r .cshcd) source .cshcd; if ( ! $?CC ) source `choose_cc`; setenv CDEBUGFLAGS "-gyz"; setenv LDEBUGFLAGS "-gyz"; make `cat` ; :' 2>&1\n\ Tabs>detab:Shift+Ctrl+Alt+I::EX:\n\ detab\n\ Tabs>retab:Shift+Ctrl+I::EX:\n\ retab\n\ C/C++ Prog>Box comment@C:Shift+Ctrl+B::EX:\n\ boxcomment|retab\n\ C/C++ Prog>Strip comment@C:::IX:\n\ sed -e 's./\\\\*. .' -e 's.\\\\*/. .' -e 's.//. .'\n\ File>Find in files>Find all and open@C:Shift+Ctrl+Alt+F::ID:\n\ f="`cat`"; nedits -noask -do "find(\\"$f\\")" `grep -F -l "$f" ./*.[ch]`\n\ File>Find in files>Find all and open@C++:Shift+Ctrl+Alt+F::ID:\n\ f="`cat`"; nedits -noask -do "find(\\"$f\\")" `grep -F -l "$f" ./*.[CHch]*`\n\ File>Find in files>Find all@C:Shift+Alt+F::IW:\n\ grep -F -n -e "`cat`" [a-zA-Z]*.[ch]\n\ File>Find in files>Find all@C++:Shift+Alt+F::IW:\n\ grep -F -n -e "`cat`" [a-zA-Z]*.[chCH]*\n\ File>Find in files>Find all@*:Shift+Alt+F::IW:\n\ grep -F -n -e "`cat`" *\n\ File>Find in files>Open found:::ID:\n\ f="`(cat; echo "")|cut -f1,2 -d:`"; fl=`echo "$f"|cut -f1 -d:`; li=`echo "$f"|cut -f2 -d:`; nedits -noask -line $li $fl\n\ File>chmod u+w:::DL:\n\ chmod u+w %\n\ File>chmod u-w:::DL:\n\ chmod u-w %\n\ File>save & chmod u-w:::DSL:\n\ chmod u-w %\n nedit.macroCommands: \ List files:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ #define list_all_files\n\ # {\n\ byName = "name"\n\ byPath = "path"\n\ byOpen = "open order (last first)"\n\ \n\ file = ""\n\ nsort = byName\n\ \n\ # count files\n\ nFile = 0\n\ for (file = focus_window("last"); file != ""; file = focus_window("next"))\n\ nFile++\n\ \n\ while (file == "")\n\ {\n\ list = ""\n\ sort = nsort\n\ current = $file_path $file_name\n\ \n\ files = $empty_array\n\ \n\ # add files into array with keys in the selected sort order\n\ if (nsort == byName)\n\ {\n\ for (file = focus_window("last"); file != ""; file = focus_window("next"))\n\ files[$file_name " - " $file_path] = file\n\ nsort = byPath\n\ }\n\ else if (nsort == byPath)\n\ {\n\ for (file = focus_window("last"); file != ""; file = focus_window("next"))\n\ files[$file_path $file_name] = file\n\ nsort = byOpen\n\ }\n\ else if (nsort == byOpen)\n\ {\n\ i = 0\n\ for (file = focus_window("last"); file != ""; file = focus_window("next"))\n\ files[rjust(i++ + 1, nFile) ": " file] = file\n\ nsort = byName\n\ }\n\ \n\ for (file in files)\n\ list = list file "\\n"\n\ \n\ focus_window(current)\n\ \n\ file = list_dialog(nFile " files sorted by "sort"\\nRaise which file?", \\\n\ list, "OK", "Sort by "nsort, "Cancel")\n\ button = $list_dialog_button\n\ if (file != "" && button == 1)\n\ break\n\ else if (button != 2)\n\ break\n\ }\n\ if (file != "")\n\ {\n\ open(files[file])\n\ focus_window(files[file])\n\ raise_window(files[file])\n\ }\n\ # }\n\ }\n\ Open multiple files:Shift+Ctrl+O::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ NEDIT_require_macro_file("array_utils.nm")\n\ NEDIT_require_macro_file("cygwin.nm")\n\ \n\ $OpenMultipleFiles[""] = 0\n\ \n\ Title = "Open multiple files\\n"\n\ T = Title\n\ E = "" # error\n\ \n\ lsmatch = ""\n\ lsopts = ""\n\ if ("lsopts" in $OpenMultipleFiles)\n\ lsopts = $OpenMultipleFiles["lsopts"]\n\ if ("lsmatch" in $OpenMultipleFiles)\n\ lsmatch = $OpenMultipleFiles["lsmatch"]\n\ \n\ openmodes = make_array("New Windows", make_arraylist1("window", "window"), \\\n\ "New Group", make_arraylist1("window", "tab"), \\\n\ "This Group", make_arraylist1("tab", "tab"))\n\ \n\ buttons = make_arraylist1("New Windows", "New Group", "This Group", \\\n\ "Options", "Filter", "Set Path", "Up", "Back")\n\ dbuttons = make_arraylist1("Enter", "Options", "Filter", "Set Path", \\\n\ "Up", "Back")\n\ opt = $empty_array\n\ \n\ ocwd = $empty_array\n\ cwd = $file_path\n\ oldwindow = $file_path $file_name\n\ \n\ if (cwd == "")\n\ {\n\ # remove any trailing / (only at root level?) from pwd result\n\ cwd = chomp(shell_command("pwd", ""), "/?\\n")\n\ if ($shell_cmd_status != 0)\n\ cwd = ""\n\ else # now add a trailing / (again)\n\ cwd = cwd "/"\n\ }\n\ \n\ if (cwd == "")\n\ return dialog(T "Could not determine current directory", "Dismiss")\n\ \n\ find_d = "find . -type d '!' -name . -print -prune | sort"\n\ find_f = "find . -type d '!' -name . -prune -o -type f -print"\n\ \n\ # ==============================================================================\n\ \n\ for (;;) # until happy\n\ {\n\ T = Title "In directory " cwd "\\n"\n\ if (ocwd[])\n\ T = T "(previous directory " ocwd[ocwd[] - 1] ", ["ocwd[]"])\\n\\n"\n\ if (E != "")\n\ E = "\\nERROR: " E "\\n\\n"\n\ \n\ cwds = quote_literal_for_shell_esc(cwd)\n\ aa = " && "\n\ cd_cwd = "cd " cwds aa\n\ echo = aa "echo '///'" aa # the /// will separate output from commands\n\ \n\ dirns = ""\n\ files = ""\n\ ls = ""\n\ # call ls, find dirns and find files\n\ cmd = cd_cwd "ls " lsopts lsmatch\n\ out = shell_command(cmd echo find_d echo find_f, "")\n\ if ($shell_cmd_status != 0)\n\ {\n\ # the ls command failed: execute the command again, picking up only stderr\n\ # (assumes find always works)\n\ EE = "FAILED " cmd "\\n" chomp(shell_command(cmd "> /dev/null", ""), "\\n+")\n\ }\n\ else\n\ {\n\ # save options/match-filters for next time\n\ $OpenMultipleFiles["lsopts"] = lsopts\n\ $OpenMultipleFiles["lsmatch"] = lsmatch\n\ # get the lists of plain files and directories directories\n\ pieces = split(out, "///\\n")\n\ ls = pieces[0]\n\ dirns = "\\n" replace_in_string(pieces[1], "^\\\\./(.*)$", "\\\\1/", "regex")\n\ files = "\\n" replace_in_string(pieces[2], "./", "")\n\ \n\ if ($shell_cmd_status != 0)\n\ {\n\ ls = ""\n\ }\n\ }\n\ \n\ list = ""\n\ n_files = 0\n\ end = 0\n\ for (pos = search_string(ls, "^.+\\n", end, "regex"); \\\n\ pos >= 0; \\\n\ pos = search_string(ls, "^.+\\n", end, "regex"))\n\ {\n\ end = $search_end # keep ending \\n\n\ filename = substring(ls, pos, end)\n\ \n\ if (search_string(files, "\\n" filename, 0, "case") < 0)\n\ continue # skip: not a plain file\n\ else if (substring(filename, 0, 1) == "~" && \\\n\ search_string(lsopts, " ?-A ", 0, "regex") < 0)\n\ continue # skip: this is (probably) a NEdit backup file\n\ # however, show it if we're looking for all files\n\ \n\ list = list filename\n\ ++n_files\n\ }\n\ list = chomp(dirns list)\n\ \n\ # we have our list of files\n\ if (list == "")\n\ {\n\ E = "No files or directories found in directory " cwd\n\ \n\ i = ocwd[] - 1\n\ if (i < 0) # nowhere to go back to\n\ return dialog(T "\\nERROR: " E, "Dismiss")\n\ newcwd = ocwd[i]\n\ E = E "\\nReturning from directory " cwd\n\ E = E "\\nto directory " newcwd\n\ cwd = newcwd\n\ delete ocwd[i]\n\ continue\n\ }\n\ \n\ # ask for filenames ----------------------------------------------------------\n\ F = "[command ' ls " lsopts lsmatch "' found " n_files " files]\\n"\n\ if (n_files == 0)\n\ {\n\ # ask for a single directory\n\ res = list_dialog(T E F "Select a directory to enter", \\\n\ list, \\\n\ dbuttons[1], dbuttons[2], dbuttons[3], \\\n\ dbuttons[4], dbuttons[5], dbuttons[6], \\\n\ "Cancel")\n\ if (!($list_dialog_button in dbuttons))\n\ return\n\ sbtn = dbuttons[$list_dialog_button]\n\ }\n\ else\n\ {\n\ if (ocwd[] == 0)\n\ res = list_multisel_dialog(T E F "Select files or a single directory", \\\n\ list, \\\n\ buttons[1], buttons[2], buttons[3], \\\n\ buttons[4], buttons[5], buttons[6], \\\n\ buttons[7], "Cancel")\n\ else\n\ res = list_multisel_dialog(T E F "Select files or a single directory", \\\n\ list, \\\n\ buttons[1], buttons[2], buttons[3], \\\n\ buttons[4], buttons[5], buttons[6], \\\n\ buttons[7], buttons[8], "Cancel")\n\ limit = buttons[] - (ocwd[] == 0)\n\ if ($list_dialog_button > limit || !($list_dialog_button in buttons))\n\ return\n\ sbtn = buttons[$list_dialog_button]\n\ }\n\ \n\ # now what?\n\ E = ""\n\ isdir = 0\n\ if (sbtn in openmodes) # -----------------------------------------------------\n\ {\n\ if (res == "")\n\ E = "No files selected"\n\ isdir = (search_string(res, "/", 0) >= 0)\n\ if (isdir && search_string(res, "\\n", 0) > 0)\n\ E = "Cannot include directories in mutiple selections"\n\ if (E != "")\n\ continue\n\ \n\ if (isdir)\n\ {\n\ ocwd[ocwd[]] = cwd\n\ cwd = cwd res\n\ continue\n\ }\n\ \n\ openmode = openmodes[sbtn]\n\ newopt = 1\n\ \n\ filenames = split(res, "\\n")\n\ for (i = 0; i in filenames; ++i)\n\ {\n\ filename = filenames[i]\n\ EE = ""\n\ if (focus_window(cwd filename) != "")\n\ {\n\ EE = "\\n file already opened: " filenames[i]\n\ }\n\ else\n\ {\n\ read_file(cwd filename)\n\ if ($read_status)\n\ {\n\ new(openmode[newopt])\n\ if (newopt < openmode[])\n\ ++newopt\n\ focus_window("last")\n\ open(cwd filename)\n\ }\n\ else\n\ EE = "\\n failed to open " filenames[i]\n\ }\n\ E = E EE\n\ }\n\ focus_window(oldwindow)\n\ raise_window()\n\ }\n\ else if (sbtn == "Enter") # --------------------------------------------------\n\ {\n\ if (res == "")\n\ E = "No directory selected"\n\ else\n\ {\n\ ocwd[ocwd[]] = cwd\n\ cwd = cwd res\n\ }\n\ }\n\ else if (sbtn == "Set Path") # -----------------------------------------------\n\ {\n\ # pick up selection, clipboard etc\n\ clip = clipboard_to_string()\n\ sel = get_selection("any")\n\ \n\ prompt = T "Enter new directory path"\n\ i = 0\n\ \n\ name = "Cancel"\n\ btns[i++] = name\n\ val[name] = ""\n\ \n\ btns[i++] = "OK"\n\ \n\ if (clip != "")\n\ {\n\ prompt = prompt "\\n clipboard: '" clip "'"\n\ name = "Clipboard"\n\ btns[i++] = name\n\ val[name] = clip\n\ }\n\ \n\ if (sel != "")\n\ {\n\ prompt = prompt "\\n selection: '" sel "'"\n\ name = "Selection"\n\ btns[i++] = name\n\ val[name] = sel\n\ }\n\ btns[i++] = btns[0]\n\ \n\ if (i == 3)\n\ str = string_dialog(prompt, btns[1], btns[2])\n\ else if (i == 4)\n\ str = string_dialog(prompt, btns[1], btns[2], btns[3])\n\ else if (i == 5)\n\ str = string_dialog(prompt, btns[1], btns[2], btns[3], btns[4])\n\ \n\ val["OK"] = str\n\ choice = btns[$string_dialog_button]\n\ str = val[choice]\n\ if (str == "")\n\ continue\n\ \n\ newcwd = str\n\ if (Cygwin_isCygwin())\n\ {\n\ if (search_string(str, "/", 0) < 0 || \\\n\ search_string(str, "^\\\\l:[\\\\\\\\/]", 0, "regex") >= 0)\n\ {\n\ # no "/"s or starts with eg "c:\\" - may be a Windows/DOS path\n\ str = Cygwin_convertDOSpath(str)\n\ if (str != "")\n\ newcwd = str\n\ }\n\ }\n\ str = newcwd\n\ newcwd = quote_literal_for_shell_esc(newcwd)\n\ newcwd = chomp(shell_command("cd " newcwd " && pwd", ""), "/?\\n")\n\ if ($shell_cmd_status != 0)\n\ newcwd = ""\n\ else # now add a trailing / (again)\n\ newcwd = newcwd "/"\n\ if (newcwd == "")\n\ E = "Could not move to directory " str\n\ else if (newcwd != cwd)\n\ {\n\ ocwd[ocwd[]] = cwd\n\ cwd = newcwd\n\ }\n\ }\n\ else if (sbtn == "Up") # -----------------------------------------------------\n\ {\n\ newcwd = quote_literal_for_shell_esc(cwd)\n\ newcwd = chomp(shell_command("cd " newcwd ".. && pwd", ""), "/?\\n")\n\ if ($shell_cmd_status != 0)\n\ newcwd = ""\n\ else # now add a trailing / (again)\n\ newcwd = newcwd "/"\n\ if (newcwd == "")\n\ E = "Could not move up to parent directory of " cwd\n\ else if (newcwd != cwd)\n\ {\n\ ocwd[ocwd[]] = cwd\n\ cwd = newcwd\n\ }\n\ }\n\ else if (sbtn == "Back") # ---------------------------------------------------\n\ {\n\ i = ocwd[] - 1\n\ if (i < 0) # nowhere to go back to\n\ return dialog(T "\\nERROR: Invalid Back button: check macro code", \\\n\ "Dismiss")\n\ cwd = ocwd[i]\n\ delete ocwd[i]\n\ }\n\ else if (sbtn == "Options") # ------------------------------------------------\n\ {\n\ if (!opt[])\n\ {\n\ opt["Show hidden files"] = make_array("", "Off", \\\n\ "On", "-A ", \\\n\ "Off", "")\n\ opt["Reverse Sort"] = make_array("", "Off", \\\n\ "On", "-r ", \\\n\ "Off", "")\n\ opt["Sort"] = make_array("", "alphabetically", \\\n\ "alphabetically", "", \\\n\ "by extension", "-X ", \\\n\ "by size", "-S ", \\\n\ "by time (access)", "-u ", \\\n\ "by time (modification)", "-t ")\n\ }\n\ # build the list of allowed options, marking selected ones with >>\n\ optslist = ""\n\ EE = ""\n\ for (anopt in opt)\n\ {\n\ partlist = ""\n\ thename = opt[anopt][""]\n\ thepart = anopt ": " thename\n\ for (aname in opt[anopt])\n\ {\n\ if (aname == "")\n\ continue\n\ apart = anopt ": " aname\n\ partlist = partlist " " apart "\\n"\n\ if (search_string(lsopts, opt[anopt][aname], 0) >= 0)\n\ {\n\ thename = aname\n\ thepart = apart\n\ }\n\ }\n\ partlist = replace_in_string(partlist, " " thepart, \\\n\ ">> " thepart, "case")\n\ optslist = optslist partlist\n\ }\n\ # get new ones\n\ newlist = list_multisel_dialog("Choose file list options,\\n" \\\n\ "no more than one per group", \\\n\ optslist) "\\n"\n\ newopts = ""\n\ for (anopt in opt)\n\ {\n\ re_opt = "^(?!.. " anopt ": ).*\\\\n"\n\ re_old = "^(?!\\\\>\\\\> " anopt ": ).*\\\\n"\n\ grepped = replace_in_string(newlist, re_opt, "", "regex", "copy")\n\ nGrepped = length(replace_in_string(grepped, "[^\\n]*", "", "regex"))\n\ if (nGrepped > 1)\n\ EE = EE "\\n - more than one option selected for " anopt\n\ if (nGrepped != 1) # use previous instance, marked with >>\n\ {\n\ grepped = replace_in_string(optslist, re_old, "", "regex", "copy")\n\ }\n\ # get option value name, at end of the line\n\ grepped = replace_in_string(grepped, "^.*: (.*)\\n", "\\\\1", "regex")\n\ value = opt[anopt][grepped]\n\ newopts = newopts value\n\ }\n\ \n\ if (EE == "")\n\ lsopts = newopts\n\ else\n\ E = "Failed to change list options:" EE\n\ }\n\ else if (sbtn == "Filter") # -------------------------------------------------\n\ {\n\ EE = ""\n\ for (;;)\n\ {\n\ M = T\n\ if (lsmatch != "")\n\ M = T "Current filter: " lsmatch "\\n"\n\ newmatch = string_dialog(M EE "Enter file patterns to match", \\\n\ "OK", "Clear", "Cancel")\n\ btn = $string_dialog_button\n\ if (btn == 1)\n\ {\n\ if (newmatch == "")\n\ break\n\ newmatch = newmatch " "\n\ if (search_string(newmatch, "[;$`'\\"~&|\\x01-\\x1F]", 0, "regex") >= 0)\n\ {\n\ EE = "Requested matches contain invalid characters\\n"\n\ }\n\ else\n\ {\n\ str = shell_command("exec sh", "for i in " newmatch "; do :; done")\n\ if ($shell_cmd_status == 0 && str == "")\n\ {\n\ # looks OK\n\ lsmatch = newmatch\n\ break\n\ }\n\ EE = "Cannot use given patterns\\nShell replies:\\n" str "\\n"\n\ }\n\ }\n\ else if (btn == 2)\n\ {\n\ lsmatch = ""\n\ break\n\ }\n\ else\n\ break\n\ }\n\ }\n\ else # -----------------------------------------------------------------------\n\ {\n\ E = sbtn " not implemented"\n\ }\n\ }\n\ }\n\ Save all files:Shift+Ctrl+S::: {\n\ NEDIT_require_macro_file("SaveAllFiles.nm")\n\ \n\ SaveAllFiles()\n\ }\n\ Save all files as [format]:::: {\n\ NEDIT_require_macro_file("SaveAllFiles.nm")\n\ \n\ fmt = list_dialog("Save all files with which format?", \\\n\ "unix\\ndos\\nmacintosh", \\\n\ "Save and Tidy", "Save", "Cancel")\n\ btn = $list_dialog_button\n\ if (1 <= btn && btn <= 2 && fmt != "")\n\ {\n\ if (btn == 1)\n\ SaveAllFilesAsFormat(fmt, 1)\n\ else # (btn == 2)\n\ SaveAllFilesAsFormat(fmt, 0)\n\ }\n\ }\n\ Close file (no save):Shift+Ctrl+W::: {\n\ close("nosave")\n\ }\n\ Complete Word:Alt+D::: {\n\ # Tuning parameters\n\ ScanDistance = 5000\n\ \n\ # Search back to a word boundary to find the word to complete\n\ startScan = max(0, $cursor - ScanDistance)\n\ endScan = min($text_length, $cursor + ScanDistance)\n\ scanString = get_range(startScan, endScan)\n\ keyEnd = $cursor-startScan\n\ keyStart = search_string(scanString, "<", keyEnd, "backward", "regex")\n\ if (keyStart == -1)\n\ return\n\ keyString = "<" substring(scanString, keyStart, keyEnd)\n\ \n\ # search both forward and backward from the cursor position. Note that\n\ # using a regex search can lead to incorrect results if any of the special\n\ # regex characters is encountered, which is not considered a delimiter\n\ backwardSearchResult = search_string(scanString, keyString, keyStart-1, \\\n\ "backward", "regex")\n\ forwardSearchResult = search_string(scanString, keyString, keyEnd, "regex")\n\ if (backwardSearchResult == -1 && forwardSearchResult == -1) {\n\ beep()\n\ return\n\ }\n\ \n\ # if only one direction matched, use that, otherwise use the nearest\n\ if (backwardSearchResult == -1)\n\ matchStart = forwardSearchResult\n\ else if (forwardSearchResult == -1)\n\ matchStart = backwardSearchResult\n\ else {\n\ if (keyStart - backwardSearchResult <= forwardSearchResult - keyEnd)\n\ matchStart = backwardSearchResult\n\ else\n\ matchStart = forwardSearchResult\n\ }\n\ \n\ # find the complete word\n\ matchEnd = search_string(scanString, ">", matchStart, "regex")\n\ completedWord = substring(scanString, matchStart, matchEnd)\n\ \n\ # replace it in the window\n\ replace_range(startScan + keyStart, $cursor, completedWord)\n\ }\n\ Remove DOS CRs:::: {\n\ # do replacements one at a time to preserve rangesets, marks etc.\n\ # this does have the unfortunate effect of generating more UNDOs though...\n\ RE = "regex"\n\ PAT = "(\\\\s+\\r?|\\r)$"\n\ for (pos = search(PAT, 0, RE); pos != -1; pos = search(PAT, pos + 1, RE))\n\ replace_range(pos, $search_end, "")\n\ }\n\ Remove DOS CRs (no tidy):::: {\n\ # do replacements one at a time to preserve rangesets, marks etc.\n\ # this does have the unfortunate effect of generating more UNDOs though...\n\ RE = "case"\n\ PAT = "\\r"\n\ for (pos = search(PAT, 0, RE); pos != -1; pos = search(PAT, pos + 1, RE))\n\ replace_range(pos, $search_end, "")\n\ }\n\ Add DOS CRs:::: {\n\ # dialog($file_format)\n\ if ($file_format == "unix")\n\ {\n\ RE = "regex"\n\ PAT = "\\\\s*\\r*$"\n\ for (pos = search(PAT, 0, RE); pos != -1; pos = search(PAT, pos + 2, RE))\n\ replace_range(pos, $search_end, "\\r")\n\ }\n\ }\n\ DOS to Cygwin path convert:::: {\n\ NEDIT_require_macro_file("cygwin.nm")\n\ \n\ Cygwin_convertDOSpathDialog()\n\ }\n\ Launch Windows Explorer:::: {\n\ NEDIT_require_macro_file("cygwin.nm")\n\ \n\ Cygwin_launchWindowsExplorer()\n\ }\n\ Language>Choose language:Ctrl+Equal::: {\n\ NEDIT_require_macro_file("ModeString.nm")\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ # provide a list of languages\n\ list = "\\n" \\\n\ "C++\\n" \\\n\ "Makefile\\n" \\\n\ "Java\\n" \\\n\ "JavaScript\\n" \\\n\ "grep -n out\\n" \\\n\ "CC output\\n" \\\n\ "Windows VC\\n" \\\n\ "Javac output\\n" \\\n\ "Sh Ksh Bash\\n" \\\n\ "Man page output\\n" \\\n\ "NEdit Macro\\n" \\\n\ "NEdit Macro RE\\n" \\\n\ "Awk\\n" \\\n\ "Perl\\n" \\\n\ "SQL\\n" \\\n\ "Doxygen\\n" \\\n\ "Doxygen strict\\n" \\\n\ "X Resources\\n" \\\n\ "C\\n" \\\n\ "SGML HTML\\n" \\\n\ ""\n\ mode = $language_mode\n\ oldmode = mode\n\ currmode = mode\n\ msg = "Choose a language mode\\n(Currently " oldmode ")"\n\ \n\ ######### VERSION 1\n\ # # add two spaces in front of all non-empty lines\n\ # list = replace_in_string(list, "^(?=.)", " ", "regex")\n\ # # change those spaces to ">>" on a line equal to the current language mode\n\ # list = replace_in_string(list, "\\n "mode"\\n", "\\n>>"mode"\\n", "case", "copy")\n\ #\n\ # # ask for a new language mode\n\ # mode = list_dialog(msg, list, "OK", "Prompt", "Cancel")\n\ # mode = substring(mode, 2, length(mode))\n\ \n\ ######### VERSION 2\n\ # mark current mode with "<<" if it is in the list\n\ if (search_string(list, "\\n" mode "\\n", 0) >= 0)\n\ {\n\ pads = replace_in_string(longest_line(list), ".", "<", "regex")\n\ currmode = mode " " substring(pads, length(mode)) "<<"\n\ list = replace_in_string(list, "\\n" mode "\\n", "\\n" currmode "\\n", "case")\n\ }\n\ # ask for a new language mode\n\ mode = list_dialog(msg, list, "OK", "Prompt", "Cancel")\n\ \n\ ######### common exit code\n\ changed = $list_dialog_button == 1\n\ if (mode != "" && mode != currmode && $list_dialog_button == 1)\n\ set_language_mode(mode)\n\ else if ($list_dialog_button == 2)\n\ {\n\ mode = string_dialog("Type a language mode name\\n(Currently " oldmode ")", \\\n\ "OK", "Cancel")\n\ if ($string_dialog_button == 1)\n\ {\n\ if (mode != "" && mode != currmode)\n\ {\n\ set_language_mode(mode)\n\ mode = $language_mode\n\ changed = (mode != "" && mode != currmode)\n\ }\n\ }\n\ else\n\ return\n\ }\n\ else\n\ mode = oldmode\n\ \n\ if (changed)\n\ ModeStringInterpret(mode)\n\ }\n\ Language>From editor string:::: {\n\ NEDIT_require_macro_file("ModeString.nm")\n\ \n\ ModeStringInterpret()\n\ }\n\ Language>C++:::: {\n\ NEDIT_require_macro_file("ModeString.nm")\n\ \n\ ModeStringInterpret("C++")\n\ \n\ if ($language_mode != "C++")\n\ set_language_mode("C++")\n\ }\n\ Language>Doxygen:::: {\n\ b = dialog("Which Doxygen style?", "Easy", "Strict")\n\ if (b == 1)\n\ set_language_mode("Doxygen")\n\ else if (b == 2)\n\ set_language_mode("Doxygen strict")\n\ else\n\ return\n\ \n\ set_em_tab_dist(4) # turn on emulated tabs\n\ set_tab_dist(4)\n\ set_use_tabs(0) # do not use tabs in auto padding\n\ }\n\ Language>grep -n out/compiler output@*:Shift+Ctrl+Equal::: {\n\ if (search("^\\\\s*\\\\^$", $cursor, "regex", "wrap", "backward") >= 0)\n\ # contains single carats on otherwise empty lines\n\ set_language_mode("Javac output")\n\ else\n\ if (search("^[^:]+:\\\\d+:", $cursor, "regex", "wrap", "backward") >= 0)\n\ # matches ...:NNN:...\n\ set_language_mode("grep -n out")\n\ else\n\ if (search("^\\"[^\\"]+\\", line \\\\d+(?::|$)", $cursor, \\\n\ "regex", "wrap", "backward") >= 0)\n\ # matches "...", line NNN:\n\ set_language_mode("CC output")\n\ else\n\ {\n\ mode = list_dialog("Choose a language mode", \\\n\ "grep -n out\\n" \\\n\ "Windows VC\\n" \\\n\ "CC output\\n" \\\n\ "Javac output", "OK", "Cancel")\n\ if (mode != "" && $list_dialog_button == 1)\n\ set_language_mode(mode)\n\ }\n\ }\n\ Language>grep -n out/CC output@NEdit Macro:::: {\n\ macro_menu_command("Language>grep -n out/CC output@*")\n\ }\n\ Language>grep -n out/CC output@NEdit Macro RE:::: {\n\ macro_menu_command("Language>grep -n out/CC output@*")\n\ }\n\ Language>NEdit Macro RE@NEdit Macro:Shift+Ctrl+Equal::: {\n\ set_language_mode("NEdit Macro RE")\n\ set_tab_dist(8)\n\ }\n\ Language>NEdit Macro@NEdit Macro RE:Shift+Ctrl+Equal::: {\n\ set_language_mode("NEdit Macro")\n\ set_tab_dist(8)\n\ }\n\ Language>NEdit Macro@*:::: {\n\ set_language_mode("NEdit Macro")\n\ set_tab_dist(8)\n\ }\n\ Language>grep -n out:::: {\n\ set_language_mode("grep -n out")\n\ }\n\ Language>Tabs 4:Ctrl+4:4:: {\n\ set_tab_dist(4)\n\ }\n\ Language>Tabs 8:Ctrl+8:8:: {\n\ set_tab_dist(8)\n\ }\n\ Language>Toggle tabs 4 - 8:Ctrl+Minus::: {\n\ if ($tab_dist == 8)\n\ set_tab_dist(4)\n\ else\n\ set_tab_dist(8)\n\ }\n\ Language>Toggle hard tabs:Shift+Ctrl+Minus:8:: {\n\ $tabs_info[""] = ""\n\ \n\ key = $file_path $file_name $sub_sep "old_em_tab_dist"\n\ \n\ if (!(key in $tabs_info))\n\ {\n\ if ($em_tab_dist > 0)\n\ $tabs_info[key] = $em_tab_dist\n\ else\n\ $tabs_info[key] = $tab_dist\n\ }\n\ \n\ dist = $tabs_info[key]\n\ \n\ # remove or restore tab emulation\n\ if ($use_tabs)\n\ {\n\ set_use_tabs(0)\n\ set_em_tab_dist($tabs_info[key])\n\ dialog("Not using hard tabs in padding\\n(emulated tabs = "$em_tab_dist")")\n\ }\n\ else\n\ {\n\ set_use_tabs(1)\n\ set_em_tab_dist(0)\n\ dialog("Using hard tabs in padding\\n" \\\n\ "(emulated tab distance = 0 [old: " dist "])")\n\ }\n\ }\n\ Language>Set hard tab width:Alt+Minus:8:: {\n\ n = string_dialog("Enter the new hard tab width (currently " $tab_dist ")")\n\ if (valid_number(n))\n\ set_tab_dist(n)\n\ else\n\ beep()\n\ }\n\ Language>Set soft tab width:Ctrl+Alt+Minus:8:: {\n\ $tabs_info[""] = ""\n\ \n\ key = $file_path $file_name $sub_sep "old_em_tab_dist"\n\ if (!(key in $tabs_info))\n\ {\n\ if ($em_tab_dist > 0)\n\ $tabs_info[key] = $em_tab_dist\n\ else\n\ $tabs_info[key] = $tab_dist\n\ }\n\ \n\ emtabdist = $em_tab_dist\n\ emtabs = "ON"\n\ if ($em_tab_dist <= 0)\n\ {\n\ emtabdist = $tabs_info[key]\n\ emtabs = "OFF"\n\ }\n\ else\n\ $tabs_info[key] = $em_tab_dist\n\ \n\ if ($use_tabs)\n\ usetabs = "ON"\n\ else\n\ usetabs = "OFF"\n\ \n\ prompt = "Enter the new soft tab width (currently " emtabdist ")" \\\n\ "\\n soft tabbing is " emtabs \\\n\ "\\n use of hard tabs in fills is " usetabs \\\n\ "\\n hard tab width is " $tab_dist\n\ \n\ n = string_dialog(prompt, \\\n\ "OK", "Toggle soft tabs", "Toggle hard tab fill")\n\ btn = $string_dialog_button\n\ \n\ if (valid_number(n) && 0 < btn && btn <= 3)\n\ {\n\ if (0 < n && n <= 20)\n\ {\n\ if ($em_tab_dist > 0)\n\ set_em_tab_dist(n)\n\ emtabdist = n\n\ if (emtabdist <= 0)\n\ emtabdist = $tab_dist\n\ }\n\ else\n\ {\n\ btn = 1\n\ dialog("Ignoring invalid value '" n "' of soft tab width\\n" \\\n\ "(value must be between 1 and 20)", "Dismiss")\n\ }\n\ }\n\ n = emtabdist\n\ $tabs_info[key] = emtabdist\n\ if (btn == 2)\n\ {\n\ set_em_tab_dist(emtabdist * ($em_tab_dist <= 0))\n\ }\n\ if (btn == 3)\n\ {\n\ set_use_tabs(!$use_tabs)\n\ }\n\ }\n\ Language>Highlight productions@Yacc:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ NEDIT_require_macro_file("array_utils.nm")\n\ NEDIT_require_macro_file("RSextensions.nm")\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ prodnames = ""\n\ yaccValues = $empty_array\n\ alt = ""\n\ \n\ # find first and last, positions of the two %% markers\n\ first = search("^\\\\s*%%", 0, "regex")\n\ if (first < 0) first = $text_length\n\ last = search("^\\\\s*%%", $search_end, "regex")\n\ \n\ # create the opposite to prs\n\ xrs = "~Yacc productions"\n\ RangeSet_forget(xrs)\n\ RangeSet_add(xrs, 0, $text_length)\n\ RangeSet_remove(xrs, 0, $text_length)\n\ \n\ # create prs - the Yacc productions rangeset\n\ prs = "Yacc productions"\n\ RangeSet_forget(prs)\n\ RangeSet_set_color(prs, "#E0E0E0")\n\ if (last < 0) last = $text_length\n\ # find productions - assumed to be one line per production alternative\n\ # starting either "production_name:" or "|".\n\ end = 0\n\ for (pos = search("^\\\\w*\\\\s*[:|]\\\\s*('\\\\{'|[^\\\\{])*", first, "regex"); \\\n\ pos != -1 && pos < last; \\\n\ pos = search("^\\\\w*\\\\s*[:|]\\\\s*('\\\\{'|[^\\\\{])*", end, "regex"))\n\ {\n\ end = $search_end\n\ RangeSet_add(prs, pos, end)\n\ pn = search("(?n^\\\\w*(?=\\\\s*:))", pos, "regex")\n\ pe = $search_end\n\ if (pn >= 0)\n\ {\n\ name = get_range(pn, pe)\n\ if (!(name in yaccValues))\n\ {\n\ yaccValues[name] = "non-terminal (with production)"\n\ prodnames = prodnames alt "<" name ">"\n\ alt = "|"\n\ }\n\ }\n\ }\n\ \n\ # evaluate xrs\n\ RangeSet_add(xrs, prs)\n\ RangeSet_inverse(xrs)\n\ RangeSet_remove(xrs, 0, first)\n\ RangeSet_remove(xrs, last, $text_length)\n\ # add comments to xrs\n\ end = 0\n\ for (pos = search("(?n/\\\\*(?:(?!\\\\*/).)*\\\\*/)", 0, "regex"); \\\n\ pos != -1; \\\n\ pos = search("(?n/\\\\*(?:(?!\\\\*/).)*\\\\*/)", end, "regex"))\n\ {\n\ end = $search_end\n\ RangeSet_add(xrs, pos, end)\n\ }\n\ \n\ # extract production names from the productions found\n\ nrs = "Yacc production names"\n\ RangeSet_forget(nrs)\n\ RangeSet_set_color(nrs, "#FFFFFF")\n\ if (prodnames != "")\n\ {\n\ end = 0\n\ for (pos = search(prodnames, first, "regex"); \\\n\ pos != -1 && pos < last; \\\n\ pos = search(prodnames, end, "regex"))\n\ {\n\ end = $search_end\n\ RangeSet_add(nrs, pos, end)\n\ }\n\ }\n\ \n\ # pick up tokens and literals\n\ trs = "Yacc tokens"\n\ RangeSet_forget(trs)\n\ RangeSet_set_color(trs, "#F0F0F0")\n\ tokens = ""\n\ alt = ""\n\ # they are defined in token/production definition lines\n\ pcentdirective = "^\\\\s*%(token|type|nonassoc|right|left)\\\\s*(?:\\\\<\\\\w+\\\\>\\\\s*)?"\n\ end = 0\n\ for (pos = search(pcentdirective, 0, "regex"); \\\n\ pos != -1 && pos < first; \\\n\ pos = search(pcentdirective, end, "regex"))\n\ {\n\ end = $search_end\n\ eol = search("\\n", end)\n\ if (eol == -1) eol = $text_length\n\ for (pn = search("(?n\\\\w+|'.'|'\\\\\\\\.')", end, "regex"); \\\n\ pn != -1 && pn < eol; \\\n\ pn = search("(?n\\\\w+|'.'|'\\\\\\\\.')", pe, "regex"))\n\ {\n\ pe = $search_end\n\ tok = get_range(pn, pe)\n\ if (!(tok in yaccValues))\n\ {\n\ if (substring(tok, 0, 1) == "'")\n\ {\n\ yaccValues[tok] = "literal"\n\ tokens = tokens alt quote_literal_as_regex(tok)\n\ }\n\ else\n\ {\n\ yaccValues[tok] = "token"\n\ tokens = tokens alt "<" tok ">"\n\ }\n\ alt = "|"\n\ }\n\ }\n\ }\n\ # extraneous, undeclared literals in productions?\n\ #nprs = RangeSet_get_count(prs)\n\ #dialog(prs " as " nprs " ranges")\n\ for (ind = 0; RangeSet_defined(prs, ind); ind++)\n\ {\n\ #RangeSet_select(prs, ind)\n\ #set_cursor_pos($RangeSet_range_start)\n\ #RangeSet_defined(prs, ind)\n\ #else dialog(prs " range " ind " from " $RangeSet_range_start " to " $RangeSet_range_end)\n\ pos = $RangeSet_range_start\n\ end = $RangeSet_range_end\n\ for (pn = search("(?n'.'|'\\\\\\\\.')", pos, "regex"); \\\n\ pn != -1 && pn < end; \\\n\ pn = search("(?n'.'|'\\\\\\\\.')", pe, "regex"))\n\ {\n\ pe = $search_end\n\ tok = get_range(pn, pe)\n\ if (!(tok in yaccValues))\n\ {\n\ yaccValues[tok] = "literal (in production only)"\n\ tokens = tokens alt quote_literal_as_regex(tok)\n\ alt = "|"\n\ }\n\ }\n\ }\n\ # now find them all\n\ end = 0\n\ for (pos = search(tokens, 0, "regex"); \\\n\ pos != -1; \\\n\ pos = search(tokens, end, "regex"))\n\ {\n\ end = $search_end\n\ RangeSet_add(trs, pos, end)\n\ }\n\ \n\ array_select_entry("Yacc words", yaccValues)\n\ RangeSet_remove(prs, xrs)\n\ RangeSet_remove(nrs, xrs)\n\ RangeSet_remove(trs, xrs)\n\ RangeSet_forget(xrs)\n\ }\n\ Comments>/* Comment */@C@C++@Java@CSS@JavaScript@Lex:::R: {\n\ selStart = $selection_start\n\ selEnd = $selection_end\n\ replace_range(selStart, selEnd, "/* " get_selection() " */")\n\ select(selStart, selEnd + 6)\n\ }\n\ Comments>/* Uncomment */@C@C++@Java@CSS@JavaScript@Lex:::R: {\n\ sel = get_selection()\n\ selStart = $selection_start\n\ selEnd = $selection_end\n\ commentStart = search_string(sel, "/*", 0)\n\ if (substring(sel, commentStart + 2, commentStart + 3) == " ")\n\ keepStart = commentStart + 3\n\ else\n\ keepStart = commentStart + 2\n\ keepEnd = search_string(sel, "*/", length(sel), "backward")\n\ commentEnd = keepEnd + 2\n\ if (substring(sel, keepEnd - 1, keepEnd) == " ")\n\ keepEnd = keepEnd - 1\n\ replace_range(selStart + commentStart, selStart + commentEnd, \\\n\ substring(sel, keepStart, keepEnd))\n\ select(selStart, selEnd - (keepStart-commentStart) - \\\n\ (commentEnd - keepEnd))\n\ }\n\ Comments>// Comment@C@C++@Java@JavaScript:::R: {\n\ replace_in_selection("^.*$", "// &", "regex")\n\ }\n\ Comments>// Uncomment@C@C++@Java@JavaScript:::R: {\n\ replace_in_selection("(^[ \\\\t]*// ?)(.*)$", "\\\\2", "regex")\n\ }\n\ Comments>// --- bar@C++@Java@JavaScript:::: {\n\ beginning_of_line()\n\ insert_string("// -----------------------------------------------------------------------------\\n")\n\ }\n\ Comments>// ==== bar@C++@Java@JavaScript:::: {\n\ beginning_of_line()\n\ insert_string("// =============================================================================\\n")\n\ }\n\ Comments>/* --- */ bar@C@C++@Java@JavaScript:::: {\n\ beginning_of_line()\n\ insert_string("/* -------------------------------------------------------------------------- */\\n")\n\ }\n\ Comments>/*-*-*/ to //@C@C++@Java@JavaScript:::: {\n\ # replace c-style vbar comments eg\n\ # /* this is a\n\ # * c-style vbar comment\n\ # */\n\ # with lines starting //\n\ \n\ pos = $cursor\n\ begF = search("/*", pos, "case", "forward")\n\ begB = search("/*", pos, "case", "backward")\n\ \n\ if (begF == -1) begF = begB\n\ if (begB == -1) begB = begF\n\ if (begF == -1) return\n\ \n\ deltaF = max(begF - pos, pos - begF)\n\ deltaB = max(begB - pos, pos - begB)\n\ if (deltaF < deltaB)\n\ beg = begF\n\ else\n\ beg = begB\n\ \n\ begsol = search("\\n", beg, "case", "backward") + 1 # fails with 0: great\n\ \n\ fin = search("\\\\*/\\\\s*\\n?", beg, "regex", "forward")\n\ finend = $search_end\n\ \n\ finsol = search("\\n", fin, "case", "backward") + 1\n\ select(begsol, finend)\n\ \n\ re = "(\\\\s*)/\\\\*.*\\n(?:\\\\1\\\\s\\\\*.*\\n)*\\\\1\\\\s\\\\*/\\\\s*\\n?"\n\ if (search(re, begsol, "regex", "forward") == begsol && \\\n\ $search_end == finend)\n\ {\n\ select(begsol, finend)\n\ s = get_range(begsol, finend)\n\ front = get_range(begsol, beg)\n\ t = replace_in_string(s, "^" front "[/ ][*]/?", front "//", "regex")\n\ u = replace_in_string(t, "\\\\s+\\n", "\\n", "regex", "copy")\n\ v = replace_in_string(u, "^" front "//\\n", "", "regex", "copy")\n\ #dialog("vbar c to c++" "\\n" \\\n\ # "s =\\n" replace_in_string(s, "^", " »", "regex", "copy") "«««" "\\n" \\\n\ # "front = \\"" front "\\"" "\\n" \\\n\ # "t =\\n" replace_in_string(t, "^", " »", "regex", "copy") "«««" "\\n" \\\n\ # "u =\\n" replace_in_string(u, "^", " »", "regex", "copy") "«««" "\\n" \\\n\ # "v =\\n" replace_in_string(v, "^", " »", "regex", "copy") "«««")\n\ replace_range(begsol, finend, v)\n\ }\n\ }\n\ Comments># Comment@Perl@Sh Ksh Bash@NEdit Macro@Makefile@Awk@Csh@Python@Tcl@Hash comments:::R: {\n\ replace_in_selection("^.*$", "#&", "regex")\n\ }\n\ Comments># Uncomment@Perl@Sh Ksh Bash@NEdit Macro@Makefile@Awk@Csh@Python@Tcl@Hash comments:::R: {\n\ replace_in_selection("(^[ \\\\t]*#)(.*)$", "\\\\2", "regex")\n\ }\n\ Comments># --- bar@Perl@Sh Ksh Bash@NEdit Macro@Makefile@Awk@Csh@Python@Tcl@Hash comments:::: {\n\ beginning_of_line()\n\ insert_string("# ------------------------------------------------------------------------------\\n")\n\ }\n\ Comments>-- Comment@SQL:::R: {\n\ replace_in_selection("^.*$", "--&", "regex")\n\ }\n\ Comments>-- Uncomment@SQL:::R: {\n\ replace_in_selection("(^[ \\\\t]*--)(.*)$", "\\\\2", "regex")\n\ }\n\ Comments>; Comment@Semi comments@PicoBlaze Assembler:::R: {\n\ # replace_in_selection("^.*$", "; &", "regex")\n\ \n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ beg = $selection_start\n\ end = $selection_end\n\ \n\ if (beg < 0)\n\ {\n\ beg = $cursor\n\ end = beg\n\ }\n\ \n\ beg = start_of_line_pos(beg)\n\ bad = start_of_line_pos(end)\n\ if (bad != end)\n\ end = end_of_line_pos(end)\n\ \n\ s = get_range(beg, end)\n\ \n\ # replace a leading space (if followed by a second) with a semicolon\n\ s = replace_in_string(s, "^ ( .*)$", ";\\\\1", "regex", "copy")\n\ # prefix with a semicolon anything which doesn't already start with a semicolon\n\ s = replace_in_string(s, "^([^;].*)$", ";\\\\1", "regex", "copy")\n\ \n\ replace_range(beg, end, s)\n\ select(beg, beg + length(s))\n\ }\n\ Comments>; Uncomment@Semi comments@PicoBlaze Assembler:::R: {\n\ # replace_in_selection("(^[ \\\\t]*;)(.*)$", "\\\\2", "regex")\n\ \n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ beg = $selection_start\n\ end = $selection_end\n\ \n\ if (beg < 0)\n\ {\n\ beg = $cursor\n\ end = beg\n\ }\n\ \n\ beg = start_of_line_pos(beg)\n\ bad = start_of_line_pos(end)\n\ if (bad != end)\n\ end = end_of_line_pos(end)\n\ \n\ s = get_range(beg, end)\n\ \n\ # replace a semicolon with a space if followed by a space sequence\n\ # then a word character or semicolon\n\ s = replace_in_string(s, "^;( +(?:\\\\w|;).*)$", " \\\\1", "regex", "copy")\n\ # remove a leading semicolon if followed by a word character\n\ s = replace_in_string(s, "^;(\\\\w.*)$", "\\\\1", "regex", "copy")\n\ \n\ replace_range(beg, end, s)\n\ select(beg, beg + length(s))\n\ }\n\ Comments>Toggle ; ±debug statement comments@PicoBlaze Assembler:::: {\n\ pos = search("^.*;.*[+-]debug>", 0, "regex")\n\ posend = $search_end\n\ if (pos < 0)\n\ {\n\ return dialog("Toggle ; ±debug statement: no ±debug comment found")\n\ }\n\ tog = get_range(posend - length("debug") - 1, posend - length("debug"))\n\ if (tog == "+")\n\ {\n\ REplusminus = "\\\\+"\n\ REminusplus = "-"\n\ nottog = "-"\n\ }\n\ else\n\ {\n\ REplusminus = "-"\n\ REminusplus = "\\\\+"\n\ nottog = "+"\n\ }\n\ \n\ cmt = search("^ *;", pos, "regex")\n\ if (cmt < 0 || cmt > posend)\n\ {\n\ # first instance of ±debug is active (uncommented) - make it inactive\n\ RE_DoComment = "^\\\\s*(?=[^;])\\\\S.*;.*" REplusminus "debug>.*$"\n\ RE_UnComment = "^\\\\s*;\\\\s*\\\\S.*;.*" REminusplus "debug>.*$"\n\ prompt = " Commenting lines with '; ... "tog"debug\\n" \\\n\ " Uncommenting lines with '; ... "nottog"debug\\n"\n\ }\n\ else\n\ {\n\ # this instance of ±debug is inactive (commented) - make it active\n\ RE_DoComment = "^\\\\s*(?=[^;])\\\\S.*;.*" REminusplus "debug>.*$"\n\ RE_UnComment = "^\\\\s*;\\\\s*\\\\S.*;.*" REplusminus "debug>.*$"\n\ prompt = " Commenting lines with '; ... "nottog"debug\\n" \\\n\ " Uncommenting lines with '; ... "tog"debug\\n"\n\ }\n\ \n\ prompt = "Toggle ; ±debug statement comments\\n" prompt\n\ \n\ show_it = dialog(prompt "Track ±debug comment toggling?", "Yes", "No", "Cancel")\n\ if (show_it < 1 || 2 < show_it)\n\ return\n\ show_it = (show_it == 1)\n\ \n\ oldpos = $cursor\n\ \n\ # loop for uncommenting\n\ for (beg = search(RE_UnComment, 0, "regex"); \\\n\ beg >= 0; \\\n\ beg = search(RE_UnComment, end, "regex"))\n\ {\n\ end = $search_end\n\ s = get_range(beg, end)\n\ if (show_it) set_cursor_pos(beg)\n\ if (show_it) select(beg, end)\n\ \n\ # replace the first semicolon with a space\n\ s = replace_in_string(s, "^(\\\\s*);", "\\\\1 ", "regex", "copy")\n\ # remove a starting space if followed by non-space\n\ s = replace_in_string(s, "^ (?=\\\\S)([^;]*)", "\\\\1 ", "regex", "copy")\n\ \n\ replace_range(beg, end, s)\n\ if (show_it) select(beg, beg + length(s))\n\ }\n\ \n\ # loop for commenting\n\ for (beg = search(RE_DoComment, 0, "regex"); \\\n\ beg >= 0; \\\n\ beg = search(RE_DoComment, end, "regex"))\n\ {\n\ end = $search_end\n\ s = get_range(beg, end)\n\ if (show_it) set_cursor_pos(beg)\n\ if (show_it) select(beg, end)\n\ \n\ s = replace_in_string(s, "^(?=[^;\\\\s])((?:(?! ?;).)*) ?;", ";\\\\1;", \\\n\ "regex", "copy")\n\ s = replace_in_string(s, "^(\\\\s*) (?=[^;\\\\s])", "\\\\1; ", "regex", "copy")\n\ s = replace_in_string(s, "^\\\\s(?=[^;\\\\s])", ";", "regex", "copy")\n\ \n\ replace_range(beg, end, s)\n\ if (show_it) select(beg, beg + length(s))\n\ }\n\ \n\ if (show_it) set_cursor_pos(oldpos)\n\ }\n\ Comments>! Comment@X Resources:::R: {\n\ replace_in_selection("^.*$", "!&", "regex")\n\ }\n\ Comments>! Uncomment@X Resources:::R: {\n\ replace_in_selection("(^[ \\\\t]*!)(.*)$", "\\\\2", "regex")\n\ }\n\ Comments>/* Bar Comment@C@C++:::R: {\n\ if ($selection_left != -1) {\n\ dialog("Selection must not be rectangular")\n\ return\n\ }\n\ start = $selection_start\n\ end = $selection_end-1\n\ origText = get_range($selection_start, $selection_end-1)\n\ newText = "/*\\n" replace_in_string(get_range(start, end), \\\n\ "^", " * ", "regex") "\\n */\\n"\n\ replace_selection(newText)\n\ select(start, start + length(newText))\n\ }\n\ Comments>/* Bar Uncomment@C@C++:::R: {\n\ selStart = $selection_start\n\ selEnd = $selection_end\n\ newText = get_range(selStart+3, selEnd-4)\n\ newText = replace_in_string(newText, "^ \\\\* ", "", "regex")\n\ replace_range(selStart, selEnd, newText)\n\ select(selStart, selStart + length(newText))\n\ }\n\ Comments>/* ==== */ bar@C@C++@Java@JavaScript:::: {\n\ beginning_of_line()\n\ insert_string("/* ========================================================================== */\\n")\n\ }\n\ Make C Prototypes@C@C++:::: {\n\ if ($selection_start == -1) {\n\ start = 0\n\ end = $text_length\n\ } else {\n\ start = $selection_start\n\ end = $selection_end\n\ }\n\ string = get_range(start, end)\n\ \n\ # remove comments\n\ string = replace_in_string(string, "//.*$", "", "regex", "copy") # C++ comments\n\ string = replace_in_string(string, "(?n/\\\\*.*?\\\\*/)", "", "regex", "copy") # C comments\n\ string = replace_in_string(string, "^\\\\s*\\n", "", "regex", "copy") # empty lines\n\ \n\ nDefs = 0\n\ searchPos = 0\n\ prototypes = ""\n\ staticPrototypes = ""\n\ for (;;) {\n\ headerStart = search_string(string, \\\n\ "^[a-zA-Z]([^;#\\"'{}=>"\n\ # and try that\n\ $go_there_lang["@@"] = "" # make sure this exists for next time\n\ \n\ $go_there_lang["C"] = "Go there@C@C++" # use tags on\n\ $go_there_lang["C++"] = "Go there@C@C++" # current word\n\ \n\ $go_there_lang["SGML HTML"] = "Go there@SGML HTML@XML"\n\ $go_there_lang["XML"] = "Go there@SGML HTML@XML"\n\ }\n\ \n\ lang = $language_mode\n\ not_lang = "@" lang\n\ command = "Go there" not_lang\n\ \n\ # if no plain "Go there", try "Go there@*"\n\ if (lang == "")\n\ {\n\ if (not_lang in $go_there_lang)\n\ {\n\ lang = "*"\n\ not_lang = "@" lang\n\ command = "Go there" not_lang\n\ }\n\ else\n\ {\n\ command = "Go there"\n\ }\n\ }\n\ \n\ if (lang in $go_there_lang)\n\ macro_menu_command($go_there_lang[lang])\n\ else if (not_lang in $go_there_lang)\n\ return dialog("No '" command "' macro nor special case in\\n" \\\n\ "'Go there for language@No Language' macro")\n\ else\n\ {\n\ # try winging it... if there's no such macro, it'll break,\n\ # but it will have set up a flag not to do so again\n\ $go_there_lang[not_lang] = ""\n\ macro_menu_command(command)\n\ # it worked!\n\ delete $go_there_lang[not_lang]\n\ $go_there_lang[lang] = command\n\ }\n\ }\n\ Go there@CC output:Shift+Ctrl+C::: {\n\ NEDIT_require_macro_file("GoThereSunCC.nm")\n\ \n\ goThereSunCC()\n\ }\n\ Go there@Windows VC:Shift+Ctrl+C::: {\n\ NEDIT_require_macro_file("GoThereWindowsVC.nm")\n\ \n\ goThereWindowsVC()\n\ }\n\ Go there@Javac output:Shift+Ctrl+C::: {\n\ NEDIT_require_macro_file("GoThereSunJavac.nm")\n\ \n\ goThereSunJavac()\n\ }\n\ Go there@C@C++:Shift+Ctrl+C::: {\n\ macro_menu_command("Move>MultiTag>Find def@C@C++")\n\ }\n\ Go there@grep -n out:Shift+Ctrl+C::: {\n\ NEDIT_require_macro_file("GoThereGrep.nm")\n\ \n\ goThereGrep()\n\ }\n\ Go there@Man page output:Shift+Ctrl+C::: {\n\ NEDIT_require_macro_file("ManHelp.nm")\n\ \n\ ManHelp()\n\ }\n\ Go there@SGML HTML@XML:Shift+Ctrl+C::: {\n\ NEDIT_require_macro_file("XMLMatch.nm")\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ pos = $cursor\n\ \n\ rs = "XMLMatchTag()"\n\ RangeSet_forget(rs)\n\ \n\ res = XMLMatchTag()\n\ \n\ if ("open_start" in res)\n\ {\n\ RangeSet_set_color(rs, "#FF8000")\n\ RangeSet_add(rs, res["open_start"], res["open_end"])\n\ RangeSet_add(rs, res["close_start"], res["close_end"])\n\ \n\ if (res["open_start"] <= pos && pos < res["open_end"])\n\ set_cursor_pos(res["close_start"] + 1)\n\ else if (res["close_start"] <= pos && pos < res["close_end"])\n\ set_cursor_pos(res["open_start"] + 1)\n\ }\n\ }\n\ Go there@PicoBlaze Assembler:Shift+Ctrl+C::: {\n\ pos = $cursor\n\ beg = search("<", pos, "regex", "backward")\n\ end = search(">", beg, "regex")\n\ word = get_range(beg, end)\n\ lbeg = search("^", pos, "regex", "backward")\n\ start = search("<", lbeg, "regex")\n\ lend = search("$", lbeg, "regex")\n\ cmdstart = start\n\ labelstart = search("\\\\w+\\\\s*:", start, "regex")\n\ labelend = $search_end\n\ # dialog("start="start" label="labelstart","labelend" lineend="lend)\n\ if (start <= labelstart && labelstart < lend)\n\ {\n\ # dialog("line starts with label")\n\ cmdstart = search("\\\\w+", labelend, "regex")\n\ }\n\ cmd = get_range(cmdstart, search(">", cmdstart, "regex"))\n\ \n\ cmnt = search(";", lbeg)\n\ \n\ # dialog("word="word"\\ncmd="cmd)\n\ if (cmnt < pos && cmnt >= 0)\n\ {\n\ beep()\n\ return dialog("Word " word " found in comment")\n\ }\n\ \n\ if (search_string(" ADD ADDCY AND CALL COMPARE DISABLE ENABLE FETCH" \\\n\ " INPUT JUMP LOAD OR OUTPUT RETURN RETURNI RL RR" \\\n\ " SL0 SL1 SLA SLX SR0 SR1 SRA SRX STORE SUB SUBCY" \\\n\ " TEXT XOR" \\\n\ " INTERRUPT C NC Z NZ" \\\n\ " S0 S1 S2 S3 S4 S5 S6 S7 S8 S9 SA SB SC SD SE SF" \\\n\ " CONSTANT ADDRESS NAMEREG ", " " toupper(word) " ", 0) >= 0)\n\ {\n\ beep()\n\ return dialog(word " is keyword: no definition")\n\ }\n\ \n\ res = -1\n\ wordtype = "???"\n\ \n\ if (search_string(" CALL JUMP ", " " toupper(cmd) " ", 0) >= 0)\n\ {\n\ wordtype = "label"\n\ res = search("^\\\\s*"word"\\\\s*:", 0, "regex")\n\ if (res >= 0)\n\ res = $search_end - 1\n\ }\n\ else if (search_string(" FETCH INPUT OUTPUT STORE ", \\\n\ " " toupper(cmd) " ", 0) >= 0 && \\\n\ (search(cmd "\\\\s+" word, start, "regex") == cmdstart || \\\n\ search(cmd "\\\\s+\\\\w+\\\\s*,\\\\s*\\\\(\\\\s*" word "\\\\s*\\\\)", \\\n\ start, "regex") == cmdstart))\n\ {\n\ wordtype = "register"\n\ res = search("^\\\\s*(?iNAMEREG)\\\\s+(?is[0-9A-F])\\\\s*,\\\\s*"word">", 0, "regex")\n\ if (res >= 0)\n\ res = $search_end\n\ }\n\ else if (search_string(" ADD ADDCY AND COMPARE LOAD OR RETURN RETURNI RL RR" \\\n\ " SL0 SL1 SLA SLX SR0 SR1 SRA SRX SUB SUBCY" \\\n\ " TEXT XOR ", " " toupper(cmd) " ", 0) >= 0 && \\\n\ (search(cmd "\\\\s+" word, start, "regex") == cmdstart || \\\n\ search(cmd "\\\\s+\\\\w+\\\\s*,\\\\s*\\\\(\\\\s*" word "\\\\s*\\\\)", \\\n\ start, "regex") == cmdstart))\n\ {\n\ wordtype = "register"\n\ res = search("^\\\\s*(?iNAMEREG)\\\\s+(?is[0-9A-F])\\\\s*,\\\\s*"word">", 0, "regex")\n\ if (res >= 0)\n\ res = $search_end\n\ }\n\ else\n\ {\n\ wordtype = "constant"\n\ res = search("^\\\\s*(?iCONSTANT)\\\\s+"word">", 0, "regex")\n\ if (res >= 0)\n\ res = $search_end\n\ }\n\ \n\ if (res >= 0)\n\ {\n\ set_cursor_pos(res)\n\ select(res - length(word), res)\n\ }\n\ else\n\ {\n\ return dialog("Definition of " wordtype " " word " not found\\n" \\\n\ "(taken from command " cmd ")")\n\ }\n\ }\n\ Open selected@*:Shift+Ctrl+Y::: {\n\ # Try to find a file whose name matches the given string, allowing for\n\ # simple environment variable (as $env or ${env}) substitution.\n\ \n\ # pick up our string - a simple selection if any, or the current word\n\ sel = get_selection("any")\n\ if (search_string(sel, "(?n\\\\s)", 0, "regex") >= 0)\n\ {\n\ # selection contains spaces/newlines: ignore it\n\ sel = ""\n\ }\n\ \n\ if (sel == "")\n\ {\n\ # find current "word" (contiguous non-spaces)\n\ pos = $cursor\n\ if (pos != 0)\n\ {\n\ pos = search("\\\\s", pos - 1, "regex", "backward") + 1\n\ }\n\ end = search("\\\\s|$", pos, "regex")\n\ sel = get_range(pos, end)\n\ }\n\ \n\ if (sel == "")\n\ {\n\ sel = string_dialog("Enter a file name to open", "OK", "Cancel")\n\ if ($string_dialog_button != 1 || sel == "")\n\ return\n\ }\n\ \n\ # now we have our strings, try to resolve simple env-var substitutions\n\ hasDollar = 1\n\ cumul = ""\n\ rest = sel\n\ while (hasDollar)\n\ {\n\ pos = search_string(rest, "(?= 0)\n\ {\n\ end = $search_end\n\ # extract the variable name\n\ var = substring(rest, pos + 1, end)\n\ var = replace_in_string(var, "[{}]", "", "regex", "copy")\n\ \n\ # list_dialog("Substituting:", \\\n\ # "old rest = '" rest "' \\n" \\\n\ # "old cumul = '" cumul "' \\n" \\\n\ # " var = '" var "' \\n" \\\n\ # " value = '" getenv(var) "' \\n" \\\n\ # "new cumul = '" cumul substring(rest, 0, pos) getenv(var) "' \\n" \\\n\ # "new rest = '" substring(rest, end) "' \\n")\n\ \n\ # add the prefix and variable value to cumul\n\ cumul = cumul substring(rest, 0, pos) getenv(var)\n\ # cut off the used part of rest\n\ rest = substring(rest, end)\n\ }\n\ else\n\ {\n\ cumul = cumul rest\n\ hasDollar = 0\n\ }\n\ }\n\ \n\ # now we have all we need in cumul\n\ filename = cumul\n\ if (filename != "")\n\ file = NEDIT_find_file_in_pathlist(filename, $file_path)\n\ else\n\ {\n\ filename = sel\n\ file = ""\n\ }\n\ \n\ if (file == "")\n\ return dialog("Could not find file:\\n " filename)\n\ \n\ open(file)\n\ focus_window(file)\n\ raise_window(file, "focus")\n\ }\n\ Open selected@C@C++:::: {\n\ macro_menu_command("Open selected@*")\n\ }\n\ C/C++ Prog>Open include@C@C++:Shift+Ctrl+Y::: {\n\ NEDIT_require_macro_file("open_incl.nm")\n\ \n\ open_include()\n\ }\n\ C/C++ Prog>Change path for open include@C@C++:::: {\n\ NEDIT_require_macro_file("open_incl.nm")\n\ \n\ open_include_changePath()\n\ }\n\ C/C++ Prog>C Comments>Cartouche@C@C++:::: {\n\ beginning_of_line()\n\ insert_string("/* -------------------------------------------------------------------------- */")\n\ newline()\n\ beginning_of_line()\n\ insert_string("/* -------------------------------------------------------------------------- */")\n\ newline()\n\ newline()\n\ process_up()\n\ process_up()\n\ beginning_of_line()\n\ insert_string("/* ")\n\ newline()\n\ process_up()\n\ end_of_line()\n\ }\n\ C/C++ Prog>C Comments>Comment Out Sel.@C@C++:::R: {\n\ selStart = $selection_start\n\ selEnd = $selection_end\n\ replace_range(selStart, selEnd, "/* " get_selection() " */")\n\ select(selStart, selEnd + 6)\n\ }\n\ C/C++ Prog>C Comments>C Uncomment Sel.@C@C++:::R: {\n\ sel = get_selection()\n\ selStart = $selection_start\n\ selEnd = $selection_end\n\ commentStart = search_string(sel, "/*", 0)\n\ if (substring(sel, commentStart+2, commentStart+3) == " ")\n\ keepStart = commentStart + 3\n\ else\n\ keepStart = commentStart + 2\n\ keepEnd = search_string(sel, "*/", length(sel), "backward")\n\ commentEnd = keepEnd + 2\n\ if (substring(sel, keepEnd - 1, keepEnd) == " ")\n\ keepEnd = keepEnd - 1\n\ replace_range(selStart + commentStart, selStart + commentEnd, \\\n\ substring(sel, keepStart, keepEnd))\n\ select(selStart, selEnd - (keepStart-commentStart) - \\\n\ (commentEnd - keepEnd))\n\ }\n\ C/C++ Prog>C Comments>+ C++ Comment@C++:::R: {\n\ replace_in_selection("^.*$", "// &", "regex")\n\ }\n\ C/C++ Prog>C Comments>- C++ Comment@C++:::R: {\n\ replace_in_selection("(^[ \\\\t]*// ?)(.*)$", "\\\\2", "regex")\n\ }\n\ C/C++ Prog>C Comments>+ C Bar Comment 1@C:::R: {\n\ if ($selection_left != -1) {\n\ dialog("Selection must not be rectangular")\n\ return\n\ }\n\ start = $selection_start\n\ end = $selection_end-1\n\ origText = get_range($selection_start, $selection_end-1)\n\ newText = "/*\\n" replace_in_string(get_range(start, end), \\\n\ "^", " * ", "regex") "\\n */\\n"\n\ replace_selection(newText)\n\ select(start, start + length(newText))\n\ }\n\ C/C++ Prog>C Comments>- C Bar Comment 1@C:::R: {\n\ selStart = $selection_start\n\ selEnd = $selection_end\n\ newText = get_range(selStart+3, selEnd-4)\n\ newText = replace_in_string(newText, "^ \\\\* ", "", "regex")\n\ replace_range(selStart, selEnd, newText)\n\ select(selStart, selStart + length(newText))\n\ }\n\ C/C++ Prog>C Comments>Comment C++ comments for C@C:::: {\n\ replace("(^|[^*])(//.*)", "\\\\1/\\\\*\\\\2 \\\\*/", "regex")\n\ }\n\ C/C++ Prog>C Comments>Uncomment C++ comments for C@C:::: {\n\ replace("/\\\\*(//.*) \\\\*/$", "\\\\1", "regex")\n\ }\n\ C/C++ Prog>Redo C styles@C@C++:::: {\n\ # remove spaces in the context "word (" or "word ["\n\ while (search("([a-zA-Z0-9_])\\\\s+([[(])", 0, "regex") >= 0)\n\ replace_all("([a-zA-Z0-9_])\\\\s+([[(])", "\\\\1\\\\2", "regex")\n\ # remove spaces in "( ... )" and "[ ... ]"\n\ while (search("(\\\\S)\\\\s+([])])", 0, "regex") >= 0)\n\ replace_all("(\\\\S)\\\\s+([])])", "\\\\1\\\\2", "regex")\n\ while (search("([[(])\\\\s+", 0, "regex") >= 0)\n\ replace_all("([[(])\\\\s+", "\\\\1", "regex")\n\ \n\ # tighten semicolons, commas to preceding text\n\ while (search("(?<=\\\\S)[ \\\\t]+([,;])", 0, "regex") >= 0)\n\ replace_all("(?<=\\\\S)[ \\\\t]+([,;])", "\\\\1", "regex")\n\ \n\ # add a single space after these keywords and following "(" or "["\n\ keyword = "()([\\\\[\\\\(])"\n\ while (search(keyword, 0, "regex") >= 0)\n\ replace_all(keyword, "\\\\1 \\\\2", "regex")\n\ \n\ # move "*" and "&" in casts\n\ while (search("([a-zA-Z0-9_])([*&]+)([ \\\\t]+)", 0, "regex") >= 0)\n\ replace_all("([a-zA-Z0-9_])([*&]+)([ \\\\t]+)", "\\\\1\\\\3\\\\2", "regex")\n\ while (search("([a-zA-Z0-9_])([*&]+)([>)])", 0, "regex") >= 0)\n\ replace_all("([a-zA-Z0-9_])([*&]+)([>)])", "\\\\1 \\\\2\\\\3", "regex")\n\ while (search("\\\\*\\\\)[ \\\\t]+", 0, "regex") >= 0)\n\ replace_all("\\\\*\\\\)[ \\\\t]+", "\\\\*\\\\)", "regex")\n\ }\n\ C/C++ Prog>Make C Prototypes@C@C++:::: {\n\ if ($selection_start == -1) {\n\ start = 0\n\ end = $text_length\n\ } else {\n\ start = $selection_start\n\ end = $selection_end\n\ }\n\ string = get_range(start, end)\n\ nDefs = 0\n\ searchPos = 0\n\ prototypes = ""\n\ staticPrototypes = ""\n\ keywords = "[ \\t]*[ \\t]*\\\\("\n\ C_cmnt = "(/\\\\*([^*]|\\n|\\\\*[^/])*\\\\*/)"\n\ CPP_cmnt = "(//.*\\n)"\n\ get_proto = "^[ \\t]*[a-zA-Z]" \\\n\ "([^;#\\"'{}=>= 0)\n\ continue\n\ if (substring(string, headerStart, headerStart+6) == "static")\n\ staticPrototypes = staticPrototypes prototype\n\ else\n\ prototypes = prototypes prototype\n\ nDefs++\n\ }\n\ if (nDefs == 0) {\n\ dialog("No function declarations found")\n\ return\n\ }\n\ new()\n\ focus_window("last")\n\ replace_range(0, 0, "/* external */\\n" prototypes "\\n/* static */\\n" staticPrototypes)\n\ set_language_mode("C")\n\ }\n\ C/C++ Prog>keyword expand@C@C++:Ctrl+Backslash::: {\n\ NEDIT_require_macro_file("c_expand.nm")\n\ \n\ if ($selection_start != -1)\n\ deselect_all()\n\ \n\ if (!c_expand())\n\ {\n\ beep()\n\ }\n\ \n\ pos = search("@[^@]*@", $cursor, "regex")\n\ if (pos != -1)\n\ {\n\ end = $search_end\n\ s = get_range(pos, $search_end)\n\ r = substring(s, 1, length(s) - 1)\n\ replace_range(pos, end, r)\n\ select(pos, end - 2)\n\ set_cursor_pos(end - 2)\n\ }\n\ }\n\ C/C++ Prog>next expand@C@C++:Shift+Ctrl+Backslash::: {\n\ pos = search("@[^@]*@", $cursor, "regex")\n\ if (pos != -1)\n\ {\n\ end = $search_end\n\ s = get_range(pos, $search_end)\n\ r = substring(s, 1, length(s) - 1)\n\ replace_range(pos, end, r)\n\ select(pos, end - 2)\n\ set_cursor_pos(end - 2)\n\ }\n\ }\n\ C/C++ Prog>extern "C"-ise@C@C++:::: {\n\ if (search("#ifdef __cplusplus", 0, "case") == -1)\n\ {\n\ deselect_all()\n\ end_of_file()\n\ \n\ insert_string("\\n#ifdef __cplusplus\\n}\\n#endif")\n\ find("#include ", "backward", "case")\n\ end_of_line()\n\ insert_string("\\n\\n#ifdef __cplusplus\\nextern \\"C\\" {\\n#endif\\n\\n")\n\ }\n\ else\n\ {\n\ beep()\n\ set_cursor_pos($search_end)\n\ }\n\ }\n\ C/C++ Prog>convert 0x?? to 'char' or "chars":::R: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ beg = $selection_start\n\ fin = $selection_end\n\ \n\ prompt = "0x?? to 'char' or \\"chars\\": "\n\ if ($selection_left >= 0)\n\ return dialog(prompt "Please use a non-rectangular selection")\n\ s = get_range(beg, fin)\n\ old = s\n\ \n\ byChar = dialog(prompt "Convert to chars or string?", \\\n\ "Chars", "String", "Cancel")\n\ if (byChar < 1 || byChar > 2)\n\ return\n\ byChar = !(byChar - 1)\n\ \n\ ch0xRE = "(?i<0x[0-9a-f][0-9a-f]>)"\n\ seq0xRE = "(?n(?i<0x[0-9a-f][0-9a-f]?>(?:\\\\s*,\\\\s*<0x[0-9a-f][0-9a-f]?>)*))"\n\ \n\ end = 0\n\ for (pos = search_string(s, seq0xRE, end, "regex"); \\\n\ pos >= 0; \\\n\ pos = search_string(s, seq0xRE, end, "regex"))\n\ {\n\ x = substring(s, pos, $search_end)\n\ end = $search_end\n\ # convert to 2 hex digits\n\ x = replace_in_string(x, "(?i0x([0-9a-f])>)", "0x0\\\\1", "regex", "copy")\n\ if (byChar)\n\ {\n\ xe = 0\n\ for (xp = search_string(x, ch0xRE, xe, "regex"); \\\n\ xp >= 0; \\\n\ xp = search_string(x, ch0xRE, xe, "regex"))\n\ {\n\ xe = $search_end\n\ cpt = hex_to_int(substring(x, xe - 2, xe))\n\ if (cpt)\n\ ch = quote_literal_as_c(tochar(cpt))\n\ else\n\ ch = "\\\\0"\n\ x = substring(x, 0, xp) "'" ch "'" substring(x, xe)\n\ xe = xp + length(ch) + 2\n\ }\n\ }\n\ else\n\ {\n\ x = replace_in_string(x, "(?n(?:\\\\s*,\\\\s*)?0x)", "", "regex", "copy")\n\ x = hex2_to_str(x)\n\ x = "\\"" quote_literal_as_c(x) "\\""\n\ x = replace_in_string(x, "[[[---!NUL!---]]]", "\\\\x00", "case", "copy")\n\ }\n\ s = substring(s, 0, pos) x substring(s, end)\n\ end = pos + length(x)\n\ }\n\ \n\ if (old != s)\n\ replace_range(beg, fin, s)\n\ }\n\ C/C++ Prog>convert text to "c-string":::R: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ beg = $selection_start\n\ fin = $selection_end\n\ \n\ prompt = "Text to \\"C-String\\": "\n\ if ($selection_left >= 0)\n\ return dialog(prompt "Please use a non-rectangular selection")\n\ s = get_range(beg, fin)\n\ \n\ byLine = dialog(prompt "Break string at newlines?", \\\n\ "Yes", "No", "Cancel")\n\ if (byLine < 1 || byLine > 2)\n\ return\n\ byLine = (byLine == 1)\n\ \n\ if (byLine)\n\ lines = split(s, "\\n")\n\ else\n\ lines[0] = s\n\ \n\ n = lines[]\n\ x = "\\"" quote_literal_as_c(lines[0])\n\ for (i = 1; i < n; i++)\n\ {\n\ x = x "\\\\n\\"\\n\\"" quote_literal_as_c(lines[i])\n\ }\n\ x = x "\\""\n\ \n\ replace_range(beg, fin, x)\n\ }\n\ Move>Start of Select:Ctrl+Home::: {\n\ if ($selection_start != -1)\n\ beginning_of_selection()\n\ else\n\ beginning_of_file()\n\ }\n\ Move>End of Line:::: {\n\ end_of_line()\n\ }\n\ Move>End of Line Select:::: {\n\ end_of_line("extend")\n\ }\n\ Move>End of Select:Ctrl+End::: {\n\ if ($selection_start != -1)\n\ end_of_selection()\n\ else\n\ end_of_file()\n\ }\n\ Move>Goto selected line number:Shift+Ctrl+L::: {\n\ sel = get_selection("any")\n\ if (sel == "")\n\ {\n\ pos = $cursor\n\ while (pos > 0 && (search("\\\\d", pos - 1, "regex") == pos - 1))\n\ pos--\n\ if (search("\\\\d+", pos, "regex") != pos)\n\ {\n\ beep() # no digit here\n\ }\n\ else\n\ {\n\ end = $search_end\n\ goto_line_number(get_range(pos, end))\n\ }\n\ }\n\ \n\ # dialog("In file "$file_name": line "sel)\n\ goto_line_number(get_selection("any"))\n\ }\n\ Move>Smart Home:Alt+Home::: {\n\ # toggle between front of line and first non-space on line\n\ c = $cursor\n\ beginning_of_line()\n\ front = $cursor\n\ if (c == front)\n\ {\n\ first_char = search("[ \\t]*", front, "regex", "forward")\n\ if (first_char != -1)\n\ set_cursor_pos($search_end)\n\ }\n\ }\n\ Move>Goto Definition@*:Shift+Ctrl+E::: {\n\ # pick any selection\n\ s = get_selection("any")\n\ c = $cursor\n\ \n\ # if we're on a word, use it\n\ if (s == "")\n\ {\n\ b = search("<", $cursor, "regex", "backward")\n\ e = search(">", $cursor, "regex", "forward")\n\ if (b <= c && c <= e)\n\ s = get_range(b, e)\n\ }\n\ \n\ # must be a valid word!\n\ pos = search_string(s, "(?n^\\\\w+$)", 0, "regex")\n\ end = $search_end\n\ if (pos != 0 || end != length(s))\n\ s = string_dialog("Enter a tag name to look up", "OK", "Cancel")\n\ \n\ # if all still OK, try to find it!\n\ if (s != "" && $string_dialog_button == 1)\n\ find_definition(s)\n\ }\n\ Move>Goto Definition@C++:Shift+Ctrl+E::: {\n\ s = get_selection("any")\n\ c = $cursor\n\ \n\ scopedWord = "(?MultiTag>Find def@*:Ctrl+Bracketright::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ if ($multitags == "")\n\ {\n\ multitags_load_multitags_file()\n\ }\n\ \n\ s = ""\n\ if ($selection_start == -1)\n\ {\n\ b = search("<", $cursor, "regex", "backward")\n\ e = search(">", $cursor, "regex", "forward")\n\ s = get_range(b, e)\n\ }\n\ else\n\ s = get_selection()\n\ \n\ if (s != "")\n\ {\n\ multitags_push_curpos()\n\ if (!multitags_choose_quick(s))\n\ {\n\ multitags_pop_curpos()\n\ deselect_all()\n\ }\n\ else\n\ {\n\ centerline()\n\ }\n\ }\n\ }\n\ Move>MultiTag>Find def@C@C++:Ctrl+Bracketright::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ if ($multitags == "")\n\ {\n\ multitags_load_all_multitags_file()\n\ }\n\ \n\ s = ""\n\ if ($selection_start == -1)\n\ {\n\ b = search("<", $cursor, "regex", "backward")\n\ e = search(">", $cursor, "regex", "forward")\n\ s = get_range(b, e)\n\ }\n\ else\n\ s = get_selection()\n\ \n\ if (s != "")\n\ {\n\ multitags_push_curpos()\n\ if (!multitags_choose_quick(s))\n\ {\n\ multitags_pop_curpos()\n\ deselect_all()\n\ }\n\ else\n\ {\n\ centerline()\n\ }\n\ }\n\ }\n\ Move>MultiTag>Find ?@*:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ if ($multitags == "")\n\ {\n\ multitags_load_multitags_file()\n\ }\n\ \n\ s = string_dialog("Symbol", "OK", "Cancel")\n\ \n\ if ($string_dialog_button == 1 && s != "")\n\ {\n\ multitags_push_curpos()\n\ if (!multitags_choose_quick(s))\n\ {\n\ multitags_pop_curpos()\n\ deselect_all()\n\ }\n\ else\n\ {\n\ centerline()\n\ }\n\ }\n\ }\n\ Move>MultiTag>Find ?@C@C++:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ if ($multitags == "")\n\ {\n\ multitags_load_all_multitags_file()\n\ }\n\ \n\ s = string_dialog("Symbol", "OK", "Cancel")\n\ \n\ if ($string_dialog_button == 1 && s != "")\n\ {\n\ multitags_push_curpos()\n\ if (!multitags_choose_quick(s))\n\ {\n\ multitags_pop_curpos()\n\ deselect_all()\n\ }\n\ else\n\ {\n\ centerline()\n\ }\n\ }\n\ }\n\ Move>MultiTag>Push:Ctrl+Bracketleft::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ multitags_push_curpos()\n\ }\n\ Move>MultiTag>Back:Shift+Ctrl+Bracketright::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ if (multitags_pop_curpos())\n\ centerline()\n\ }\n\ Move>MultiTag>Reload tags@*:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ multitags_load_multitags_file("tags")\n\ }\n\ Move>MultiTag>Reload tags@C@C++:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ multitags_forget_multitags_file()\n\ multitags_load_all_multitags_file("tags")\n\ }\n\ Move>MultiTag>Forget tags:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ multitags_forget_multitags_file()\n\ }\n\ Move>MultiTag>Show tags files:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ s = $multitags_files\n\ if (s == "" || s == "\\n")\n\ s = " (none)\\n"\n\ list_dialog("Multitags: Loaded tags file", $multitags_files)\n\ }\n\ Move>MultiTag>Load specific tags file:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ s = string_dialog("Enter file path", "OK", "Cancel")\n\ if ($string_dialog_button == 1 && s != "")\n\ multitags_load_multitags_file(s)\n\ \n\ }\n\ Move>MultiTag>File symbols:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ if ($multitags == "")\n\ {\n\ if ($language_mode == "C" || \\\n\ $language_mode == "C++")\n\ multitags_load_all_multitags_file()\n\ else\n\ multitags_load_multitags_file()\n\ }\n\ \n\ if (multitags_choose_in_file($file_name))\n\ centerline()\n\ }\n\ Move>MultiTag>Set stack:Shift+Ctrl+Alt+J::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ multitags_set_stack_length()\n\ }\n\ Move>MultiTag>Show stack:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ if (multitags_choose_from($multitags_stack))\n\ centerline()\n\ }\n\ Move>MultiTag>Empty stack:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ multitags_empty_stack()\n\ }\n\ Move>Go to Match:Shift+Ctrl+5::: {\n\ select($cursor, $cursor)\n\ cc = $cursor-1\n\ if (cc == -1)\n\ forward_character()\n\ c = get_character(cc)\n\ if (search_string("{}()[]<>\\"", c, 0) == -1)\n\ forward_character()\n\ \n\ match()\n\ \n\ if ($selection_start != -1)\n\ {\n\ if ($cursor == $selection_start+1)\n\ set_cursor_pos($selection_end)\n\ else\n\ set_cursor_pos($selection_start)\n\ }\n\ select($cursor, $cursor)\n\ }\n\ Move>Collapse Match:Ctrl+KP_Subtract::: {\n\ NEDIT_require_macro_file("fold.nm")\n\ \n\ if ($selection_start != -1)\n\ res = fold_selection()\n\ else\n\ res = fold_bracket_or_custom_match()\n\ if (!res)\n\ beep()\n\ }\n\ Move>Expand Match:Ctrl+KP_Add::: {\n\ NEDIT_require_macro_file("fold.nm")\n\ \n\ if (!fold_expand())\n\ beep()\n\ }\n\ Move>Position History>Save position:Ctrl+KP_Begin::: {\n\ $SAVE_POSITIONS[""] = ""\n\ $SAVE_POSITION_INDEX[""] = ""\n\ markers = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"\n\ file = $file_path $file_name\n\ \n\ if (!(file in $SAVE_POSITIONS))\n\ {\n\ $SAVE_POSITIONS[file] = ""\n\ $SAVE_POSITION_INDEX[file] = 0\n\ mark("0")\n\ }\n\ \n\ # save position operation stores a new marker letter at position index\n\ # in positions string, and increases the index (if no more more positions\n\ # are available, the first position marker is reused)\n\ \n\ positions = $SAVE_POSITIONS[file]\n\ index = $SAVE_POSITION_INDEX[file]\n\ \n\ # find a new marker char\n\ for (i = 0; i < length(markers); i++)\n\ {\n\ marker = substring(markers, i, i + 1)\n\ if (search_string(positions, marker, 0, "case") < 0)\n\ break\n\ }\n\ if (i >= length(markers)) # all used - steal the first one which isn't 0\n\ {\n\ pos = search_string(positions, "[^0]", 0, "regex")\n\ marker = substring(positions, pos, pos + 1)\n\ positions = replace_substring(positions, pos, pos + 1, "")\n\ if (index >= pos)\n\ index--\n\ }\n\ # mark our position\n\ #dialog("index: "index"\\npositions: "positions"\\nmarker: "marker"\\nfile = "file)\n\ mark(marker)\n\ # and insert it in the list\n\ positions = replace_substring(positions, index, index, marker)\n\ # now save info\n\ $SAVE_POSITIONS[file] = positions\n\ $SAVE_POSITION_INDEX[file] = index + 1\n\ }\n\ Move>Position History>Go back one position:Ctrl+KP_Left::: {\n\ $SAVE_POSITIONS[""] = ""\n\ $SAVE_POSITION_INDEX[""] = ""\n\ markers = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"\n\ file = $file_path $file_name\n\ \n\ if (!(file in $SAVE_POSITIONS))\n\ {\n\ $SAVE_POSITIONS[file] = ""\n\ $SAVE_POSITION_INDEX[file] = 0\n\ }\n\ \n\ # go back one position\n\ \n\ positions = $SAVE_POSITIONS[file]\n\ index = $SAVE_POSITION_INDEX[file]\n\ \n\ if (search_string(positions, "0", 0, "case") < 0)\n\ {\n\ mark("0") # for return to current cursor if we change our minds\n\ $SAVE_POSITIONS[file] = positions "0"\n\ }\n\ \n\ for (;;)\n\ {\n\ if (index <= 0)\n\ {\n\ beep()\n\ #dialog("No previous position stored\\nTotal stored: " length(positions))\n\ return\n\ }\n\ $SAVE_POSITION_INDEX[file] = --index\n\ marker = substring(positions, index, index + 1)\n\ if (marker != "0") # skip marker 0\n\ {\n\ pos = $cursor\n\ goto_mark(marker)\n\ if (pos != $cursor)\n\ break # exit loop if we've moved\n\ }\n\ }\n\ }\n\ Move>Position History>Go forward one position:Ctrl+KP_Right::: {\n\ $SAVE_POSITIONS[""] = ""\n\ $SAVE_POSITION_INDEX[""] = ""\n\ markers = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"\n\ file = $file_path $file_name\n\ \n\ if (!(file in $SAVE_POSITIONS))\n\ {\n\ $SAVE_POSITIONS[file] = ""\n\ $SAVE_POSITION_INDEX[file] = 0\n\ }\n\ \n\ # go forward one position\n\ \n\ positions = $SAVE_POSITIONS[file]\n\ index = $SAVE_POSITION_INDEX[file]\n\ \n\ if (search_string(positions, "0", 0, "case") < 0)\n\ {\n\ mark("0") # for return to current cursor if we change our minds\n\ $SAVE_POSITIONS[file] = positions "0"\n\ }\n\ \n\ for (;;)\n\ {\n\ if (index == length(positions))\n\ {\n\ beep()\n\ #dialog("No following position stored\\nTotal stored: " length(positions))\n\ return\n\ }\n\ marker = substring(positions, index, index + 1)\n\ $SAVE_POSITION_INDEX[file] = ++index\n\ if (marker != "0") # skip marker 0\n\ {\n\ pos = $cursor\n\ goto_mark(marker)\n\ if (pos != $cursor)\n\ break # exit loop if we've moved\n\ }\n\ }\n\ }\n\ Move>Position History>Jump back again:Ctrl+KP_Down::: {\n\ $SAVE_POSITIONS[""] = ""\n\ $SAVE_POSITION_INDEX[""] = ""\n\ markers = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"\n\ file = $file_path $file_name\n\ \n\ if (!(file in $SAVE_POSITIONS))\n\ {\n\ $SAVE_POSITIONS[file] = ""\n\ $SAVE_POSITION_INDEX[file] = 0\n\ mark("0")\n\ beep()\n\ return\n\ }\n\ \n\ $SAVE_POSITIONS[file] = replace_in_string($SAVE_POSITIONS[file], "0", "", "copy")\n\ goto_mark("0")\n\ }\n\ Move>Position History>Record jump back:Ctrl+KP_Up::: {\n\ $SAVE_POSITIONS[""] = ""\n\ $SAVE_POSITION_INDEX[""] = ""\n\ markers = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"\n\ file = $file_path $file_name\n\ \n\ if (!(file in $SAVE_POSITIONS))\n\ {\n\ $SAVE_POSITIONS[file] = ""\n\ $SAVE_POSITION_INDEX[file] = 0\n\ }\n\ \n\ $SAVE_POSITIONS[file] = $SAVE_POSITIONS[file] "0"\n\ mark("0")\n\ }\n\ Move>Position History>Forget positions:Ctrl+KP_Delete::: {\n\ $SAVE_POSITIONS[""] = ""\n\ $SAVE_POSITION_INDEX[""] = ""\n\ markers = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"\n\ file = $file_path $file_name\n\ \n\ if (file in $SAVE_POSITIONS)\n\ {\n\ delete $SAVE_POSITIONS[file]\n\ delete $SAVE_POSITION_INDEX[file]\n\ }\n\ }\n\ Edit>Paste selection to cursor:::: {\n\ sel = get_selection("any")\n\ if (sel == "")\n\ beep()\n\ else\n\ {\n\ replace_range($cursor, $cursor, sel)\n\ set_cursor_pos($cursor + length(sel))\n\ }\n\ }\n\ Edit>Delete back by Tab Stop:F12::: {\n\ NEDIT_require_macro_file("tabDelete.nm")\n\ \n\ tab_delete()\n\ }\n\ Edit>Delete forward by Tab Stop:Shift+F12::: {\n\ NEDIT_require_macro_file("tabDelete.nm")\n\ \n\ tab_delete_forward()\n\ }\n\ Edit>Insert Special>Non-breaking Space:::: {\n\ insert_string(" ")\n\ }\n\ Edit>Insert Special>Insert tab:Ctrl+Grave::: {\n\ insert_string("\\t")\n\ }\n\ Edit>Insert Special>ISO8859-1 Punctuation:::: {\n\ s = " ˇ˘Ł¤Ą¦§¨©Ş«¬­®Ż°±˛ł´µ¶·¸ąş»Ľ˝ľż×÷"\n\ l = ""\n\ for (i = 0; i < length(s); i++)\n\ {\n\ if (i > 0 && i % 6 == 0)\n\ l = l "\\n"\n\ l = l " "(i % 6) ": " substring(s, i, i + 1) " "\n\ }\n\ \n\ s = ""\n\ while (s == "")\n\ {\n\ s = list_dialog("Choose a line and an index within it",\\\n\ l"\\n", "0", "1", "2", "3", "4", "5")\n\ b = $list_dialog_button\n\ if (b <= 0 || b > 6)\n\ return\n\ }\n\ \n\ b-- # from 0 to 5\n\ c = 7 * b + 4\n\ insert_string(substring(s, c, c + 1))\n\ }\n\ Edit>Insert Special>ISO8859-1 Accents:::: {\n\ s = "[A]: 0: Ŕ 1: Á 2:  3: Ă 4: Ä 5: Ĺ 6: Ć\\n"\\\n\ "[a]: 0: ŕ 1: á 2: â 3: ă 4: ä 5: ĺ 6: ć\\n"\\\n\ "[E]: 0: Č 1: É 2: Ę 3: Ë\\n"\\\n\ "[e]: 0: č 1: é 2: ę 3: ë\\n"\\\n\ "[I]: 0: Ě 1: Í 2: Î 3: Ď\\n"\\\n\ "[i]: 0: ě 1: í 2: î 3: ď\\n"\\\n\ "[O]: 0: Ň 1: Ó 2: Ô 3: Ő 4: Ö 5: Ř\\n"\\\n\ "[o]: 0: ň 1: ó 2: ô 3: ő 4: ö 5: ř\\n"\\\n\ "[U]: 0: Ů 1: Ú 2: Ű 3: Ü\\n"\\\n\ "[u]: 0: ů 1: ú 2: ű 3: ü\\n"\\\n\ "[Y]: 0: Ý 1: ý 2: ˙\\n"\\\n\ "[CN]: 0: Ç 1: ç 2: Ń 3: ń\\n"\\\n\ "[ĐŢß]: 0: Đ 1: Ţ 2: đ 3: ţ 4: ß\\n"\n\ c = ""\n\ while (c == "")\n\ {\n\ x = list_dialog("Choose a line and an index within it",\\\n\ s, "No", "0", "1", "2", "3", "4", "5", "6")\n\ b = $list_dialog_button\n\ if (b < 2 || b > 8)\n\ return\n\ \n\ b -= 2\n\ i = 7 * b + 10\n\ c = substring(x, i, i + 1)\n\ if (c == "")\n\ beep()\n\ }\n\ insert_string(c)\n\ }\n\ Edit>Delete line:::: {\n\ here = $cursor\n\ beginning_of_line()\n\ start = $cursor\n\ end_of_line()\n\ end = $cursor + 1\n\ set_cursor_pos(here)\n\ process_down()\n\ replace_range(start, end, "")\n\ }\n\ Edit>Delete to end:::: {\n\ if ($selection_start == -1) {\n\ if (get_character($cursor) == "\\n")\n\ delete_next_character()\n\ else\n\ delete_to_end_of_line()\n\ }\n\ else {\n\ delete_selection()\n\ }\n\ }\n\ Edit>Deselect:::: {\n\ if ($selection_start != -1)\n\ deselect_all()\n\ }\n\ Edit>Next window:::: {\n\ NEDIT_require_macro_file("win_nextprev.nm")\n\ \n\ win_next()\n\ }\n\ Edit>Prev window:::: {\n\ NEDIT_require_macro_file("win_nextprev.nm")\n\ \n\ win_prev()\n\ }\n\ Edit>Find in files>Find line@C:Ctrl+Alt+F::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ if ($selection_start == -1)\n\ greplines_from_prompt("./*.[ch] /dev/null")\n\ else\n\ {\n\ greplines("./*.[ch] /dev/null", get_selection())\n\ }\n\ }\n\ Edit>Find in files>Find line@C++:Ctrl+Alt+F::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ if ($selection_start == -1)\n\ greplines_from_prompt("./*.[CHch]* /dev/null")\n\ else\n\ {\n\ greplines("./*.[CHch]* /dev/null", get_selection())\n\ }\n\ }\n\ Edit>Find in files>Find line C/C++ (-R)@C@C++:::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ greplines_from_prompt_r("*.[cChH][+pP][+pP] *.[cChH] *.inl *.INL")\n\ }\n\ Edit>Find in files>Find line in *:Ctrl+Alt+F::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ if ($selection_start == -1)\n\ greplines_from_prompt("* /dev/null")\n\ else\n\ {\n\ greplines("* /dev/null", get_selection())\n\ }\n\ }\n\ Edit>Strip trailing space:::: {\n\ if ($selection_start == -1)\n\ {\n\ str = get_range(0, $text_length)\n\ mod = replace_in_string(str, "\\\\s+$", "", "regex", "copy")\n\ if (str != mod)\n\ replace_range(0, $text_length, mod)\n\ }\n\ else\n\ {\n\ str = get_selection()\n\ mod = replace_in_string(str, "\\\\s+$", "", "regex", "copy")\n\ if (str != mod)\n\ replace_selection(mod)\n\ }\n\ }\n\ Edit>ReDeTab>detab all tabs:::: {\n\ NEDIT_require_macro_file("redetab_re.nm")\n\ \n\ line = $line\n\ col = $column\n\ top = $top_line\n\ \n\ if ($selection_start >= 0)\n\ {\n\ beg = $selection_start\n\ end = $selection_end\n\ s = get_selection()\n\ beginning_of_selection()\n\ startcol = $column\n\ }\n\ else\n\ {\n\ beg = 0\n\ end = $text_length\n\ s = get_range(beg, end)\n\ startcol = 0\n\ }\n\ \n\ # detab all tabs\n\ t = detab_re(s, startcol, "keeptrailing", $tab_dist, "all")\n\ \n\ replace_range(beg, end, t)\n\ scroll_to_line(top)\n\ goto_line_number(line, col)\n\ scroll_to_line(top)\n\ deselect_all()\n\ }\n\ Edit>ReDeTab>retab all tabs:::: {\n\ NEDIT_require_macro_file("redetab_re.nm")\n\ \n\ line = $line\n\ col = $column\n\ top = $top_line\n\ \n\ if ($selection_start >= 0)\n\ {\n\ beg = $selection_start\n\ end = $selection_end\n\ s = get_selection()\n\ beginning_of_selection()\n\ startcol = $column\n\ }\n\ else\n\ {\n\ beg = 0\n\ end = $text_length\n\ s = get_range(beg, end)\n\ startcol = 0\n\ }\n\ \n\ # retab all tabs\n\ minspaces = string_dialog("minspaces", 1, 2, 3, 4, 5, 6, 7, 8)\n\ if (minspaces == "")\n\ minspaces = $string_dialog_button\n\ t = retab_re(s, startcol, "keeptrailing", $tab_dist, minspaces, "all")\n\ \n\ replace_range(beg, end, t)\n\ scroll_to_line(top)\n\ goto_line_number(line, col)\n\ scroll_to_line(top)\n\ deselect_all()\n\ }\n\ Edit>ReDeTab>detab only leading tabs:::: {\n\ NEDIT_require_macro_file("redetab_re.nm")\n\ \n\ line = $line\n\ col = $column\n\ top = $top_line\n\ \n\ if ($selection_start >= 0)\n\ {\n\ beg = $selection_start\n\ end = $selection_end\n\ s = get_selection()\n\ beginning_of_selection()\n\ startcol = $column\n\ }\n\ else\n\ {\n\ beg = 0\n\ end = $text_length\n\ s = get_range(beg, end)\n\ startcol = 0\n\ }\n\ \n\ # detab only leading tabs\n\ t = detab_re(s, startcol, "keeptrailing", $tab_dist, "leading")\n\ \n\ replace_range(beg, end, t)\n\ scroll_to_line(top)\n\ goto_line_number(line, col)\n\ scroll_to_line(top)\n\ deselect_all()\n\ }\n\ Edit>ReDeTab>retab only leading tabs:::: {\n\ NEDIT_require_macro_file("redetab_re.nm")\n\ \n\ line = $line\n\ col = $column\n\ top = $top_line\n\ \n\ if ($selection_start >= 0)\n\ {\n\ beg = $selection_start\n\ end = $selection_end\n\ s = get_selection()\n\ beginning_of_selection()\n\ startcol = $column\n\ }\n\ else\n\ {\n\ beg = 0\n\ end = $text_length\n\ s = get_range(beg, end)\n\ startcol = 0\n\ }\n\ \n\ # retab only leading tabs\n\ t = retab_re(s, startcol, "keeptrailing", $tab_dist, 1, "leading")\n\ \n\ replace_range(beg, end, t)\n\ scroll_to_line(top)\n\ goto_line_number(line, col)\n\ scroll_to_line(top)\n\ deselect_all()\n\ }\n\ Edit>ReDeTab>Choose re/de-tab:Ctrl+5::: {\n\ $REDETAB[""] = 0\n\ \n\ dotidy = "Tidy line ends"\n\ notidy = "Don't tidy line ends"\n\ \n\ if (!(dotidy in $REDETAB))\n\ $REDETAB[dotidy] = 0\n\ \n\ val = $REDETAB[dotidy]\n\ \n\ if ($selection_start >= 0)\n\ {\n\ isSelect = 1\n\ scope = "Selection"\n\ selstart = $selection_start\n\ selend = $selection_end\n\ selleft = $selection_left\n\ selright = $selection_right\n\ }\n\ else\n\ {\n\ isSelect = 0\n\ scope = "Document"\n\ selstart = 0\n\ selend = $text_length\n\ selleft = -1\n\ selright = -1\n\ }\n\ line = $line\n\ column = $column\n\ \n\ options = "detab all tabs\\n" \\\n\ "retab all tabs\\n" \\\n\ "detab only leading tabs\\n" \\\n\ "retab only leading tabs"\n\ \n\ if (val)\n\ tidy = notidy\n\ else\n\ tidy = dotidy\n\ \n\ line = list_dialog("Choose tab replacement action", options, \\\n\ scope, tidy, "Cancel")\n\ btn = $list_dialog_button\n\ \n\ if (btn != 1 && btn != 2)\n\ return\n\ \n\ if (isSelect && ($selection_start != selstart))\n\ {\n\ beep()\n\ return\n\ }\n\ \n\ if (btn == 2)\n\ {\n\ val = !val\n\ $REDETAB[dotidy] = val\n\ }\n\ \n\ # tidy lines first?\n\ if (val)\n\ {\n\ old = get_range(selstart, selend)\n\ str = replace_in_string(old, "\\\\s+$", "", "regex", "copy")\n\ if (old != str)\n\ {\n\ replace_range(selstart, selend, str)\n\ if (isSelect)\n\ {\n\ selend = selstart + length(str)\n\ if (selleft >= 0)\n\ select_rectangle(selstart, selend, selleft, selright)\n\ else\n\ select(selstart, selend)\n\ }\n\ }\n\ }\n\ \n\ # now do the tab conversion\n\ if (line != "")\n\ macro_menu_command("Edit>ReDeTab>" line)\n\ \n\ # restore cursor\n\ goto_line_number(line, column)\n\ }\n\ Edit>ReDeTab>Old>Detab:::: {\n\ NEDIT_require_macro_file("redetab.nm")\n\ \n\ if ($selection_start != -1)\n\ redetab_selection("detab")\n\ else\n\ {\n\ s = detab(get_range(0, $text_length), 0, 0, 0, $tab_dist)\n\ replace_range(0, $text_length, s)\n\ }\n\ }\n\ Edit>ReDeTab>Old>Retab (for string)@C@C++@Java@JavaScript@Yacc@Awk@NEdit Macro:::R: {\n\ NEDIT_require_macro_file("redetab.nm")\n\ \n\ redetab_selection("retab", "\\"([^\\\\n\\\\\\\\\\"]|\\\\\\\\\\\\n|\\\\\\\\.)*\\"")\n\ }\n\ Edit>ReDeTab>Old>Retab:::R: {\n\ NEDIT_require_macro_file("redetab.nm")\n\ \n\ redetab_selection("retab")\n\ }\n\ Edit>ReDeTab>make test area:::: {\n\ NEDIT_require_macro_file("redetab_re.nm")\n\ # load_macro_file($NEDIT_MACRO_DIR"/redetab_re.nm")\n\ \n\ s="12345678"\n\ b=" "\n\ r = ""\n\ for (i = 0; i <= 8; i++)\n\ {\n\ for (j = 7; j >= 0; j--)\n\ {\n\ r = r substring(s, 0, length(s)-j) substring(b, 0, j) substring(b, 0, i) i "\\n"\n\ }\n\ }\n\ beginning_of_line()\n\ insert_string(r)\n\ \n\ s="12345678"\n\ b=" "\n\ r = ""\n\ l = ""\n\ for (i = 0; i <= 8; i++)\n\ {\n\ for (j = 7; j >= 0; j--)\n\ {\n\ r = r l \\\n\ substring(s, 0, length(s)-j) substring(b, 0, j) substring(b, 0, i) i "\\n"\n\ l = l " "\n\ }\n\ }\n\ beginning_of_line()\n\ insert_string(r)\n\ \n\ \n\ }\n\ Edit>Insert tab:Ctrl+Grave::: {\n\ insert_string("\\t")\n\ }\n\ Edit>Increase indent by tab:Ctrl+Tab::: {\n\ shift_right_by_tab()\n\ }\n\ Edit>Increase indent:Ctrl+Space::: {\n\ shift_right()\n\ }\n\ Edit>Decrease indent:Shift+Ctrl+Space::: {\n\ shift_left()\n\ }\n\ Edit>Decrease indent by tab:Shift+Ctrl+Tab::: {\n\ shift_left_by_tab()\n\ }\n\ Edit>Show tabs:::R: {\n\ NEDIT_require_macro_file("redetab.nm")\n\ \n\ showtabspace("display")\n\ }\n\ Edit>Complete Word>Recent@*:Shift+Ctrl+Alt+Space::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("wordfinish.nm")\n\ \n\ if ($multitags_symbols == "")\n\ multitags_load_multitags_file()\n\ \n\ wordfinish($multitags_symbols)\n\ }\n\ Edit>Complete Word>Recent@C@C++:Shift+Ctrl+Alt+Space::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("wordfinish.nm")\n\ \n\ if ($multitags_symbols == "")\n\ multitags_load_all_multitags_file()\n\ \n\ wordfinish($multitags_symbols)\n\ }\n\ Edit>Complete Word>Default:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("wordfinish.nm")\n\ \n\ if ($wordfinish_sym_list == "")\n\ {\n\ wordfinish_add_symfiles()\n\ }\n\ \n\ if ($multitags_symbols == "")\n\ {\n\ multitags_load_symbols()\n\ if ($multitags_symbols != "")\n\ wordfinish_add_symbols($multitags_symbols)\n\ }\n\ \n\ wordfinish($wordfinish_sym_list)\n\ }\n\ Edit>Complete Word>Forward@*:Alt+Right::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("wordfinish.nm")\n\ \n\ if ($wordfinish_sym_list == "")\n\ {\n\ wordfinish_add_symfiles()\n\ }\n\ \n\ if ($multitags_symbols == "")\n\ {\n\ multitags_load_symbols()\n\ if ($multitags_symbols != "")\n\ wordfinish_add_symbols($multitags_symbols)\n\ }\n\ \n\ wordfinish($wordfinish_sym_list, "forward")\n\ }\n\ Edit>Complete Word>Forward@C@C++:Alt+Right::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("wordfinish.nm")\n\ \n\ if ($wordfinish_sym_list == "")\n\ {\n\ wordfinish_add_symfiles()\n\ }\n\ \n\ if ($multitags_symbols == "")\n\ {\n\ if ($multitags == "")\n\ multitags_load_all_multitags_file()\n\ multitags_load_symbols()\n\ if ($multitags_symbols != "")\n\ wordfinish_add_symbols($multitags_symbols)\n\ }\n\ \n\ wordfinish($wordfinish_sym_list, "forward")\n\ }\n\ Edit>Complete Word>Backward@*:Alt+Left::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("wordfinish.nm")\n\ \n\ if ($wordfinish_sym_list == "")\n\ {\n\ wordfinish_add_symfiles()\n\ }\n\ \n\ if ($multitags_symbols == "")\n\ {\n\ multitags_load_symbols()\n\ if ($multitags_symbols != "")\n\ wordfinish_add_symbols($multitags_symbols)\n\ }\n\ \n\ wordfinish($wordfinish_sym_list, "backward")\n\ }\n\ Edit>Complete Word>Backward@C@C++:Alt+Left::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("wordfinish.nm")\n\ \n\ if ($wordfinish_sym_list == "")\n\ {\n\ wordfinish_add_symfiles()\n\ }\n\ \n\ if ($multitags_symbols == "")\n\ {\n\ multitags_load_all_multitags_file()\n\ multitags_load_symbols()\n\ if ($multitags_symbols != "")\n\ wordfinish_add_symbols($multitags_symbols)\n\ }\n\ \n\ wordfinish($wordfinish_sym_list, "backward")\n\ }\n\ Edit>Complete Word>Deselect:Alt+Down::: {\n\ if ($selection_start != -1)\n\ deselect_all()\n\ }\n\ Edit>Complete Word>Del Select:Alt+Up::R: {\n\ if ($selection_start != -1)\n\ replace_selection("")\n\ }\n\ Edit>Complete Word>Standard:Alt+D::: {\n\ # Tuning parameters\n\ ScanDistance = 200\n\ \n\ # Search back to a word boundary to find the word to complete\n\ startScan = max(0, $cursor - ScanDistance)\n\ endScan = min($text_length, $cursor + ScanDistance)\n\ scanString = get_range(startScan, endScan)\n\ keyEnd = $cursor-startScan\n\ keyStart = search_string(scanString, "<", keyEnd, "backward", "regex")\n\ if (keyStart == -1)\n\ return\n\ keyString = "<" substring(scanString, keyStart, keyEnd)\n\ \n\ # search both forward and backward from the cursor position. Note that\n\ # using a regex search can lead to incorrect results if any of the special\n\ # regex characters is encountered, which is not considered a delimiter\n\ backwardSearchResult = search_string(scanString, keyString, keyStart-1, \\\n\ "backward", "regex")\n\ forwardSearchResult = search_string(scanString, keyString, keyEnd, "regex")\n\ if (backwardSearchResult == -1 && forwardSearchResult == -1) {\n\ beep()\n\ return\n\ }\n\ \n\ # if only one direction matched, use that, otherwise use the nearest\n\ if (backwardSearchResult == -1)\n\ matchStart = forwardSearchResult\n\ else if (forwardSearchResult == -1)\n\ matchStart = backwardSearchResult\n\ else {\n\ if (keyStart - backwardSearchResult <= forwardSearchResult - keyEnd)\n\ matchStart = backwardSearchResult\n\ else\n\ matchStart = forwardSearchResult\n\ }\n\ \n\ # find the complete word\n\ matchEnd = search_string(scanString, ">", matchStart, "regex")\n\ completedWord = substring(scanString, matchStart, matchEnd)\n\ \n\ # replace it in the window\n\ replace_range(startScan + keyStart, $cursor, completedWord)\n\ }\n\ Edit>Toggle case next:Ctrl+Alt+6::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ replace_range($cursor, $cursor+1, togglecase(get_character($cursor)))\n\ forward_character()\n\ }\n\ Edit>Toggle case sel:::R: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ replace_selection(togglecase(get_selection()))\n\ }\n\ HTML>directive@SGML HTML@XML:Shift+Ctrl+Period::R: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ html_convert_to_markup()\n\ }\n\ HTML>dialog directive@SGML HTML@XML:Shift+Ctrl+Slash::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ $html_add_markup_brackets["last"] = html_ask_for_markup()\n\ }\n\ HTML>-a name-@SGML HTML:Ctrl+Alt+A::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ html_make_A_NAME()\n\ }\n\ HTML>-a href-@SGML HTML:Alt+A::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ html_make_A_HREF()\n\ }\n\ HTML>-tt-@SGML HTML:Alt+T::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ $html_add_markup_brackets["last"] = html_add_markup_brackets("tt")\n\ }\n\ HTML>-i-@SGML HTML:Alt+I::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ $html_add_markup_brackets["last"] = html_add_markup_brackets("i")\n\ }\n\ HTML>-b-@SGML HTML:Alt+B::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ $html_add_markup_brackets["last"] = html_add_markup_brackets("b")\n\ }\n\ HTML>-p-@SGML HTML:Shift+Ctrl+P::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ if ($selection_start != -1) {\n\ s = "

" get_selection() "

"\n\ replace_selection(s)\n\ fill_paragraph()\n\ end_of_selection()\n\ deselect_all()\n\ }\n\ else {\n\ $html_add_markup_brackets["last"] = html_add_markup_brackets("p")\n\ }\n\ }\n\ HTML>-strong-@SGML HTML:Shift+Ctrl+S::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ $html_add_markup_brackets["last"] = html_add_markup_brackets("strong")\n\ }\n\ HTML>-pre-@SGML HTML:::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ if ($selection_start == -1)\n\ {\n\ $html_add_markup_brackets["last"] = html_add_markup_brackets("pre")\n\ }\n\ else\n\ {\n\ sel = get_selection()\n\ e = $selection_start\n\ \n\ if (search_string(sel, "&", 0) != -1)\n\ sel = replace_in_string(sel, "&", "&")\n\ \n\ if (search_string(sel, "<", 0) != -1)\n\ sel = replace_in_string(sel, "<", "<")\n\ \n\ if (search_string(sel, ">", 0) != -1)\n\ sel = replace_in_string(sel, ">", ">")\n\ \n\ sel = "
\\n" sel "
\\n"\n\ \n\ replace_selection(sel)\n\ deselect_all()\n\ set_cursor_pos(e)\n\ }\n\ }\n\ HTML>-repeat markup-@SGML HTML:::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ $html_add_markup_brackets[""] = 0\n\ if (("last" in $html_add_markup_brackets) && \\\n\ $html_add_markup_brackets["last"] != "")\n\ html_add_markup_brackets($html_add_markup_brackets["last"])\n\ else\n\ $html_add_markup_brackets["last"] = html_ask_for_markup()\n\ }\n\ HTML>&entities;@SGML HTML@XML:::R: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ s = html_entities()\n\ replace_selection(s)\n\ }\n\ HTML>&entities; (all)@SGML HTML@XML:::R: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ s = html_entities("", "all")\n\ replace_selection(s)\n\ }\n\ NEdit Macro>Make Debug Dialog@NEdit Macro@NEdit Macro RE:::R: {\n\ # convert the current NEdit Macro code selection into a dialog text\n\ # if it is an assignment, add the assigned value to the text\n\ \n\ # start by finding out where we are and picking up the code string\n\ beg = $selection_start\n\ pos = $selection_end\n\ if (pos == -1 || beg == pos)\n\ return # no selection\n\ \n\ s = get_selection()\n\ deselect_all()\n\ \n\ if (s == "")\n\ return # no selection - odd!\n\ \n\ if (substring(s, -1) != "\\n")\n\ pos = search("\\n", pos)\n\ else\n\ pos--\n\ \n\ if (pos == -1)\n\ pos = $text_length\n\ \n\ # RE for strings in NEdit Macro\n\ strRE = "\\"" # open quote \\\n\ "(?:" # a group of zero or more \\\n\ "[^\\\\\\\\\\"]" # non-backslash or quote character \\\n\ "|\\\\\\\\(?:0[0-3][0-7]{1,2}" # or backslash and: 0 and octdigit \\\n\ "|0[0-7]{1,2}" # \\\n\ "|[xX][0-9a-fA-F]{1,2}" # and: x and hexdigit \\\n\ "|[\\"?\\\\\\\\abefnrtv]" # and special escape \\\n\ ")" # \\\n\ ")*" # \\\n\ "\\"" # ending with close quote\n\ \n\ # fetch left hand side of first assignment found\n\ before_eq = s\n\ # remove strings and other comments to find valid assignment\n\ no_strcmt = before_eq\n\ no_strcmt = replace_in_string(no_strcmt, strRE, "", "regex", "copy")\n\ no_strcmt = replace_in_string(no_strcmt, "#.*$", "", "regex", "copy")\n\ # remove all text of lines not containing an assignment operator\n\ no_strcmt = replace_in_string(no_strcmt, \\\n\ "^(.*?(? \\" " before_eq\n\ \n\ # double-up backslashes\n\ s = replace_in_string(s, "\\\\", "\\\\\\\\", "case", "copy")\n\ \n\ # replace double-quotes with backslash+double-quotes\n\ s = replace_in_string(s, "\\"", "\\\\\\"", "case", "copy")\n\ \n\ # replace newlines (except for terminating ones) with backslash+'n'\n\ s = replace_in_string(s, "(?n\\n*$)", "", "regex", "copy") # remove ending "\\n"s\n\ s = replace_in_string(s, "\\n", "\\\\n\\" \\\\\\n \\"", "case", "copy")\n\ \n\ set_cursor_pos(pos)\n\ insert_string("\\ndialog(\\"" s "\\"" before_eq ")")\n\ }\n\ NEdit Macro>Make Debug Values Dialog@NEdit Macro@NEdit Macro RE:::: {\n\ \n\ # ask for variable values to display, one at a time, and build a dialog\n\ # to display them.\n\ \n\ locked = $locked\n\ set_locked(1)\n\ \n\ pos = $cursor\n\ \n\ basetitle = "Make Debug Values Dialog\\n"\n\ subtitle = ""\n\ title = basetitle subtitle "\\n"\n\ \n\ numvar = "Number"\n\ strvar = "String"\n\ txtvar = "Text"\n\ \n\ btn[1] = numvar\n\ btn[2] = strvar\n\ btn[3] = txtvar\n\ \n\ cancel = "Done"\n\ quit = "Cancel all"\n\ btn[0] = cancel\n\ nCancel = btn[]\n\ btn[nCancel] = btn[0]\n\ nQuit = nCancel + 1\n\ btn[nQuit] = quit\n\ \n\ prompt = "Macro variables"\n\ dialog_str = ""\n\ q = "\\""\n\ qq = "\\\\\\""\n\ c = ", "\n\ s = " "\n\ sep = ""\n\ count = 0\n\ do_list = 0\n\ \n\ while (1)\n\ {\n\ var = string_dialog(title \\\n\ "Enter variable", btn[1], btn[2], btn[3], \\\n\ btn[nCancel], btn[nQuit])\n\ qvar = replace_in_string(var, "\\\\", "\\\\\\\\", "case", "copy")\n\ qvar = replace_in_string(qvar, q, qq, "case", "copy")\n\ \n\ got_btn = btn[$string_dialog_button]\n\ str = ""\n\ if (got_btn == numvar && var != "")\n\ {\n\ str = sep q qvar " = " q s var\n\ }\n\ else if (got_btn == strvar && var != "")\n\ {\n\ str = sep q qvar " = " qq q s var s q qq q\n\ }\n\ else if (got_btn == txtvar && var != "")\n\ {\n\ str = sep q qvar " =\\\\n" q s \\\n\ "replace_in_string(" var ", " \\\n\ q "^" q ", " \\\n\ q s s s s s s s "»" q ", " \\\n\ q "regex" q c q "copy" q ")" \\\n\ s q "«««" q\n\ do_list = 1\n\ }\n\ else if (got_btn == cancel)\n\ break\n\ else if (got_btn == quit)\n\ {\n\ set_locked(locked)\n\ return\n\ }\n\ else if (var == "")\n\ {\n\ if (dialog(title "No variable name given - stop asking for more?", \\\n\ "Yes, stop", "No, continue") == 1)\n\ break\n\ else\n\ continue\n\ }\n\ else\n\ break\n\ count++\n\ subtitle = subtitle " " got_btn ": " var "\\n"\n\ title = basetitle " So far (" count "):\\n" subtitle "\\n"\n\ dialog_str = dialog_str str\n\ sep = " \\"\\\\n\\" \\\\\\n "\n\ }\n\ \n\ if (!count)\n\ {\n\ set_locked(locked)\n\ return\n\ }\n\ \n\ head = string_dialog(title "Default title is " q prompt q "\\n\\n" \\\n\ "Dialog's new prompt string?", \\\n\ "OK", "Cancel")\n\ \n\ if (head == "")\n\ head = prompt\n\ \n\ head = replace_in_string(head, "\\\\", "\\\\\\\\", "case", "copy")\n\ head = q replace_in_string(head, q, qq, "case", "copy") q \n\ \n\ if ($string_dialog_button != 1)\n\ {\n\ set_locked(locked)\n\ return\n\ }\n\ \n\ # the dialog's text is in dialog_str - now paste it in\n\ #dialog_str = "(" head sep dialog_str ")"\n\ \n\ btn[1 + (1 - do_list)] = "List"\n\ btn[1 + do_list ] = "Normal"\n\ \n\ list_dialog(title "Add this as what kind of dialog?\\n\\n" \\\n\ head, \\\n\ dialog_str, btn[1], btn[2], "No")\n\ got_btn = $list_dialog_button - 1\n\ if (got_btn == 0 || got_btn == 1)\n\ {\n\ set_cursor_pos(pos)\n\ set_locked(locked)\n\ beginning_of_line()\n\ \n\ if (got_btn == do_list)\n\ str = "dialog"\n\ else\n\ {\n\ str = "list_dialog"\n\ sep = ", \\\\\\n"\n\ }\n\ \n\ dialog_str = "(" head sep dialog_str ")"\n\ \n\ s = replace_in_string(str, ".", " ", "regex")\n\ dialog_str = replace_in_string(dialog_str, "^", s, "regex")\n\ dialog_str = str substring(dialog_str, length(str))\n\ \n\ insert_string(dialog_str "\\n")\n\ }\n\ set_locked(locked)\n\ }\n\ NEdit Macro>NEDIT_LOADED settings:::: {\n\ NEDIT_show_settings()\n\ }\n\ NEdit Macro>Loaded files full:::: {\n\ NEDIT_show_macro_files()\n\ }\n\ NEdit Macro>Loaded files:::: {\n\ NEDIT_show_macro_file_names()\n\ }\n\ NEdit Macro>Reload file:::: {\n\ NEDIT_request_reload_macro_file("", "short")\n\ }\n\ NEdit Macro>Reload this file@NEdit Macro:::: {\n\ NEDIT_request_reload_macro_file($file_path $file_name)\n\ }\n\ NEdit Macro>Reload all:::: {\n\ NEDIT_reload_all_macro_files()\n\ }\n\ NEdit Macro>Open file:::: {\n\ NEDIT_request_edit_macro_file("short")\n\ }\n\ NEdit Macro>Make Macro Calltips:::: {\n\ NEDIT_require_macro_file("MakeMacroCallTips.nm")\n\ \n\ # default file name\n\ #fname = replace_in_string($NEDIT_MACRO_DIR, "/$", "", "regex", "copy") ".ct"\n\ fname = $NEDIT_HOME_DIR "/calltips/" $NEDIT_MACRO_DIR_NAME ".ct"\n\ fname = NEDIT_reduce_filename(fname)\n\ \n\ s = list_dialog("Send calltips data where?", \\\n\ "New document window\\n" \\\n\ "File " fname "\\n" \\\n\ "", "OK", "Cancel")\n\ if ($list_dialog_button != 1)\n\ return\n\ \n\ cts = MakeMacroCallTips($NEDIT_MACRO_DIR)\n\ if (cts == "")\n\ return dialog("failed to create calltips from files in " $NEDIT_MACRO_DIR)\n\ \n\ if (s == "New document window")\n\ {\n\ new()\n\ focus_window("last")\n\ insert_string(cts)\n\ }\n\ else if (s == ("File " fname))\n\ {\n\ if (!write_file(cts, fname))\n\ dialog("Failed to save calltips to file " fname)\n\ }\n\ }\n\ NEdit Macro>Make Macro Calltips (Debug):::: {\n\ NEDIT_require_macro_file("MakeMacroCallTipsDbg.nm")\n\ \n\ # default file name\n\ #fname = replace_in_string($NEDIT_MACRO_DIR, "/$", "", "regex", "copy") ".ct"\n\ fname = $NEDIT_HOME_DIR "/calltips/" $NEDIT_MACRO_DIR_NAME ".ct"\n\ fname = NEDIT_reduce_filename(fname)\n\ \n\ s = list_dialog("Send calltips data where?", \\\n\ "New document window\\n" \\\n\ "File " fname "\\n" \\\n\ "", "OK", "Cancel")\n\ if ($list_dialog_button != 1)\n\ return\n\ \n\ cts = MakeMacroCallTipsDbg($NEDIT_MACRO_DIR)\n\ if (cts == "")\n\ return dialog("failed to create calltips from files in " $NEDIT_MACRO_DIR)\n\ \n\ if (s == "New document window")\n\ {\n\ new()\n\ focus_window("last")\n\ insert_string(cts)\n\ }\n\ else if (s == ("File " fname))\n\ {\n\ if (!write_file(cts, fname))\n\ dialog("Failed to save calltips to file " fname)\n\ }\n\ }\n\ NEdit Macro>nedit.rc>Open nedit.rc:::: {\n\ # open the current "nedit.rc" file\n\ \n\ base = $NEDIT_HOME_DIR\n\ envb = getenv("NEDIT_HOME")\n\ home = getenv("HOME")\n\ ndir = ".nedit"\n\ file = "nedit.rc"\n\ \n\ file_names[0] = base "/" file\n\ file_names[1] = envb "/" file\n\ file_names[2] = home "/" ndir "/" file\n\ \n\ nedit_rc = ""\n\ \n\ for (i = 0; i < file_names[]; ++i)\n\ {\n\ s = read_file(file_names[i])\n\ if ($read_status)\n\ {\n\ nedit_rc = file_names[i]\n\ break\n\ }\n\ }\n\ \n\ if (nedit_rc != "")\n\ {\n\ open(nedit_rc)\n\ focus_window(nedit_rc)\n\ raise_window()\n\ }\n\ }\n\ NEdit Macro>nedit.rc>Fix nedit.rc home directories:::: {\n\ base = $NEDIT_HOME_DIR\n\ home = getenv("HOME")\n\ \n\ # replace occurrences of absolute paths containing .nedit with either\n\ # base"/" or home"/"".nedit/"; such paths may be separated by ':'s,\n\ # so exclude those from the valid characters in the list\n\ \n\ srch = "/([^:]+/)*\\\\.nedit/"\n\ \n\ if (base == (home "/.nedit"))\n\ repl = base\n\ else\n\ {\n\ s = shell_command("ls -ld " home "/.nedit", "")\n\ if ($shell_cmd_status != 0 || substring(s, 0, 1) != "d")\n\ repl = base # no .nedit directory in ${HOME}\n\ else\n\ repl = home "/.nedit"\n\ }\n\ if (substring(repl, -1) != "/")\n\ repl = repl "/"\n\ \n\ len_repl = length(repl)\n\ \n\ title = "Replacing paths matching " srch " with " repl "\\n\\n"\n\ \n\ if ($locked)\n\ {\n\ dialog(title "File " $file_name " is currently read-only")\n\ return\n\ }\n\ \n\ if ($file_name != "nedit.rc")\n\ if (2 != dialog(title \\\n\ "This file is not called nedit.rc\\nDo you want to do this?", \\\n\ "No", "Yes"))\n\ return\n\ \n\ set_language_mode("X Resources")\n\ \n\ interact = (1 == dialog(title \\\n\ "Do you want to check each change?", "Yes", "No"))\n\ \n\ end = 0\n\ nchanges = 0\n\ nfound = 0\n\ nskip = 0\n\ for (pos = search(srch, end, "regex"); \\\n\ pos >= 0; \\\n\ pos = search(srch, end, "regex"))\n\ {\n\ end = $search_end\n\ from = get_range(pos, end)\n\ do_break = 0\n\ do_it = from != repl # make sure change is significant\n\ nskip += 1 - do_it\n\ if (interact && do_it)\n\ {\n\ set_locked(1)\n\ from = get_range(pos, end)\n\ set_cursor_pos(pos)\n\ set_cursor_pos(end)\n\ select(pos, end)\n\ do_it = dialog(title \\\n\ "Do you want to change\\n " from \\\n\ "\\nto\\n " repl "\\nat this point?", "Yes", "No", "Cancel")\n\ set_locked(0)\n\ do_break = do_it != 2 # not "No" to change => "Cancel"\n\ }\n\ ++nfound\n\ if (do_it == 1) # "Yes" to change\n\ {\n\ replace_range(pos, end, repl)\n\ end = pos + len_repl\n\ ++nchanges\n\ }\n\ else if (do_break)\n\ break\n\ }\n\ \n\ if (nfound > 0 && nchanges <= nfound)\n\ {\n\ if ($modified)\n\ {\n\ res = dialog(title \\\n\ "Changed occurrences of " srch " to " repl \\\n\ "\\n - scanned " nfound \\\n\ "\\n - skipped " nskip \\\n\ "\\n - changed " nchanges \\\n\ "\\nSave file?", "Save", "Save As...", "Cancel")\n\ if (res == 1)\n\ save()\n\ else if (res == 2)\n\ save_as()\n\ else\n\ return\n\ }\n\ else\n\ dialog(title \\\n\ "Changed occurrences of " srch " to " repl \\\n\ "\\n - scanned " nfound \\\n\ "\\n - skipped " nskip \\\n\ "\\n - changed " nchanges)\n\ }\n\ }\n\ NEdit Macro>nedit.rc>Compare nedit-{light|dark}.rc:::: {\n\ NEDIT_require_macro_file("RSfileMerge.nm")\n\ \n\ base = $NEDIT_HOME_DIR\n\ \n\ nlight = base "/nedit-light.rc"\n\ ndark = base "/nedit-dark.rc"\n\ \n\ # start by altering resettable color settings\n\ \n\ # load the files\n\ flight = read_file(nlight)\n\ if (!$read_status || flight == "")\n\ return dialog("Cannot find file " nlight, "Cancel")\n\ llight = length(flight)\n\ \n\ fdark = read_file(ndark)\n\ if (!$read_status || fdark == "")\n\ return dialog("Cannot find file " ndark, "Cancel")\n\ ldark = length(fdark)\n\ \n\ # substitute the color specs (ending with ...Color|ground)\n\ findColor = "^nedit.([a-z])(\\\\w*(?:Color|[gG]round): )"\n\ replColor = "nedit.\\\\U\\\\1\\\\2"\n\ \n\ flight = replace_in_string(flight, findColor, replColor, "regex")\n\ fdark = replace_in_string(fdark, findColor, replColor, "regex")\n\ \n\ # ask whether to write back the results\n\ msg = ""\n\ if (flight != "") msg = msg nlight " color settings altered\\n"\n\ if (fdark != "") msg = msg ndark " color settings altered\\n"\n\ if (msg != "")\n\ {\n\ msg = msg "\\nWrite back altered file(s)?"\n\ if (dialog(msg, "Yes", "No") == 1)\n\ {\n\ r = 1\n\ if (flight != "") r = write_file(flight, nlight)\n\ if (!r) return dialog("Error writing back " nlight, "Cancel")\n\ r = 1\n\ if (fdark != "") r = write_file(fdark, ndark)\n\ if (!r) return dialog("Error writing back " ndark, "Cancel")\n\ }\n\ }\n\ \n\ # now diff the adjusted files\n\ new()\n\ focus_window("last")\n\ raise_window()\n\ \n\ insert_string("diff " nlight " " ndark)\n\ execute_command_line()\n\ set_language_mode("X Resources")\n\ \n\ fileMerge_from_diff()\n\ }\n\ NEdit Macro>nedit.rc>Compare with nedit.rc:::: {\n\ NEDIT_require_macro_file("RSfileMerge.nm")\n\ \n\ base = $NEDIT_HOME_DIR\n\ \n\ nfilerc = $file_path $file_name\n\ neditrc = base "/nedit.rc"\n\ if ($modified)\n\ {\n\ res = dialog("Do you want to save " nfilerc "\\n" \\\n\ "and compare it with " neditrc "?", \\\n\ "Save", "Cancel")\n\ if (res != 1)\n\ return\n\ save()\n\ }\n\ \n\ # load the files\n\ ffilerc = read_file(nfilerc)\n\ if (!$read_status || ffilerc == "")\n\ return dialog("Cannot find file " nfilerc, "Cancel")\n\ \n\ fneditrc = read_file(neditrc)\n\ if (!$read_status ||fneditrc == "")\n\ return dialog("Cannot find file " fneditrc, "Cancel")\n\ \n\ # now diff the files\n\ new()\n\ focus_window("last")\n\ raise_window()\n\ \n\ insert_string("diff " neditrc " " nfilerc)\n\ execute_command_line()\n\ set_language_mode("X Resources")\n\ \n\ fileMerge_from_diff()\n\ }\n\ NEdit Macro>NEdit DEBUG macros>Enable:::: {\n\ NEDIT_require_macro_file("DEBUG.nm")\n\ \n\ $DEBUG_ENABLE = 1\n\ }\n\ NEdit Macro>NEdit DEBUG macros>Disable:::: {\n\ NEDIT_require_macro_file("DEBUG.nm")\n\ \n\ $DEBUG_ENABLE = 0\n\ }\n\ NEdit Macro>NEdit DEBUG macros>Clear All:::: {\n\ NEDIT_require_macro_file("DEBUG.nm")\n\ \n\ DEBUG_clear_all()\n\ }\n\ NEdit Macro>Execute selection:::: {\n\ file = getenv("HOME") "/.-selection.nm"\n\ sel = get_selection()\n\ if (sel == "")\n\ sel = string_dialog("Enter macro statement to execute")\n\ \n\ if (substring(sel, -1) != "\\n")\n\ sel = sel "\\n"\n\ \n\ if (write_file(sel, file) == 0)\n\ return dialog("NEdit Macro>Execute selection:\\n\\n" \\\n\ "Could not write selection to file\\n"file)\n\ \n\ load_macro_file(file)\n\ \n\ err = shell_command("rm " file, "")\n\ if ($shell_cmd_status != 0)\n\ return dialog("NEdit Macro>Execute selection:\\n\\n" \\\n\ "Failed to remove temporary selection file\\n" file)\n\ }\n\ NEdit Macro>Replace macro expression with its value:::R: {\n\ err = ""\n\ if ($locked)\n\ {\n\ beep()\n\ return\n\ }\n\ \n\ beg = $selection_start\n\ end = $selection_end\n\ s = get_range(beg, end)\n\ \n\ # ignore final newline, if any\n\ if (substring(s, -1) == "\\n")\n\ {\n\ s = substring(s, 0, -1)\n\ end--\n\ }\n\ \n\ if (search_string(s, "\\n", 0) >= 0)\n\ err = "expression includes newlines\\n"\n\ \n\ strRE = "\\"(?:\\\\\\\\(?:" \\\n\ "0[0-3][0-7]{1,2}|" \\\n\ "0[0-7]{1,2}|" \\\n\ "[xX][0-9a-fA-F]{1,2}|" \\\n\ "['\\"?\\\\\\\\abefnrtv]" \\\n\ ")|[^\\\\\\\\\\"])*\\""\n\ \n\ nostr = replace_in_string(s, strRE, "", "regex", "copy")\n\ \n\ if (search_string(nostr, "\\"", 0) >= 0)\n\ err = "expression contains bad strings"\n\ \n\ keyRE = "<(?:break|continue|define|delete|do|else|for|if|in|return|while)>"\n\ if (search_string(nostr, keyRE, 0, "regex") >= 0)\n\ err = "expression contains keyword(s)"\n\ \n\ if (err != "")\n\ return dialog(err)\n\ \n\ sel = "r__ = (" s ") \\"\\"\\nreplace_range("beg", "end", r__)\\n"\n\ btn = dialog("Do you want to issue the command\\n " sel "here?", "Yes", "No")\n\ \n\ if (btn == 1)\n\ {\n\ file = getenv("HOME") "/.-selection.nm"\n\ if (write_file(sel, file) == 0)\n\ return dialog("NEdit Macro>Execute selection:\\n\\n" \\\n\ "Could not write selection to file\\n"file)\n\ load_macro_file(file)\n\ err = shell_command("rm " file, "")\n\ if ($shell_cmd_status != 0)\n\ return dialog("NEdit Macro>Execute selection:\\n\\n" \\\n\ "Failed to remove temporary selection file\\n" file)\n\ }\n\ }\n\ Various>Fill Sel. w/Char:::R: {\n\ if ($selection_start == -1) {\n\ beep()\n\ return\n\ }\n\ \n\ # Ask the user what character to fill with\n\ fillChar = string_dialog("Fill selection with what character?", "OK", "Cancel")\n\ if ($string_dialog_button == 2)\n\ return\n\ \n\ # Count the number of lines in the selection\n\ nLines = 0\n\ for (i=$selection_start; i<$selection_end; i++)\n\ if (get_character(i) == "\\n")\n\ nLines++\n\ \n\ # Create the fill text\n\ rectangular = $selection_left != -1\n\ line = ""\n\ fillText = ""\n\ if (rectangular) {\n\ for (i=0; i<$selection_right-$selection_left; i++)\n\ line = line fillChar\n\ for (i=0; i=0 && get_character(i)!="\\n"; i--)\n\ startIndent++\n\ for (i=0; i<$wrap_margin-startIndent; i++)\n\ fillText = fillText fillChar\n\ fillText = fillText "\\n"\n\ for (i=0; i<$wrap_margin; i++)\n\ line = line fillChar\n\ for (i=0; i=$selection_start && get_character(i)!="\\n"; \\\n\ i--)\n\ fillText = fillText fillChar\n\ }\n\ }\n\ \n\ # Replace the selection with the fill text\n\ replace_selection(fillText)\n\ }\n\ Various>Build Cols:::R: {\n\ NEDIT_require_macro_file("columns.nm")\n\ \n\ make_columns_dialog()\n\ }\n\ Various>Mail>Quote Mail Reply:::: {\n\ if ($selection_start == -1)\n\ replace_all("^.*$", "\\\\> &", "regex")\n\ else\n\ replace_in_selection("^.*$", "\\\\> &", "regex")\n\ }\n\ Various>Mail>Unquote Mail Reply:::: {\n\ if ($selection_start == -1)\n\ replace_all("(^\\\\> )(.*)$", "\\\\2", "regex")\n\ else\n\ replace_in_selection("(^\\\\> )(.*)$", "\\\\2", "regex")\n\ }\n\ Various>Mail>Fix mail =?? quoting:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ s = get_range(0, $text_length)\n\ t = ""\n\ while (t != s)\n\ {\n\ t = s\n\ s = replace_in_string(s, "^(.*)=\\\\n", "\\\\1", "regex", "copy")\n\ }\n\ \n\ r = ""\n\ old = 0\n\ for (pos = search_string(s, "=[0-9A-F][0-9A-F]", 0, "regex"); \\\n\ pos != -1; \\\n\ pos = search_string(s, "=[0-9A-F][0-9A-F]", pos + 3, "regex"))\n\ {\n\ pat = substring(s, pos, pos + 3)\n\ repl = hex_to_char(substring(pat, 1))\n\ r = r substring(s, old, pos) repl\n\ old = pos + 3\n\ }\n\ replace_range(0, $text_length, r)\n\ }\n\ Various>Show Language Mode:::: {\n\ s = ""\n\ s = s "File is " $file_name "\\n"\n\ s = s "Path is " $file_path "\\n\\n"\n\ s = s "Language mode is " $language_mode "\\n"\n\ s = s "Auto-indent is " $auto_indent "\\n"\n\ s = s "Tab spacing is " $tab_dist\n\ tab = $em_tab_dist\n\ if (tab < 0)\n\ tab = "off"\n\ s = s ", Emulated tab spacing is " tab "\\n"\n\ if ($use_tabs)\n\ tab = "hard tabs"\n\ else\n\ tab = "spaces only"\n\ s = s "Using " tab " in padding and tab emulation\\n"\n\ \n\ s = s "Syntax highlighting is "\n\ if ($highlight_syntax)\n\ s = s "on\\n"\n\ else\n\ s = s "off\\n"\n\ \n\ s = s "Wrap text mode is " $wrap_text\n\ s = s " (margin = " $wrap_margin ")\\n"\n\ \n\ \n\ s = s "\\nFile format is " $file_format\n\ \n\ dialog(s)\n\ \n\ }\n\ Various>Change Locking:::: {\n\ s = ""\n\ n = 0\n\ while (1)\n\ {\n\ n = dialog("Set file lock", "on", "off", "toggle", "", 0, 1, 2, "dismiss")\n\ \n\ if (n == 1)\n\ s = "on"\n\ else if (n == 2)\n\ s = "off"\n\ else if (n == 3)\n\ s = "toggle"\n\ else if (n == 4)\n\ s = ""\n\ else if (n == 5)\n\ s = ""\n\ else if (n == 6)\n\ s = ""\n\ else if (n == 7)\n\ s = ""\n\ else\n\ break\n\ \n\ if (s == "")\n\ {\n\ if (n == 4)\n\ set_read_only()\n\ else if (n == 5)\n\ set_read_only(0)\n\ else if (n == 6)\n\ set_read_only(1)\n\ else if (n == 7)\n\ set_read_only(2)\n\ }\n\ else\n\ set_read_only(s)\n\ }\n\ }\n\ Various>Code for ROR13:::R: {\n\ NEDIT_require_macro_file("ROR13.nm")\n\ \n\ replace_selection(code_ror13(get_selection()))\n\ }\n\ Various>Hex to char:::R: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ replace_selection(hex2_to_str(get_selection()))\n\ }\n\ Various>Char to hex:::R: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ replace_selection(char_to_hex(get_selection()))\n\ }\n\ Various>Fragment files:::: {\n\ NEDIT_require_macro_file("Fragment_store.nm")\n\ \n\ f = Fragment_choose_name()\n\ if (f == "")\n\ return\n\ \n\ res = dialog("Chosen frangment file is '" f "'\\nChoose an action", \\\n\ "Fetch/Add", "(Re)Load", "Open file", "Cancel")\n\ \n\ if (res == 1)\n\ Fragment_fetch(f)\n\ else if (res == 2)\n\ Fragment_load(f)\n\ else if (res == 3)\n\ Fragment_open_file(f)\n\ }\n\ Various>Copy as REGEX:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ s = get_selection("any")\n\ \n\ if (s == "")\n\ s = string_dialog("Enter string to convert to REGEX", "OK")\n\ \n\ if (s == "")\n\ return\n\ \n\ t = quote_literal_as_regex(s)\n\ string_to_clipboard(t)\n\ }\n\ Various>Find as REGEX:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ s = get_selection("any")\n\ \n\ if (s == "")\n\ s = string_dialog("Enter string to convert to REGEX", "OK")\n\ \n\ if (s == "")\n\ return\n\ \n\ t = quote_literal_as_regex(s)\n\ find(t, "regex")\n\ }\n\ Various>Copy unquoted REGEX@NEdit Macro@NEdit Macro RE:::: {\n\ s = get_selection("all")\n\ if (s == "")\n\ s = string_dialog("Enter quoted REGEX to copy unquoted")\n\ \n\ if (s != "")\n\ string_to_clipboard(replace_in_string(s, "\\\\\\\\", "\\\\", "copy"))\n\ }\n\ Various>Useful REGEXes>Find a REGEX:::: {\n\ NEDIT_require_macro_file("REGEX_store.nm")\n\ \n\ REGEX_fetch()\n\ }\n\ Various>Useful REGEXes>Open REGEX file:::: {\n\ NEDIT_require_macro_file("REGEX_store.nm")\n\ \n\ REGEX_open_regexes_file()\n\ }\n\ Various>Useful REGEXes>(Re)load REGEX file:::: {\n\ NEDIT_require_macro_file("REGEX_store.nm")\n\ \n\ REGEX_load_regexes()\n\ }\n\ Various>Useful REGEXes>Find quoted REGEX:::: {\n\ # we want something to match a non-string-delimiting double quote\n\ nonDelimDQ = "(?:\\\\\\\\.|[^\\\\\\\\\\"])"\n\ nonDelimDQs = nonDelimDQ "*"\n\ \n\ # anchored RE has either a ^ at the front or a $ at the end\n\ anchored = "\\\\^" nonDelimDQs "|" nonDelimDQs "\\\\$"\n\ \n\ # for non-anchored, just detect whether the string contains typical RE pieces\n\ nonAnchored = nonDelimDQs # start set of typical RE pieces \\\n\ "(?:" "\\\\(\\\\?" # start parenthetical expression \\\n\ "|" "[]).][*+?]" # repeat after class,group,any \\\n\ "|" "[*+]\\\\?" # non-greedy repeat \\\n\ "|" "\\\\[\\\\^?" nonDelimDQ "+?\\\\]" # [character-class] \\\n\ "|" "\\\\|" # pipe-char \\\n\ "|" "\\\\\\\\\\\\\\\\[1-9&dDlLsSwWyYuUabefnrtv]" # double-backslashed char \\\n\ "|" "\\\\\\\\[-\\\\[\\\\]<>{}().|^$*+?&]" # escaped RE metachar \\\n\ ")" nonDelimDQs\n\ \n\ matchRE = "\\"(?:" anchored "|" nonAnchored ")\\""\n\ \n\ find(matchRE, "regex")\n\ }\n\ Various>Calltip files>Open file:::: {\n\ NEDIT_require_macro_file("CallTipFiles.nm")\n\ \n\ CallTipFileOpen()\n\ }\n\ Various>Calltip files>Load file:::: {\n\ NEDIT_require_macro_file("CallTipFiles.nm")\n\ \n\ CallTipFileLoad()\n\ }\n\ Various>Calltip files>Create new:::: {\n\ NEDIT_require_macro_file("CallTipFiles.nm")\n\ \n\ CallTipFileCreateNew()\n\ }\n\ Various>Convert URL %-escape to text:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ REesc = "%[0-9a-fA-F][0-9a-fA-F]"\n\ \n\ end = 0\n\ for (pos = search(REesc, 0, "regex"); \\\n\ pos >= 0; \\\n\ pos = search(REesc, end, "regex"))\n\ {\n\ end = $search_end\n\ hex = get_range(pos + 1, pos + 3)\n\ chr = hex_to_char(hex)\n\ replace_all("%" hex, chr, "case")\n\ end = pos + 1\n\ }\n\ \n\ REesc = "\\\\&#[0-9a-fA-F]+;"\n\ \n\ end = 0\n\ for (pos = search(REesc, 0, "regex"); \\\n\ pos >= 0; \\\n\ pos = search(REesc, end, "regex"))\n\ {\n\ end = $search_end\n\ str = get_range(pos, end)\n\ int = substring(str, 2, -1)\n\ chr = tochar(int)\n\ replace_all(str, chr, "case")\n\ end = pos + 1\n\ }\n\ }\n\ Various>Convert UTF-8 to ISO8859-1:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ REextn = "[\\x80-\\xBF]"\n\ RE1 = "[\\xC0-\\xDF]" REextn\n\ RE2 = "[\\xE0-\\xEF]" REextn REextn\n\ RE3 = "[\\xF0-\\xF7]" REextn REextn REextn\n\ RE4 = "[\\xF8-\\xFB]" REextn REextn REextn REextn\n\ RE5 = "[\\xFC-\\xFD]" REextn REextn REextn REextn REextn\n\ REany = "(?:"RE1"|"RE2"|"RE3"|"RE4"|"RE5")(?!"REextn")"\n\ \n\ RangeSet_set_color("UTF8 Errors", "red")\n\ RangeSet_set_color("UTF8 Converted", "cyan")\n\ \n\ conv = ""\n\ end = 0\n\ for (pos = search(REany, end, "regex"); pos >= 0; pos = search(REany, end, "regex"))\n\ {\n\ end = $search_end\n\ if (end - pos > 2)\n\ continue\n\ str = get_range(pos, end)\n\ ch1 = substr(str, 0, 1)\n\ c1 = toascii(ch1)\n\ n = 0\n\ j = 128\n\ # from bit 6 to bit 2 in ch1 (of bits 7 to 0), count contiguous 1s\n\ for (i = 64; i > 2 && (c1 & i); i /= 2)\n\ {\n\ n++\n\ j += i\n\ }\n\ # now build cval: start\n\ cval = c1 & compl(j)\n\ #dialog("orig = "c1" "int_to_bin(c1,8)"\\ncval = "int_to_bin(cval,8))\n\ for (i = 1; i <= n; i++)\n\ {\n\ c = toascii(substr(str, i, i + 1))\n\ cval = 64 * cval + (c & 63)\n\ }\n\ if (cval < 256)\n\ {\n\ ch = tochar(cval)\n\ replace_all(str, ch, "case")\n\ end = pos + 1\n\ RangeSet_add("UTF8 Converted", pos, end)\n\ conv = conv "\\n " str " -> " ch " (" cval " = \\\\x" int_to_hex(cval) ")"\n\ set_cursor_pos(pos)\n\ set_cursor_pos(end)\n\ }\n\ else\n\ {\n\ RangeSet_add("UTF8 Errors", pos, end)\n\ conv = conv "\\n " str " failed (" cval " = \\\\x" int_to_hex(cval) ")"\n\ }\n\ }\n\ if (conv != "")\n\ {\n\ dialog("Converted:" conv)\n\ }\n\ }\n\ Rangesets>Add:::R: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ L = RangeSet_ask("Range set to add to")\n\ if (L == "")\n\ return\n\ \n\ r = RangeSet_add(L)\n\ }\n\ Rangesets>Find>All in "Find All" (green):::: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ NEDIT_require_macro_file("RSfindAll.nm")\n\ \n\ rs = "Find All"\n\ action = "ask"\n\ \n\ # create the range set\n\ if (!RangeSet_getRangeSet(rs))\n\ {\n\ if (!RangeSet_getNewRangeSet(rs))\n\ {\n\ dialog("Could not create range set " rs, "Cancel")\n\ return\n\ }\n\ \n\ if (background_is_dark())\n\ RangeSet_set_color_basic(rs, "#007f40")\n\ else\n\ RangeSet_set_color_basic(rs, "#a0ff00")\n\ \n\ action = "add"\n\ }\n\ \n\ RangeSet_FindAll_Ask(rs, action)\n\ }\n\ Rangesets>Find>All in "Find All" again:::: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ NEDIT_require_macro_file("RSfindAll.nm")\n\ \n\ rs = "Find All"\n\ action = "ask"\n\ \n\ # pick up the last find parameters\n\ lastfind = FindAllHistory_Get()\n\ \n\ # create the range set\n\ if (!RangeSet_getRangeSet(rs))\n\ {\n\ if (!RangeSet_getNewRangeSet(rs))\n\ {\n\ dialog("Could not create range set " rs, "Cancel")\n\ return\n\ }\n\ \n\ if (background_is_dark())\n\ RangeSet_set_color_basic(rs, "#007f40")\n\ else\n\ RangeSet_set_color_basic(rs, "#a0ff00")\n\ \n\ action = "add"\n\ }\n\ \n\ if (lastfind[] == 0)\n\ {\n\ # found nothing from last time - do normal "Find All"\n\ RangeSet_FindAll_Ask(rs, action)\n\ return\n\ }\n\ \n\ # pick up any selection as a pattern, otherwise use the old one\n\ pattern = get_selection("any")\n\ if (pattern == "")\n\ {\n\ pattern = lastfind["pattern"]\n\ }\n\ type = lastfind["type"]\n\ \n\ # NB this search is not added to the Find All history\n\ RangeSet_FindAll(rs, pattern, type)\n\ }\n\ Rangesets>Find>All:::: {\n\ NEDIT_require_macro_file("RSfindAll.nm")\n\ \n\ RangeSet_FindAll_Ask()\n\ }\n\ Rangesets>Find>All (all files):::: {\n\ NEDIT_require_macro_file("RSfindAll.nm")\n\ \n\ info = RangeSet_FindAll_Ask_AllDocs()\n\ if (info[])\n\ {\n\ new("window")\n\ focus_window("last")\n\ raise_window()\n\ insert_string( "Pattern: " info["pattern"] \\\n\ "\\nType: " info["type"] \\\n\ "\\nOccurrences: " info["occurrences"] \\\n\ "\\n\\n" info["results"])\n\ \n\ set_language_mode("grep -n out")\n\ }\n\ }\n\ Rangesets>Color>Dark Background?:::: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ background_is_dark("ask")\n\ }\n\ Rangesets>Color>Quick:::: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ RangeSet_QuickColor()\n\ }\n\ Rangesets>Color>Set:::: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ L = RangeSet_ask("Range set to color")\n\ if (L == "")\n\ return\n\ \n\ C = string_dialog("Color for Range set \\""L"\\"")\n\ \n\ if (C == "")\n\ r = RangeSet_set_color_basic(L)\n\ else\n\ r = RangeSet_set_color_basic(L, C)\n\ }\n\ Rangesets>Color>Old-style:::: {\n\ NEDIT_require_macro_file("RSextensions.nm")\n\ \n\ list = $RangeSet_list\n\ if (list != "") {\n\ LL = substring(list, 0, 1)\n\ L = string_dialog("Range set to color (defined: " list ")", "OK", "Set " LL, "Cancel")\n\ if (L == "" && $string_dialog_button == 2)\n\ L = LL\n\ if (L == "")\n\ return\n\ }\n\ else {\n\ L = string_dialog("Range set to color", "OK", "Cancel")\n\ if (L == "" || $string_dialog_button == 2)\n\ return\n\ }\n\ \n\ C = string_dialog("Color for Range set \\""L"\\"")\n\ \n\ if (C == "")\n\ r = RangeSet_set_color_basic(L)\n\ else\n\ r = RangeSet_set_color_basic(L, C)\n\ }\n\ Rangesets>Color>Colored sets>Red:::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ col = "Red"\n\ \n\ RangeSet_add(col)\n\ RangeSet_set_color(col, col)\n\ }\n\ Rangesets>Color>Colored sets>Blue:::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ col = "Blue"\n\ \n\ RangeSet_add(col)\n\ RangeSet_set_color(col, col)\n\ }\n\ Rangesets>Color>Colored sets>Green:::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ col = "Green"\n\ \n\ RangeSet_add(col)\n\ RangeSet_set_color(col, col)\n\ }\n\ Rangesets>Color>Colored sets>Cyan:::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ col = "Cyan"\n\ \n\ RangeSet_add(col)\n\ RangeSet_set_color(col, col)\n\ }\n\ Rangesets>Color>Colored sets>Magenta:::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ col = "Magenta"\n\ \n\ RangeSet_add(col)\n\ RangeSet_set_color(col, col)\n\ }\n\ Rangesets>Color>Colored sets>Yellow:::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ col = "Yellow"\n\ \n\ RangeSet_add(col)\n\ RangeSet_set_color(col, col)\n\ }\n\ Rangesets>Color>Colored sets>Brown:::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ col = "Brown"\n\ \n\ RangeSet_add(col)\n\ RangeSet_set_color(col, col)\n\ }\n\ Rangesets>Color>Colored sets>Orange:::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ col = "Orange"\n\ \n\ RangeSet_add(col)\n\ RangeSet_set_color(col, col)\n\ }\n\ Rangesets>Color>Colored sets>White:::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ col = "White"\n\ \n\ RangeSet_add(col)\n\ RangeSet_set_color(col, col)\n\ }\n\ Rangesets>Color>Colored sets>Gray:::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ col = "Gray"\n\ \n\ RangeSet_add(col)\n\ RangeSet_set_color(col, col)\n\ }\n\ Rangesets>Color>Colored sets>Black:::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ col = "Black"\n\ \n\ RangeSet_add(col)\n\ RangeSet_set_color(col, col)\n\ }\n\ Rangesets>Color>XPM Color:::: {\n\ NEDIT_require_macro_file("element.nm")\n\ NEDIT_require_macro_file("RSextensions.nm")\n\ \n\ set_language_mode("XPM pixmap")\n\ \n\ lablist = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"\n\ charlist = ""\n\ text = get_range(0, $text_length)\n\ rest = $text_length\n\ \n\ for (i = 0; text != "";)\n\ {\n\ l = element_i(text, 0)\n\ text = element_from_to(text, 1)\n\ \n\ if (search_string(l, "^\\"(.).*[ \\t]c[ \\t]([^ \\t\\"]+)\\",[ \\t]*$", 0, "regex") != -1)\n\ {\n\ v = replace_in_string(l, "^\\"(.).*[ \\t]c[ \\t]([^ \\t\\"]+)\\",[ \\t]*$", "\\\\1\\t\\\\2", "regex")\n\ r = substring(lablist, i, i+1)\n\ s = element_i(v, 0, "\\t")\n\ c = element_i(v, 1, "\\t")\n\ rest = length(text)\n\ if (tolower(c) == "none")\n\ continue\n\ if (i >= 26)\n\ continue\n\ i++\n\ # dialog("l='"l"'\\nv='"v"'\\n"i": Color range "r" for letter '"s"' with "c)\n\ charlist = charlist s\n\ if (RangeSet_defined(r))\n\ RangeSet_forget(r)\n\ RangeSet_set_color_basic(r, c)\n\ }\n\ }\n\ \n\ startpos = search("^\\"", $text_length - rest, "regex")\n\ \n\ while (i > 0)\n\ {\n\ s = substring(charlist, i-1, i)\n\ r = substring(lablist, i-1, i)\n\ sre = s\n\ # dialog("search_string(\\"[]\\\\|+*?.^$<>\\", \\""s"\\", 0, \\"case\\") = " search_string("[]\\\\|+*?.^$<>", s, 0, "case"))\n\ if (search_string("[]\\\\|+*?.^$<>", s, 0, "case") >= 0)\n\ sre = "\\\\"s\n\ sre = sre"+"\n\ # dialog(i": Color range "r" for letter '"s"' ("sre")")\n\ \n\ pos = startpos\n\ while (pos != -1)\n\ {\n\ pos = search(sre, pos, "regex", "forward")\n\ if (pos >= 0)\n\ {\n\ RangeSet_add(r, pos, $search_end)\n\ pos = $search_end\n\ }\n\ }\n\ i--\n\ }\n\ }\n\ Rangesets>RS1 =>RS1 + selection repeat:::R: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ RS1 = ""\n\ color_it = 0\n\ \n\ $RS1eqRS1plusRS2[""] = ""\n\ if ("RS1" in $RS1eqRS1plusRS2)\n\ RS1 = $RS1eqRS1plusRS2["RS1"]\n\ if (!RangeSet_defined(RS1))\n\ RS1 = ""\n\ \n\ confirm = 0\n\ if ("Confirm" in $RS1eqRS1plusRS2)\n\ confirm = $RS1eqRS1plusRS2["Confirm"]\n\ \n\ $RS1eqRS1plusRS2["RS1"] = RS1\n\ \n\ intro = "[Repeat] Add selection to range set\\n\\n"\n\ \n\ if (confirm)\n\ {\n\ res = dialog(intro "{" RS1 "} = {" RS1 "} + selection", \\\n\ "OK", "Change Sets", "No")\n\ if (res < 1 || res > 2)\n\ return\n\ if (res == 2)\n\ RS1 = ""\n\ # else (res == 1) - no change, carry on\n\ }\n\ \n\ if (RS1 == "")\n\ {\n\ RS1 = RangeSet_ask(intro "First range set")\n\ if (RS1 == "")\n\ return\n\ \n\ if (!RangeSet_defined(RS1))\n\ color_it = 1\n\ \n\ $RS1eqRS1plusRS2["RS1"] = RS1\n\ }\n\ \n\ r = RangeSet_add(RS1)\n\ if (color_it)\n\ RangeSet_QuickColor(RS1)\n\ }\n\ Rangesets>RS1 =>RS1 - selection repeat:::R: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ RS1 = ""\n\ color_it = 0\n\ \n\ $RS1eqRS1plusRS2[""] = ""\n\ if ("RS1" in $RS1eqRS1plusRS2)\n\ RS1 = $RS1eqRS1plusRS2["RS1"]\n\ if (!RangeSet_defined(RS1))\n\ RS1 = ""\n\ \n\ confirm = 0\n\ if ("Confirm" in $RS1eqRS1plusRS2)\n\ confirm = $RS1eqRS1plusRS2["Confirm"]\n\ \n\ $RS1eqRS1plusRS2["RS1"] = RS1\n\ \n\ intro = "[Repeat] Add selection to range set\\n\\n"\n\ \n\ if (confirm)\n\ {\n\ res = dialog(intro "{" RS1 "} = {" RS1 "} + selection", \\\n\ "OK", "Change Sets", "No")\n\ if (res < 1 || res > 2)\n\ return\n\ if (res == 2)\n\ RS1 = ""\n\ # else (res == 1) - no change, carry on\n\ }\n\ \n\ if (RS1 == "")\n\ {\n\ RS1 = RangeSet_ask(intro "First range set")\n\ if (RS1 == "")\n\ return\n\ \n\ if (!RangeSet_defined(RS1))\n\ color_it = 1\n\ \n\ $RS1eqRS1plusRS2["RS1"] = RS1\n\ }\n\ \n\ r = RangeSet_remove(RS1)\n\ if (color_it)\n\ RangeSet_QuickColor(RS1)\n\ }\n\ Rangesets>RS1 =>RS1 + RS2 repeat:::: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ RS1 = ""\n\ RS2 = ""\n\ color_it = 0\n\ \n\ $RS1eqRS1plusRS2[""] = ""\n\ if ("RS1" in $RS1eqRS1plusRS2)\n\ RS1 = $RS1eqRS1plusRS2["RS1"]\n\ if (!RangeSet_defined(RS1))\n\ RS1 = ""\n\ \n\ if ("RS2" in $RS1eqRS1plusRS2)\n\ RS2 = $RS1eqRS1plusRS2["RS2"]\n\ if (!RangeSet_defined(RS2))\n\ RS2 = ""\n\ \n\ confirm = 0\n\ if ("Confirm" in $RS1eqRS1plusRS2)\n\ confirm = $RS1eqRS1plusRS2["Confirm"]\n\ \n\ $RS1eqRS1plusRS2["RS1"] = RS1\n\ $RS1eqRS1plusRS2["RS2"] = RS2\n\ \n\ intro = "[Repeat] Add second range set ranges to first range set\\n\\n"\n\ \n\ if (confirm)\n\ {\n\ res = dialog(intro "{" RS1 "} = {" RS1 "} + {" RS2 "}", \\\n\ "OK", "Change Sets", "No")\n\ if (res < 1 || res > 2)\n\ return\n\ if (res == 2)\n\ {\n\ RS1 = ""\n\ RS2 = ""\n\ }\n\ # else (res == 1) - no change, carry on\n\ }\n\ \n\ if (RS1 == "")\n\ {\n\ RS1 = RangeSet_ask(intro "First range set")\n\ if (RS1 == "")\n\ return\n\ \n\ if (!RangeSet_defined(RS1))\n\ color_it = 1\n\ \n\ $RS1eqRS1plusRS2["RS1"] = RS1\n\ }\n\ \n\ if (RS2 == "")\n\ {\n\ RS2 = RangeSet_askExisting(intro "Second range set (first is "RS1")")\n\ if (RS2 == "")\n\ return\n\ \n\ $RS1eqRS1plusRS2["RS2"] = RS2\n\ }\n\ \n\ r = RangeSet_add(RS1, RS2)\n\ if (color_it)\n\ RangeSet_QuickColor(RS1)\n\ }\n\ Rangesets>RS1 =>RS1 + RS2:::: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ intro = "Add second range set ranges to first range set\\n\\n"\n\ RS1 = RangeSet_ask(intro "First range set")\n\ if (RS1 == "")\n\ return\n\ \n\ color_it = 0\n\ if (!RangeSet_defined(RS1))\n\ color_it = 1\n\ \n\ RS2 = RangeSet_askExisting(intro "Second range set (first is "RS1")")\n\ if (RS2 == "")\n\ return\n\ \n\ r = RangeSet_add(RS1, RS2)\n\ if (color_it)\n\ RangeSet_QuickColor(RS1)\n\ \n\ $RS1eqRS1plusRS2["RS1"] = RS1\n\ $RS1eqRS1plusRS2["RS2"] = RS2\n\ }\n\ Rangesets>RS1 =>RS1 - RS2:::: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ intro = "Remove second range set ranges from first range set\\n\\n"\n\ RS1 = RangeSet_ask(intro "First range set")\n\ if (RS1 == "")\n\ return\n\ \n\ color_it = 0\n\ if (!RangeSet_defined(RS1))\n\ color_it = 1\n\ \n\ RS2 = RangeSet_askExisting(intro "Second range set (first is "RS1")")\n\ if (RS2 == "")\n\ return\n\ \n\ r = RangeSet_remove(RS1, RS2)\n\ if (color_it)\n\ RangeSet_QuickColor(RS1)\n\ \n\ $RS1eqRS1plusRS2["RS1"] = RS1\n\ $RS1eqRS1plusRS2["RS2"] = RS2\n\ }\n\ Rangesets>RS1 =>RS1 - RS2 repeat:::: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ RS1 = ""\n\ RS2 = ""\n\ color_it = 0\n\ \n\ $RS1eqRS1plusRS2[""] = ""\n\ if ("RS1" in $RS1eqRS1plusRS2)\n\ RS1 = $RS1eqRS1plusRS2["RS1"]\n\ if (!RangeSet_defined(RS1))\n\ RS1 = ""\n\ \n\ if ("RS2" in $RS1eqRS1plusRS2)\n\ RS2 = $RS1eqRS1plusRS2["RS2"]\n\ if (!RangeSet_defined(RS2))\n\ RS2 = ""\n\ \n\ confirm = 0\n\ if ("Confirm" in $RS1eqRS1plusRS2)\n\ confirm = $RS1eqRS1plusRS2["Confirm"]\n\ \n\ $RS1eqRS1plusRS2["RS1"] = RS1\n\ $RS1eqRS1plusRS2["RS2"] = RS2\n\ \n\ intro = "[Repeat] Remove second range set ranges from first range set\\n\\n"\n\ \n\ if (confirm)\n\ {\n\ res = dialog(intro "{" RS1 "} = {" RS1 "} - {" RS2 "}", \\\n\ "OK", "Change Sets", "No")\n\ if (res < 1 || res > 2)\n\ return\n\ if (res == 2)\n\ {\n\ RS1 = ""\n\ RS2 = ""\n\ }\n\ # else (res == 1) - no change, carry on\n\ }\n\ \n\ if (RS1 == "")\n\ {\n\ RS1 = RangeSet_ask(intro "First range set")\n\ if (RS1 == "")\n\ return\n\ \n\ if (!RangeSet_defined(RS1))\n\ color_it = 1\n\ \n\ $RS1eqRS1plusRS2["RS1"] = RS1\n\ }\n\ \n\ if (RS2 == "")\n\ {\n\ RS2 = RangeSet_askExisting(intro "Second range set (first is "RS1")")\n\ if (RS2 == "")\n\ return\n\ \n\ $RS1eqRS1plusRS2["RS2"] = RS2\n\ }\n\ \n\ r = RangeSet_remove(RS1, RS2)\n\ if (color_it)\n\ RangeSet_QuickColor(RS1)\n\ }\n\ Rangesets>RS1 =>RS1 & RS2 (intersect):::: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ intro = "Change first range set to its intersection with the second range set\\n\\n"\n\ RS1 = RangeSet_askExisting(intro "First range set")\n\ if (RS1 == "")\n\ return\n\ \n\ RS2 = RangeSet_askExisting(intro "Second range set (first is "RS1")")\n\ if (RS2 == "")\n\ return\n\ \n\ rs1id = RangeSet_getRangeSet(RS1)\n\ if (!rs1id)\n\ {\n\ dialog(intro "RangeSet '" RS1 "' does not exist")\n\ return\n\ }\n\ \n\ rs2id = RangeSet_getRangeSet(RS2)\n\ if (!rs2id)\n\ {\n\ dialog(intro "RangeSet '" RS2 "' does not exist")\n\ return\n\ }\n\ \n\ rstmp = rangeset_create() # create a temporary\n\ if (!rstmp)\n\ {\n\ dialog(intro "Could not create temporary rangeset")\n\ return\n\ }\n\ rangeset_add(rstmp, rs2id) # load the temporary (== RS2)\n\ rangeset_invert(rstmp) # invert the temporary (== ~RS2)\n\ rangeset_subtract(rs1id, rstmp) # subtract ~RS2 from RS1: gives RS1 /\\ RS2\n\ \n\ rangeset_destroy(rstmp) # don't need this anymore\n\ }\n\ Rangesets>RS1 =>~RS1:::: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ RS1 = RangeSet_ask("Range set to invert")\n\ if (RS1 == "")\n\ return\n\ \n\ r = RangeSet_inverse(RS1)\n\ }\n\ Rangesets>RS1 =>RS1 op RS2 repeat confirm:::: {\n\ $RS1eqRS1plusRS2[""] = ""\n\ \n\ if (!("Confirm" in $RS1eqRS1plusRS2))\n\ $RS1eqRS1plusRS2["Confirm"] = 0\n\ \n\ confirm = $RS1eqRS1plusRS2["Confirm"]\n\ \n\ if (confirm)\n\ {\n\ onoff = "ON"\n\ b1 = "No"\n\ b2 = "Yes"\n\ }\n\ else\n\ {\n\ onoff = "OFF"\n\ b1 = "Yes"\n\ b2 = "No"\n\ }\n\ \n\ rangesets = "\\n"\n\ if (("RS1" in $RS1eqRS1plusRS2) && $RS1eqRS1plusRS2["RS1"] != "")\n\ rangesets = rangesets "\\nFirst range set: '" $RS1eqRS1plusRS2["RS1"] "'\\n"\n\ if (("RS2" in $RS1eqRS1plusRS2) && $RS1eqRS1plusRS2["RS2"] != "")\n\ rangesets = rangesets "\\nSecond range set: '" $RS1eqRS1plusRS2["RS2"] "'\\n"\n\ \n\ res = dialog("Do you want to confirm each repeated RangeSet operation?\\n" \\\n\ "(Currently confirmations are " onoff ")" rangesets, \\\n\ b1, b2, "Cancel")\n\ if (0 < res && res < 3)\n\ {\n\ --res\n\ $RS1eqRS1plusRS2["Confirm"] = (confirm == res)\n\ }\n\ }\n\ Rangesets>Differences>Merge files from diff:::: {\n\ NEDIT_require_macro_file("RSfileMerge.nm")\n\ \n\ fileMerge_from_diff()\n\ }\n\ Rangesets>Differences>Merge files + rework:::: {\n\ NEDIT_require_macro_file("RSfileMerge.nm")\n\ \n\ fileMerge_from_diff("rework")\n\ }\n\ Rangesets>Differences>Merge files from diff [REV]:::: {\n\ NEDIT_require_macro_file("RSfileMerge.nm")\n\ \n\ fileMerge_from_diff(0, "rev")\n\ }\n\ Rangesets>Differences>Merge files + rework [REV]:::: {\n\ NEDIT_require_macro_file("RSfileMerge.nm")\n\ \n\ fileMerge_from_diff("rework", "rev")\n\ }\n\ Rangesets>Differences>Rework Changes:::: {\n\ NEDIT_require_macro_file("RSfileMerge.nm")\n\ \n\ fileMerge_rework_changes()\n\ }\n\ Rangesets>Differences>Rework Single Change:::: {\n\ NEDIT_require_macro_file("RSfileMerge.nm")\n\ \n\ error = ""\n\ sep = ": "\n\ plu = ""\n\ \n\ # get rangeset number for old changes\n\ rsnm = "Changed (old)"\n\ rsa = rangeset_get_by_name(rsnm)\n\ if (rsa[] != 1)\n\ {\n\ error = sep rsnm\n\ sep = ", "\n\ plu = "s"\n\ }\n\ rO = rsa[0]\n\ \n\ # get rangeset number for new changes\n\ rsnm = "Changed (new)"\n\ rsa = rangeset_get_by_name(rsnm)\n\ if (rsa[] != 1)\n\ {\n\ error = plu sep rsnm\n\ }\n\ rN = rsa[0]\n\ \n\ if (error != "")\n\ return dialog("Rework difference - single change\\n" \\\n\ "Missing rangeset" plu error, "Cancel")\n\ \n\ # find index in rO or rN where we have the cursor\n\ index = rangeset_includes(rO, $cursor)\n\ if (!index)\n\ index = rangeset_includes(rN, $cursor)\n\ if (!index)\n\ return dialog("Rework difference - single change\\n" \\\n\ "Cursor at position " $cursor " not in a change range", \\\n\ "Cancel")\n\ \n\ fileMerge_rework_changes(index)\n\ }\n\ Rangesets>Differences>Change colors:::: {\n\ NEDIT_require_macro_file("RSfileMerge.nm")\n\ \n\ fileMerge_mapRSbg_ask()\n\ }\n\ Rangesets>Differences>CVS - Postprocess cvs diff output:::: {\n\ # cvs/rcs file diffs\n\ # look for "Index:" relative-filepath before each diff\n\ # find the diff line - substitute the filename there with the one from "Index:"\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ ipos = 0 # index filename start position\n\ iend = 0 # index filename end position\n\ dpos = 0 # diff command filename start position\n\ dend = 0 # diff command filename end position\n\ \n\ list = ""\n\ count = 0\n\ for (ipos = search("(?<=^Index: ).*", iend, "regex"); \\\n\ ipos >= 0; \\\n\ ipos = search("(?<=^Index: ).*", iend, "regex"))\n\ {\n\ iend = $search_end\n\ # pick up information about the filename in the Index: line\n\ index_fname = get_range(ipos, iend)\n\ fname = sub_re(index_fname, ".*/", "") # strip the path\n\ fname_re = quote_literal_as_regex(fname) # RE for file base name\n\ \n\ # determine limit of search for the diff line\n\ next_ipos = search("(?<=^Index: ).*", iend, "regex")\n\ if (next_ipos < 0)\n\ next_ipos = $text_length\n\ \n\ # find the diff line mentioning the index file base name\n\ diff_re = "^(diff .*\\\\s)" fname_re "((?:\\\\s.*|$))"\n\ dpos = search(diff_re, iend, "regex")\n\ dend = $search_end\n\ \n\ if (ipos < dpos && dend <= next_ipos)\n\ {\n\ # we have and "Index:" line followed by a "diff" line for the same file\n\ # pick up the diff line\n\ line = get_range(dpos, dend)\n\ # replace the filename with the filepath from the index line\n\ repl = sub_re(line, diff_re, "\\\\1" quote_literal_as_subst(index_fname) "\\\\2")\n\ if (line != repl)\n\ {\n\ replace_range(dpos, dend, repl)\n\ list = list repl "\\n"\n\ count++\n\ }\n\ }\n\ }\n\ if (count == 0)\n\ {\n\ dialog("Postprocess cvs diff output for patch input\\nNo changes")\n\ }\n\ else\n\ {\n\ list_dialog("Postprocess cvs diff output for patch input\\n" \\\n\ count " changes:", list)\n\ }\n\ }\n\ Rangesets>Differences>Highlight Plain Diff:::: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ q = dialog("Highlight difference specs?", "Dark", "Light", "No")\n\ if (q == 1)\n\ col = "#808080"\n\ else if (q == 2)\n\ col = "#d8d8d8"\n\ else\n\ col = ""\n\ \n\ RangeSet_forget("Old")\n\ RangeSet_forget("New")\n\ RangeSet_forget("Line spec")\n\ \n\ RangeSet_set_color("Old", "#ffb0a0")\n\ RangeSet_set_color("New", "#b0ffff")\n\ if (col != "") RangeSet_set_color("Line spec", col)\n\ \n\ regex = "regex"\n\ \n\ RE = "(?<=^\\\\< ).*" # add \\n if you like\n\ pos = 0\n\ for (pos = search(RE, 0, regex); pos != -1; pos = search(RE, pos, regex))\n\ {\n\ r = RangeSet_add("Old", pos, $search_end)\n\ pos = $search_end + 1\n\ }\n\ \n\ RE = "(?<=^\\\\> ).*" # add \\n if you like\n\ pos = 0\n\ for (pos = search(RE, 0, regex); pos != -1; pos = search(RE, pos, regex))\n\ {\n\ r = RangeSet_add("New", pos, $search_end)\n\ pos = $search_end + 1\n\ }\n\ \n\ if (col != "")\n\ {\n\ RE = "^\\\\d+(?:,\\\\d+)?[acd]\\\\d+(?:,\\\\d+)?\\n"\n\ pos = 0\n\ for (pos = search(RE, 0, regex); pos != -1; pos = search(RE, pos, regex))\n\ {\n\ r = RangeSet_add("Line spec", pos, $search_end)\n\ pos = $search_end\n\ }\n\ }\n\ }\n\ Rangesets>Differences>Forget Highlight:::: {\n\ NEDIT_require_macro_file("RSextensions.nm")\n\ \n\ RangeSet_forget("Old")\n\ RangeSet_forget("New")\n\ RangeSet_forget("Line spec")\n\ }\n\ Rangesets>Differences>Clean-up diff output:::: {\n\ diffcmd = "diff"\n\ pos = search("^diff\\\\s+(-\\\\w+\\\\s+)*", 0, "regex")\n\ if (pos >= 0)\n\ diffcmd = get_range(pos, $search_end)\n\ \n\ diffline = "(?:\\\\d+(?:,\\\\d+)?[acd]\\\\d+(?:,\\\\d+)?|---|[<>] .*)"\n\ \n\ # the search strings\n\ # CVS directory diffs: of no functional value\n\ matchCVSdirDiffs = "^" diffcmd ".*/CVS/.*\\\\n(?:"diffline"\\\\n)*"\n\ # Diffs where only what-strings are different\n\ matchWhatStringDiffs = "^" diffcmd ".*\\\\n\\\\d+c\\\\d+\\\\n" \\\n\ "\\\\<\\\\s+.*@\\\\(#\\\\) \\\\$Name.*\\\\n" \\\n\ "---\\\\n" \\\n\ "\\\\>\\\\s+.*@\\\\(#\\\\) \\\\$Name.*\\\\n(?!" diffline "$)"\n\ # Non-diffs!\n\ matchOnlyInDiffs = "^Only in .*\\n"\n\ commonSubDirs = "^Common subdirectories: .*\\n"\n\ \n\ # other\n\ noNewlines = "^\\\\\\\\ No newline at end of file\\n"\n\ filesDiffer = "^Files .+ and .+ differ\\n"\n\ \n\ # put them in an array\n\ matchRE[0] = matchCVSdirDiffs\n\ matchRE[1] = matchWhatStringDiffs\n\ matchRE[2] = matchOnlyInDiffs\n\ matchRE[3] = commonSubDirs\n\ matchRE[4] = noNewlines\n\ matchRE[5] = filesDiffer\n\ \n\ matchTxt[0] = "CVS directory diffs"\n\ matchTxt[1] = "Diffs only in what/version strings"\n\ matchTxt[2] = "Assymetries in files (files only found on one side)"\n\ matchTxt[3] = "Common subdirectories"\n\ matchTxt[4] = "Missing final newline complaints"\n\ matchTxt[5] = "Differing files (no content shown)"\n\ \n\ # set up a rangeset for coloring them\n\ rsid = rangeset_create()\n\ if (rsid)\n\ rangeset_set_color(rsid, "#ff0080")\n\ \n\ for (i = 0; i in matchRE; i++)\n\ {\n\ end = 0\n\ for (pos = search(matchRE[i], 0, "regex"); \\\n\ pos >= 0; \\\n\ pos = search(matchRE[i], end, "regex"))\n\ {\n\ end = $search_end\n\ if (rsid)\n\ rangeset_add(rsid, pos, end)\n\ }\n\ if (end > 0)\n\ if (dialog("Remove " matchTxt[i] ":\\n " matchRE[i] "\\nRemove it?", \\\n\ "OK", "Skip") == 1)\n\ replace_all(matchRE[i], "", "regex")\n\ rangeset_subtract(rsid, 0, $text_length)\n\ }\n\ \n\ rangeset_destroy(rsid)\n\ }\n\ Rangesets>Differences>Remove/open "Only in" files:::: {\n\ onlyInRE = "^Only in (.*): (.*)\\n"\n\ \n\ # pick up all "Only in" lines\n\ lines = replace_in_string(get_range(0, $text_length), \\\n\ "^(?!" onlyInRE ").*\\n", "", "regex")\n\ \n\ openHow[0] = "window"\n\ openHow[1] = "tab"\n\ openHowFirst = 0\n\ openHowNext = 0\n\ doDelete = 0\n\ \n\ cwd = $file_path\n\ if (cwd == "")\n\ {\n\ # remove any trailing / (only at root level?) from pwd result\n\ cwd = replace_in_string(shell_command("pwd", ""), \\\n\ "((?n.*))\\n$", "\\\\1", "regex", "copy")\n\ if ($shell_cmd_status != 0)\n\ cwd = ""\n\ else # now add a trailing / (again)\n\ cwd = cwd "/"\n\ }\n\ oldwindow = $file_path $file_name\n\ \n\ T = "\\"Only in\\" files\\n"\n\ E = ""\n\ while (lines != "")\n\ {\n\ doDelete = 0\n\ if (E != "")\n\ E = "\\nERROR: " E "\\n\\n"\n\ \n\ sel = list_multisel_dialog(T E "Select files and decide on action", \\\n\ lines, \\\n\ "Delete", \\\n\ "New Window", "New Group", "This Group", \\\n\ "Cancel")\n\ E = ""\n\ btn = $list_dialog_button\n\ if (btn == 0 || btn > 4)\n\ return\n\ if (btn == 1)\n\ {\n\ # delete files\n\ doDelete = 1\n\ }\n\ else if (btn == 2)\n\ {\n\ openHowFirst = 0\n\ openHowNext = 0\n\ }\n\ else if (btn == 3)\n\ {\n\ openHowFirst = 0\n\ openHowNext = 1\n\ }\n\ else # if (btn == 4)\n\ {\n\ openHowFirst = 1\n\ openHowNext = 1\n\ }\n\ \n\ if (sel == "")\n\ {\n\ E = "no file selected"\n\ continue\n\ }\n\ \n\ if (doDelete)\n\ {\n\ cmd = replace_in_string(sel "\\n", onlyInRE, "rm \\\\1/\\\\2\\n", "regex")\n\ num = length(cmd) - length(replace_in_string(cmd, "\\n", ""))\n\ if (num > 10)\n\ {\n\ list_dialog("Issue the following command?", cmd, "Yes", "No")\n\ rmbtm = $list_dialog_button\n\ }\n\ else\n\ {\n\ rmbtm = dialog("Issue the following command?\\n\\n" cmd, "Yes", "No")\n\ }\n\ if (rmbtm == 1)\n\ {\n\ out = shell_command(cmd, "")\n\ if (out != "")\n\ {\n\ cmd = replace_in_string(cmd, "^((?:.*\\n){3})(?:.*\\n)+", "\\\\1...\\n", \\\n\ "regex", "copy")\n\ E = "delete command output\\n\\n" cmd "\\nOutput:\\n\\n" out\n\ }\n\ # remove deleted files from list\n\ end = 0\n\ sel = sel "\\n"\n\ asel = split(sel, "\\n")\n\ for (i in asel)\n\ if (asel[i] != "")\n\ {\n\ line = asel[i] "\\n"\n\ lines = replace_in_string(lines, line, "", "case", "copy")\n\ if (get_range(0, length(line)) == line)\n\ pref = ""\n\ else\n\ pref = "\\n"\n\ replace_all(pref line, pref, "case")\n\ }\n\ }\n\ }\n\ else # we're opening files\n\ {\n\ filenames = split(replace_in_string(sel "\\n", onlyInRE, "\\\\1/\\\\2\\n", \\\n\ "regex"), "\\n")\n\ openmode = openHow[openHowFirst]\n\ for (i = 0; i in filenames; ++i)\n\ {\n\ filename = filenames[i]\n\ if (filename == "")\n\ continue\n\ if (substring(filename, 0, 2) == "./")\n\ filename = cwd substring(filename, 2)\n\ else if (substring(filename, 0, 1) != "/")\n\ filename = cwd filename\n\ \n\ EE = ""\n\ if (focus_window(filename) != "")\n\ {\n\ EE = "\\n file already opened: " filename\n\ }\n\ else\n\ {\n\ read_file(filename)\n\ if ($read_status)\n\ {\n\ new(openmode)\n\ focus_window("last")\n\ open(filename)\n\ openmode = openHow[openHowNext]\n\ }\n\ else\n\ EE = "\\n failed to open " filename\n\ }\n\ E = E EE\n\ }\n\ focus_window(oldwindow)\n\ raise_window()\n\ }\n\ }\n\ }\n\ Rangesets>Differences>Choose open files for diff:::: {\n\ NEDIT_require_macro_file("RSfileMerge.nm")\n\ \n\ # count files\n\ nFile = 0\n\ for (file = focus_window("last"); file != ""; file = focus_window("next"))\n\ nFile++\n\ \n\ list = "\\n"\n\ current = $file_path $file_name\n\ \n\ files = $empty_array\n\ \n\ # add files into array with keys in the selected sort order\n\ for (file = focus_window("last"); file != ""; file = focus_window("next"))\n\ files[$file_name " - " $file_path] = file\n\ \n\ # generate the list for the dialog\n\ for (file in files)\n\ list = list file "\\n"\n\ \n\ err = ""\n\ while (1)\n\ {\n\ ff = list_multisel_dialog("Difference:\\n" err \\\n\ "Choose 2 files from the list of " \\\n\ nFile " open files", \\\n\ list, "OK", "Cancel")\n\ \n\ ffs = split(ff, "\\n")\n\ if ($list_dialog_button != 1)\n\ return\n\ if (ffs[] != 2)\n\ {\n\ err = "Error: " ffs[] " (not 2) files were selected\\n"\n\ }\n\ else\n\ break\n\ }\n\ \n\ ffs[0] = files[ffs[0]]\n\ ffs[1] = files[ffs[1]]\n\ \n\ # try to get a sensible language\n\ lang = ""\n\ \n\ focus_window(ffs[0])\n\ if ($language_mode != "" && $language_mode != "Plain")\n\ lang = $language_mode\n\ \n\ focus_window(ffs[1])\n\ if ($language_mode != "" && $language_mode != "Plain")\n\ if ($language_mode != lang)\n\ lang = ""\n\ \n\ # OK: diff the files in a new window\n\ new("window")\n\ focus_window("last")\n\ raise_window()\n\ \n\ if (lang != "")\n\ set_language_mode(lang)\n\ \n\ cmd = "diff " quote_literal_for_shell_esc(ffs[0]) \\\n\ " " quote_literal_for_shell_esc(ffs[1])\n\ replace_range(0, $text_length, cmd)\n\ execute_command_line()\n\ \n\ fileMerge_from_diff()\n\ }\n\ Rangesets>Differences>Compare document against file:::: {\n\ NEDIT_require_macro_file("RSextensions.nm")\n\ NEDIT_require_macro_file("RSshowChange.nm")\n\ \n\ diff_with_saved()\n\ \n\ clear = dialog("Clear Difference Rangesets A, C and D?", "Yes", "No")\n\ if (clear == 1)\n\ {\n\ RangeSet_forget("a")\n\ RangeSet_forget("c")\n\ RangeSet_forget("d")\n\ }\n\ }\n\ Rangesets>Remove>From set:::R: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ selleft = $selection_left\n\ selright = $selection_right\n\ selstart = $selection_start\n\ selend = $selection_end\n\ \n\ Ls = RangeSet_askExisting("Range sets from which to remove selection", "multi")\n\ \n\ for (n in Ls)\n\ {\n\ L = Ls[n]\n\ if (selleft != -1)\n\ {\n\ ln0 = pos_to_line(selstart)\n\ ln1 = pos_to_line(selend)\n\ for (ln = ln0; ln <= ln1; ln++)\n\ {\n\ left = line_col_to_pos(ln, selleft)\n\ right = line_col_to_pos(ln, selright)\n\ if (left < right && left != -1)\n\ {\n\ RangeSet_remove(L, left, right)\n\ }\n\ }\n\ }\n\ else\n\ {\n\ RangeSet_remove(L, selstart, selend)\n\ }\n\ }\n\ }\n\ Rangesets>Remove>From all sets:::R: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ NEDIT_require_macro_file("RSextensions.nm")\n\ \n\ selleft = $selection_left\n\ selright = $selection_right\n\ selstart = $selection_start\n\ selend = $selection_end\n\ \n\ if (selleft == -1)\n\ {\n\ for (i in $rangeset_list)\n\ rangeset_subtract($rangeset_list[i], selstart, selend)\n\ }\n\ else\n\ {\n\ Ls = split(RangeSet_list(), "\\n")\n\ for (n in Ls)\n\ {\n\ L = Ls[n]\n\ ln0 = pos_to_line(selstart)\n\ ln1 = pos_to_line(selend)\n\ for (ln = ln0; ln <= ln1; ln++)\n\ {\n\ left = line_col_to_pos(ln, selleft)\n\ right = line_col_to_pos(ln, selright)\n\ if (left < right && left != -1)\n\ {\n\ RangeSet_remove(L, left, right)\n\ }\n\ }\n\ }\n\ }\n\ \n\ }\n\ Rangesets>Forget>Set:::: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ L = RangeSet_askExisting("Range sets to forget", "multi")\n\ if (L[] == 0)\n\ return\n\ \n\ for (n in L)\n\ {\n\ # if (dialog("Forgetting Rangeset \\"" L[n] "\\"", "OK", "Skip") == 1)\n\ RangeSet_forget(L[n])\n\ }\n\ }\n\ Rangesets>Forget>All sets:::: {\n\ while (0 in $rangeset_list)\n\ rangeset_destroy($rangeset_list[0])\n\ }\n\ Rangesets>Navigate>Choose Set:::: {\n\ NEDIT_require_macro_file("RSnavigate.nm")\n\ \n\ RangeSet_NavigateWhich("", "ask")\n\ }\n\ Rangesets>Navigate>Choose TOP Set:::: {\n\ NEDIT_require_macro_file("RSnavigate.nm")\n\ \n\ nrs = $rangeset_list[]\n\ if (nrs == 0)\n\ rs = ""\n\ else\n\ {\n\ id = $rangeset_list[nrs - 1]\n\ rs = RangeSet_forceName(id)\n\ }\n\ \n\ if (rs != "")\n\ RangeSet_NavigateWhich(rs)\n\ else\n\ RangeSet_NavigateWhich()\n\ }\n\ Rangesets>Navigate>Move Backward Select:::: {\n\ NEDIT_require_macro_file("RSnavigate.nm")\n\ \n\ RangeSet_Navigate("", -1, 1)\n\ }\n\ Rangesets>Navigate>Move Backward:::: {\n\ NEDIT_require_macro_file("RSnavigate.nm")\n\ \n\ RangeSet_Navigate("", -1)\n\ }\n\ Rangesets>Navigate>Move Backward Center:::: {\n\ NEDIT_require_macro_file("RSnavigate.nm")\n\ \n\ RangeSet_Navigate("", -1, 0, 1)\n\ }\n\ Rangesets>Navigate>Move Forward Center:::: {\n\ NEDIT_require_macro_file("RSnavigate.nm")\n\ \n\ RangeSet_Navigate("", 1, 0, 1)\n\ }\n\ Rangesets>Navigate>Move Forward:::: {\n\ NEDIT_require_macro_file("RSnavigate.nm")\n\ \n\ RangeSet_Navigate("", 1)\n\ }\n\ Rangesets>Navigate>Move Forward Select:::: {\n\ NEDIT_require_macro_file("RSnavigate.nm")\n\ \n\ RangeSet_Navigate("", 1, 1)\n\ }\n\ Rangesets>Run through:::: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ L = RangeSet_askExisting("Range set to run through")\n\ if (L == "")\n\ return\n\ \n\ old_p = $cursor\n\ \n\ if (RangeSet_defined(L))\n\ {\n\ s = "rangeset \\""L"\\" (id="RangeSet_getRangeSet(L)")\\n"\\\n\ "Rangeset "$RangeSet_label " has " $RangeSet_ranges " ranges\\n"\n\ c = $RangeSet_color\n\ if (c != "")\n\ s = s "Color "c\n\ s = s "\\nModify behaviour \\"" $RangeSet_modify_response "\\""\n\ s = s "\\n\\nDefined rangesets:\\n" RangeSet_list()\n\ r = dialog(s, "OK", "Select", "Cancel")\n\ if (r != 1 && r != 2)\n\ return\n\ \n\ doSelect = (r == 2)\n\ carry_on = 1\n\ for (i = 0; carry_on == 1 && i < RangeSet_get_count(L); i++) {\n\ # deselect_all()\n\ if (RangeSet_select(L, i))\n\ ok = "good"\n\ else\n\ ok = "bad"\n\ t = " "i+1" of "$RangeSet_ranges": [" $selection_start ", " $selection_end "] ("ok")\\n"\n\ set_cursor_pos($selection_start)\n\ set_cursor_pos($selection_end)\n\ set_cursor_pos($selection_start)\n\ if (!doSelect)\n\ deselect_all()\n\ carry_on = dialog(" " $RangeSet_label " range " t, "OK", "Cancel")\n\ }\n\ \n\ if (carry_on == 1)\n\ set_cursor_pos(old_p)\n\ }\n\ }\n\ Rangesets>Go to range:::: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ L = ""\n\ Ls = RangeSet_names()\n\ \n\ if (Ls[] == 0)\n\ beep()\n\ else if (Ls[] == 1)\n\ L = Ls[0]\n\ else\n\ L = RangeSet_askExisting("Range in which set?")\n\ \n\ if (L == "")\n\ return\n\ \n\ if (RangeSet_defined(L))\n\ {\n\ loop = 1\n\ while (loop)\n\ {\n\ # build title string\n\ s = "rangeset \\""L"\\"\\n"\\\n\ "Rangeset "$RangeSet_label " has " $RangeSet_ranges " ranges\\n"\n\ c = $RangeSet_color\n\ if (c != "")\n\ s = s "Color " c\n\ s = s "\\nModify behaviour \\"" $RangeSet_modify_response "\\""\n\ \n\ width = length($RangeSet_ranges "")\n\ \n\ list = ""\n\ line = ""\n\ endline = ""\n\ for (i = 0; RangeSet_defined(L, i); i++) {\n\ numstr = " " i\n\ numstr = substring(numstr, length(numstr) - width, length(numstr)) ":"\n\ RangeSet_defined(L, i)\n\ p1 = search("\\n", max($RangeSet_range_start - 1, 0), "case", "backward")\n\ if (p1 < 0)\n\ p1 = 0\n\ if (p1 <= $RangeSet_range_start - 1)\n\ p1++\n\ p2 = search("\\n", $RangeSet_range_start, "case")\n\ if (p2 == -1)\n\ p2 = $text_length\n\ if (p2 < $RangeSet_range_end)\n\ endline = get_range($RangeSet_range_start, p2) "...»"\n\ else\n\ endline = get_range($RangeSet_range_start, $RangeSet_range_end) "»" \\\n\ get_range($RangeSet_range_end, p2)\n\ line = get_range(p1, $RangeSet_range_start) "«" endline\n\ where = "== "\n\ if ($cursor < $RangeSet_range_start)\n\ where = " > "\n\ else if ($cursor > $RangeSet_range_end)\n\ where = "< "\n\ list = list numstr where line "\\n"\n\ \n\ # debug = "p1 = " p1 "\\n" \\\n\ # "$RangeSet_range_start = " $RangeSet_range_start "\\n" \\\n\ # "p2 = " p2 "\\n" \\\n\ # "$RangeSet_range_end = " $RangeSet_range_end "\\n"\n\ # dialog(debug numstr line)\n\ }\n\ \n\ if (list != "")\n\ {\n\ line = list_dialog(s, list, "OK", "Select", "Find & Loop", "Cancel")\n\ if ($list_dialog_button > 3 || line == "")\n\ return # dismissed or dialog closed\n\ \n\ loop = $list_dialog_button == 3\n\ sel = $list_dialog_button == 2\n\ \n\ line = replace_in_string(line, " *(\\\\d+):.*", "\\\\1", "regex")\n\ if (RangeSet_defined(L, line))\n\ {\n\ set_cursor_pos($RangeSet_range_start)\n\ centerline()\n\ }\n\ if (sel)\n\ RangeSet_select(L, line)\n\ }\n\ else\n\ {\n\ loop = 0\n\ dialog("rangeset \\""L"\\" contains no ranges")\n\ }\n\ }\n\ }\n\ else\n\ {\n\ dialog("rangeset \\""L"\\" is undefined")\n\ }\n\ }\n\ Rangesets>Mark with range:::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ selleft = $selection_left\n\ selright = $selection_right\n\ selstart = $selection_start\n\ selend = $selection_end\n\ \n\ L = RangeSet_ask("Range set used to mark")\n\ if (L == "")\n\ return\n\ \n\ if (!RangeSet_defined(L) || $RangeSet_color == "")\n\ RangeSet_QuickColor(L)\n\ \n\ if (selleft != -1)\n\ {\n\ ln0 = pos_to_line(selstart)\n\ ln1 = pos_to_line(selend)\n\ for (ln = ln0; ln <= ln1; ln++)\n\ {\n\ left = line_col_to_pos(ln, selleft)\n\ right = line_col_to_pos(ln, selright)\n\ if (left < right && left != -1)\n\ {\n\ # select(left, right)\n\ # dialog("line " ln "(select line " ln - ln0 + 1")\\n" \\\n\ # "left " left " right " right \\\n\ # " (cols: " selleft ", " selright ")")\n\ RangeSet_add(L, left, right)\n\ }\n\ }\n\ }\n\ else\n\ {\n\ RangeSet_add(L, selstart, selend)\n\ }\n\ }\n\ Rangesets>Mark with range (no columns):::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ L = RangeSet_ask("Range set used to mark")\n\ if (L == "")\n\ return\n\ \n\ RangeSet_add(L)\n\ \n\ if (!RangeSet_defined(L) || $RangeSet_color == "")\n\ {\n\ RangeSet_QuickColor(L)\n\ }\n\ }\n\ Rangesets>Mark with TOP range:::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ selleft = $selection_left\n\ selright = $selection_right\n\ selstart = $selection_start\n\ selend = $selection_end\n\ \n\ idid = $rangeset_list[]\n\ if (idid == 0)\n\ {\n\ L = RangeSet_ask("No current range sets\\nRange set used to mark")\n\ if (L == "")\n\ return\n\ }\n\ else\n\ {\n\ id = $rangeset_list[idid - 1]\n\ # dialog("Number of RS="idid"\\nTop id="id)\n\ L = rangeset_info(id)["name"]\n\ }\n\ \n\ if (!RangeSet_defined(L) || $RangeSet_color == "")\n\ RangeSet_QuickColor(L)\n\ \n\ if (selleft != -1)\n\ {\n\ ln0 = pos_to_line(selstart)\n\ ln1 = pos_to_line(selend)\n\ for (ln = ln0; ln <= ln1; ln++)\n\ {\n\ left = line_col_to_pos(ln, selleft)\n\ right = line_col_to_pos(ln, selright)\n\ if (left < right && left != -1)\n\ {\n\ # select(left, right)\n\ # dialog("line " ln "(select line " ln - ln0 + 1")\\n" \\\n\ # "left " left " right " right \\\n\ # " (cols: " selleft ", " selright ")")\n\ RangeSet_add(L, left, right)\n\ }\n\ }\n\ }\n\ else\n\ {\n\ RangeSet_add(L, selstart, selend)\n\ }\n\ }\n\ Rangesets>Remove from TOP range:::R: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ selleft = $selection_left\n\ selright = $selection_right\n\ selstart = $selection_start\n\ selend = $selection_end\n\ \n\ idid = $rangeset_list[]\n\ if (idid == 0)\n\ {\n\ return dialog("No current range sets")\n\ }\n\ else\n\ {\n\ id = $rangeset_list[idid - 1]\n\ L = rangeset_info(id)["name"]\n\ }\n\ \n\ if (selleft != -1)\n\ {\n\ ln0 = pos_to_line(selstart)\n\ ln1 = pos_to_line(selend)\n\ for (ln = ln0; ln <= ln1; ln++)\n\ {\n\ left = line_col_to_pos(ln, selleft)\n\ right = line_col_to_pos(ln, selright)\n\ if (left < right && left != -1)\n\ {\n\ # select(left, right)\n\ # dialog("line " ln "(select line " ln - ln0 + 1")\\n" \\\n\ # "left " left " right " right \\\n\ # " (cols: " selleft ", " selright ")")\n\ RangeSet_remove(L, left, right)\n\ }\n\ }\n\ }\n\ else\n\ {\n\ RangeSet_remove(L, selstart, selend)\n\ }\n\ }\n\ Rangesets>Delete text of set:::: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ L = RangeSet_askExisting("Range set whose text to delete")\n\ if (L == "")\n\ return\n\ if (!RangeSet_defined(L))\n\ {\n\ dialog("Rangeset "L" not defined")\n\ return\n\ }\n\ \n\ prompt = "Do you really want to delete the contents of rangeset "L"?\\n"\n\ prompt = prompt "("L" contains "RangeSet_get_count(L)" ranges)\\n"\n\ prompt = prompt "Choose \\"Yes (prompt)\\" for confirmation for each range\\n"\n\ prompt = prompt "Choose \\"Yes (silent)\\" to remove all text unconditionally"\n\ para = dialog("Do you really want to delete the contents of rangeset "L"?", \\\n\ "No", "Yes (prompt)", "Yes (silent)", "Yes (fast)")\n\ silent = 0\n\ if (2 <= para && para <= 4)\n\ {\n\ silent = (para >= 3)\n\ noselect = (para == 4)\n\ }\n\ else\n\ return\n\ \n\ if (noselect)\n\ {\n\ rs = RangeSet_getRangeSet(L)\n\ for (a = rangeset_range(rs, 1); a[]; a = rangeset_range(rs, 1))\n\ replace_range(a["start"], a["end"], "")\n\ return\n\ }\n\ \n\ prompt = ""\n\ prompt = prompt "Choose \\"OK\\" to delete this range\\n"\n\ prompt = prompt "Choose \\"Stop\\" to stop deleting ranges\\n"\n\ prompt = prompt "Choose \\"Skip\\" to keep this range and carry on"\n\ skip = 0\n\ ndel = 0\n\ while (RangeSet_get_count(L) > skip)\n\ {\n\ RangeSet_select(L, skip)\n\ set_cursor_pos($selection_end)\n\ set_cursor_pos($selection_start)\n\ \n\ if (silent)\n\ ok = silent\n\ else\n\ {\n\ prompt1 = "Rangeset "L" contains "RangeSet_get_count(L) " ranges\\n"\n\ if (skip > 0)\n\ prompt1 = prompt1 "of which the first "skip" have been skipped\\n"\n\ ok = dialog(prompt1 prompt, "OK", "Stop", "Skip")\n\ }\n\ \n\ if (ok == 1) # OK\n\ {\n\ RangeSet_select(L, skip)\n\ replace_selection("")\n\ ndel++\n\ }\n\ else if (ok == 3)\n\ {\n\ skip++\n\ deselect_all()\n\ }\n\ else\n\ {\n\ skip = $RangeSet_ranges\n\ break\n\ }\n\ }\n\ \n\ if (silent)\n\ RangeSet_forget(L)\n\ else\n\ {\n\ prompt = "Rangeset "L" contains "RangeSet_get_count(L) " ranges\\n"\n\ if (ndel == 0)\n\ ndel = "no ranges"\n\ else if (ndel == 1)\n\ ndel = "1 range"\n\ else\n\ ndel = ndel " ranges"\n\ prompt = prompt "(" ndel " deleted)\\n"\n\ prompt = prompt "Do you want to forget "L"?"\n\ if (skip == 0)\n\ {\n\ b1 = "Yes"\n\ b2 = "No"\n\ }\n\ else\n\ {\n\ b1 = "No"\n\ b2 = "Yes"\n\ skip = 1\n\ }\n\ if (dialog(prompt, b1, b2) == 1 + skip) # yes clicked?\n\ RangeSet_forget(L)\n\ }\n\ }\n\ Rangesets>Modify Fn:::: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ L = RangeSet_askExisting("Range set whose behaviour to change")\n\ if (L == "")\n\ return\n\ \n\ info = "Range set " L\n\ if (RangeSet_defined(L))\n\ info = info " uses \\""$RangeSet_modify_response"\\""\n\ \n\ modify_fn = "maintain\\nins_del\\ninclude\\ndel_ins\\nexclude\\nbreak\\n"\n\ C = list_dialog(info "\\nWhich modify behaviour?", modify_fn, "OK")\n\ \n\ if (C == "")\n\ RangeSet_set_modify_response(L)\n\ else\n\ RangeSet_set_modify_response(L, C)\n\ }\n\ Rangesets>Move to topmost:::: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ L = RangeSet_askExisting("Range set to move to top")\n\ if (L == "" || !RangeSet_defined(L))\n\ return\n\ \n\ # get an anonymous rangeset\n\ id = rangeset_create()\n\ # save L's information\n\ lid = RangeSet_getRangeSet(L)\n\ RangeSet_defined(L)\n\ color = $RangeSet_color\n\ mode = $RangeSet_modify_response\n\ rangeset_add(id, lid)\n\ # remove L\n\ rangeset_destroy(lid)\n\ # set L's parameters in id\n\ rangeset_set_color(id, color)\n\ rangeset_set_name(id, L)\n\ rangeset_set_mode(id, mode)\n\ \n\ # Was: \n\ # T = RangeSet_ask("Temporary range set (will be deleted)")\n\ # if (T == "")\n\ # {\n\ # dialog("No temporary range set to perform move of range set" L)\n\ # return\n\ # }\n\ # else if (RangeSet_defined(T))\n\ # {\n\ # x = dialog("Temporary set "T" in use: do you want to erase it?", "No", "Yes")\n\ # if (x != 2)\n\ # {\n\ # dialog("Cannot use temporary range set "T" to move range set "L)\n\ # return\n\ # }\n\ # }\n\ # \n\ # RangeSet_forget(T)\n\ # RangeSet_defined(L)\n\ # color = $RangeSet_color\n\ # RangeSet_add(T, L)\n\ # RangeSet_forget(L)\n\ # RangeSet_add(L, T)\n\ # RangeSet_set_color_basic(L, color)\n\ # RangeSet_forget(T)\n\ }\n\ Rangesets>Change behaviour:::: {\n\ NEDIT_require_macro_file("RSselect.nm")\n\ \n\ L = RangeSet_askExisting("Range set whose behaviour to change?")\n\ if (L == "")\n\ return\n\ \n\ list="maintain\\nins_del\\ninclude\\ndel_ins\\nexclude\\nbreak"\n\ \n\ id = RangeSet_getRangeSet(L)\n\ curr = rangeset_info(id)["mode"]\n\ \n\ mode = list_dialog("Range set " L " has behaviour " curr"\\nNew behaviour", \\\n\ list, "OK", "Cancel")\n\ \n\ if ($list_dialog_button != 1)\n\ return\n\ \n\ rangeset_set_mode(id, mode)\n\ }\n\ Backlight>Set XPM Backlighting:::: {\n\ NEDIT_require_macro_file("element.nm")\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ set_backlight_string()\n\ \n\ new_bls = ""\n\ bls = ""\n\ pos = 0\n\ end = 0\n\ got_one = 0\n\ \n\ # process a line at a time\n\ while (pos >= 0)\n\ {\n\ end = search("\\n", pos, "case")\n\ if (end == -1)\n\ break\n\ \n\ # get the line\n\ l = get_range(pos, end)\n\ pos = end + 1\n\ \n\ # does it match a color specification?\n\ if (search_string(l, "^\\"(.).*[ \\t]c[ \\t]([^ \\t\\"]+)\\",[ \\t]*$", 0, "regex") != -1)\n\ {\n\ v = replace_in_string(l, "^\\"(.).*[ \\t]c[ \\t]([^ \\t\\"]+)\\",[ \\t]*$", "\\\\1\\t\\\\2", "regex")\n\ s = element_i(v, 0, "\\t")\n\ c = element_i(v, 1, "\\t")\n\ \n\ got_one = 1 # we're in the color specification part\n\ \n\ if (tolower(c) == "none") # special case: no color\n\ continue\n\ \n\ new_bls = new_bls ";" toascii(s) ":" c\n\ }\n\ else if (got_one) # not a color line: color specification part finished\n\ break\n\ }\n\ \n\ set_backlight_string()\n\ bls = $backlight_string # pick up old highlighting\n\ \n\ if (bls != "")\n\ new_bls = bls new_bls\n\ else\n\ new_bls = substring(new_bls, 1, length(new_bls))\n\ \n\ set_backlight_string(new_bls)\n\ \n\ set_language_mode("XPM pixmap")\n\ }\n\ Backlight>Set Default Backlighting:::: {\n\ set_backlight_string()\n\ }\n\ Backlight>Remove Backlighting:::: {\n\ set_backlight_string("")\n\ }\n\ Backlight>Show Backlighting Groups:::: {\n\ NEDIT_require_macro_file("backlight.nm")\n\ \n\ backlight_display_backlights()\n\ }\n\ Backlight>Change Backlighting Groups:::: {\n\ NEDIT_require_macro_file("backlight.nm")\n\ \n\ backlight_manip_backlights()\n\ }\n\ Backlight>Assign standard groups:::: {\n\ NEDIT_require_macro_file("backlight.nm")\n\ \n\ r = backlight_assign_standard_groups()\n\ set_backlight_string("")\n\ set_backlight_string(r)\n\ dialog("bg="get_colors()["rgb_text_bg"]", bl="r)\n\ }\n\ Backlight>Forget Backlighting Groups:::: {\n\ NEDIT_require_macro_file("backlight.nm")\n\ \n\ for (g in $backlights)\n\ delete $backlights[g]\n\ }\n\ Backlight>Convert all xbm to xpm:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ pos = 0\n\ \n\ q = "\\""\n\ qcn = "\\",\\n"\n\ sp = " "\n\ s = ""\n\ F = "#"\n\ B = "."\n\ \n\ while (pos >= 0)\n\ {\n\ wpos = search("(?<=_width\\\\s)\\\\d+(?=\\\\s*$)", pos, "regex")\n\ w = get_range(wpos, $search_end)\n\ hpos = search("(?<=_height\\\\s)\\\\d+(?=\\\\s*$)", pos, "regex")\n\ h = get_range(hpos, $search_end)\n\ bpos = search("<\\\\w+_bits\\\\[\\\\]", pos, "regex")\n\ if (wpos < pos || hpos < pos || bpos < pos)\n\ break\n\ \n\ name = get_range(bpos, $search_end - 7)\n\ \n\ w += 0\n\ h += 0\n\ \n\ s = s "/* XPM */\\n" \\\n\ "static char *" name "_pm[] = {\\n" \\\n\ "/* width height ncolors cpp [ x_hot y_hot] */\\n" \\\n\ q w sp h " 2 1 0 0" qcn \\\n\ "/* colors */\\n" \\\n\ q "#\\ts foreground\\tm black\\tc black" qcn \\\n\ q ".\\ts background\\tm white\\tc white" qcn \\\n\ "/* pixels */\\n"\n\ \n\ bpos = search("{", bpos) + 1\n\ bend = search("}", bpos)\n\ vals = get_range(bpos, bend)\n\ vals = replace_in_string(vals, "\\\\s|\\\\n", "", "regex")\n\ \n\ arr = split(vals, ",")\n\ narr = arr[]\n\ ls = ""\n\ dw = 0\n\ for (i = 0; i < narr; ++i)\n\ {\n\ ds = int_to_bin(hex_to_int(replace_in_string(arr[i], "0x", "")), 8)\n\ dw += length(ds)\n\ ls = ls reverse_string(ds)\n\ if (dw >= w)\n\ {\n\ dw = 0\n\ s = s q replace_in_string(replace_in_string(substring(ls, 0, w), \\\n\ "0", B, "copy"), \\\n\ "1", F, "copy")\n\ ls = ""\n\ if (--h)\n\ s = s qcn\n\ else\n\ s = s q "};\\n"\n\ }\n\ }\n\ s = s "\\n"\n\ pos = bend\n\ }\n\ new()\n\ focus_window("last")\n\ replace_range(0, 0, s)\n\ }\n\ Highlight>Convert to HTML:::: {\n\ NEDIT_require_macro_file("HStoHTML.nm")\n\ prompt = "Expand tabs to spaces during conversion?\\n"\n\ prompt = prompt "(Tab distance is " $tab_dist ")"\n\ if (dialog(prompt, "Yes", "No") == 1) # "yes" clicked?\n\ HighlightToHTML("detab") # do detab\n\ else\n\ HighlightToHTML() # leave tabs in HTML\n\ }\n\ Highlight>Convert to HTML Pretty:::: {\n\ NEDIT_require_macro_file("HStoHTML.nm")\n\ \n\ prompt = "Expand tabs to spaces during conversion?\\n"\n\ prompt = prompt "(Tab distance is " $tab_dist ")"\n\ if (dialog(prompt, "Yes", "No") == 1) # "yes" clicked?\n\ HighlightToHTML_PrettyPage("detab", "white", "#c0c0c0", "#e5e5e5") # do detab\n\ else\n\ HighlightToHTML_PrettyPage("", "white", "#c0c0c0", "#e5e5e5") # leave tabs in HTML\n\ }\n\ Highlight>Convert to HTML (Thorsten):::: {\n\ NEDIT_require_macro_file("sh2html.nm")\n\ \n\ params["source"] = $file_name\n\ params["css"] = "INLINE"\n\ sh2html(params)\n\ }\n\ Highlight>Show Attributes:::: {\n\ NEDIT_require_macro_file("extensions.nm") # for toascii\n\ \n\ while (1)\n\ {\n\ pos = $cursor\n\ c = get_range($cursor, $cursor + 1)\n\ \n\ s = "Language mode: " $language_mode\n\ s = s "\\n\\nPosition: " $cursor\n\ s = s "\\n\\nCharacter: '" c "' (" toascii(c) ")"\n\ s = s "\\n\\nPattern Info - get_pattern_at_pos(" $cursor "):"\n\ a = get_pattern_at_pos($cursor)\n\ for (v in a)\n\ s = s "\\n [" v "] = " a[v]\n\ if (a[] == 0)\n\ s = s "\\n "\n\ if ("extent" in a)\n\ end = pos + a["extent"]\n\ else\n\ end = pos\n\ \n\ pattern = ""\n\ if ("pattern" in a)\n\ pattern = a["pattern"]\n\ \n\ s = s "\\n\\nStyle Info - get_style_at_pos(" $cursor "):"\n\ a = get_style_at_pos($cursor)\n\ for (v in a)\n\ s = s "\\n [" v "] = " a[v]\n\ if (a[] == 0)\n\ s = s "\\n "\n\ \n\ style = ""\n\ if ("style" in a)\n\ style = a["style"]\n\ \n\ s = s "\\n\\nNon-Positional Info:"\n\ s = s "\\nPattern Info - get_pattern_by_name(\\"" pattern "\\"):"\n\ a = get_pattern_by_name(pattern)\n\ for (v in a)\n\ s = s "\\n [" v "] = " a[v]\n\ if (a[] == 0)\n\ s = s "\\n "\n\ \n\ s = s "\\n\\nStyle Info - get_style_by_name(\\"" style "\\"):"\n\ a = get_style_by_name(style)\n\ for (v in a)\n\ s = s "\\n [" v "] = " a[v]\n\ if (a[] == 0)\n\ s = s "\\n "\n\ \n\ s = s "\\n\\nColor Info - get_colors():"\n\ a = get_colors()\n\ for (v in a)\n\ s = s "\\n [" v "] = " a[v]\n\ if (a[] == 0)\n\ s = s "\\n "\n\ \n\ if (pos != end)\n\ {\n\ s = s "\\n\\nTry again with a new position or select extent?"\n\ btn = dialog(s, "Cancel", "Again", "Select")\n\ if (btn == 3)\n\ select(pos, end)\n\ else if (btn != 2)\n\ return\n\ }\n\ else\n\ {\n\ btn = dialog(s "\\n\\nTry again with a new position?", "Cancel", "Again")\n\ if (btn != 2)\n\ return\n\ }\n\ }\n\ }\n\ Paragraph>Show settings@Plain text@Doxygen@Doxygen strict:::: {\n\ NEDIT_require_macro_file("PlainText.nm")\n\ \n\ PlainText_setSettings()\n\ }\n\ Paragraph>Toggle 1st Line Handling@PERS text:::: {\n\ NEDIT_require_macro_file("pers.nm")\n\ \n\ $PERS_take_second_line = !$PERS_take_second_line\n\ \n\ line = ""\n\ if ($PERS_take_second_line)\n\ line = "SECOND"\n\ else\n\ line = "FIRST"\n\ \n\ dialog("The " line " line of a paragraph\\n" \\\n\ "determines the indentation for\\n" \\\n\ "paragraph refilling.")\n\ }\n\ Paragraph>Select Paragraph@Plain text@Doxygen@Doxygen strict:::: {\n\ NEDIT_require_macro_file("PlainText.nm")\n\ \n\ paraBeg = PlainText_ParagraphBegin(get_range(0, $text_length), $cursor)\n\ paraEnd = PlainText_ParagraphEnd(get_range(0, $text_length), $cursor)\n\ select(paraBeg, paraEnd)\n\ set_cursor_pos(paraEnd)\n\ }\n\ Paragraph>Select Paragraph@PERS text:::: {\n\ NEDIT_require_macro_file("pers.nm")\n\ \n\ select(PERS_beginOfParagraph($cursor), PERS_endOfParagraph($cursor))\n\ }\n\ Paragraph>Refill Paragraphs@Plain text@Doxygen@Doxygen strict:Alt+J::: {\n\ NEDIT_require_macro_file("PlainText.nm")\n\ \n\ if ($selection_left != -1)\n\ return dialog("Cannot refill a paragraph in a rectangular selection")\n\ \n\ start = $cursor\n\ end = $cursor\n\ if ($selection_start != -1)\n\ {\n\ set_cursor_pos($selection_start)\n\ start = $selection_start\n\ end = $selection_end\n\ }\n\ else\n\ {\n\ start = PlainText_ParagraphBegin(get_range(0, $text_length), $cursor)\n\ end = PlainText_ParagraphEnd(get_range(0, $text_length), $cursor)\n\ set_cursor_pos(start)\n\ }\n\ \n\ p = PlainText_ParagraphFill(get_range(start, end), $column, 0, end - start)\n\ replace_range(start, end, p)\n\ set_cursor_pos(start + length(p))\n\ }\n\ Paragraph>Refill Paragraphs@PERS text:Alt+J::: {\n\ NEDIT_require_macro_file("pers.nm")\n\ \n\ if ($selection_start == -1)\n\ set_cursor_pos(PERS_refillParagraph($cursor))\n\ else\n\ set_cursor_pos(PERS_refillParagraph(PERS_makeParagraph($selection_start, $selection_end)))\n\ }\n\ Paragraph>Start of Paragraph@PERS text:::: {\n\ NEDIT_require_macro_file("pers.nm")\n\ \n\ set_cursor_pos(PERS_beginOfParagraph($cursor))\n\ }\n\ Paragraph>End of Paragraph@PERS text:::: {\n\ NEDIT_require_macro_file("pers.nm")\n\ \n\ set_cursor_pos(PERS_endOfParagraph($cursor))\n\ }\n\ Paragraph>Previous Paragraph@PERS text:::: {\n\ NEDIT_require_macro_file("pers.nm")\n\ \n\ c = PERS_beginOfParagraph(PERS_beginOfParagraph($cursor) - 1)\n\ while (c >= 0)\n\ {\n\ if (!PERS_isEmptyLine(c))\n\ {\n\ set_cursor_pos(c)\n\ return\n\ }\n\ c = PERS_beginOfParagraph(PERS_beginOfParagraph(c) - 1)\n\ }\n\ }\n\ Paragraph>Next Paragraph@PERS text:::: {\n\ NEDIT_require_macro_file("pers.nm")\n\ \n\ c = PERS_endOfParagraph($cursor) + 1\n\ while (c <= $text_length)\n\ {\n\ if (!PERS_isEmptyLine(c))\n\ {\n\ set_cursor_pos(c)\n\ return\n\ }\n\ c = PERS_endOfParagraph(c) + 1\n\ }\n\ }\n\ man / postprocess:F1::: {\n\ NEDIT_require_macro_file("ManHelp.nm")\n\ \n\ ManHelp()\n\ }\n\ Redo braces@C@C++@Perl@NEdit Macro@Java@JavaScript:::: {\n\ indent[0] = ""\n\ \n\ if ($selection_start >= 0)\n\ {\n\ beg = $selection_start\n\ end = $selection_end\n\ }\n\ else\n\ {\n\ if (1 != dialog("C-style redo brace indents?\\n" \\\n\ "Process whole document?", "Yes", "No"))\n\ return\n\ beg = 0\n\ end = $text_length\n\ }\n\ if ($locked)\n\ {\n\ beep()\n\ return\n\ }\n\ \n\ set_locked(1)\n\ txt = get_range(beg, end)\n\ \n\ n = string_dialog("Indent width (default "$em_tab_dist")", "OK")\n\ if ($string_dialog_button != 1)\n\ return\n\ \n\ if (search_string(n, "^\\\\s*\\\\d+\\\\s*$", 0, "regex") < 0)\n\ {\n\ dialog("Using indent width "$em_tab_dist" instead of '"n"'")\n\ n = $em_tab_dist\n\ }\n\ else if (n < 1)\n\ {\n\ dialog("Using indent width "$em_tab_dist" instead of "n)\n\ n = $em_tab_dist\n\ }\n\ \n\ spaces = ""\n\ for (i = 0; i < n; i++)\n\ spaces = spaces " "\n\ \n\ for (i = 1; i < 20; i++)\n\ {\n\ indent[i] = indent[i - 1] spaces\n\ }\n\ \n\ i = 0\n\ for (pos = search_string(txt, "{", 0); \\\n\ pos != -1; \\\n\ pos = search_string(txt, "[{}\\n]", pos + 1, "regex"))\n\ {\n\ c = substring(txt, pos, pos + 1)\n\ if (c == "{")\n\ i++\n\ else if (c == "}")\n\ i--\n\ else if (c == "\\n")\n\ {\n\ endpos = search_string(txt, "[^ \\t]", pos + 1, "regex")\n\ if (endpos != -1)\n\ {\n\ c = substring(txt, endpos, endpos + 1)\n\ l = endpos - pos - 1\n\ if (c != "\\n" && c != "}")\n\ {\n\ dl = length(indent[i]) - l\n\ txt = substring(txt, 0, pos + 1) \\\n\ indent[i] \\\n\ substring(txt, endpos)\n\ }\n\ else if (c == "}" && i > 0)\n\ {\n\ dl = length(indent[i]) - l\n\ txt = substring(txt, 0, pos + 1) \\\n\ indent[i - 1] \\\n\ substring(txt, endpos)\n\ }\n\ else\n\ dl = 0\n\ }\n\ }\n\ }\n\ set_locked(0)\n\ replace_range(beg, end, txt)\n\ }\n\ Tidy C/C++@C@C++@Perl@NEdit Macro@Java@JavaScript:::: {\n\ if ($selection_start >= 0)\n\ {\n\ beg = $selection_start\n\ end = $selection_end\n\ }\n\ else\n\ {\n\ if (1 != dialog("C-style tidy operator spaces\\n" \\\n\ "Tidy whole document?", "Yes", "No"))\n\ return\n\ beg = 0\n\ end = $text_length\n\ }\n\ \n\ binops = "(\\\\?|" \\\n\ "(?\\\\>?\\\\>?=?|" \\\n\ "-=?(?!=)|" \\\n\ "\\\\+=?(?!=)|" \\\n\ "(?"\n\ result = ""\n\ \n\ bpos = -1\n\ epos = 0\n\ while (bpos != epos)\n\ {\n\ bpos = search_string(sel, strcmtdef, epos, "regex")\n\ if (bpos < 0)\n\ bpos = $text_length\n\ text = substring(sel, epos, bpos)\n\ epos = $search_end\n\ if (epos < bpos)\n\ epos = bpos\n\ #else\n\ # text = text " "\n\ #last = substring(result, -1)\n\ #if (last != "" && search_string(last, "(?n\\\\s)", 0, "regex") < 0)\n\ # last = "A "\n\ #else\n\ # last = ""\n\ \n\ if (length(text))\n\ {\n\ text = replace_in_string(text, "(\\\\w+)\\\\s+\\\\(", "\\\\1(", "regex", "copy")\n\ \n\ text = replace_in_string(text, "(?<="keywords")(?:|\\\\s\\\\s+)\\\\(", " (", \\\n\ "regex", "copy")\n\ text = replace_in_string(text, "\\\\s*(\\\\S)", "else \\\\1", \\\n\ "regex", "copy")\n\ \n\ text = replace_in_string(text, "(^(?!\\\\s)|\\\\S)\\\\s*(" binops ")\\\\s*", "\\\\1 \\\\2 ", \\\n\ "regex", "copy")\n\ \n\ text = replace_in_string(text, "([]}),[{(])\\\\s+", "\\\\1", \\\n\ "regex", "copy")\n\ \n\ text = replace_in_string(text, "([]}),])\\\\s*(?![])[.;]|-\\\\>)", "\\\\1 ", \\\n\ "regex", "copy")\n\ \n\ text = replace_in_string(text, "(\\\\S)\\\\s+([])])", "\\\\1\\\\2", "regex", "copy")\n\ text = replace_in_string(text, "(::|.)\\\\s+", "\\\\1", "regex", "copy")\n\ text = replace_in_string(text, "(\\\\S)\\\\s+-\\\\s+\\\\>", "\\\\1->", "regex", "copy")\n\ \n\ # text = replace_in_string(text, "\\\\s+\\n", "\\n", "regex", "copy")\n\ \n\ #if (last != "")\n\ # text = substring(text, 1)\n\ \n\ result = result text substring(sel, bpos, epos)\n\ }\n\ }\n\ \n\ if (result != sel)\n\ replace_range(beg, end, replace_in_string(result, "\\\\s+$", "", "regex", "copy"))\n\ }\n\ C/C++ Prog>C++ cast - set@C++:::: {\n\ $CppCastOper[1] = ""\n\ prompt = "Which cast type to use?"\n\ if ($CppCastOper[] == 2)\n\ prompt = prompt " (currently " $CppCastOper[0] ")"\n\ i = dialog(prompt, "static", "dynamic", "reinterpret", "(reset)", "Cancel")\n\ if (i == 1)\n\ $CppCastOper[0] = "static_cast"\n\ else if (i == 2)\n\ $CppCastOper[0] = "dynamic_cast"\n\ else if (i == 3)\n\ $CppCastOper[0] = "reinterpret_cast"\n\ else if (i == 4)\n\ delete $CppCastOper[0]\n\ }\n\ C/C++ Prog>C++ cast - apply@C++:::R: {\n\ $CppCastOper[1] = ""\n\ if ($CppCastOper[] != 2)\n\ macro_menu_command("C/C++ Prog>C++ cast - set@C++")\n\ p = $selection_start\n\ replace_range($selection_end, $selection_end, ")")\n\ s = $CppCastOper[0] "<>("\n\ replace_range(p, p, $CppCastOper[0] "<>(")\n\ p += length(s) - 2\n\ set_cursor_pos(p)\n\ }\n\ Development>"what" string@C@C++@Doxygen@Doxygen strict:::: {\n\ NEDIT_require_macro_file("Development.nm")\n\ \n\ Development_makeWhatString_C_Cpp()\n\ }\n\ Development>"what" string@XML@SGML HTML:::: {\n\ NEDIT_require_macro_file("Development.nm")\n\ \n\ Development_makeWhatString_HTML_SGML_XML()\n\ }\n\ Development>"what" string@Makefile@Csh@Sh Ksh Bash@Hash comments:::: {\n\ NEDIT_require_macro_file("Development.nm")\n\ \n\ Development_makeWhatString_Hash()\n\ }\n\ Development>File header box@C@C++@Doxygen@Doxygen strict:::: {\n\ NEDIT_require_macro_file("Development.nm")\n\ \n\ Development_makeFileHeaderComment_C_Cpp()\n\ }\n\ Development>File header box@Makefile@Csh@Sh Ksh Bash@Hash comments:::: {\n\ NEDIT_require_macro_file("Development.nm")\n\ \n\ Development_makeFileHeaderComment_Hash()\n\ }\n\ Development>File header box@NEdit Macro@NEdit Macro RE:::: {\n\ NEDIT_require_macro_file("Development.nm")\n\ \n\ Development_makeFileHeaderComment_Hash()\n\ }\n\ Development>Add header file guards@C@C++@Doxygen@Doxygen strict:::: {\n\ NEDIT_require_macro_file("Development.nm")\n\ \n\ Development_addHeaderFileGuards_C_Cpp()\n\ }\n\ Development>New C++ file:::: {\n\ NEDIT_require_macro_file("Development.nm")\n\ \n\ s = string_dialog("Make new C++ file:", "OK", "Cancel")\n\ if (s != "" && $string_dialog_button == 1)\n\ Development_makeNewFile_Cpp(s)\n\ }\n\ Development>New C++ Class files:::: {\n\ NEDIT_require_macro_file("Development.nm")\n\ \n\ s = string_dialog("Make header and source C++ file for class:", "OK", "Cancel")\n\ if (s != "" && $string_dialog_button == 1)\n\ Development_makeClassFiles_Cpp(s)\n\ }\n\ Development>Open C++ Class files:::: {\n\ NEDIT_require_macro_file("Development.nm")\n\ \n\ s = string_dialog("Directory: " $file_path "\\n" \\\n\ "Open header and source C++ file for class:", "OK", "Cancel")\n\ if (s != "" && $string_dialog_button == 1)\n\ Development_openClassFiles_Cpp(s)\n\ }\n\ Development>Make C++ Method in class.cpp file@C++:::: {\n\ NEDIT_require_macro_file("Development.nm")\n\ \n\ Development_makeCppMethod()\n\ }\n\ Development>Change default C++ file extensions@C++:::: {\n\ NEDIT_require_macro_file("Development.nm")\n\ \n\ Development_SetupCppPreferredFileExtn("redo")\n\ }\n\ Development>Setup class to filename conversion:::: {\n\ NEDIT_require_macro_file("Development.nm")\n\ \n\ Development_SetupClassToFileName()\n\ }\n\ Tests>Macro interpreter tests setup:::: {\n\ $TEST = "test-init"\n\ dialog("This macro performs the following assignment:\\n" \\\n\ "\\n" \\\n\ " $TEST = \\"test-init\\"\\n" \\\n\ "\\n" \\\n\ "The macro menu entry \\"Macro interpreter tests setup\\"\\n" \\\n\ "allows different files to be read from the directory\\n" \\\n\ " " $NEDIT_HOME "test_nm_syntax/\\n" \\\n\ "using load_macro_file(), executing their content. Each\\n" \\\n\ "of these files are expected to set $TEST to \\"\\" on\\n" \\\n\ "successful termination\\n")\n\ }\n\ Tests>Macro interpreter tests:::: {\n\ while (1)\n\ {\n\ $test_nm_syntax[""] = ""\n\ \n\ unknown = " ? "\n\ success = " OK "\n\ failure = "*FAIL*"\n\ testinit = "test-init"\n\ \n\ dir = $NEDIT_HOME "test_nm_syntax/"\n\ if (!("tests" in $test_nm_syntax))\n\ {\n\ ls = shell_command("[ -d " dir " ] && (cd " dir "; ls *.nm)", "")\n\ if ($shell_cmd_status != 0)\n\ {\n\ dialog("Test directory " dir " not found or empty")\n\ return\n\ }\n\ \n\ ls = substring(ls, 0, -1)\n\ files = split(ls, "\\n")\n\ \n\ tests = $empty_array\n\ for (i in files)\n\ tests[files[i]] = unknown\n\ \n\ $test_nm_syntax["tests"] = tests\n\ }\n\ \n\ tests = $test_nm_syntax["tests"]\n\ \n\ while (1)\n\ {\n\ list = ""\n\ for (t in tests)\n\ list = list tests[t] "\\t" t "\\n"\n\ \n\ s = list_dialog( \\\n\ "The following files are expected to set the value\\n" \\\n\ "of the variable $TEST to \\"\\" on successful termination\\n" \\\n\ "($TEST starts with value \\"" testinit "\\")\\n" \\\n\ "Check which file?", \\\n\ list, \\\n\ "Load it to test", "Open in editor", "Reset List", "Cancel")\n\ \n\ res = $list_dialog_button\n\ if (res < 1 || res > 3)\n\ return\n\ \n\ if (res == 3) # Reset List\n\ {\n\ $test_nm_syntax = $empty_array\n\ tests = $empty_array\n\ break\n\ }\n\ \n\ if (s == "")\n\ continue\n\ \n\ file = replace_in_string(s, "^[^\\t]*\\t", "", "regex")\n\ fullfile = dir file\n\ content = read_file(fullfile)\n\ if (!$read_status || content == "")\n\ {\n\ err = ""\n\ if (content == "")\n\ err = "\\n(no content)"\n\ dialog("Problem reading file\\n " fullfile err "\\n\\nDropping " file)\n\ delete $test_nm_syntax["tests"][file]\n\ delete tests[file]\n\ continue\n\ }\n\ \n\ if (res == 2) # Open in editor\n\ {\n\ open(fullfile)\n\ focus_window(fullfile)\n\ raise_window()\n\ continue\n\ }\n\ else if (res != 1) # not Load it to test - exit macro\n\ return\n\ \n\ # pick up leading comments (if any)\n\ # skip blank lines\n\ pos = search_string(content, "^\\\\s*\\\\S", 0, "regex")\n\ content = substring(content, pos)\n\ pos = search_string(content, "^\\\\s*(?:[^#\\\\s]|\\n)", 0, "regex")\n\ content = substring(content, 0, pos)\n\ if (content != "")\n\ {\n\ if (length(replace_in_string(content, ".*", "", "regex")) > 8)\n\ {\n\ list_dialog("Comments (" file ")", content, "Test","Skip","Cancel")\n\ res = $list_dialog_button\n\ }\n\ else\n\ res = dialog("Comments (" file ")\\n\\n" content, "Test","Skip","Cancel")\n\ if (res == 2)\n\ continue\n\ else if (res != 1)\n\ return\n\ }\n\ \n\ # if we get here we will attempt to load the file fullfile\n\ # this may fail with a syntax error so prepare things for next time\n\ $test_nm_syntax["tests"][file] = failure\n\ tests[file] = failure\n\ $TEST = testinit\n\ load_macro_file(fullfile)\n\ # if we get here, we had no failure\n\ if ($TEST == "")\n\ {\n\ $test_nm_syntax["tests"][file] = success\n\ tests[file] = success\n\ }\n\ \n\ # ... and loop again\n\ }\n\ \n\ # no re-read to do\n\ if ("tests" in $test_nm_syntax)\n\ return\n\ }\n\ }\n\ Tests>pos to line, col:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ r = dialog("Use buffer as string argument?", "No: document", "Yes")\n\ here = $cursor\n\ if (r != 2)\n\ {\n\ ln = pos_to_line(here)\n\ cl = pos_to_column(here)\n\ \n\ ps = line_col_to_pos(ln, cl)\n\ }\n\ else\n\ {\n\ s = get_range(0, $text_length)\n\ ln = pos_to_line(here, s)\n\ cl = pos_to_column(here, $tab_dist, s)\n\ \n\ ps = str_line_col_to_pos(s, ln, cl)\n\ }\n\ \n\ u = ""\n\ if (r == 2)\n\ u = "Using document as string\\n"\n\ dialog(u "Original position: " here \\\n\ "\\nfound line: " ln \\\n\ "\\nfound col : " cl \\\n\ "\\n===> new pos = " ps)\n\ }\n\ Tests>set window title:::: {\n\ h = "\\n\\nFormat specifiers are\\n" \\\n\ "%c ClearCase view tag\\n" \\\n\ "%[n]d directory, with one optional numeric digit n\\n" \\\n\ " specifying the maximum number of trailing directory\\n" \\\n\ " components to display. Skipped components are\\n" \\\n\ " replaced by an ellipsis (...).\\n" \\\n\ "%f file name, without the path name\\n" \\\n\ "%h host name\\n" \\\n\ "%s NEdit server name (server mode only)\\n" \\\n\ "%[*]S file status, either verbose (%S) or brief (%*S)\\n" \\\n\ "%u user name\\n"\n\ \n\ s = string_dialog("Enter a new title for the window" h, "Text", "Format")\n\ ty = "text"\n\ if ($string_dialog_button == 0)\n\ return\n\ if ($string_dialog_button == 2)\n\ ty = "format"\n\ set_window_title_format(s, ty)\n\ }\n\ Tests>split test:::: {\n\ s = get_selection()\n\ count = string_dialog("Enter split count (default indefinite)", \\\n\ "OK", "lastnotnull")\n\ lastnotnull = 0\n\ if ($string_dialog_button == 2)\n\ lastnotnull = 1\n\ if (count != "" && !valid_number(count))\n\ dialog("Invalid count value (should be an integer)")\n\ \n\ if (count == "")\n\ {\n\ if (lastnotnull) a = split(s, " ", "lastnotnull")\n\ else a = split(s, " ")\n\ }\n\ else\n\ {\n\ if (lastnotnull) a = split(s, " ", count, "lastnotnull")\n\ else a = split(s, " ", count)\n\ }\n\ \n\ r = "String: '" s "'\\nCount: " count "\\nResult (" a[] "):\\n"\n\ for (i = 0; i < a[]; i++)\n\ r = r "[" i "] = :" a[i] ":\\n"\n\ \n\ dialog(r)\n\ }\n\ Tests>justify test:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ if ($selection_start != -1)\n\ s = get_selection()\n\ else\n\ s = string_dialog("Enter string to justify", "OK")\n\ \n\ l = string_dialog("Enter minimum length", "OK")\n\ lj = replace_in_string(ljust(s, l), "^.*$", "<<|&|", "regex")\n\ rj = replace_in_string(rjust(s, l), "^.*$", ">>|&|", "regex")\n\ list_dialog("Left/Right justification: length " l " of string:\\n" s, \\\n\ "Left justification:\\n" lj "\\n" \\\n\ " Right justification:\\n" rj, "Dismiss")\n\ }\n\ Tests>substring:::: {\n\ s = ""\n\ s1a = substring(s, 0, length(s))\n\ s1b = substring(s, 0)\n\ s2a = substring(s, length(s) - 1, length(s))\n\ s2b = substring(s, -1)\n\ s3a = substring(s, 1, length(s) - 1)\n\ s3b = substring(s, 1, -1)\n\ s4a = substring(s, length(s) - 1, 1)\n\ s4b = substring(s, -1, 1)\n\ \n\ lines = ""\n\ lines = lines "substring(s, 0, length(s)) = '"s1a"'\\n"\n\ lines = lines "substring(s, 0) = '"s1b"'\\n"\n\ lines = lines "equal = " (s1a == s1b) " (should be 1)\\n"\n\ lines = lines "substring(s, length(s) - 1, length(s)) = '"s2a"'\\n"\n\ lines = lines "substring(s, -1) = '"s2b"'\\n"\n\ lines = lines "equal = " (s2a == s2b) " (should be 1)\\n"\n\ lines = lines "substring(s, 1, length(s) - 1) = '"s3a"'\\n"\n\ lines = lines "substring(s, 1, -1) = '"s3b"'\\n"\n\ lines = lines "equal = " (s3a == s3b) " (should be 1)\\n"\n\ lines = lines "substring(s, length(s) - 1, 1) = '"s4a"'\\n"\n\ lines = lines "substring(s, -1, 1) = '"s4b"'\\n"\n\ lines = lines "equal = " (s4a == s4b) " (should be 1)\\n"\n\ \n\ list_dialog("Results of substring operations for s =\\n'" s "'", lines)\n\ }\n\ Tests>replace_substring bug:::: {\n\ result = replace_substring(12345, 2, 3, 9876)\n\ if (result == "12987645")\n\ result = result "\\n\\nSuccess"\n\ else\n\ result = result "\\n\\nFAILED"\n\ dialog("replace_substring(12345, 2, 3, 9876) == " result)\n\ }\n\ Tests>clone window:Alt+Equal::: {\n\ clone_document()\n\ }\n\ Tests>array_select_entry:::R: {\n\ NEDIT_require_macro_file("array_utils.nm")\n\ \n\ # dialog("This macro tests selection of an array formed of selected lines")\n\ \n\ a = split(get_selection(), "\\n")\n\ r = array_select_entry("Select an entry:", a, "b1", "b2", "b3", "b4", "b5")\n\ \n\ s = "entry selection:"\n\ for (k in r)\n\ {\n\ s = s "\\n [" k "] = " r[k]\n\ }\n\ if (r[] == 0)\n\ s = s "\\n "\n\ \n\ dialog(s)\n\ }\n\ Tests>array_list_content:::: {\n\ NEDIT_require_macro_file("array_utils.nm")\n\ \n\ a = $empty_array\n\ a[""] = "the key is empty"\n\ a[-12] = "minus twelve"\n\ a[-3] = "moins trois"\n\ a[-1] = "negative one"\n\ a[0] = "zero"\n\ a[1] = "positive 1"\n\ a[2] = "two"\n\ a[3] = "tre"\n\ a[4] = "quatro"\n\ a[5] = "cinq"\n\ a[10] = "TEN"\n\ a[11] = "onze"\n\ a[12] = "duodecimus"\n\ a[1000] = "mille"\n\ a["line"] = " this is a line\\nwith a \\\\n!"\n\ a["column"] = "whatever"\n\ \n\ r = array_select_entry("Select an entry:", a, "b1", "b2", "b3", "b4", "b5")\n\ \n\ s = "entry selection:"\n\ for (k in r)\n\ {\n\ s = s "\\n [" k "] = " r[k]\n\ }\n\ if (r[] == 0)\n\ s = s "\\n "\n\ array_select_entry("Received:", r)\n\ \n\ dialog(s)\n\ }\n\ Tests>valid_number:::: {\n\ NEDIT_require_macro_file("array_utils.nm")\n\ \n\ s = string_dialog("Test valid number:\\nEnter a numeric string", "OK")\n\ \n\ res = "String:\\n '"s"'\\nis a"\n\ if (valid_number(s))\n\ res = res " VALID number = " (0 + s)\n\ else\n\ res = res "n INVALID number"\n\ \n\ dialog(res, "OK")\n\ }\n\ Tests>GCD (a, b):::: {\n\ NEDIT_require_macro_file("GCD.nm")\n\ \n\ a = "bad"\n\ while (!valid_number(a))\n\ a = string_dialog("GCD: Enter first number")\n\ \n\ b = "bad"\n\ while (!valid_number(b))\n\ b = string_dialog("GCD: Enter second number")\n\ \n\ c = gcd(a, b)\n\ dialog("GCD of "a" and "b" is "c)\n\ }\n\ Tests>replace_selection()>version 1:::R: {\n\ sel = get_selection()\n\ start = $selection_start\n\ end = $selection_end\n\ left = $selection_left\n\ right = $selection_right\n\ \n\ s = string_dialog("Enter string to replace selection")\n\ ss = s\n\ \n\ if (left >= 0)\n\ {\n\ x = split(sel, "\\n")\n\ n = x[]\n\ while (n-- > 1)\n\ ss = ss "\\n" s\n\ select_rectangle(start, end, left, right)\n\ }\n\ else\n\ select(start, end)\n\ \n\ replace_selection(ss)\n\ }\n\ Tests>replace_selection()>version 2:::R: {\n\ sel = get_selection()\n\ start = $selection_start\n\ end = $selection_end\n\ left = $selection_left\n\ right = $selection_right\n\ \n\ s = string_dialog("Enter string to replace selection")\n\ ss = s\n\ \n\ if (left >= 0)\n\ {\n\ # rectangular selection: all lines in the selected block to be replaced with s\n\ # build the block as a sequence of lines containing s\n\ s = replace_in_string(s, "\\n", " ") # only one line allowed in replacement\n\ n = split(sel, "\\n")[] # count lines in selection\n\ ss = "" # to contain n lines of s duplicates\n\ s2 = s "\\n"\n\ while (n > 0) # duplicate replacement string n times\n\ {\n\ if (n % 2 == 1)\n\ ss = ss s2\n\ n /= 2\n\ s2 = s2 s2 # using doubling to go fast\n\ }\n\ ss = substring(ss, 0, length(ss) - 1) # remove last added "\\n"\n\ # re-select in case we lost the selection during dialog\n\ select_rectangle(start, end, left, right)\n\ }\n\ else\n\ select(start, end) # re-select (see above)\n\ \n\ replace_selection(ss)\n\ }\n\ Tests>replace_selection()>version 3:::R: {\n\ sel = get_selection()\n\ start = $selection_start\n\ end = $selection_end\n\ left = $selection_left\n\ right = $selection_right\n\ \n\ s = string_dialog("Enter string to replace selection")\n\ \n\ if (left >= 0)\n\ {\n\ # rectangular selection: all lines in the selected block\n\ # to be replaced with s so build the block as a sequence\n\ # of lines containing s\n\ s = replace_in_string(s, "\\n", " ", "copy") # single line replacement\n\ n = split(sel, "\\n")[] # count lines in selection\n\ s2 = s "\\n"\n\ s = ""\n\ # duplicate replacement string n times\n\ for (;;)\n\ {\n\ if (n % 2 == 1)\n\ s = s s2\n\ n /= 2\n\ if (n > 0)\n\ s2 = s2 s2\n\ else\n\ break\n\ }\n\ s = substring(s, 0, length(s) - 1) # remove last added "\\n"\n\ # re-select in case we lost the selection during dialog\n\ select_rectangle(start, end, left, right)\n\ }\n\ else\n\ select(start, end) # re-select (see above)\n\ \n\ replace_selection(s)\n\ }\n\ Tests>Fill Sel. w/Char>Original:::R: {\n\ if ($selection_start == -1) {\n\ beep()\n\ return\n\ }\n\ \n\ # Ask the user what character to fill with\n\ fillChar = string_dialog("Fill selection with what character?", "OK", "Cancel")\n\ if ($string_dialog_button == 2 || $string_dialog_button == 0)\n\ return\n\ \n\ # Count the number of lines in the selection\n\ nLines = 0\n\ for (i=$selection_start; i<$selection_end; i++)\n\ if (get_character(i) == "\\n")\n\ nLines++\n\ \n\ # Create the fill text\n\ rectangular = $selection_left != -1\n\ line = ""\n\ fillText = ""\n\ if (rectangular) {\n\ for (i=0; i<$selection_right-$selection_left; i++)\n\ line = line fillChar\n\ for (i=0; i=0 && get_character(i)!="\\n"; i--)\n\ startIndent++\n\ for (i=0; i<$wrap_margin-startIndent; i++)\n\ fillText = fillText fillChar\n\ fillText = fillText "\\n"\n\ for (i=0; i<$wrap_margin; i++)\n\ line = line fillChar\n\ for (i=0; i=$selection_start && get_character(i)!="\\n"; \\\n\ i--)\n\ fillText = fillText fillChar\n\ }\n\ }\n\ \n\ # Replace the selection with the fill text\n\ replace_selection(fillText)\n\ }\n\ Tests>Fill Sel. w/Char>version 2:::R: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ if ($selection_start == -1) {\n\ beep()\n\ return\n\ }\n\ \n\ # Ask the user what character to fill with\n\ fillChar = string_dialog("Fill selection with what character?", "OK", "Cancel")\n\ if ($string_dialog_button == 2 || $string_dialog_button == 0)\n\ return\n\ \n\ # Count the number of lines in the selection\n\ nLines = length(replace_in_string(get_selection(), "^.*$", "", "regex"))\n\ \n\ # Create the fill text\n\ rectangular = $selection_left != -1\n\ line = ""\n\ fillText = ""\n\ if (rectangular) {\n\ line = repeat(fillChar, $selection_right - $selection_left)\n\ fillText = line repeat("\\n" line, nLines)\n\ } else {\n\ if (nLines == 0) {\n\ fillText = repeat(fillChar, $selection_end - $selection_start)\n\ } else {\n\ # we need to measure from start of first line to sel start\n\ # and from start of last line to sel end\n\ p1 = pos_to_column($selection_start)\n\ p2 = pos_to_column($selection_end)\n\ # now assemble our text\n\ line = repeat(fillChar, $wrap_margin)\n\ fillText = repeat(fillChar, $wrap_margin - p1) "\\n" \\\n\ repeat(line "\\n", nLines - 1) \\\n\ repeat(fillChar, p2)\n\ }\n\ }\n\ \n\ # Replace the selection with the fill text\n\ replace_selection(fillText)\n\ }\n\ Tests>Fill Sel. w/Char>version 3:::R: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ if ($selection_start == -1) {\n\ beep()\n\ return\n\ }\n\ \n\ # Ask the user what character to fill with\n\ fillChar = string_dialog("Fill selection with what character?", "OK", "Cancel")\n\ if ($string_dialog_button == 2 || $string_dialog_button == 0)\n\ return\n\ \n\ # Count the number of lines in the selection\n\ nLines = length(replace_in_string(get_selection(), "^.*$", "", "regex"))\n\ \n\ # Create the fill text\n\ rectangular = $selection_left != -1\n\ line = ""\n\ fillText = ""\n\ if (rectangular) {\n\ line = repeat(fillChar, $selection_right - $selection_left)\n\ fillText = line repeat("\\n" line, nLines)\n\ } else {\n\ if (nLines == 0) {\n\ fillText = repeat(fillChar, $selection_end - $selection_start)\n\ } else {\n\ # we need to measure from start of first line to sel start\n\ # and from start of last line to sel end\n\ \n\ selpos[0] = $selection_start\n\ selpos[1] = $selection_end\n\ \n\ for (i = 0; i < 2; ++i) {\n\ end = selpos[i]\n\ pos = search("^", end, "regex", "backward")\n\ col = 0\n\ nextCol = 0\n\ while (pos < end) {\n\ nexttab = search("\\t", pos)\n\ if (nexttab < pos || nexttab > end)\n\ nexttab = end\n\ if (nexttab == end)\n\ nextCol = col + end - pos # no tabs between pos and end\n\ else if (nexttab > pos)\n\ nextCol = col + nexttab - pos # skip contiguous non-tabs\n\ else {\n\ nextCol = col + $tab_dist - (col % $tab_dist)\n\ nexttab++\n\ }\n\ pos = nexttab\n\ col = nextCol\n\ }\n\ selcol[i] = col\n\ }\n\ # now assemble our text\n\ line = repeat(fillChar, $wrap_margin)\n\ fillText = repeat(fillChar, $wrap_margin - selcol[0]) "\\n" \\\n\ repeat(line "\\n", nLines - 1) \\\n\ repeat(fillChar, selcol[1])\n\ }\n\ }\n\ \n\ # Replace the selection with the fill text\n\ replace_selection(fillText)\n\ }\n\ Tests>Fill Sel. w/Char>version 4:::R: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ if ($selection_start == -1) {\n\ beep()\n\ return\n\ }\n\ \n\ # Ask the user what character to fill with\n\ fillChar = string_dialog("Fill selection with what character?", "OK", "Cancel")\n\ if ($string_dialog_button == 2 || $string_dialog_button == 0)\n\ return\n\ \n\ # Count the number of lines in the selection\n\ nLines = length(replace_in_string(get_selection(), "^.*$", "", "regex"))\n\ \n\ # Create the fill text\n\ rectangular = $selection_left != -1\n\ line = ""\n\ fillText = ""\n\ if (rectangular) {\n\ line = repeat(fillChar, $selection_right - $selection_left)\n\ fillText = line repeat("\\n" line, nLines)\n\ } else {\n\ if (nLines == 0) {\n\ fillText = repeat(fillChar, $selection_end - $selection_start)\n\ } else {\n\ # we need to measure from start of first line to sel start\n\ # and from start of last line to sel end\n\ \n\ selpos[0] = $selection_start\n\ selpos[1] = $selection_end\n\ \n\ for (i = 0; i < 2; ++i) {\n\ end = selpos[i]\n\ pos = search("^", end, "regex", "backward")\n\ col = 0\n\ while (pos < end) {\n\ nexttab = search("\\t", pos)\n\ if (nexttab < 0 || nexttab >= end) {\n\ col += end - pos # skip contiguous non-tabs\n\ nexttab = end\n\ } else {\n\ col += nexttab - pos + $tab_dist\n\ col -= (col % $tab_dist)\n\ }\n\ pos = nexttab + 1 # skip past the tab just found\n\ }\n\ selcol[i] = col\n\ }\n\ # now assemble our text\n\ line = repeat(fillChar, $wrap_margin)\n\ fillText = repeat(fillChar, $wrap_margin - selcol[0]) "\\n" \\\n\ repeat(line "\\n", nLines - 1) \\\n\ repeat(fillChar, selcol[1])\n\ }\n\ }\n\ \n\ # Replace the selection with the fill text\n\ replace_selection(fillText)\n\ }\n\ Tests>Fill Sel. w/Char>version 5:::R: {\n\ if ($selection_start == -1) {\n\ beep()\n\ return\n\ }\n\ \n\ # Ask the user what character to fill with\n\ fillChar = string_dialog("Fill selection with what character?", \\\n\ "OK", "Cancel")\n\ if ($string_dialog_button == 2 || $string_dialog_button == 0)\n\ return\n\ \n\ # Count the number of lines (NL characters) in the selection\n\ # (by removing all non-NLs in selection and counting the remainder)\n\ nLines = length(replace_in_string(get_selection(), \\\n\ "^.*$", "", "regex"))\n\ \n\ rectangular = $selection_left != -1\n\ \n\ # work out the pieces of required of the replacement text\n\ # this will be top mid bot where top is empty or ends in NL,\n\ # mid is 0 or more lines of repeats ending with NL, and\n\ # bot is 0 or more repeats of the fillChar\n\ \n\ toplen = -1 # top piece by default empty (no NL)\n\ midlen = 0\n\ botlen = 0\n\ \n\ if (rectangular) {\n\ # just fill the rectangle: mid\\n \\ nLines\n\ # mid\\n /\n\ # bot - last line with no nl\n\ midlen = $selection_right - $selection_left\n\ botlen = $selection_right - $selection_left\n\ } else {\n\ # |col[0]\n\ # .........toptoptop\\n |col[0]\n\ # either midmidmidmidmidmid\\n \\ nLines - 1 or ...botbot...\n\ # midmidmidmidmidmid\\n / |col[1]\n\ # botbot... |\n\ # |col[1] |wrap margin\n\ # we need column positions col[0], col[1] of selection start and\n\ # end (use a loop and arrays to do the two positions)\n\ sel[0] = $selection_start\n\ sel[1] = $selection_end\n\ \n\ # col[0] = pos_to_column($selection_start)\n\ # col[1] = pos_to_column($selection_end)\n\ \n\ for (i = 0; i < 2; ++i) {\n\ end = sel[i]\n\ pos = search("^", end, "regex", "backward")\n\ thisCol = 0\n\ while (pos < end) {\n\ nexttab = search("\\t", pos)\n\ if (nexttab < 0 || nexttab >= end) {\n\ thisCol += end - pos # count remaining non-tabs\n\ nexttab = end\n\ } else {\n\ thisCol += nexttab - pos + $tab_dist\n\ thisCol -= (thisCol % $tab_dist)\n\ }\n\ pos = nexttab + 1 # skip past the tab or end\n\ }\n\ col[i] = thisCol\n\ }\n\ toplen = max($wrap_margin - col[0], 0)\n\ botlen = min(col[1], $wrap_margin)\n\ \n\ if (nLines == 0) {\n\ toplen = -1\n\ botlen = max(botlen - col[0], 0)\n\ } else {\n\ midlen = $wrap_margin\n\ if (toplen < 0)\n\ toplen = 0\n\ nLines-- # top piece will end in a NL\n\ }\n\ }\n\ \n\ # Create the fill text\n\ # which is the longest piece? make a line of that length\n\ # (use string doubling - this allows the piece to be\n\ # appended to double in size at each iteration)\n\ \n\ len = max(toplen, midlen, botlen)\n\ charlen = length(fillChar) # maybe more than one char given!\n\ \n\ line = ""\n\ while (len > 0) {\n\ if (len % 2)\n\ line = line fillChar\n\ len /= 2\n\ if (len > 0)\n\ fillChar = fillChar fillChar\n\ }\n\ # assemble our pieces\n\ toppiece = ""\n\ midpiece = ""\n\ botpiece = ""\n\ if (toplen >= 0)\n\ toppiece = substring(line, 0, toplen * charlen) "\\n"\n\ if (botlen > 0)\n\ botpiece = substring(line, 0, botlen * charlen)\n\ \n\ # assemble midpiece (use doubling again)\n\ line = substring(line, 0, midlen * charlen) "\\n"\n\ while (nLines > 0) {\n\ if (nLines % 2)\n\ midpiece = midpiece line\n\ nLines /= 2\n\ if (nLines > 0)\n\ line = line line\n\ }\n\ # Replace the selection with the complete fill text\n\ replace_selection(toppiece midpiece botpiece)\n\ }\n\ Tests>Fill Sel. w/Char>version 6:::R: {\n\ if ($selection_start == -1) {\n\ beep()\n\ return\n\ }\n\ # keep hold of these...\n\ sel_start = $selection_start\n\ sel_end = $selection_end\n\ sel_left = $selection_left\n\ sel_right = $selection_right\n\ sel_text = get_selection()\n\ \n\ rectangular = sel_left != -1\n\ \n\ prompt = "Fill a selected area with repeated text\\n\\n"\n\ \n\ # Ask the user what character to fill with\n\ if (rectangular) {\n\ prompt = prompt \\\n\ "Rectangular selections are replaced by repeats\\n" \\\n\ "starting at the left edge of the selection, ending\\n" \\\n\ "at the right edge.\\n\\n"\n\ } else {\n\ prompt = prompt \\\n\ "Normal text selections fill to the current wrap\\n" \\\n\ "margin from the start point to the end point of the\\n" \\\n\ "selection, overlaying text as if the repeated string\\n" \\\n\ "started at the first character position of each line\\n\\n"\n\ }\n\ prompt = prompt "Fill selection with what character/string?"\n\ \n\ fillChar = string_dialog(prompt, "OK", "Cancel")\n\ if ($string_dialog_button == 2 || $string_dialog_button == 0)\n\ return\n\ \n\ # Count the number of lines (NL characters) in the selection\n\ # (by removing all non-NLs in selection and counting the remainder)\n\ nLines = length(replace_in_string(sel_text, "^.*$", "", "regex"))\n\ \n\ # work out the pieces of required of the replacement text\n\ # this will be top mid bot where top is empty or ends in NL,\n\ # mid is 0 or more lines of repeats ending with NL, and\n\ # bot is 0 or more repeats of the fillChar\n\ \n\ toplen = -1 # top piece by default empty (no NL)\n\ midlen = 0\n\ botlen = 0\n\ \n\ if (rectangular) {\n\ # just fill the rectangle: mid\\n \\ nLines\n\ # mid\\n /\n\ # bot - last line with no nl\n\ midlen = sel_right - sel_left\n\ botlen = sel_right - sel_left\n\ } else {\n\ # |col[0]\n\ # ........ptoptoptop\\n |col[0]\n\ # either midmidmidmidmidmid\\n \\ nLines - 1 or ...botbot...\n\ # midmidmidmidmidmid\\n / |col[1]\n\ # botbotb.. |\n\ # |col[1] |wrap margin\n\ # [notice non-integral copies of repeats cause vertical alignment]\n\ # we need column positions col[0], col[1] of selection start and\n\ # end (use a loop and arrays to do the two positions)\n\ sel[0] = sel_start\n\ sel[1] = sel_end\n\ \n\ # col[0] = pos_to_column($selection_start)\n\ # col[1] = pos_to_column($selection_end)\n\ \n\ for (i = 0; i < 2; ++i) {\n\ end = sel[i]\n\ pos = search("^", end, "regex", "backward")\n\ thisCol = 0\n\ while (pos < end) {\n\ nexttab = search("\\t", pos)\n\ if (nexttab < 0 || nexttab >= end) {\n\ thisCol += end - pos # count remaining non-tabs\n\ nexttab = end\n\ } else {\n\ thisCol += nexttab - pos + $tab_dist\n\ thisCol -= (thisCol % $tab_dist)\n\ }\n\ pos = nexttab + 1 # skip past the tab or end\n\ }\n\ col[i] = thisCol\n\ }\n\ toplen = max($wrap_margin - col[0], 0)\n\ botlen = min(col[1], $wrap_margin)\n\ \n\ if (nLines == 0) {\n\ toplen = -1\n\ botlen = max(botlen - col[0], 0)\n\ } else {\n\ midlen = $wrap_margin\n\ if (toplen < 0)\n\ toplen = 0\n\ nLines-- # top piece will end in a NL\n\ }\n\ }\n\ \n\ # Create the fill text\n\ \n\ # which is the longest piece? make a line of that length\n\ # (use string doubling - this allows the piece to be\n\ # appended to double in size at each iteration, much faster\n\ # than repeated appending of the single fillChar)\n\ \n\ len = max(toplen, midlen, botlen)\n\ charlen = length(fillChar) # maybe more than one char given!\n\ repeat_count = (len + charlen - 1) / charlen\n\ \n\ line = ""\n\ while (repeat_count > 0) {\n\ if (repeat_count % 2)\n\ line = line fillChar\n\ repeat_count /= 2\n\ if (repeat_count > 0)\n\ fillChar = fillChar fillChar\n\ }\n\ \n\ # assemble our pieces\n\ toppiece = ""\n\ midpiece = ""\n\ botpiece = ""\n\ if (toplen >= 0) {\n\ # this is NOT a rectangular selection (toplen < 0 for rectangles)\n\ # make repeats align over lines\n\ toppiece = substring(line, col[0], col[0] + toplen) "\\n"\n\ }\n\ if (botlen > 0)\n\ botpiece = substring(line, 0, botlen)\n\ \n\ # assemble midpiece (use doubling again)\n\ line = substring(line, 0, midlen) "\\n"\n\ while (nLines > 0) {\n\ if (nLines % 2)\n\ midpiece = midpiece line\n\ nLines /= 2\n\ if (nLines > 0)\n\ line = line line\n\ }\n\ \n\ # Make sure the selection is still there\n\ # (it might have been deselected while the dialog was up)\n\ if (sel_left < 0)\n\ select(sel_start, sel_end)\n\ else\n\ select_rectangle(sel_start, sel_end, sel_left, sel_right)\n\ \n\ # Replace the selection with the complete fill text\n\ replace_selection(toppiece midpiece botpiece)\n\ }\n\ Tests>Show NEDIT_HOME:::: {\n\ dialog("$NEDIT_HOME is " $NEDIT_HOME "\\n" \\\n\ "getenv(\\"NEDIT_HOME\\") is " getenv("NEDIT_HOME"))\n\ }\n\ Tests>Undo/Redo>Undo/Unselect:Ctrl+Alt+Z::: {\n\ line = $line\n\ col = $column\n\ top = $top_line\n\ undo()\n\ deselect_all()\n\ goto_line_number(line, col)\n\ scroll_to_line(top)\n\ }\n\ Tests>Undo/Redo>Redo/Unselect:Shift+Ctrl+Alt+Z::: {\n\ line = $line\n\ col = $column\n\ top = $top_line\n\ redo()\n\ deselect_all()\n\ goto_line_number(line, col)\n\ scroll_to_line(top)\n\ }\n\ Tests>Repaste>Clear:::: {\n\ $RePasteData[""] = 0 # make sure global array $RePasteData exists\n\ if ("buffer" in $RePasteData)\n\ delete $RePasteData["buffer"]\n\ }\n\ Tests>Repaste>Copy:::: {\n\ $RePasteData[""] = 0 # make sure global array $RePasteData exists\n\ data = get_selection("any") # pick up any selected text\n\ \n\ if (data != "")\n\ {\n\ $RePasteData["buffer"] = data\n\ \n\ is_rect = ($selection_left >=0)\n\ $RePasteData["rect"] = is_rect\n\ \n\ $RePasteData["size"] = ""\n\ if (is_rect)\n\ {\n\ cols = $selection_right - $selection_left\n\ rows = length(replace_in_string(data, ".*", "", "regex")) + 1\n\ $RePasteData["size"] = "[rows="rows", cols="cols"]"\n\ }\n\ else\n\ {\n\ len = length(data)\n\ rows = length(replace_in_string(data, ".*", "", "regex")) + 1\n\ $RePasteData["size"] = "[rows="rows", length="len"]"\n\ }\n\ }\n\ \n\ # if none found, use what was used last time - if at all\n\ if (data == "" && ("buffer" in $RePasteData))\n\ data = $RePasteData["buffer"]\n\ }\n\ Tests>Repaste>Paste:::: {\n\ $RePasteData[""] = 0 # make sure global array $RePasteData exists\n\ \n\ # use what was used last time - if at all\n\ if ("buffer" in $RePasteData)\n\ data = $RePasteData["buffer"]\n\ else\n\ data = ""\n\ \n\ # nothing to paste?\n\ if (data != "")\n\ {\n\ # insert the data to paste\n\ if ($RePasteData["rect"])\n\ {\n\ string_to_clipboard(data)\n\ paste_clipboard("rect")\n\ }\n\ else\n\ {\n\ pos = $cursor\n\ replace_range(pos, pos, data)\n\ set_cursor_pos(pos + length(data))\n\ }\n\ }\n\ else\n\ beep()\n\ }\n\ Tests>Repaste>Copy/Paste:::: {\n\ $RePasteData[""] = 0 # make sure global array $RePasteData exists\n\ data = get_selection("any") # pick up any selected text\n\ \n\ beg = $selection_start\n\ end = $selection_end\n\ if (beg < 0)\n\ {\n\ beg = $cursor\n\ end = $cursor\n\ }\n\ \n\ if (data != "")\n\ {\n\ $RePasteData["buffer"] = data\n\ \n\ is_rect = ($selection_left >=0)\n\ $RePasteData["rect"] = is_rect\n\ \n\ $RePasteData["size"] = ""\n\ if (is_rect)\n\ {\n\ cols = $selection_right - $selection_left\n\ rows = length(replace_in_string(data, ".*", "", "regex")) + 1\n\ $RePasteData["size"] = "[rows="rows", cols="cols"]"\n\ }\n\ else\n\ {\n\ len = length(data)\n\ rows = length(replace_in_string(data, ".*", "", "regex")) + 1\n\ $RePasteData["size"] = "[rows="rows", length="len"]"\n\ }\n\ }\n\ \n\ # if none found, use what was used last time - if at all\n\ if (data == "" && ("buffer" in $RePasteData))\n\ data = $RePasteData["buffer"]\n\ if (end == beg && $selection_start >= 0)\n\ end = beg + length(data)\n\ \n\ # nothing to paste?\n\ if (data != "")\n\ {\n\ # insert the data to paste\n\ if ($RePasteData["rect"])\n\ {\n\ string_to_clipboard(data)\n\ paste_clipboard("rect")\n\ }\n\ else\n\ {\n\ replace_range(beg, end, data)\n\ if ($selection_start < 0)\n\ set_cursor_pos(beg + length(data))\n\ }\n\ }\n\ else\n\ beep()\n\ }\n\ Tests>Repaste>Copy/Paste 2:::: {\n\ $RePasteData[""] = 0 # make sure global array $RePasteData exists\n\ data = get_selection("any") # pick up any selected text\n\ \n\ if (data != "")\n\ {\n\ $RePasteData["buffer"] = data\n\ \n\ is_rect = ($selection_left >=0)\n\ $RePasteData["rect"] = is_rect\n\ \n\ $RePasteData["size"] = ""\n\ if (is_rect)\n\ {\n\ cols = $selection_right - $selection_left\n\ rows = length(replace_in_string(data, ".*", "", "regex")) + 1\n\ $RePasteData["size"] = "[rows="rows", cols="cols"]"\n\ }\n\ else\n\ {\n\ len = length(data)\n\ rows = length(replace_in_string(data, ".*", "", "regex")) + 1\n\ $RePasteData["size"] = "[rows="rows", length="len"]"\n\ }\n\ }\n\ \n\ # if none found, use what was used last time - if at all\n\ if (data == "" && ("buffer" in $RePasteData))\n\ data = $RePasteData["buffer"]\n\ \n\ if ($selection_end >= 0 && $selection_left < 0)\n\ {\n\ set_cursor_pos($selection_end)\n\ deselect_all()\n\ }\n\ pos = $cursor\n\ \n\ # nothing to paste?\n\ if (data != "")\n\ {\n\ # insert the data to paste\n\ if ($RePasteData["rect"])\n\ {\n\ string_to_clipboard(data)\n\ paste_clipboard("rect")\n\ }\n\ else\n\ {\n\ replace_range(pos, pos, data)\n\ set_cursor_pos(pos + length(data))\n\ }\n\ }\n\ else\n\ beep()\n\ }\n\ Tests>Repaste>View Paste Buffer:Shift+Ctrl+Alt+Z::: {\n\ $RePasteData[""] = 0 # make sure global array $RePasteData exists\n\ if ("buffer" in $RePasteData)\n\ {\n\ data = $RePasteData["buffer"]\n\ size = $RePasteData["size"]\n\ list_dialog("Re-paste buffer contents: " size, data, \\\n\ "Paste", "Clear", "Cancel")\n\ \n\ if ($list_dialog_button == 1)\n\ {\n\ if ($RePasteData["rect"])\n\ {\n\ string_to_clipboard(data)\n\ paste_clipboard("rect")\n\ }\n\ else\n\ {\n\ pos = $cursor\n\ replace_range(pos, pos, data)\n\ set_cursor_pos(pos + length(data))\n\ }\n\ }\n\ else if ($list_dialog_button == 2)\n\ {\n\ delete $RePasteData["buffer"]\n\ }\n\ }\n\ else\n\ {\n\ dialog("Re-paste buffer is empty")\n\ }\n\ }\n\ Tests>XML>Match Tags@SGML HTML@XML:::: {\n\ NEDIT_require_macro_file("XMLMatch.nm")\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ rs = "XMLMatchTag()"\n\ res = XMLMatchTag()\n\ if ("open_start" in res)\n\ {\n\ RangeSet_forget(rs)\n\ RangeSet_set_color(rs, "#FF4000")\n\ RangeSet_add(rs, res["open_start"], res["close_end"])\n\ RangeSet_select(rs)\n\ }\n\ else\n\ {\n\ dialog("No tag found at position "$cursor)\n\ }\n\ }\n\ Tests>Column width of string:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ if ($selection_start < 0)\n\ {\n\ s = string_dialog("Enter a string whose width to measure")\n\ startcol = 0\n\ }\n\ else\n\ {\n\ s = get_selection()\n\ startcol = pos_to_column($selection_start)\n\ }\n\ \n\ nl = search_string(s, "\\n", 0)\n\ if (nl >= 0)\n\ s = substring(s, 0, nl)\n\ \n\ dialog("The string '" s "'\\nat column " startcol "\\n" \\\n\ "is " colwidth(s, startcol) " columns wide")\n\ }\n\ Tests>int, bin, oct, hex>int to bin, oct, hex:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ err = ""\n\ while (1)\n\ {\n\ s = string_dialog(err "Enter number and choose digits", \\\n\ 1,2,3,4,5,6,7,8,9,10,11,12)\n\ prec = $string_dialog_button\n\ if (prec == 0)\n\ return\n\ if (!valid_number(s))\n\ {\n\ err = "Number value given '" s "' is invalid\\n"\n\ continue\n\ }\n\ \n\ err = "int: " s " [min digits " prec "]:\\n"\n\ r["bin"] = int_to_bin(s, prec)\n\ r["hex"] = int_to_hex(s, prec)\n\ r["oct"] = int_to_oct(s, prec)\n\ for (i in r)\n\ {\n\ err = err i ": " r[i] " ["length(r[i])"]\\n"\n\ }\n\ err = err "\\n"\n\ }\n\ }\n\ Tests>int, bin, oct, hex>int to bin, oct, hex 2:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ NEDIT_require_macro_file("array_utils.nm")\n\ \n\ decRE = "^( *)([+-]?[1-9][0-9]+|0)$"\n\ b64RE = "^ *([1-9][0-9]*)_([0-9a-zA-Z+/]+)$"\n\ octRE = "^( *)0([0-7]+)$"\n\ hexRE = "^( *)0?x([0-9a-fA-F]+)$"\n\ \n\ REs = make_arraylist(decRE, b64RE, octRE, hexRE)\n\ bases = make_arraylist(10, 0, 8, 16)\n\ \n\ err = ""\n\ while (1)\n\ {\n\ input = string_dialog(err "Enter number and choose digits", \\\n\ 1,2,3,4,5,6,7,8,9,10,11,12)\n\ \n\ err = "Input is: " input "\\n"\n\ s = input\n\ prec = $string_dialog_button\n\ if (prec == 0)\n\ return\n\ \n\ base = -1\n\ for (i = 0; i < REs[]; i++)\n\ {\n\ if (search_string(s, REs[i], 0, "regex") == 0)\n\ {\n\ base = replace_in_string(input, REs[i], "\\\\1", "regex")\n\ s = replace_in_string(input, REs[i], "\\\\2", "regex")\n\ # err = err "RE is " REs[i] "\\n"\n\ # err = err "extract [" s "] and [" base "]\\n"\n\ if (!valid_number(base))\n\ base = bases[i]\n\ if (base < 2 || base > 62)\n\ {\n\ # err = "Invalid base " base " in " input " (value is " s ")\\n"\n\ base = -1\n\ break\n\ }\n\ if (base != 10)\n\ {\n\ # err = err "Calling base_to_int(" base ", '" s "')\\n"\n\ s = base_to_int(base, s)\n\ }\n\ break\n\ }\n\ }\n\ if (!valid_number(s) || base < 2)\n\ {\n\ err = err "Number value given '" s "' (originally '" input "') is invalid\\n"\n\ continue\n\ }\n\ \n\ err = err "int: " s " [min digits " prec "]:\\n"\n\ r["bin"] = int_to_bin(s, prec)\n\ r["hex"] = int_to_hex(s, prec)\n\ r["oct"] = int_to_oct(s, prec)\n\ for (i in r)\n\ {\n\ err = err " " i ": " r[i] " ["length(r[i])"]\\n"\n\ }\n\ err = err "\\n"\n\ }\n\ }\n\ Tests>int, bin, oct, hex>bin-bits to hex, dec, oct, bin:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ NEDIT_require_macro_file("array_utils.nm")\n\ \n\ decRE = "^( *)([+-]?[1-9][0-9]+|0)$"\n\ b64RE = "^ *([1-9][0-9]*)_([0-9a-zA-Z+/]+)$"\n\ octRE = "^( *)0([0-7]+)$"\n\ hexRE = "^( *)0?x([0-9a-fA-F]+)$"\n\ \n\ err = ""\n\ while (1)\n\ {\n\ input = string_dialog(err "Enter bits and/or bit ranges\\n" \\\n\ "then select whether these are on or off", \\\n\ "On (1)", "Off (0)", "Cancel")\n\ if (1 > $string_dialog_button || $string_dialog_button > 2)\n\ return\n\ \n\ err = ""\n\ toggle = $string_dialog_button != 1\n\ accumulator = 0\n\ words = replace_in_string(input, "(?n[^:0-9-]+)", " ", "regex", "copy")\n\ words = replace_in_string(words, ":", "-", "copy")\n\ words = replace_in_string(words, "-+", "-", "regex", "copy")\n\ words = replace_in_string(words, " -", "-", "copy")\n\ words = replace_in_string(words, "- ", "-", "copy")\n\ words = replace_in_string(words, "^ +", "", "regex", "copy")\n\ words = replace_in_string(words, " +$", "", "regex", "copy")\n\ word = split(words, " ")\n\ for (i = 0; i < word[]; i++)\n\ {\n\ numbers = split(word[i], "-")\n\ n0 = numbers[0]\n\ n1 = numbers[numbers[] - 1]\n\ if (numbers[] > 2 || n0 == "" || n1 == "")\n\ {\n\ err = "invalid range(s) specified '" word[i] "' from:\\n " input "\\n\\n"\n\ break\n\ }\n\ lo = min(n0, n1)\n\ hi = max(n0, n1)\n\ if (lo >= 32 || hi >= 32)\n\ {\n\ err = "bit positions out of range [0-31]:\\n " input "\\n\\n"\n\ break\n\ }\n\ b = 1\n\ for (pos = 0; pos <= hi; pos++)\n\ {\n\ if (pos >= lo)\n\ accumulator |= b\n\ b *= 2\n\ }\n\ }\n\ if (err != "")\n\ continue\n\ \n\ # present results\n\ prompt = "Bits and/or bit ranges\\n " input "\\nturned "\n\ if (toggle)\n\ {\n\ prompt = prompt "Off (0)"\n\ accumulator = -accumulator - 1\n\ }\n\ else\n\ prompt = prompt "On (1)"\n\ prompt = prompt " gives"\n\ values = "hex: 0x" int_to_hex(accumulator) "\\n" \\\n\ "dec: " accumulator "\\n" \\\n\ "oct: 0" int_to_oct(accumulator) "\\n" \\\n\ "bin: 0b" int_to_bin(accumulator)\n\ v = list_multisel_dialog(prompt, values, "OK", "To file", "To clipboard")\n\ v = replace_in_string(v, "^.*: *", "", "regex")\n\ if ($list_dialog_button == 2)\n\ replace_range($cursor, $cursor, v)\n\ else if ($list_dialog_button == 3)\n\ string_to_clipboard(v)\n\ }\n\ }\n\ Tests>Word counts>Bad version:::: {\n\ wordCounts = $empty_array\n\ text_str = get_selection("any")\n\ if (text_str == "")\n\ text_str = get_range(0, $text_length)\n\ wordEnd = 0\n\ for (;;) {\n\ # find first word in the text string\n\ wordStart = search_string(text_str, "\\\\Y+", 0, "regex")\n\ if (wordStart < 0)\n\ break\n\ wordEnd = $search_end\n\ word = substring(text_str, wordStart, wordEnd)\n\ # remove that word and all before it from the text string\n\ text_str = substring(text_str, wordEnd, length(text_str))\n\ # add to word counts array\n\ if (word in wordCounts)\n\ ++wordCounts[word]\n\ else\n\ wordCounts[word] = 1\n\ }\n\ list = ""\n\ for (word in wordCounts) {\n\ list = list word ": " wordCounts[word] "\\n"\n\ }\n\ list_dialog("Word count occurrences - " wordCounts[] " unique words", list)\n\ }\n\ Tests>Word counts>Better version:::: {\n\ wordCounts = $empty_array\n\ text_str = get_selection("any")\n\ if (text_str == "")\n\ text_str = get_range(0, $text_length)\n\ wordEnd = 0\n\ for (;;) {\n\ # find first word in the text string\n\ wordStart = search_string(text_str, "\\\\Y+", wordEnd, "regex")\n\ if (wordStart < 0)\n\ break\n\ wordEnd = $search_end\n\ word = substring(text_str, wordStart, wordEnd)\n\ # add to word counts array\n\ if (word in wordCounts)\n\ ++wordCounts[word]\n\ else\n\ wordCounts[word] = 1\n\ }\n\ list = ""\n\ for (word in wordCounts) {\n\ list = list word ": " wordCounts[word] "\\n"\n\ }\n\ list_dialog("Word count occurrences - " wordCounts[] " unique words", list)\n\ }\n\ Tests>Word counts>Split version:::: {\n\ wordCounts = $empty_array\n\ text_str = get_selection("any")\n\ if (text_str == "")\n\ text_str = get_range(0, $text_length)\n\ text_words = split(text_str, "\\\\y+", "regex")\n\ for (i in text_words) {\n\ word = text_words[i] # string assignment is cheap - just don't modify!\n\ # add to word counts array\n\ if (word != "" && (word in wordCounts))\n\ ++wordCounts[word]\n\ else\n\ wordCounts[word] = 1\n\ }\n\ list = ""\n\ for (word in wordCounts) {\n\ list = list word ": " wordCounts[word] "\\n"\n\ }\n\ list_dialog("Word count occurrences - " wordCounts[] " unique words", list)\n\ }\n\ Tests>Word counts>No word extract version:::: {\n\ wordCounts = $empty_array\n\ text_str = get_selection("any")\n\ if (text_str == "")\n\ text_str = get_range(0, $text_length)\n\ wordEnd = 0\n\ for (;;) {\n\ # find first word in the text string\n\ wordStart = search_string(text_str, "\\\\Y+", wordEnd, "regex")\n\ if (wordStart < 0)\n\ break\n\ wordEnd = $search_end\n\ # do we already have this word?\n\ found = 0\n\ for (word in wordCounts) {\n\ if (search_string(text_str, word, wordStart, "case") == wordStart && \\\n\ length(word) == wordEnd - wordStart) {\n\ found = 1\n\ ++wordCounts[word]\n\ break\n\ }\n\ }\n\ if (found == 0) {\n\ # we need to extract the first word: it's new\n\ word = substring(text_str, wordStart, wordEnd)\n\ # add to word counts array\n\ wordCounts[word] = 1\n\ }\n\ }\n\ list = ""\n\ for (word in wordCounts) {\n\ list = list word ": " wordCounts[word] "\\n"\n\ }\n\ list_dialog("Word count occurrences - " wordCounts[] " unique words", list)\n\ }\n\ Tests>GREP>grep filter text:::: {\n\ # grep filter - remove all but matching lines\n\ \n\ selS = $selection_start\n\ selE = $selection_end\n\ selL = $selection_left\n\ selR = $selection_right\n\ \n\ if (selS < 0)\n\ {\n\ selS = 0\n\ selE = $text_length\n\ s = get_range(selS, selE)\n\ ctx = "document"\n\ }\n\ else\n\ {\n\ s = get_selection()\n\ ctx = "selection"\n\ }\n\ \n\ re = string_dialog("Grep lines in " ctx ": enter regex pattern", \\\n\ "grep", "grep -v", "Cancel")\n\ btn = $string_dialog_button\n\ if (re == "" || btn == 0 || btn == 3)\n\ return # do nothing\n\ if (btn == 1)\n\ matchtype = "?!"\n\ else\n\ matchtype = "?="\n\ if (substring(re, 0, 1) != "^") # starts with a ^?\n\ re = ".*" re # add slack in front of search pattern\n\ if (search_string(re, "(?= 0) # ends with non-esc'd $?\n\ re = re ".*" # add slack at the end\n\ \n\ # remove unwanted lines\n\ t = replace_in_string(s, "^(" matchtype re ").*\\n", "", "regex")\n\ if (selL >= 0)\n\ {\n\ select_rectangle(selS, selE, selL, selR)\n\ replace_selection(t)\n\ }\n\ else\n\ {\n\ replace_range(selS, selE, t)\n\ }\n\ }\n\ Tests>GREP>grep file to find dialog:::: {\n\ # grep lines, show the results in a "Go there/Dump to window" dialog\n\ \n\ REGEX = "regex"\n\ COPY = "copy"\n\ \n\ re = string_dialog("Keep matching lines: enter regex pattern", \\\n\ "grep", "grep -v", "Cancel")\n\ orig_re = re\n\ btn = $string_dialog_button\n\ if (re == "" || btn == 0 || btn == 3)\n\ return # do nothing\n\ greptype = "matching regular expression"\n\ if (btn == 1)\n\ {\n\ matchtype = "?!"\n\ }\n\ else\n\ {\n\ matchtype = "?="\n\ greptype = "not " greptype\n\ }\n\ if (substring(re, 0, 1) != "^") # starts with a ^?\n\ re = ".*" re # add slack in front of search pattern\n\ if (search_string(re, "(? 0 && lines[nlines - 1] == "")\n\ delete lines[--nlines]\n\ \n\ # use the calculated RE to remove unwanted line entries\n\ for (i = 0; i < nlines; i++)\n\ if (search_string(lines[i], re, 0, REGEX) == 0)\n\ delete lines[i]\n\ \n\ fpath = $file_path $file_name\n\ fcolon = $file_name ":"\n\ \n\ # now build up a results string from what's left\n\ res = ""\n\ for (i = 0; i < nlines; i++)\n\ if (i in lines)\n\ {\n\ j = i + 1\n\ res = res fcolon j ":" lines[i] "\\n"\n\ }\n\ \n\ prompt = "Grep file to find dialog\\n " fpath "\\n" greptype ": '" orig_re "'"\n\ prompt = prompt "\\n\\nRE: '" re "'"\n\ \n\ # resultant lines in res\n\ if (res != "")\n\ {\n\ carry_on = 1\n\ e_prompt = ""\n\ while (carry_on)\n\ {\n\ # loop allowing the user to jump to each line\n\ line = list_dialog(prompt e_prompt, \\\n\ res, \\\n\ "Go there", "Dump to Window", "Cancel")\n\ if ($list_dialog_button == 2)\n\ {\n\ carry_on = 0\n\ new("window") # can't give it a title ("Grep Output")\n\ focus_window("last")\n\ set_language_mode("grep -n out")\n\ insert_string(prompt "\\n\\n" res)\n\ }\n\ else if ($list_dialog_button == 1)\n\ {\n\ msg = ""\n\ e_prompt = "\\n\\nNo line selected"\n\ if (line == "")\n\ e_prompt = ""\n\ if (search_string(line, fcolon, 0) == 0)\n\ {\n\ # extract line number\n\ line = substring(line, $search_end)\n\ lineno = replace_in_string(line, "(\\\\d+):.*", "\\\\1", REGEX, COPY)\n\ pref = fcolon lineno ":"\n\ # now remove the file:line number prefix from the remains\n\ msg = substring(line, length(pref))\n\ # right: go there\n\ goto_line_number(lineno)\n\ beg = $cursor\n\ end = search("\\n", beg)\n\ if (get_range(beg, end) != msg)\n\ calltip(msg, $cursor, "tipText")\n\ }\n\ else\n\ calltip(line, -1, "tipText")\n\ }\n\ else\n\ carry_on = 0\n\ }\n\ }\n\ else\n\ {\n\ dialog(prompt "\\n\\nNo matching lines")\n\ }\n\ }\n\ Tests>Simple Find All:::: {\n\ # pick up search string\n\ sel = get_selection("any")\n\ if (sel != "")\n\ {\n\ pat = string_dialog("Enter search pattern\\n" \\\n\ "(default is '" sel "')", \\\n\ "OK", "Clear", "Cancel")\n\ if (pat == "")\n\ pat = sel\n\ }\n\ else\n\ {\n\ pat = string_dialog("Enter search pattern", "OK", "Clear", "Cancel")\n\ }\n\ btn = $string_dialog_button\n\ if (btn == 2)\n\ {\n\ # delete old result rangeset(s) for re-creation\n\ sets = rangeset_get_by_name("Find all")\n\ if (sets[] != 0)\n\ rangeset_destroy(sets)\n\ btn = (pat == "") # carry on as if OK had been \n\ }\n\ if (pat == "" || btn != 1)\n\ return\n\ \n\ # choose search type\n\ ty[1] = "literal"\n\ ty[2] = "case"\n\ ty[3] = "word"\n\ ty[4] = "caseWord"\n\ ty[5] = "regex"\n\ ty[6] = "regexNoCase"\n\ \n\ ind = dialog("Search for\\n\\n '" pat "'\\n\\nas the following pattern type", \\\n\ ty[1], ty[2], ty[3], ty[4], ty[5], ty[6], "Cancel")\n\ if (!(ind in ty))\n\ return\n\ \n\ srchtype = ty[ind]\n\ \n\ # delete old result rangeset(s) for re-creation\n\ sets = rangeset_get_by_name("Find all")\n\ if (sets[] != 0)\n\ rangeset_destroy(sets)\n\ \n\ # (re)create a rangeset for results - this will be the "top-most" rangeset\n\ rs = rangeset_create()\n\ if (rs == 0)\n\ return dialog("Could not create a rangeset for Find All search", "Dismiss")\n\ \n\ rangeset_set_name(rs, "Find all")\n\ rangeset_set_color(rs, "#80FFC0") # greenish\n\ \n\ # now do the search and assemble results\n\ res = ""\n\ num = 0\n\ end = 0\n\ for (pos = search(pat, 0, srchtype); \\\n\ pos >= 0; \\\n\ pos = search(pat, end, srchtype))\n\ {\n\ ++num\n\ end = $search_end\n\ rangeset_add(rs, pos, end)\n\ bol = max(search("\\n", pos, "case", "backward") + 1, 0)\n\ eol = min(search("\\n", pos, "case", "forward"), $text_length)\n\ # add to res a representatoin of the (first) line of the found pattern\n\ if (eol > end)\n\ res = res num ": " get_range(bol, pos) \\\n\ "[[" get_range(pos, end) \\\n\ "]]" get_range(end, eol) "\\n"\n\ else\n\ res = res num ": " get_range(bol, pos) \\\n\ "[[" get_range(pos, eol) "...\\n"\n\ }\n\ \n\ if (num == 0)\n\ return dialog("No occurrences of " srchtype " pattern\\n\\n" \\\n\ " '" pat "'\\n\\nfound", "Dismiss")\n\ \n\ # found all, have results - now go there\n\ line = list_dialog("Found "num" occurrences of " srchtype " pattern\\n\\n" \\\n\ " '" pat "'\\n\\nGo to which one?", \\\n\ res, "OK", "Select", "Cancel")\n\ btn = $list_dialog_button\n\ if (line == "" || !(btn == 1 || btn == 2))\n\ return\n\ \n\ num = replace_in_string(line, ":.*", "", "regex") + 0\n\ range = rangeset_range(rs, num)\n\ if (range[])\n\ {\n\ set_cursor_pos(range["start"])\n\ if (btn == 2)\n\ select(range["start"], range["end"])\n\ }\n\ }\n\ Tests>read_file test:::: {\n\ file = exist_filename_dialog("read_file test")\n\ suff = file\n\ if (substring(file, 0, length($file_path)) == $file_path)\n\ suff = substring(file, length($file_path))\n\ \n\ text = read_file(suff)\n\ stat = "FAIL"\n\ if ($read_status)\n\ stat = "OK "\n\ \n\ text = read_file(file)\n\ stts = "FAIL"\n\ if ($read_status)\n\ stts = "OK "\n\ \n\ list_dialog("Results", \\\n\ "Window path: "$file_path"\\n" \\\n\ "Full file path: "file"\\n" \\\n\ "File path suffix: "suff"\\n" \\\n\ "read_file status: "stat" "suff"\\n" \\\n\ "read_file status: "stts" "file"\\n" \\\n\ )\n\ }\n\ Tests>list_dialog keywords>with string:::: {\n\ sel[1]="browse"\n\ sel[2]="single"\n\ sel[3]="multi"\n\ sel[4]="extend"\n\ b = dialog("Which select style?", sel[1],sel[2],sel[3],sel[4], "Cancel")\n\ if (!(b in sel))\n\ return\n\ \n\ s = list_dialog("Test", \\\n\ "single_sel\\nmulti_sel\\nbrowse_sel\\nextend_sel\\nstring_entry", \\\n\ sel[b]"_sel", "string_entry", \\\n\ "OK", "Dismiss")\n\ r = "Button=" $list_dialog_button " - val=[" length(s) "]"\n\ \n\ if (replace_in_string(s, "\\n", "") == "") # no newlines found\n\ r = r " '" s "'"\n\ else\n\ r = r "\\n--------\\n" s "\\n--------"\n\ \n\ dialog(r)\n\ }\n\ Tests>list_dialog keywords>without string:::: {\n\ sel[1]="browse"\n\ sel[2]="single"\n\ sel[3]="multi"\n\ sel[4]="extend"\n\ b = dialog("Which select style?", sel[1],sel[2],sel[3],sel[4], "Cancel")\n\ if (!(b in sel))\n\ return\n\ \n\ s = list_dialog("Test", \\\n\ "single_sel\\nmulti_sel\\nbrowse_sel\\nextend_sel\\nstring_entry", \\\n\ sel[b]"_sel", \\\n\ "OK", "Dismiss")\n\ r = "Button=" $list_dialog_button " - val=[" length(s) "]"\n\ \n\ if (replace_in_string(s, "\\n", "") == "") # no newlines found\n\ r = r " '" s "'"\n\ else\n\ r = r "\\n--------\\n" s "\\n--------"\n\ \n\ dialog(r)\n\ }\n\ HSBC>SQSH>Vertical records to horizontal table:::: {\n\ NEDIT_require_macro_file("HSBC/VerticalToHorizontal.nm")\n\ \n\ DoVerticalToHorizontal()\n\ }\n\ HSBC>SQSH>sqsh:Ctrl+KP_Enter:s:: {\n\ NEDIT_require_macro_file("HSBC/SQSHmacros.nm")\n\ \n\ DoSelectedSQSH()\n\ }\n\ HSBC>SQSH>sqsh fragments::f:: {\n\ NEDIT_require_macro_file("Fragment_store.nm")\n\ \n\ Fragment_fetch("SQSH")\n\ }\n\ HSBC>SQSH>sqsh fragments - (Re)load from file:::: {\n\ NEDIT_require_macro_file("Fragment_store.nm")\n\ \n\ Fragment_load_fragments("SQSH")\n\ }\n\ HSBC>SQSH>sqsh fragments - Open file:::: {\n\ NEDIT_require_macro_file("Fragment_store.nm")\n\ \n\ Fragment_open_file("SQSH")\n\ }\n\ HSBC>other>EOD compare log analysis:::: {\n\ NEDIT_require_macro_file("RSextensions.nm")\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ # find lines of a particular account group\n\ rs = "Accounts"\n\ rsacc = rs\n\ RangeSet_set_color(rs, "orange")\n\ RangeSet_remove(rs, 0, $text_length)\n\ \n\ group = string_dialog("Account prefix (use +Hedges for / accounts)", \\\n\ "OK", "+Hedges", "Cancel")\n\ but = $string_dialog_button\n\ if (group != "")\n\ {\n\ tail = ""\n\ group = "^.*<" quote_literal_as_regex(group)\n\ if (but == 1)\n\ tail = "\\\\d+(?:[^/\\\\d].*\\n|\\n)"\n\ else if (but == 2)\n\ tail = "(?=\\\\d+).*\\n"\n\ if (tail != "")\n\ {\n\ group = group tail\n\ for (pos = search(group, 0, "regex"); \\\n\ pos >= 0; \\\n\ pos = search(group, $search_end, "regex"))\n\ RangeSet_add(rs, pos, $search_end)\n\ }\n\ }\n\ \n\ if (RangeSet_defined(rs))\n\ RangeSet_set_color(rs, "orange")\n\ \n\ # find position lines where positions match, mark them as grey\n\ pos = search("Comparing Opening Bonds Positions Against Bloomberg Positions", \\\n\ 0, "case")\n\ if (pos < 0)\n\ return\n\ \n\ summary = search("Summary", pos, "case")\n\ \n\ rs = "GoodPositions"\n\ RangeSet_set_color(rs, "gray")\n\ RangeSet_remove(rs, 0, $text_length)\n\ \n\ while (pos < summary)\n\ {\n\ pos = search("^.{47}(.{11}) \\\\1.*\\n", pos, "regex")\n\ if (pos < 0)\n\ break\n\ RangeSet_add(rs, pos, $search_end)\n\ pos = $search_end\n\ }\n\ \n\ if (RangeSet_defined(rs))\n\ RangeSet_set_color(rs, "gray")\n\ \n\ # mark out error count columns in mid green of the summary section\n\ pos = summary\n\ \n\ rs = "ErrorCols"\n\ RangeSet_set_color(rs, "#00a000")\n\ RangeSet_remove(rs, 0, $text_length)\n\ \n\ while (pos >= 0)\n\ {\n\ pos = search("^SUMMARY: .{103}$", pos, "regex")\n\ end = $search_end\n\ if (pos < 0)\n\ break\n\ pos = search("(?<=SUMMARY: .{21}).{18}(?=.{64}$)", pos, "regex")\n\ RangeSet_add(rs, pos, $search_end)\n\ pos = search("(?<=SUMMARY: .{48}).{18}(?=.{37}$)", pos, "regex")\n\ RangeSet_add(rs, pos, $search_end)\n\ pos = search("(?<=SUMMARY: .{75}).{18}(?=.{10}$)", pos, "regex")\n\ RangeSet_add(rs, pos, $search_end)\n\ \n\ pos = end\n\ }\n\ \n\ rscols = rs\n\ \n\ if (RangeSet_defined(rs))\n\ {\n\ RangeSet_set_color(rs, "#00a000")\n\ if (RangeSet_defined(rsacc))\n\ {\n\ RangeSet_set_color(rsacc "Err", "#00b000")\n\ RangeSet_add("~ErrorCols", rs)\n\ RangeSet_inverse("~ErrorCols")\n\ RangeSet_add(rsacc "Err", rsacc)\n\ RangeSet_remove(rsacc "Err", "~ErrorCols")\n\ RangeSet_forget("~ErrorCols")\n\ }\n\ }\n\ \n\ # look for non-zero error counts within the error columns\n\ pos = summary\n\ \n\ rs = "ErrorInCols"\n\ RangeSet_set_color(rs, "green")\n\ RangeSet_remove(rs, 0, $text_length)\n\ \n\ while (pos >= 0)\n\ {\n\ pos = search("(?<= )(?!0>)\\\\d+(?= )", pos, "regex")\n\ if (pos < 0)\n\ break\n\ ext = $search_end\n\ if (RangeSet_includes_pos(rscols, pos))\n\ {\n\ if (ext <= $RangeSet_range_end)\n\ RangeSet_add(rs, pos, ext)\n\ }\n\ pos = ext\n\ }\n\ \n\ if (RangeSet_defined(rs))\n\ RangeSet_set_color(rs, "green")\n\ }\n\ Joerg Fischer>Rangesets>marks>mark_line:::: {\n\ NEDIT_require_macro_file("jf/marks.nm")\n\ \n\ jf_mark_line(1)\n\ }\n\ Joerg Fischer>Rangesets>marks>unmark_line:::: {\n\ NEDIT_require_macro_file("jf/marks.nm")\n\ \n\ jf_mark_line(-1)\n\ }\n\ Joerg Fischer>Rangesets>marks>next_mark:::: {\n\ NEDIT_require_macro_file("jf/marks.nm")\n\ \n\ jf_next_mark(1)\n\ }\n\ Joerg Fischer>Rangesets>marks>previous_mark:::: {\n\ NEDIT_require_macro_file("jf/marks.nm")\n\ \n\ jf_next_mark(-1)\n\ }\n\ Joerg Fischer>Rangesets>marks>next_mark_choose:::: {\n\ NEDIT_require_macro_file("jf/marks.nm")\n\ \n\ jf_next_mark_choose(1)\n\ }\n\ Joerg Fischer>Rangesets>marks>previous_mark_choose:::: {\n\ NEDIT_require_macro_file("jf/marks.nm")\n\ \n\ jf_next_mark_choose(-1)\n\ }\n\ Joerg Fischer>Rangesets>marks>clear_all_marks:::: {\n\ NEDIT_require_macro_file("jf/marks.nm")\n\ \n\ jf_clear_all_marks()\n\ }\n\ Joerg Fischer>Rangesets>marks>save_as:::: {\n\ NEDIT_require_macro_file("jf/marks.nm")\n\ \n\ jf_marks_save_as()\n\ }\n\ Joerg Fischer>Rangesets>marks>go_back:::: {\n\ NEDIT_require_macro_file("jf/marks.nm")\n\ \n\ goto_mark(9)\n\ }\n\ Joerg Fischer>Macro extraction:::: {\n\ NEDIT_require_macro_file("jf/nxmenu.nm")\n\ \n\ jf_extract_menu(9)\n\ }\n\ Joerg Fischer>Show accelerators:::: {\n\ NEDIT_require_macro_file("jf/nxmenu.nm")\n\ \n\ jf_show_accel(9)\n\ }\n\ xVCard Save::x:: {\n\ process_shift_down()\n\ forward_paragraph("extend")\n\ process_shift_up()\n\ \n\ s = get_selection()\n\ t = replace_in_string(s, "(?n.*\\nFN(?:;[^:]*)?:([^\\n]*).*)", "\\\\1", "regex")\n\ process_down()\n\ \n\ if (t == "") {\n\ t = replace_in_string(s, "(?n.*\\nORG(?:;[^:]*)?:([^\\n]*).*)", "\\\\1", "regex")\n\ if (t == "")\n\ dialog("Found no FN or ORG in\\n\\n" s)\n\ }\n\ \n\ f = replace_in_string(t, "[][~`'\\"!@#$%^*()\\\\{};:?/<>.]", "-", "regex", "copy")\n\ f = replace_in_string(f, "[&]", "+", "regex", "copy")\n\ \n\ r = dialog("title: "t"\\nfile: "f"\\n--------\\n"s"--------\\n", "Skip", "Save")\n\ if (r == 2)\n\ write_file(s, f ".vcf")\n\ }\n\ xVCard Save Loop:::: {\n\ while ($cursor != $text_length) {\n\ process_shift_down()\n\ forward_paragraph("extend")\n\ process_shift_up()\n\ \n\ s = get_selection()\n\ t = replace_in_string(s, "(?n.*\\nFN(?:;[^:]*)?:([^\\n]*).*)", "\\\\1", "regex")\n\ process_down()\n\ \n\ if (t == "") {\n\ t = replace_in_string(s, "(?n.*\\nORG(?:;[^:]*)?:([^\\n]*).*)", "\\\\1", "regex")\n\ if (t == "")\n\ dialog("Found no FN or ORG in\\n\\n" s)\n\ }\n\ \n\ f = replace_in_string(t, "[][~`'\\"!@#$%^*()\\\\{};:?/<>.]", "-", "regex","copy")\n\ f = replace_in_string(f, "[&]", "+", "regex", "copy")\n\ \n\ r = dialog("title: "t"\\nfile: "f"\\n--------\\n"s"--------\\n", \\\n\ "Skip", "Save", "Exit")\n\ if (r == 2)\n\ write_file(s, f ".vcf")\n\ else if (r == 3)\n\ return\n\ }\n\ }\n\ Launch application:::: {\n\ $LaunchApplication[""] = ""\n\ \n\ b = 0\n\ btn[++b] = "OK"\n\ val[b] = ""\n\ \n\ other[0] = get_selection("any")\n\ other[1] = clipboard_to_string()\n\ other_src[0] = "Selection"\n\ other_src[1] = "Clipboard"\n\ \n\ if ("Last" in $LaunchApplication)\n\ other[2] = $LaunchApplication["Last"]\n\ else\n\ other[2] = ""\n\ other_src[2] = "Last"\n\ \n\ extrap = ""\n\ for (i = 0; i < other[]; i++)\n\ {\n\ str = other[i]\n\ src = other_src[i]\n\ strp = ""\n\ if (str != "")\n\ {\n\ strp = replace_in_string(str, "\\n", "; ", "copy")\n\ strp = substring(strp, 0, 40) substring("...", 0, 3 * (length(strp) > 40))\n\ extrap = extrap "\\n" src ": '" strp "'"\n\ btn[++b] = src\n\ val[b] = str\n\ }\n\ }\n\ \n\ prompt = "Enter a command to run in the background\\n" \\\n\ "in directory " $file_path "\\n" \\\n\ extrap\n\ \n\ cmd = ""\n\ if (b == 1)\n\ cmd = string_dialog(prompt, btn[1], "Cancel")\n\ else if (b == 2)\n\ cmd = string_dialog(prompt, btn[1], btn[2], "Cancel")\n\ else if (b == 3)\n\ cmd = string_dialog(prompt, btn[1], btn[2], btn[3], "Cancel")\n\ else if (b == 4)\n\ cmd = string_dialog(prompt, btn[1], btn[2], btn[3], btn[4], "Cancel")\n\ \n\ val[1] = cmd\n\ \n\ b = $string_dialog_button\n\ if ((b in val) && val[b] != "")\n\ {\n\ redirects = " < /dev/null > /dev/null 2>&1;\\n"\n\ $LaunchApplication["Last"] = val[b]\n\ shell_command("exec bash", "( " val[b] " )" redirects)\n\ }\n\ }\n\ Sort lines:::R: {\n\ s = get_selection()\n\ t = split(s, "\\n")\n\ n = t[] - 1 # keep incomplete line at the end\n\ if (n > 1) {\n\ for (i = 0; i < n; i++)\n\ {\n\ l = t[i] "\\n"\n\ a[l] = i\n\ }\n\ u = ""\n\ for (l in a)\n\ {\n\ u = u l\n\ }\n\ u = u t[n]\n\ replace_selection(u)\n\ }\n\ deselect_all()\n\ }\n\ Sudoku>Navigation>Pos@Sudoku hidden:::: {\n\ set_cursor_pos(Sudoku_posToGridPos($cursor))\n\ }\n\ Sudoku>Navigation>Up@Sudoku hidden:::: {\n\ pos = Sudoku_posToGridPos($cursor)\n\ row = Sudoku_posToGridRow(pos)\n\ col = Sudoku_posToGridCol(pos)\n\ if (row == 0)\n\ {\n\ beep()\n\ return\n\ }\n\ pos = Sudoku_gridToPos(row - 1, col)\n\ set_cursor_pos(pos)\n\ }\n\ Sudoku>Navigation>Down@Sudoku hidden:::: {\n\ pos = Sudoku_posToGridPos($cursor)\n\ row = Sudoku_posToGridRow(pos)\n\ col = Sudoku_posToGridCol(pos)\n\ if (row == 8)\n\ {\n\ beep()\n\ return\n\ }\n\ pos = Sudoku_gridToPos(row + 1, col)\n\ set_cursor_pos(pos)\n\ }\n\ Sudoku>Navigation>Left@Sudoku hidden:::: {\n\ pos = Sudoku_posToGridPos($cursor)\n\ row = Sudoku_posToGridRow(pos)\n\ col = Sudoku_posToGridCol(pos)\n\ if (col == 0)\n\ {\n\ beep()\n\ return\n\ }\n\ pos = Sudoku_gridToPos(row, col - 1)\n\ set_cursor_pos(pos)\n\ }\n\ Sudoku>Navigation>Right@Sudoku hidden:::: {\n\ pos = Sudoku_posToGridPos($cursor)\n\ row = Sudoku_posToGridRow(pos)\n\ col = Sudoku_posToGridCol(pos)\n\ if (col == 8)\n\ {\n\ beep()\n\ return\n\ }\n\ pos = Sudoku_gridToPos(row, col + 1)\n\ set_cursor_pos(pos)\n\ }\n\ Sudoku>Basic@Sudoku hidden:::: {\n\ NEDIT_require_macro_file("play/Sudoku.nm")\n\ \n\ if (!$overtype_mode) set_overtype_mode(1)\n\ if ($language_mode != "Sudoku") set_language_mode("Sudoku")\n\ \n\ font = "-misc-fixed-medium-r-*-*-*-200-*-*-c-*-iso8859-1"\n\ set_fonts(font, font, font, font)\n\ \n\ $Sudoku[""] = 0\n\ blank = $Sudoku[""]\n\ \n\ if (!("colors" in $Sudoku))\n\ {\n\ $Sudoku.rs_names = make_arraylist("mask", \\\n\ "full", \\\n\ "init", \\\n\ "digit", \\\n\ "check")\n\ $Sudoku.colors = make_arraylist("dark grey",\\\n\ "light grey",\\\n\ "cyan",\\\n\ "red", \\\n\ "orange")\n\ }\n\ if (!("rs" in $Sudoku))\n\ {\n\ $Sudoku.rs = make_array("mask", 0, \\\n\ "full", 0, \\\n\ "init", 0, \\\n\ "digit", 0, \\\n\ "check", 0)\n\ }\n\ \n\ for (i in $Sudoku.rs_names)\n\ {\n\ rs = $Sudoku.rs_names[i]\n\ if (!rangeset_info($Sudoku.rs[rs]).defined)\n\ {\n\ $Sudoku.rs[rs] = rangeset_create()\n\ rangeset_set_color($Sudoku.rs[rs], $Sudoku.colors[i])\n\ rangeset_set_name($Sudoku.rs[rs], "Sudoku " rs)\n\ }\n\ }\n\ \n\ if (!("excl" in $Sudoku))\n\ {\n\ $Sudoku.excl = 1\n\ $Sudoku.masks = ""\n\ }\n\ if (!("tips" in $Sudoku))\n\ {\n\ $Sudoku.tips = 1\n\ }\n\ }\n\ Sudoku>Grid:::: {\n\ NEDIT_require_macro_file("play/Sudoku.nm")\n\ \n\ btn = dialog("Sudoku: make a new grid in which window?", "New", "Here", "Cancel")\n\ if (btn != 1 && btn != 2)\n\ return\n\ if (btn == 1)\n\ {\n\ new()\n\ focus_window("last")\n\ }\n\ set_overtype_mode(1)\n\ set_language_mode("Sudoku")\n\ set_highlight_syntax(1)\n\ set_incremental_backup(0)\n\ set_incremental_search_line(0)\n\ set_make_backup_copy(0)\n\ set_show_line_numbers(0)\n\ set_show_matching("off")\n\ set_statistics_line(0)\n\ set_use_tabs(0)\n\ set_wrap_text("none")\n\ Sudoku_drawGrid()\n\ }\n\ Sudoku>Load initial numbers:::: {\n\ NEDIT_require_macro_file("play/Sudoku.nm")\n\ \n\ macro_menu_command("Sudoku>Basic@Sudoku hidden")\n\ \n\ for (rs in $Sudoku.rs)\n\ rangeset_subtract($Sudoku.rs[rs], 0, $text_length)\n\ \n\ if (!("init" in $Sudoku))\n\ $Sudoku.init = $empty_array\n\ \n\ if ($Sudoku.init[])\n\ {\n\ btn = dialog("Sudoku: initial numbers already stored\\n" \\\n\ " - leave grid alone?\\n" \\\n\ " - restore grid to original values?\\n" \\\n\ " - record current values as initial?", \\\n\ "Leave", "Restore", "Record")\n\ if (btn < 2)\n\ return\n\ if (btn == 2) # Restore\n\ {\n\ Sudoku_drawGrid($Sudoku.init, $Sudoku.rs.init)\n\ Sudoku_arrayToRS($Sudoku.init, $Sudoku.rs.init, 1)\n\ return\n\ }\n\ }\n\ $Sudoku.init = Sudoku_gridRead(0)\n\ Sudoku_arrayToRS($Sudoku.init, $Sudoku.rs.init, 1)\n\ }\n\ Sudoku>Mask N@Sudoku hidden:::: {\n\ NEDIT_require_macro_file("play/Sudoku.nm")\n\ \n\ macro_menu_command("Sudoku>Basic@Sudoku hidden")\n\ \n\ if ($Sudoku.excl)\n\ $Sudoku.masks = ""\n\ \n\ rangeset_subtract($Sudoku.rs.digit, 0, $text_length)\n\ rangeset_subtract($Sudoku.rs.mask, 0, $text_length)\n\ rangeset_subtract($Sudoku.rs.full, 0, $text_length)\n\ \n\ masks = $Sudoku.masks\n\ if ("maskdigit" in $Sudoku)\n\ {\n\ n = $Sudoku.maskdigit\n\ if (search_string("123456789", n, 0) >= 0 && length(n) == 1)\n\ if (search_string(masks, n, 0) < 0)\n\ masks = masks n\n\ else\n\ masks = replace_in_string(masks, n, "", "copy")\n\ $Sudoku.masks = masks\n\ }\n\ for (i = 0; i < length(masks); i++)\n\ {\n\ d = substring(masks, i, i + 1)\n\ Sudoku_gridToRS($Sudoku.rs.full, 1)\n\ Sudoku_digitMaskToRS(d, $Sudoku.rs.digit, $Sudoku.rs.mask)\n\ }\n\ if ($Sudoku.tips)\n\ {\n\ counts = Sudoku_countGridDigits()\n\ if ($Sudoku.excl)\n\ text = "Currently showing " n "'s mask"\n\ else\n\ text = "Masks for digits in the set {" masks "}"\n\ for (i = 1; i <= 9; i++)\n\ {\n\ n = counts[i]\n\ text = text "\\n [" i "]: " n\n\ if (n == 9)\n\ text = text " (all present)"\n\ else if (n > 9)\n\ text = text " (ERROR: too many)"\n\ }\n\ if (counts[0])\n\ text = text "\\n" counts[0] " cells remaining"\n\ calltip(text, $text_length, "tipText", "strict")\n\ }\n\ }\n\ Sudoku>Mask 1::1:: {\n\ $Sudoku.maskdigit = 1\n\ macro_menu_command("Sudoku>Mask N@Sudoku hidden")\n\ }\n\ Sudoku>Mask 2::2:: {\n\ $Sudoku.maskdigit = 2\n\ macro_menu_command("Sudoku>Mask N@Sudoku hidden")\n\ }\n\ Sudoku>Mask 3::3:: {\n\ $Sudoku.maskdigit = 3\n\ macro_menu_command("Sudoku>Mask N@Sudoku hidden")\n\ }\n\ Sudoku>Mask 4::4:: {\n\ $Sudoku.maskdigit = 4\n\ macro_menu_command("Sudoku>Mask N@Sudoku hidden")\n\ }\n\ Sudoku>Mask 5::5:: {\n\ $Sudoku.maskdigit = 5\n\ macro_menu_command("Sudoku>Mask N@Sudoku hidden")\n\ }\n\ Sudoku>Mask 6::6:: {\n\ $Sudoku.maskdigit = 6\n\ macro_menu_command("Sudoku>Mask N@Sudoku hidden")\n\ }\n\ Sudoku>Mask 7::7:: {\n\ $Sudoku.maskdigit = 7\n\ macro_menu_command("Sudoku>Mask N@Sudoku hidden")\n\ }\n\ Sudoku>Mask 8::8:: {\n\ $Sudoku.maskdigit = 8\n\ macro_menu_command("Sudoku>Mask N@Sudoku hidden")\n\ }\n\ Sudoku>Mask 9::9:: {\n\ $Sudoku.maskdigit = 9\n\ macro_menu_command("Sudoku>Mask N@Sudoku hidden")\n\ }\n\ Sudoku>Single/Multi masks:::: {\n\ NEDIT_require_macro_file("play/Sudoku.nm")\n\ \n\ macro_menu_command("Sudoku>Basic@Sudoku hidden")\n\ \n\ excl = $Sudoku.excl\n\ if (excl)\n\ btn = dialog("Currently only one digit mask is set at a time\\n" \\\n\ "Would you like to accumulate masks?", \\\n\ "Yes", "No")\n\ else\n\ btn = dialog("Currently digit masks are accumulated\\n" \\\n\ "Would you like to show only one digit guide at a time?", \\\n\ "Yes", "No")\n\ \n\ if (btn == 1)\n\ $Sudoku.excl = !excl\n\ }\n\ Sudoku>Help tips:::: {\n\ NEDIT_require_macro_file("play/Sudoku.nm")\n\ \n\ macro_menu_command("Sudoku>Basic@Sudoku hidden")\n\ \n\ $Sudoku.tips = !$Sudoku.tips\n\ }\n\ Sudoku>Clear masks:::: {\n\ NEDIT_require_macro_file("play/Sudoku.nm")\n\ \n\ macro_menu_command("Sudoku>Basic@Sudoku hidden")\n\ \n\ rangeset_subtract($Sudoku.rs.digit, 0, $text_length)\n\ rangeset_subtract($Sudoku.rs.mask, 0, $text_length)\n\ # rangeset_subtract($Sudoku.rs.full, 0, $text_length)\n\ }\n\ Sudoku>Check duplicates:::: {\n\ NEDIT_require_macro_file("play/Sudoku.nm")\n\ \n\ macro_menu_command("Sudoku>Basic@Sudoku hidden")\n\ \n\ rangeset_subtract($Sudoku.rs.check, 0, $text_length)\n\ \n\ for (r = 0; r < 9; r++)\n\ for (c = 0; c < 9; c++)\n\ Sudoku_checkDuplicates(r, c, $Sudoku.rs.check)\n\ }\n\ Sudoku>Cheat:::: {\n\ NEDIT_require_macro_file("play/Sudoku.nm")\n\ \n\ macro_menu_command("Sudoku>Basic@Sudoku hidden")\n\ \n\ Sudoku_analyseGrid()\n\ }\n\ Sudoku>Cheat once:::: {\n\ NEDIT_require_macro_file("play/Sudoku.nm")\n\ \n\ macro_menu_command("Sudoku>Basic@Sudoku hidden")\n\ \n\ rc = Sudoku_analyseGrid(1)\n\ if (rc != "")\n\ set_cursor_pos(Sudoku_gridToPos(substring(rc,0,1),substring(rc,1,2)))\n\ }\n\ Add selection@NEdit Calltip:::: {\n\ s = get_selection("any")\n\ if (s == "")\n\ return\n\ \n\ list_dialog("Insert the following:", s, "As keyword", "As is", "Cancel")\n\ btn = $list_dialog_button\n\ \n\ k = get_selection("any")\n\ if (btn == 1)\n\ {\n\ if (k != "")\n\ k = replace_in_string(k, "(?n^\\\\s*(\\\\S+).*$)", "\\\\1", "regex", "copy")\n\ prompt = "Enter calltip keyword"\n\ if (k != "")\n\ prompt = prompt "(default '" k "')"\n\ prompt = prompt ":"\n\ w = string_dialog(prompt, "OK", "Cancel")\n\ if ($string_dialog_button != 1)\n\ return\n\ if (w == "")\n\ w = k\n\ k = w\n\ }\n\ else if (btn == 2)\n\ {\n\ k = ""\n\ }\n\ else\n\ return\n\ \n\ s = replace_in_string(s, "(?n^\\\\s*(\\\\S|\\\\S.*\\\\S)\\\\s*$)", "\\\\1", "regex", "copy")\n\ s = replace_in_string(s, "\\n(\\\\s*\\n)+", "\\n.\\n", "regex", "copy")\n\ if (k != "")\n\ {\n\ k = replace_in_string(k, "\\n+", " ", "regex", "copy")\n\ k = replace_in_string(k, "^\\\\s*(\\\\S|\\\\S.*\\\\S)\\\\s*$", "\\\\1", "regex", "copy")\n\ k = replace_in_string(k, "\\\\s\\\\s+", " ", "regex", "copy")\n\ }\n\ if (k != "")\n\ s = k "\\n" k "\\n" s\n\ \n\ end_of_file()\n\ insert_string("\\n\\n" s "\\n")\n\ }\n\ PicoBlaze>Call Tree@PicoBlaze Assembler:::: {\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ start_pos = $cursor\n\ label = ""\n\ if ($selection_start >= 0)\n\ {\n\ label = get_selection()\n\ if (search_string(label, "(?n^\\\\w+$)", 0, "regex") != 0)\n\ label = ""\n\ }\n\ else\n\ {\n\ labelpos = search("<\\\\w+", $cursor, "regex", "backward")\n\ labelend = $search_end\n\ if (labelpos <= $cursor && $cursor <= labelend)\n\ label = get_range(labelpos, labelend)\n\ }\n\ prompt = "Enter label"\n\ if (label != "")\n\ prompt = prompt "\\nDefault: " label\n\ s = string_dialog(prompt, "OK", "Cancel")\n\ if ($string_dialog_button != 1)\n\ return\n\ if (s != "")\n\ label = s\n\ if (search_string(label, "(?n^\\\\w+$)", 0, "regex") != 0)\n\ return dialog("Label string '" label "' is invalid")\n\ else\n\ #define PicoBlazeAsm_SearchDeps\n\ {\n\ #label = $1\n\ visited[label] = 0\n\ REl = "\\\\s*\\\\w+\\\\s*:"\n\ REc = "\\\\s*;.*"\n\ REflow = "(?iJUMP\\\\s|CALL\\\\s|RETURNI?(?!\\\\s*N?[CZ]))"\n\ REi = "\\\\s*(?!" REflow ")\\\\w+\\\\s.*"\n\ REskip = "^(?:(?:\\\\s*|"REc"|"REl"\\\\s*|"REl REc"|"REi"|"REl REi")\\n)*" \\\n\ "(?:"REl")?\\\\s*"\n\ REendsub = "(?:RETURN|JUMP)(?!\\\\s*N?[CZ])"\n\ REcalljump = "(?i(?:CALL|JUMP)\\\\s*(?:N?[CZ]\\\\s*,\\\\s*)?)(?=\\\\w+)"\n\ \n\ rsd = "Dependencies"\n\ RangeSet_forget(rsd)\n\ RangeSet_set_color(rsd, "#80FFc0")\n\ rsl = "Labels"\n\ RangeSet_forget(rsl)\n\ RangeSet_set_color(rsl, "#80FFFF")\n\ \n\ while (1)\n\ {\n\ not_all_visited = 0\n\ for (label in visited)\n\ if (visited[label] == 0)\n\ {\n\ not_all_visited = 1\n\ break\n\ }\n\ if (!not_all_visited)\n\ break # no more to visit - all done\n\ defpos = search("^\\\\s*" label "\\\\s*:", 0, "regex")\n\ if (defpos < 0)\n\ {\n\ dialog("Label " label " not found")\n\ delete visited[label]\n\ continue\n\ }\n\ visited[label] = 1\n\ \n\ set_cursor_pos(defpos)\n\ labelpos = search(label, defpos)\n\ labelend = $search_end\n\ RangeSet_add(rsl, labelpos, labelend)\n\ \n\ flow_end_eol = defpos\n\ while (1)\n\ {\n\ # skip all lines until we get to a CALL, JUMP or RETURN\n\ flow_pos = search(REskip, flow_end_eol, "regex")\n\ flow_end = $search_end\n\ RangeSet_add(rsd, flow_pos, flow_end)\n\ if (flow_end == $text_length)\n\ break\n\ \n\ flow_end_bol = start_of_line_pos(flow_end)\n\ flow_end_eol = end_of_line_pos(flow_end)\n\ \n\ RangeSet_add(rsd, flow_pos, flow_end_eol + 1)\n\ \n\ # so we're at a CALL or JUMP: pick up the label\n\ if (search(REcalljump, flow_end, "regex") == flow_end)\n\ {\n\ labelpos = $search_end\n\ search("\\\\w+", labelpos, "regex")\n\ labelend = $search_end\n\ RangeSet_add(rsl, labelpos, labelend)\n\ label = get_range(labelpos, labelend)\n\ if (!(label in visited))\n\ {\n\ set_cursor_pos(labelpos)\n\ visited[label] = 0 # a new label to check\n\ # dialog("New label: " label)\n\ }\n\ }\n\ else if (search("RETURN", flow_end) != flow_end)\n\ {\n\ set_cursor_pos(flow_end)\n\ if (2 == dialog("Bad CALL or JUMP", "Continue", "Quit"))\n\ return\n\ }\n\ \n\ if (search(REendsub, flow_end, "regex") == flow_end)\n\ break\n\ }\n\ }\n\ }\n\ set_cursor_pos(start_pos)\n\ }\n\ PicoBlaze>Assembler@PicoBlaze Assembler:::: {\n\ NEDIT_require_macro_file("play/PicoBlazeAssembler.nm")\n\ \n\ PicoBlaze_assemble()\n\ }\n\ PicoBlaze>Decode OpCode@PicoBlaze Assembler:::: {\n\ NEDIT_require_macro_file("play/PicoBlazeAssembler.nm")\n\ \n\ \n\ prompt = "PicoBlaze Decode OpCode\\n"\n\ \n\ h = string_dialog(prompt "Enter hexadecimal OpCode value")\n\ if (search_string(h, "^[0-9a-fA-F]+$", 0, "regex") != 0)\n\ return dialog(prompt " '" h "'\\nis not a valid hexadecimal OpCode value")\n\ \n\ i = hex_to_int(h)\n\ s = PicoBlaze_decode(i)\n\ \n\ dialog(prompt " '" h "'\\nyields the OpCode\\n " s)\n\ }\n\ PicoBlaze>Disassemble HEX:::: {\n\ NEDIT_require_macro_file("play/PicoBlazeAssembler.nm")\n\ \n\ s = PicoBlaze_disassemble(get_range(0, $text_length))\n\ if (s == "")\n\ return dialog("PicoBlaze: Disassemble HEX\\nFailed")\n\ \n\ new()\n\ focus_window("last")\n\ raise_window()\n\ insert_string(s)\n\ }\n\ PicoBlaze>Simulate>Execute from here@PicoBlaze Assembler:::: {\n\ NEDIT_require_macro_file("play/PicoBlazeAssembler.nm")\n\ \n\ PicoBlaze_interpret_line()\n\ }\n\ PicoBlaze>Simulate>Step@PicoBlaze Assembler:::: {\n\ NEDIT_require_macro_file("play/PicoBlazeAssembler.nm")\n\ \n\ PicoBlaze_interpret_line("pc")\n\ }\n\ PicoBlaze>Simulate>Return@PicoBlaze Assembler:::: {\n\ NEDIT_require_macro_file("play/PicoBlazeAssembler.nm")\n\ \n\ PicoBlaze_interpret_line("return")\n\ }\n\ PicoBlaze>Simulate>Reset@PicoBlaze Assembler:::: {\n\ NEDIT_require_macro_file("play/PicoBlazeAssembler.nm")\n\ \n\ PicoBlaze_interpret_line("reset")\n\ }\n\ PicoBlaze>Simulate>Interrupt@PicoBlaze Assembler:::: {\n\ NEDIT_require_macro_file("play/PicoBlazeAssembler.nm")\n\ \n\ PicoBlaze_interpret_line("interrupt")\n\ }\n\ PicoBlaze>Simulate>Reset All@PicoBlaze Assembler:::: {\n\ NEDIT_require_macro_file("play/PicoBlazeAssembler.nm")\n\ \n\ PicoBlaze_resetstate()\n\ }\n\ PicoBlaze>; Comment@PicoBlaze Assembler:::: {\n\ s = "Comments>; Comment@Semi comments@PicoBlaze Assembler"\n\ \n\ macro_menu_command(s)\n\ }\n\ PicoBlaze>; Uncomment@PicoBlaze Assembler:::: {\n\ s = "Comments>; Uncomment@Semi comments@PicoBlaze Assembler"\n\ \n\ macro_menu_command(s)\n\ }\n\ PicoBlaze>Toggle ; ±debug statement comments@PicoBlaze Assembler:::: {\n\ s = "Comments>Toggle ; ±debug statement comments@PicoBlaze Assembler"\n\ \n\ macro_menu_command(s)\n\ }\n\ PicoBlaze>String Output@PicoBlaze Assembler:::: {\n\ $PicoBlaze_STRINGOUTPUT[""] = 0\n\ \n\ if (!("chars" in $PicoBlaze_STRINGOUTPUT))\n\ {\n\ chars["\\x01"] = "ctrl_SOH"\n\ chars["\\x02"] = "ctrl_STX"\n\ chars["\\x03"] = "ctrl_ETX"\n\ chars["\\x04"] = "ctrl_EOT"\n\ chars["\\x05"] = "ctrl_ENQ"\n\ chars["\\x06"] = "ctrl_ACK"\n\ chars["\\x07"] = "ctrl_BEL"\n\ \n\ chars["\\x08"] = "ctrl_BS"\n\ chars["\\x09"] = "ctrl_HT"\n\ chars["\\x0A"] = "ctrl_NL"\n\ chars["\\x0B"] = "ctrl_VT"\n\ chars["\\x0C"] = "ctrl_NP"\n\ chars["\\x0D"] = "ctrl_CR"\n\ chars["\\x0E"] = "ctrl_SO"\n\ chars["\\x0F"] = "ctrl_SI"\n\ \n\ chars["\\x10"] = "ctrl_DLE"\n\ chars["\\x11"] = "ctrl_DC1"\n\ chars["\\x12"] = "ctrl_DC2"\n\ chars["\\x13"] = "ctrl_DC3"\n\ chars["\\x14"] = "ctrl_DC4"\n\ chars["\\x15"] = "ctrl_NAK"\n\ chars["\\x16"] = "ctrl_SYN"\n\ chars["\\x17"] = "ctrl_ETB"\n\ \n\ chars["\\x18"] = "ctrl_CAN"\n\ chars["\\x19"] = "ctrl_EM"\n\ chars["\\x1A"] = "ctrl_SUB"\n\ chars["\\x1B"] = "ctrl_ESC"\n\ chars["\\x1C"] = "ctrl_FS"\n\ chars["\\x1D"] = "ctrl_GS"\n\ chars["\\x1E"] = "ctrl_RS"\n\ chars["\\x1F"] = "ctrl_US"\n\ \n\ chars["\\x20"] = "ch_space"\n\ chars["\\x21"] = "ch_exclam"\n\ chars["\\x22"] = "ch_dquot"\n\ chars["\\x23"] = "ch_hash"\n\ chars["\\x24"] = "ch_dollar"\n\ chars["\\x25"] = "ch_percent"\n\ chars["\\x26"] = "ch_amp"\n\ chars["\\x27"] = "ch_squot"\n\ chars["\\x28"] = "ch_oparen"\n\ chars["\\x29"] = "ch_cparen"\n\ chars["\\x2A"] = "ch_star"\n\ chars["\\x2B"] = "ch_plus"\n\ chars["\\x2C"] = "ch_comma"\n\ chars["\\x2D"] = "ch_minus"\n\ chars["\\x2E"] = "ch_dot"\n\ chars["\\x2F"] = "ch_slash"\n\ \n\ chars["\\x30"] = "ch_0"\n\ chars["\\x31"] = "ch_1"\n\ chars["\\x32"] = "ch_2"\n\ chars["\\x33"] = "ch_3"\n\ chars["\\x34"] = "ch_4"\n\ chars["\\x35"] = "ch_5"\n\ chars["\\x36"] = "ch_6"\n\ chars["\\x37"] = "ch_7"\n\ \n\ chars["\\x38"] = "ch_8"\n\ chars["\\x39"] = "ch_9"\n\ chars["\\x3A"] = "ch_colon"\n\ chars["\\x3B"] = "ch_semicolon"\n\ chars["\\x3C"] = "ch_less"\n\ chars["\\x3D"] = "ch_equal"\n\ chars["\\x3E"] = "ch_greater"\n\ chars["\\x3F"] = "ch_question"\n\ \n\ chars["\\x40"] = "ch_at"\n\ chars["\\x41"] = "ch_A"\n\ chars["\\x42"] = "ch_B"\n\ chars["\\x43"] = "ch_C"\n\ chars["\\x44"] = "ch_D"\n\ chars["\\x45"] = "ch_E"\n\ chars["\\x46"] = "ch_F"\n\ chars["\\x47"] = "ch_G"\n\ \n\ chars["\\x48"] = "ch_H"\n\ chars["\\x49"] = "ch_I"\n\ chars["\\x4A"] = "ch_J"\n\ chars["\\x4B"] = "ch_K"\n\ chars["\\x4C"] = "ch_L"\n\ chars["\\x4D"] = "ch_M"\n\ chars["\\x4E"] = "ch_N"\n\ chars["\\x4F"] = "ch_O"\n\ \n\ chars["\\x50"] = "ch_P"\n\ chars["\\x51"] = "ch_Q"\n\ chars["\\x52"] = "ch_R"\n\ chars["\\x53"] = "ch_S"\n\ chars["\\x54"] = "ch_T"\n\ chars["\\x55"] = "ch_U"\n\ chars["\\x56"] = "ch_V"\n\ chars["\\x57"] = "ch_W"\n\ \n\ chars["\\x58"] = "ch_X"\n\ chars["\\x59"] = "ch_Y"\n\ chars["\\x5A"] = "ch_Z"\n\ chars["\\x5B"] = "ch_obracket"\n\ chars["\\x5C"] = "ch_backslash"\n\ chars["\\x5D"] = "ch_cbracket"\n\ chars["\\x5E"] = "ch_caret"\n\ chars["\\x5F"] = "ch_under"\n\ \n\ chars["\\x60"] = "ch_grave"\n\ chars["\\x61"] = "ch_a"\n\ chars["\\x62"] = "ch_b"\n\ chars["\\x63"] = "ch_c"\n\ chars["\\x64"] = "ch_d"\n\ chars["\\x65"] = "ch_e"\n\ chars["\\x66"] = "ch_f"\n\ chars["\\x67"] = "ch_g"\n\ \n\ chars["\\x68"] = "ch_h"\n\ chars["\\x69"] = "ch_i"\n\ chars["\\x6A"] = "ch_j"\n\ chars["\\x6B"] = "ch_k"\n\ chars["\\x6C"] = "ch_l"\n\ chars["\\x6D"] = "ch_m"\n\ chars["\\x6E"] = "ch_n"\n\ chars["\\x6F"] = "ch_o"\n\ \n\ chars["\\x70"] = "ch_p"\n\ chars["\\x71"] = "ch_q"\n\ chars["\\x72"] = "ch_r"\n\ chars["\\x73"] = "ch_s"\n\ chars["\\x74"] = "ch_t"\n\ chars["\\x75"] = "ch_u"\n\ chars["\\x76"] = "ch_v"\n\ chars["\\x77"] = "ch_w"\n\ \n\ chars["\\x78"] = "ch_x"\n\ chars["\\x79"] = "ch_y"\n\ chars["\\x7A"] = "ch_z"\n\ chars["\\x7B"] = "ch_obrace"\n\ chars["\\x7C"] = "ch_vbar"\n\ chars["\\x7D"] = "ch_cbrace"\n\ chars["\\x7E"] = "ch_tilde"\n\ chars["\\x7F"] = "ch_DEL"\n\ \n\ $PicoBlaze_STRINGOUTPUT.chars = chars\n\ }\n\ \n\ intro = "PicoBlaze String output\\n"\n\ \n\ list = "\\n"\n\ reg = ""\n\ if ("register" in $PicoBlaze_STRINGOUTPUT)\n\ {\n\ reg = $PicoBlaze_STRINGOUTPUT.register\n\ list = list "register: " reg "\\n"\n\ }\n\ proc = ""\n\ if ("routine" in $PicoBlaze_STRINGOUTPUT)\n\ {\n\ proc = $PicoBlaze_STRINGOUTPUT.routine\n\ list = list "routine: " proc "\\n"\n\ }\n\ if (reg != "" && proc != "")\n\ {\n\ list = list_multisel_dialog(intro "Change which settings", list, "OK")\n\ list = "\\n" list "\\n"\n\ }\n\ if (search_string(list, "\\nregister: ", 0) >= 0)\n\ reg = ""\n\ if (search_string(list, "\\nroutine: ", 0) >= 0)\n\ proc = ""\n\ \n\ while (reg == "")\n\ {\n\ reg = string_dialog(intro "Enter register name")\n\ if (search_string(reg, "(?i^\\\\w+$)", 0, "regex") != 0)\n\ reg = ""\n\ }\n\ while (proc == "")\n\ {\n\ proc = string_dialog(intro "Enter routine name")\n\ if (search_string(proc, "(?i^\\\\w+$)", 0, "regex") != 0)\n\ proc = ""\n\ }\n\ $PicoBlaze_STRINGOUTPUT.register = reg\n\ $PicoBlaze_STRINGOUTPUT.routine = proc\n\ \n\ s = string_dialog(intro "register: " reg "\\nroutine: " proc \\\n\ "\\n\\nEnter string", \\\n\ "OK", "Cancel")\n\ \n\ if ($string_dialog_button != 1)\n\ return\n\ \n\ sp12 = " "\n\ res = sp12 "; send characters of string\\n" sp12 "; '" s "'\\n"\n\ res = res sp12 "; through routine " proc " using register " reg "\\n"\n\ \n\ slen = length(s)\n\ last = ""\n\ for (i = 0; i < slen; i++)\n\ {\n\ c = substring(s, i, i + 1)\n\ if (c != last)\n\ res = res sp12 "LOAD " reg ", " $PicoBlaze_STRINGOUTPUT.chars[c] "\\n"\n\ res = res sp12 "CALL "proc "\\n"\n\ last = c\n\ }\n\ \n\ list_dialog(intro "Results", res, "Clipboard", "File", "Cancel")\n\ if ($list_dialog_button == 1)\n\ string_to_clipboard(res)\n\ else if ($list_dialog_button == 2)\n\ insert_string(res)\n\ }\n\ Fonts>Pick font:::: {\n\ $Fonts[""] = 0\n\ if (!("order" in $Fonts)) {\n\ n = 0\n\ list = ""\n\ \n\ name = "4x6"\n\ f.n = "-misc-fixed-medium-r-*--6-*-*-*-c-*-iso8859-1"\n\ f.i = f.n\n\ f.b = f.n\n\ f.e = f.n\n\ $Fonts[name] = f; order[n++] = name; list = list name "\\n"\n\ \n\ name = "5x7"\n\ f.n = "-misc-fixed-medium-r-*--7-*-*-*-c-*-iso8859-1"\n\ f.i = f.n\n\ f.b = f.n\n\ f.e = f.n\n\ $Fonts[name] = f; order[n++] = name; list = list name "\\n"\n\ \n\ name = "5x8"\n\ f.n = "-misc-fixed-medium-r-*--8-*-*-*-c-*-iso8859-1"\n\ f.i = f.n\n\ f.b = f.n\n\ f.e = f.n\n\ $Fonts[name] = f; order[n++] = name; list = list name "\\n"\n\ \n\ name = "6x9"\n\ f.n = "-misc-fixed-medium-r-*--9-*-*-*-c-*-iso8859-1"\n\ f.i = f.n\n\ f.b = f.n\n\ f.e = f.n\n\ $Fonts[name] = f; order[n++] = name; list = list name "\\n"\n\ \n\ name = "6x10"\n\ f.n = "-misc-fixed-medium-r-*--10-*-*-*-c-*-iso8859-1"\n\ f.i = f.n\n\ f.b = f.n\n\ f.e = f.n\n\ $Fonts[name] = f; order[n++] = name; list = list name "\\n"\n\ \n\ name = "6x12"\n\ f.n = "-misc-fixed-medium-r-*--12-*-*-*-c-*-iso8859-1"\n\ f.i = f.n\n\ f.b = f.n\n\ f.e = f.n\n\ $Fonts[name] = f; order[n++] = name; list = list name "\\n"\n\ \n\ name = "6x13semi"\n\ f.n = "-misc-fixed-medium-r-semicondensed--13-*-*-*-c-*-iso8859-1"\n\ f.i = "-misc-fixed-medium-o-semicondensed--13-*-*-*-c-*-iso8859-1"\n\ f.b = "-misc-fixed-bold-r-semicondensed--13-*-*-*-c-*-iso8859-1"\n\ f.e = "-misc-fixed-bold-r-semicondensed--13-*-*-*-c-*-iso8859-1"\n\ $Fonts[name] = f; order[n++] = name; list = list name "\\n"\n\ \n\ name = "7x13"\n\ f.n = "-misc-fixed-medium-r-normal--13-*-*-*-c-70-iso8859-1"\n\ f.i = "-misc-fixed-medium-o-normal--13-*-*-*-c-70-iso8859-1"\n\ f.b = "-misc-fixed-bold-r-normal--13-*-*-*-c-70-iso8859-1"\n\ f.e = "-misc-fixed-bold-r-normal--13-*-*-*-c-70-iso8859-1"\n\ $Fonts[name] = f; order[n++] = name; list = list name "\\n"\n\ \n\ $Fonts.order = order\n\ $Fonts.list = list\n\ }\n\ \n\ name = ""\n\ while (name == "")\n\ {\n\ name = list_dialog("Choose a font set", $Fonts.list, "OK", "Cancel")\n\ if ($list_dialog_button != 1)\n\ return\n\ }\n\ f = $Fonts[name]\n\ set_fonts(f.n, f.i, f.b, f.e)\n\ }\n\ fix nedit's cc output:::: {\n\ replace_all("(?:", "source/\\\\1.c:", "regex")\n\ }\n nedit.bgMenuCommands: \ Go there@grep -n out:::: {\n\ macro_menu_command("Go there@grep -n out")\n\ }\n\ Go there@CC output:::: {\n\ macro_menu_command("Go there@CC output")\n\ }\n\ Go there@Javac output:::: {\n\ macro_menu_command("Go there@Javac output")\n\ }\n\ Go there@Man page output:::: {\n\ macro_menu_command("Go there@Man page output")\n\ }\n\ Go there@SGML HTML@XML:::: {\n\ macro_menu_command("Go there@SGML HTML@XML")\n\ }\n\ Undo:::: {\n\ undo()\n\ }\n\ Redo:::: {\n\ redo()\n\ }\n\ Cut:::R: {\n\ cut_clipboard()\n\ }\n\ Copy:::R: {\n\ copy_clipboard()\n\ }\n\ Copy as REGEX:::: {\n\ macro_menu_command("Various>Copy as REGEX")\n\ }\n\ Paste:::: {\n\ paste_clipboard()\n\ }\n\ Back:::: {\n\ macro_menu_command("Move>MultiTag>Back")\n\ }\n\ Push:::: {\n\ macro_menu_command("Move>MultiTag>Push")\n\ }\n\ Find forward@*:::R: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ s = get_selection()\n\ c = $cursor\n\ multitags_push_curpos()\n\ find(s, "forward", "literal")\n\ if ($cursor == c)\n\ multitags_pop_curpos_quiet()\n\ }\n\ Find forward@C@C++:::R: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ s = get_selection()\n\ c = $cursor\n\ multitags_push_curpos()\n\ find(s, "forward", "case")\n\ if ($cursor == c)\n\ multitags_pop_curpos_quiet()\n\ }\n\ Find backward@*:::R: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ s = get_selection()\n\ c = $cursor\n\ multitags_push_curpos()\n\ find(s, "backward", "literal")\n\ if ($cursor == c)\n\ multitags_pop_curpos_quiet()\n\ }\n\ Find backward@C@C++:::R: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ s = get_selection()\n\ c = $cursor\n\ multitags_push_curpos()\n\ find(s, "backward", "case")\n\ if ($cursor == c)\n\ multitags_pop_curpos_quiet()\n\ }\n\ Find as REGEX:::: {\n\ macro_menu_command("Various>Find as REGEX")\n\ }\n\ Copy unquoted REGEX:::: {\n\ macro_menu_command("Various>Copy unquoted REGEX@NEdit Macro@NEdit Macro RE")\n\ }\n\ .../...@SGML HTML@XML:::R: {\n\ macro_menu_command("HTML>directive@SGML HTML@XML")\n\ }\n\ ...?...@SGML HTML@XML:::: {\n\ macro_menu_command("HTML>dialog directive@SGML HTML@XML")\n\ }\n\ -a name-@SGML HTML:::: {\n\ macro_menu_command("HTML>-a name-@SGML HTML")\n\ }\n\ -a href-@SGML HTML:::: {\n\ macro_menu_command("HTML>-a href-@SGML HTML")\n\ }\n\ -tt-@SGML HTML:::: {\n\ macro_menu_command("HTML>-tt-@SGML HTML")\n\ }\n\ -i-@SGML HTML:::: {\n\ macro_menu_command("HTML>-i-@SGML HTML")\n\ }\n\ -b-@SGML HTML:::: {\n\ macro_menu_command("HTML>-b-@SGML HTML")\n\ }\n\ -p-@SGML HTML:::: {\n\ macro_menu_command("HTML>-p-@SGML HTML")\n\ }\n\ -strong-@SGML HTML:::: {\n\ macro_menu_command("HTML>-strong-@SGML HTML")\n\ }\n\ -pre-@SGML HTML:::: {\n\ macro_menu_command("HTML>-pre-@SGML HTML")\n\ }\n\ &entities;@SGML HTML@XML:::: {\n\ macro_menu_command("HTML>&entities;@SGML HTML@XML")\n\ }\n\ &entities; (all)@SGML HTML@XML:::: {\n\ macro_menu_command("HTML>&entities; (all)@SGML HTML@XML")\n\ }\n\ MultiTag>Push:::: {\n\ macro_menu_command("Move>MultiTag>Push")\n\ }\n\ MultiTag>Back:::: {\n\ macro_menu_command("Move>MultiTag>Back")\n\ }\n\ MultiTag>Show Stack:::: {\n\ macro_menu_command("Move>MultiTag>Show stack")\n\ }\n\ MultiTag>Find Def@*:::: {\n\ macro_menu_command("Move>MultiTag>Find def@*")\n\ }\n\ MultiTag>Find Def@C@C++:::: {\n\ macro_menu_command("Move>MultiTag>Find def@C@C++")\n\ }\n\ MultiTag>Find ?@*:::: {\n\ macro_menu_command("Move>MultiTag>Find ?@*")\n\ }\n\ MultiTag>Find ?@C@C++:::: {\n\ macro_menu_command("Move>MultiTag>Find ?@C@C++")\n\ }\n\ MultiTag>Reload Tags@*:::: {\n\ macro_menu_command("Move>MultiTag>Reload tags@*")\n\ }\n\ MultiTag>Reload Tags@C@C++:::: {\n\ macro_menu_command("Move>MultiTag>Reload tags@C@C++")\n\ }\n\ MultiTag>Forget Tags:::: {\n\ macro_menu_command("Move>MultiTag>Forget tags")\n\ }\n\ MultiTag>File Symbols:::: {\n\ macro_menu_command("Move>MultiTag>File symbols")\n\ }\n\ MultiTag>Show tags files:::: {\n\ macro_menu_command("Move>MultiTag>Show tags files")\n\ }\n\ MultiTag>Set Stack:::: {\n\ macro_menu_command("Move>MultiTag>Set stack")\n\ }\n\ MultiTag>Empty Stack:::: {\n\ macro_menu_command("Move>MultiTag>Empty stack")\n\ }\n\ Grep>C lines@C@CC output:::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ files = "[a-zA-Z]*.[ch] /dev/null"\n\ if ($selection_start != -1 && $selection_left == -1)\n\ greplines(files)\n\ else\n\ greplines_from_prompt(files)\n\ }\n\ Grep>C files@C@CC output:::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ files = "[a-zA-Z]*.[ch] /dev/null"\n\ if ($selection_start != -1 && $selection_left == -1)\n\ grepfiles(files)\n\ else\n\ grepfiles_from_prompt(files)\n\ }\n\ Grep>C++ lines@C++@CC output:::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ files = "[a-zA-Z]*.[CcHhIi]* /dev/null"\n\ if ($selection_start != -1 && $selection_left == -1)\n\ greplines(files)\n\ else\n\ greplines_from_prompt(files)\n\ }\n\ Grep>C++ files@C++@CC output:::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ files = "[a-zA-Z]*.[CcHhIi]* /dev/null"\n\ if ($selection_start != -1 && $selection_left == -1)\n\ grepfiles(files)\n\ else\n\ grepfiles_from_prompt(files)\n\ }\n\ Grep>all lines:::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ files = "* /dev/null"\n\ if ($selection_start != -1 && $selection_left == -1)\n\ greplines(files)\n\ else\n\ greplines_from_prompt(files)\n\ }\n\ Grep>all lines (-R):::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ grepmatch = "*"\n\ \n\ here = $file_path\n\ if (here == "")\n\ here = "."\n\ \n\ str = get_selection("any")\n\ \n\ dir = string_dialog("grep from which directory?" \\\n\ "\\n- " $NEDIT_START_DIR " : start directory" \\\n\ "\\n- " here " : this directory", \\\n\ "OK", "Start Directory +", "This Directory +", "Cancel")\n\ \n\ if ($string_dialog_button == 2)\n\ dir = NEDIT_remove_dotdot($NEDIT_START_DIR dir)\n\ else if ($string_dialog_button == 4 || $string_dialog_button == 0)\n\ return\n\ else if (dir == "" || $string_dialog_button != 1)\n\ dir = NEDIT_remove_dotdot(here dir)\n\ \n\ greplines_from_prompt_r(str, grepmatch, dir)\n\ }\n\ Grep>C/C++ all lines (-R)@C@C++:::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ grepmatch = "*.[cChH][+pPxX][+pPxX] *.[cChH] *.CC *.cc *.inl *.INL"\n\ \n\ greplines_from_prompt_r("", grepmatch)\n\ }\n\ Grep>C/C++ all lines (-R) from ?@C@C++:::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ str = get_selection("any")\n\ grepmatch = "*.[cChH][+pPxX][+pPxX] *.[cChH] *.CC *.cc *.inl *.INL"\n\ \n\ here = $file_path\n\ if (here == "")\n\ here = "."\n\ \n\ dir = string_dialog("grep from which directory?" \\\n\ "\\n- " $NEDIT_START_DIR " : start directory" \\\n\ "\\n- " here " : this directory", \\\n\ "OK", "Start Directory +", "This Directory +", "Cancel")\n\ \n\ if ($string_dialog_button == 2)\n\ dir = NEDIT_remove_dotdot($NEDIT_START_DIR dir)\n\ else if ($string_dialog_button == 4 || $string_dialog_button == 0)\n\ return\n\ else if (dir == "" || $string_dialog_button != 1)\n\ dir = NEDIT_remove_dotdot(here dir)\n\ \n\ greplines_from_prompt_r(str, grepmatch, dir)\n\ }\n\ Grep>all files:::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ files = "*"\n\ if ($selection_start != -1 && $selection_left == -1)\n\ grepfiles(files)\n\ else\n\ grepfiles_from_prompt(files)\n\ }\n\ Macros>Show Loaded@NEdit Macro@NEdit Macro RE:::: {\n\ NEDIT_show_macro_files()\n\ }\n\ Macros>Reload Selected@NEdit Macro@NEdit Macro RE:::: {\n\ macro_menu_command("NEdit Macro>Reload file")\n\ }\n\ Macros>Reload All@NEdit Macro@NEdit Macro RE:::: {\n\ macro_menu_command("NEdit Macro>Reload all")\n\ }\n\ Macros>Reload this file@NEdit Macro@NEdit Macro RE:::: {\n\ macro_menu_command("NEdit Macro>Reload this file@NEdit Macro")\n\ }\n\ Macros>NEdit Macro@NEdit Macro RE:::: {\n\ macro_menu_command("Language>NEdit Macro@*")\n\ }\n\ Macros>NEdit Macro RE@NEdit Macro:::: {\n\ macro_menu_command("Language>NEdit Macro RE@NEdit Macro")\n\ }\n\ Macros>Make Debug Dialog@NEdit Macro@NEdit Macro RE:::R: {\n\ macro_menu_command("NEdit Macro>Make Debug Dialog@NEdit Macro@NEdit Macro RE")\n\ }\n\ Macros>Make Debug Values Dialog@NEdit Macro@NEdit Macro RE:::: {\n\ macro_menu_command("NEdit Macro>Make Debug Values Dialog@NEdit Macro@NEdit Macro RE")\n\ }\n\ Menu>Toggle:::: {\n\ show_menu()\n\ }\n\ Menu>On:::: {\n\ show_menu("on")\n\ }\n\ Menu>Off:::: {\n\ show_menu("off")\n\ }\n\ Find all:::: {\n\ macro_menu_command("Rangesets>Find>All in \\"Find All\\" (green)")\n\ }\n\ Find all in>"Find All" (green):::: {\n\ macro_menu_command("Rangesets>Find>All in \\"Find All\\" (green)")\n\ }\n\ Find all in>Choose rangeset:::: {\n\ macro_menu_command("Rangesets>Find>All")\n\ }\n\ Find all in>All files:::: {\n\ macro_menu_command("Rangesets>Find>All (all files)")\n\ }\n\ Mark with range:::R: {\n\ macro_menu_command("Rangesets>Mark with range")\n\ }\n\ Mark with TOP range:::R: {\n\ macro_menu_command("Rangesets>Mark with TOP range")\n\ }\n\ Rangeset>Find range:::: {\n\ macro_menu_command("Rangesets>Go to range")\n\ }\n\ Rangeset>Selection>RS + selection:::R: {\n\ macro_menu_command("Rangesets>Mark with range")\n\ }\n\ Rangeset>Selection>RS - selection:::R: {\n\ macro_menu_command("Rangesets>Remove>From set")\n\ }\n\ Rangeset>Selection>Remove from all sets:::R: {\n\ macro_menu_command("Rangesets>Remove>From all sets")\n\ }\n\ Rangeset>RS1 = RS1 + RS2:::: {\n\ macro_menu_command("Rangesets>RS1 =>RS1 + RS2")\n\ }\n\ Rangeset>RS1 = RS1 - RS2:::: {\n\ macro_menu_command("Rangesets>RS1 =>RS1 - RS2")\n\ }\n\ Rangeset>RS1 = RS1 & RS2:::: {\n\ macro_menu_command("Rangesets>RS1 =>RS1 & RS2 (intersect)")\n\ }\n\ Rangeset>RS1 = ~RS1:::: {\n\ macro_menu_command("Rangesets>RS1 =>~RS1")\n\ }\n\ Rangeset>Color Set:::: {\n\ macro_menu_command("Rangesets>Color>Quick")\n\ }\n\ Rangeset>Forget Set:::: {\n\ macro_menu_command("Rangesets>Forget>Set")\n\ }\n\ Make C++ method@C++:::: {\n\ macro_menu_command("Development>Make C++ Method in class.cpp file@C++")\n\ }\n\ tabs>retab all tabs:::: {\n\ macro_menu_command("Edit>ReDeTab>retab all tabs")\n\ }\n\ tabs>detab all tabs:::: {\n\ macro_menu_command("Edit>ReDeTab>detab all tabs")\n\ }\n\ tabs>detab only leading tabs:::: {\n\ macro_menu_command("Edit>ReDeTab>detab only leading tabs")\n\ }\n\ dec oct hex bin etc:::: {\n\ macro_menu_command("Tests>int, bin, oct, hex>int to bin, oct, hex 2")\n\ }\n nedit.highlightPatterns: Ada:Default\n\ Awk:Default\n\ C++:3:0{\n\ Fold comment:"(\\f)\\[\\[\\[(([^\\f]*)\\|\\|\\|)?":"\\]\\]\\]\\f[^\\f]*$"::Dark::\n\ Fold Name:"\\3":""::Fold Comment:Fold comment:C\n\ Fold Start:"\\1":""::Flag:Fold comment:C\n\ trigraph hash:"\\?\\?=":::DiTriGraph::\n\ trigraph backslash:"\\?\\?/":::DiTriGraph::\n\ trigraph caret:"\\?\\?'":::DiTriGraph::\n\ trigraph brackets:"(\\?\\?\\(|\\?\\?\\))":::DiTriGraph::\n\ trigraph braces:"(\\?\\?\\<|\\?\\?\\>)":::DiTriGraph::\n\ trigraph pipe:"\\?\\?!":::DiTriGraph::\n\ trigraph tilde:"\\?\\?-":::DiTriGraph::\n\ comment:"/\\*":"\\*/"::Comment::\n\ comment work:"(?iTODO|YOU ARE HERE)(?:(?!\\s*\\*/).)*":::Comment Work:comment:\n\ cplus comment:"//":"(?":"^\\s*#\\s*(?:endif|else)>"::#if 0 Comment::\n\ end-of-line string start:"L?[""']$":::Flag::\n\ string:"L?""":"""":"\\n":String::\n\ unterminated string:"(?:[^""\\\\]|\\\\[""\\\\])$":::Flag:string:\n\ preprocessor line:"^\\s*(#|%:)\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>":"$"::Preprocessor::\n\ string escape chars:"\\\\(?:[0-7]{1,3}|x[0-9a-fA-F]+|['""?\\\\abfnrtv]|\\n)":::String1:string:\n\ string escape errors:"\\\\.":::Flag:string:\n\ preprocessor esc chars:"\\\\(?:[0-7]{1,3}|x[0-9a-fA-F]+|['""?\\\\abfnrtv]|\\n)":::Preprocessor1:preprocessor line:\n\ preprocessor comment:"/\\*":"\\*/"::Comment:preprocessor line:\n\ preproc comment work:"(?iTODO|(?:YOU ARE HERE))(?:(?!\\s*\\*/).)*":::Comment Work:preprocessor comment:\n\ preproc cplus comment:"//":"$"::Comment:preprocessor line:\n\ preproc cplus comment work:"(?iTODO|(?:YOU ARE HERE)).*":::Comment Work:preproc cplus comment:\n\ preprocessor keywords:"<__(?:(?:LINE|FILE|DATE|TIME|STDC)__)|cplusplus>":::Preprocessor2::\n\ character constant:"L?'":"'":"[^\\\\][^']":Character Const::\n\ character escape chars:"\\\\(?:[0-7]{1,3}|x[0-9a-fA-F]+|['""?\\\\abfnrtv]|\\n)":::String1:character constant:\n\ character escape errors:"\\\\.":::Flag:character constant:\n\ numeric constant:"<(?i(?:0x[\\da-fA-F]+|0[0-7]*|[1-9]\\d*)(?:l|u|lu|ul)|(?:(?:\\d*\\.\\d+|\\d+\\.)(?:e[-+]?\\d+)?[lf]?))(?=\\W|$)":::Numeric Const::D\n\ storage keyword:"<(?:class|typename|template|friend|virtual|inline|explicit|operator|public|private|protected|const|extern|auto|register|static|mutable|unsigned|signed|volatile|char|double|float|int|long|short|bool|wchar_t|void|typedef|struct|union|enum|export)>":::Storage Type::D\n\ extension keyword:"<(?:typeid|asm)>":::Flag::D\n\ goto statement:"(?n<(goto)\\s+(\\w+))":::Keyword::\n\ goto keyword:"\\1":""::Keyword:goto statement:C\n\ goto label:"\\2":""::Label:goto statement:C\n\ label:"(?n(?<=[;{}:])\\s+(?!<(?:public|protected|private|default)>)(\\w+):(?!:))":::Operator::\n\ label word:"\\1":""::Label:label:C\n\ keyword:"<(?:new|delete|this|return|goto|if|else|case|default|switch|break|continue|while|do|for|try|catch|throw|sizeof|true|false|namespace|using|dynamic_cast|static_cast|reinterpret_cast|const_cast)>":::Keyword::D\n\ operator keyword:"<(?:and|bitand|and_eq|or|bitor|or_eq|xor|xor_eq|not|not_eq|compl)>":::Operator::D\n\ digraphs braces:"\\<%|%\\>":::DiTriGraph::D\n\ digraphs brackets:"\\<:|:\\>":::DiTriGraph::D\n\ digraphs hash:"%:":::DiTriGraph::D\n\ braces:"([{}]|\\<%|%\\>)":::Bracket::D\n\ semicolon:";":::Bracket::D\n\ comma:",":::Bracket::D\n\ operators:"(=|:|\\?|==|!=|\\<|\\<=|\\>|\\>=|-|-\\>|\\.|\\+|\\+\\+|-|--|\\*|/|%|\\&|\\&\\&|\\||\\|\\||^|!|~)":::Operator::D\n\ brackets:"([][]|\\<:|:\\>)":::Bracket::D\n\ parens:"[()]":::Bracket::D\n\ assert:"":::Text Key::D\n\ }\n\ C:1:0{\n\ Fold comment:"(\\f)\\[\\[\\[(([^\\f]*)\\|\\|\\|)?":"\\]\\]\\]\\f[^\\f]*$"::Dark::\n\ Fold Name:"\\3":""::Fold Comment:Fold comment:C\n\ Fold Start:"\\1":""::Flag:Fold comment:C\n\ comment:"/\\*":"\\*/"::Comment::\n\ comment work:"(?iTODO|YOU ARE HERE)(?:(?!\\s*\\*/).)*":::Comment Work:comment:\n\ #if 0 comment:"^\\s*#\\s*if\\s+0>":"^\\s*#\\s*(?:endif|else)>"::#if 0 Comment::\n\ C++ line comment:"//":"$"::Comment line::\n\ C++ line comment work:"(?iTODO|YOU ARE HERE).*":::Comment line:C++ line comment:\n\ end-of-line string start:"L?[""']$":::Flag::\n\ string:"L?""":"""":"\\n":String::\n\ unterminated string:"(?:[^""\\\\]|\\\\[""\\\\])$":::Flag:string:\n\ preprocessor line:"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>":"$"::Preprocessor::\n\ string escape chars:"\\\\(?:[0-7]{1,3}|x[0-9a-fA-F]+|['""?\\\\abfnrtv]|\\n)":::String1:string:\n\ string escape errors:"\\\\.":::Flag:string:\n\ preprocessor esc chars:"\\\\(?:[0-7]{1,3}|x[0-9a-fA-F]+|['""?\\\\abfnrtv]|\\n)":::Preprocessor1:preprocessor line:\n\ preprocessor comment:"/\\*":"\\*/"::Comment:preprocessor line:\n\ preprocessor keywords:"<__(?:LINE|FILE|DATE|TIME|STDC)__>":::Preprocessor::\n\ character constant:"L?'":"'":"[^\\\\][^']":Character Const::\n\ character escape chars:"\\\\(?:[0-7]{1,3}|x[0-9a-fA-F]+|['""?\\\\abfnrtv]|\\n)":::String1:character constant:\n\ character escape errors:"\\\\.":::Flag:character constant:\n\ numeric constant:"<(?i(?:0x[\\da-fA-F]+|0[0-7]*|[1-9]\\d*)(?:l|u|lu|ul)|(?:(?:\\d*\\.\\d+|\\d+\\.)(?:e[-+]?\\d+)?[lf]?))(?=\\W|$)":::Numeric Const::D\n\ storage keyword:"<(?:const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum)>":::Storage Type::D\n\ extension keyword:"<(?:class|public|protected|private|typename)>":::Label::D\n\ keyword:"<(?:return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>":::Keyword::D\n\ braces:"[{}]":::Bracket::D\n\ operators:"(=|:|\\?|==|!=|\\<|\\<=|\\>|\\>=|-|-\\>|\\.|\\+|\\+\\+|-|--|\\*|/|%|\\&|\\&\\&|\\||\\|\\||^|!|~)":::Operator::D\n\ parens:"[)(]":::Operator::\n\ brackets:"[][]":::Bracket::\n\ }\n\ CSS:Default\n\ Csh:Default\n\ Fortran:Default\n\ Java:3:0{\n\ README:"Java highlighting patterns for NEdit 5.1. Version 1.5 Author/maintainer: Joachim Lous - jlous at users.sourceforge.net":::Flag::D\n\ Fold comment:"(\\f)\\[\\[\\[(([^\\f]*)\\|\\|\\|)?":"\\]\\]\\]\\f[^\\f]*$"::Dark::\n\ Fold Name:"\\3":""::Fold Comment:Fold comment:C\n\ Fold Start:"\\1":""::Flag:Fold comment:C\n\ doccomment:"/\\*\\*":"\\*/"::Text Comment::\n\ doccomment tag:"@\\l*":::Text Key1:doccomment:\n\ comment:"/\\*":"\\*/"::Comment::\n\ comment work:"(?:TODO|(?:YOU ARE HERE))(?:(?!\\s*\\*/).)*":::Comment Work:comment:\n\ cplus comment:"//":"$"::Comment::\n\ cplus comment work:"(?:TODO|(?:YOU ARE HERE)).*":::Comment Work:cplus comment:\n\ string:"""":"""":"\\n":String::\n\ string escape:"(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr'""\\\\])":::String1:string:\n\ single quoted:"'":"'":"\\n":String::\n\ single quoted escape:"(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr'""\\\\])(?=')":::String1:single quoted:\n\ single quoted char:".(?=')":::String:single quoted:\n\ single quoted error:".":::Flag:single quoted:\n\ hex const:"<(?i0[X][\\dA-F]+)>":::Numeric Const::\n\ long const:"<(?i[\\d]+L)>":::Numeric Const::\n\ decimal const:"(?":";":"\\n":Preprocessor::\n\ package term:"&":"&":"\\n":Keyword:package:C\n\ package package:"(?:\\l\\w+)":::Preprocessor1:package:\n\ package sep:"\\.":::Keyword:package:\n\ package error:"\\S":::Flag:package:\n\ import:"<(?:import)>":";":"\\n":Preprocessor::\n\ import term:"&":"&":"\\n":Keyword:import:C\n\ import package:"(?:\\l\\w+)(?=\\s*\\.)":::Preprocessor1:import:\n\ import class:"(?:\\l\\w+|\\*)(?=\\s*;)":::Storage Type:import:\n\ import sep:"\\.":::Keyword:import:\n\ import error:"\\S":::Flag:import:\n\ classdef:"<(?:class|interface)>\\s*\\n?\\s*([\\l_]\\w*)":::Keyword::\n\ classdef name:"\\1":""::Storage Type:classdef:C\n\ extends:"<(?:extends)>":"(?=(?:|[{;]))"::Keyword::\n\ extends argument:"<[\\l_][\\w\\.]*(?=\\s*(?:/\\*.*\\*/)?(?://.*)?\\n?\\s*(?:[,;{]|))":::Storage Type:extends:\n\ extends comma:",":::Keyword:extends:\n\ extends comment:"/\\*":"\\*/"::Comment:extends:\n\ extends cpluscomment:"//":"$"::Comment:extends:\n\ extends error:"\\S":::Flag:extends:\n\ impl_throw:"<(?:implements|throws)>":"(?=[{;])"::Keyword::\n\ impl_throw argument:"<[\\l_][\\w\\.]*(?=\\s*(?:/\\*.*\\*/)?(?://.*)?\\n?\\s*[,;{])":::Storage Type:impl_throw:\n\ impl_throw comma:",":::Keyword:impl_throw:\n\ impl_throw comment:"/\\*":"\\*/"::Comment:impl_throw:\n\ impl_throw cpluscomment:"//":"$"::Comment:impl_throw:\n\ impl_throw error:"\\S":::Flag:impl_throw:\n\ case default:"\\s*:":::Label::\n\ case:"":":"::Label::\n\ case single quoted:"'\\\\?[^']'":::Character Const:case:\n\ case numeric const:"(?^&|%()]":::Keyword:case:\n\ case error:"\\S":::Flag:case:\n\ label:"([;{}:])":"[\\l_]\\w*\\s*:":"[^\\s\\n]":Label::\n\ label qualifier:"\\1":""::Keyword:label:C\n\ labelref:"<(?:break|continue)>\\s*\\n?\\s*([\\l_]\\w*)?(?=\\s*\\n?\\s*;)":::Keyword::\n\ labelref name:"\\1":""::Label:labelref:C\n\ instanceof:"\\s*\\n?\\s*([\\l_][\\w.]*)":::Keyword::\n\ instanceof class:"\\1":""::Storage Type:instanceof:C\n\ newarray:"new\\s*[\\n\\s]\\s*([\\l_][\\w\\.]*)\\s*\\n?\\s*(?=\\[)":::Keyword::\n\ newarray type:"\\1":""::Storage Type:newarray:C\n\ constructor def:"<(abstract|final|native|private|protected|public|strictfp|static|synchronized)\\s*[\\n|\\s]\\s*[\\l_]\\w*\\s*\\n?\\s*(?=\\()":::Subroutine::\n\ constructor def modifier:"\\1":""::Keyword:constructor def:C\n\ keyword - modifiers:"<(?:abstract|final|native|private|protected|public|strictfp|static|transient|synchronized|volatile)>":::Keyword::\n\ keyword - control flow:"<(?:catch|do|else|finally|for|if|return|switch|throw|try|while)>":::Keyword::\n\ keyword - calc value:"<(?:new|super|this)>":::Keyword::\n\ keyword - literal value:"<(?:false|null|true)>":::Numeric Const::\n\ function def:"<([\\l_][\\w\\.]*)>((?:\\s*\\[\\s*\\])*)\\s*[\\n|\\s]\\s*<[\\l_]\\w*>\\s*\\n?\\s*(?=\\()":::Plain::\n\ function def type:"\\1":""::Storage Type:function def:C\n\ function def type brackets:"\\2":""::Bracket:function def:C\n\ function call:"<[\\l_]\\w*>\\s*\\n?\\s*(?=\\()":::Plain::\n\ cast:"[^\\w\\s]\\s*\\n?\\s*\\(\\s*([\\l_][\\w\\.]*)\\s*\\)":::Keyword::\n\ cast type:"\\1":""::Storage Type:cast:C\n\ declaration:"<[\\l_][\\w\\.]*>((:?\\s*\\[\\s*\\]\\s*)*)(?=\\s*\\n?\\s*(?!instanceof)[\\l_]\\w*)":::Storage Type::\n\ declaration brackets:"\\1":""::Bracket:declaration:C\n\ variable:"<[\\l_]\\w*>":::Identifier1::D\n\ braces and parens:"[(){}[\\]]":::Bracket::D\n\ signs:"[-+*/%=,.;:<>!|&^?~]":::Operator::D\n\ error:"\\S":::Flag::D\n\ }\n\ JavaScript:1:0{\n\ DSComment:"//":"$"::Comment::\n\ MLComment:"/\\*":"\\*/"::Comment::\n\ DQColors:"aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen|#[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]":::Text Arg1:DQStrings:\n\ SQColors:"aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen|(#)[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-F-af0-9]":::Text Arg1:SQStrings:\n\ Events:"<(onAbort|onBlur|onClick|onChange|onDblClick|onDragDrop|onError|onFocus|onKeyDown|onKeyPress|onLoad|onMouseDown|onMouseMove|onMouseOut|onMouseOver|onMouseUp|onMove|onResize|onSelect|onSubmit|onUnload)>":::Keyword::\n\ Braces:"[{}]":::Keyword::\n\ Statements:"<(break|continue|else|for|if|in|new|return|this|typeof|var|while|with)>":::Keyword::\n\ Function:"function[\\t ]+([a-zA-Z0-9_]+)[\\t \\(]+":"[\\n{]"::Keyword::\n\ FunctionName:"\\1":""::Storage Type:Function:C\n\ FunctionArgs:"\\(":"\\)"::Text Arg:Function:\n\ Parentheses:"[()]":::Plain::\n\ BuiltInObjectType:"<(anchor|Applet|Area|Array|button|checkbox|Date|document|elements|FileUpload|form|frame|Function|hidden|history|Image|link|location|Math|navigator|Option|password|Plugin|radio|reset|select|string|submit|text|textarea|window)>":::Storage Type::\n\ SQStrings:"'":"'":"\\n":String::\n\ DQStrings:"""":"""":"\\n":String::\n\ EventCapturing:"captureEvents|releaseEvents|routeEvent|handleEvent":"\\)":"\\n":Keyword::\n\ PredefinedMethods:"<(abs|acos|alert|anchor|asin|atan|atan2|back|big|blink|blur|bold|ceil|charAt|clear|clearTimeout|click|close|confirm|cos|escape|eval|exp|fixed|floor|focus|fontcolor|fontsize|forward|getDate|getDay|getHours|getMinutes|getMonth|getSeconds|getTime|getTimezoneOffset|getYear|go|indexOf|isNaN|italics|javaEnabled|join|lastIndexOf|link|log|max|min|open|parse|parseFloat|parseInt|pow|prompt|random|reload|replace|reset|reverse|round|scroll|select|setDate|setHours|setMinutes|setMonth|setSeconds|setTimeout|setTime|setYear|sin|small|sort|split|sqrt|strike|sub|submit|substring|sup|taint|tan|toGMTString|toLocaleString|toLowerCase|toString|toUpperCase|unescape|untaint|UTC|write|writeln)>":::Keyword::\n\ Properties:"<(action|alinkColor|anchors|appCodeName|appName|appVersion|bgColor|border|checked|complete|cookie|defaultChecked|defaultSelected|defaultStatus|defaultValue|description|E|elements|enabledPlugin|encoding|fgColor|filename|forms|frames|hash|height|host|hostname|href|hspace|index|lastModified|length|linkColor|links|LN2|LN10|LOG2E|LOG10E|lowsrc|method|name|opener|options|parent|pathname|PI|port|protocol|prototype|referrer|search|selected|selectedIndex|self|SQRT1_2|SQRT2|src|status|target|text|title|top|type|URL|userAgent|value|vlinkColor|vspace|width|window)>":::Storage Type::\n\ Operators:"[= ; ->]|[/]|&|\\|":::Preprocessor::\n\ Identifiers:"\\l\\w*":::Plain::\n\ Numeric:"(?":::Identifier::\n\ Built-in Pref Vars:"(?":::Identifier2::\n\ Built-in Special Vars:"(?":::String1::\n\ Built-in Subrs:"<(?:append_file|beep|calltip|clipboard_to_string|dialog|focus_window|get_character|get_pattern_(by_name|at_pos)|get_range|get_selection|get_style_(by_name|at_pos)|getenv|kill_calltip|length|list_dialog|max|min|rangeset_(?:add|create|destroy|get_by_name|includes|info|invert|range|set_color|set_mode|set_name|subtract)|read_file|replace_in_string|replace_range|replace_selection|replace_substring|search|search_string|select|select_rectangle|set_cursor_pos|set_language_mode|set_locked|shell_command|split|string_compare|string_dialog|string_to_clipboard|substring|t_print|tolower|toupper|valid_number|write_file)>":::Subroutine::\n\ Menu Actions:"<(?:new|open|open-dialog|open_dialog|open-selected|open_selected|close|save|save-as|save_as|save-as-dialog|save_as_dialog|revert-to-saved|revert_to_saved|revert_to_saved_dialog|include-file|include_file|include-file-dialog|include_file_dialog|load-macro-file|load_macro_file|load-macro-file-dialog|load_macro_file_dialog|load-tags-file|load_tags_file|load-tags-file-dialog|load_tags_file_dialog|unload_tags_file|load_tips_file|load_tips_file_dialog|unload_tips_file|print|print-selection|print_selection|exit|undo|redo|delete|select-all|select_all|shift-left|shift_left|shift-left-by-tab|shift_left_by_tab|shift-right|shift_right|shift-right-by-tab|shift_right_by_tab|find|find-dialog|find_dialog|find-again|find_again|find-selection|find_selection|find_incremental|start_incremental_find|replace|replace-dialog|replace_dialog|replace-all|replace_all|replace-in-selection|replace_in_selection|replace-again|replace_again|replace_find|replace_find_same|replace_find_again|goto-line-number|goto_line_number|goto-line-number-dialog|goto_line_number_dialog|goto-selected|goto_selected|mark|mark-dialog|mark_dialog|goto-mark|goto_mark|goto-mark-dialog|goto_mark_dialog|match|select_to_matching|goto_matching|find-definition|find_definition|show_tip|split-window|split_window|close-pane|close_pane|uppercase|lowercase|fill-paragraph|fill_paragraph|control-code-dialog|control_code_dialog|filter-selection-dialog|filter_selection_dialog|filter-selection|filter_selection|execute-command|execute_command|execute-command-dialog|execute_command_dialog|execute-command-line|execute_command_line|shell-menu-command|shell_menu_command|macro-menu-command|macro_menu_command|bg_menu_command|post_window_bg_menu|beginning-of-selection|beginning_of_selection|end-of-selection|end_of_selection|repeat_macro|repeat_dialog|raise_window|focus_pane|set_statistics_line|set_incremental_search_line|set_show_line_numbers|set_auto_indent|set_wrap_text|set_wrap_margin|set_highlight_syntax|set_make_backup_copy|set_incremental_backup|set_show_matching|set_match_syntax_based|set_overtype_mode|set_locked|set_tab_dist|set_em_tab_dist|set_use_tabs|set_fonts|set_language_mode)(?=\\s*\\()":::Subroutine::\n\ Text Actions:"<(?:self-insert|self_insert|grab-focus|grab_focus|extend-adjust|extend_adjust|extend-start|extend_start|extend-end|extend_end|secondary-adjust|secondary_adjust|secondary-or-drag-adjust|secondary_or_drag_adjust|secondary-start|secondary_start|secondary-or-drag-start|secondary_or_drag_start|process-bdrag|process_bdrag|move-destination|move_destination|move-to|move_to|move-to-or-end-drag|move_to_or_end_drag|end_drag|copy-to|copy_to|copy-to-or-end-drag|copy_to_or_end_drag|exchange|process-cancel|process_cancel|paste-clipboard|paste_clipboard|copy-clipboard|copy_clipboard|cut-clipboard|cut_clipboard|copy-primary|copy_primary|cut-primary|cut_primary|newline|newline-and-indent|newline_and_indent|newline-no-indent|newline_no_indent|delete-selection|delete_selection|delete-previous-character|delete_previous_character|delete-next-character|delete_next_character|delete-previous-word|delete_previous_word|delete-next-word|delete_next_word|delete-to-start-of-line|delete_to_start_of_line|delete-to-end-of-line|delete_to_end_of_line|forward-character|forward_character|backward-character|backward_character|key-select|key_select|process-up|process_up|process-down|process_down|process-shift-up|process_shift_up|process-shift-down|process_shift_down|process-home|process_home|forward-word|forward_word|backward-word|backward_word|forward-paragraph|forward_paragraph|backward-paragraph|backward_paragraph|beginning-of-line|beginning_of_line|end-of-line|end_of_line|beginning-of-file|beginning_of_file|end-of-file|end_of_file|next-page|next_page|previous-page|previous_page|page-left|page_left|page-right|page_right|toggle-overstrike|toggle_overstrike|scroll-up|scroll_up|scroll-down|scroll_down|scroll_left|scroll_right|scroll-to-line|scroll_to_line|select-all|select_all|deselect-all|deselect_all|focusIn|focusOut|process-return|process_return|process-tab|process_tab|insert-string|insert_string|mouse_pan)>":::Subroutine::\n\ Keyword:"<(?:break|continue|define|delete|else|for|if|in|return|while)>":::Keyword::\n\ Braces:"[{}]":::Bracket::D\n\ ParensBrackets:"[\\[\\]()]":::Bracket::D\n\ Global Variable:"\\$[A-Za-z0-9_]+":::Identifier1::\n\ BadString:"""(?:\\\\.|[^""\\\\])*\\\\?$":::Flag::\n\ String:"""":"""":"\\n":String::\n\ String Escape Char:"\\\\(?:0[0-3][0-7]{1,2}|0[0-7]{1,2}|[xX][0-9a-fA-F]{1,2}|['""?\\\\abefnrtv]|\\n)":::String1:String:\n\ String Escape Undefined:"\\\\.":::Flag:String:\n\ Numeric Const:"(?":::Numeric Const::\n\ Macro Definition:"(?<=define)\\s+\\w+":::Subroutine1::\n\ Custom Macro:"\\w+(?=\\s*(?:\\\\\\n)?\\s*[\\(])":::Subroutine1::\n\ Variables:"\\w+":::Identifier1::D\n\ Operator:"(=|==|!=|\\<|\\<=|\\>|\\>=|-|\\+|\\+\\+|-|--|\\*|/|%|\\&|\\&\\&|\\||\\|\\||\\^|!|~)":::Operator::D\n\ BadPunct:"[,;]+\\s*(?:#(?:(?!\\\\$).)*)?$":::Flag::\n\ Comma:",":::Bracket::D\n\ SemiColon:";":::Bracket::D\n\ Continuation:"\\\\$":::Label::D\n\ Spaces:"\\s":::Plain::D\n\ Unknown:".":::Flag::D\n\ }\n\ NEdit Macro RE:2:0{\n\ README:"NEdit Macro syntax highlighting patterns, version 2.6, maintainer Thorsten Haude, nedit at thorstenhau.de":::Flag::D\n\ Fold comment:"(\\f)\\[\\[\\[(([^\\f]*)\\|\\|\\|)?":"\\]\\]\\]\\f[^\\f]*$"::Dark::\n\ Fold Name:"\\3":""::Fold Comment:Fold comment:C\n\ Fold Start:"\\1":""::Flag:Fold comment:C\n\ Comment Cont:"#()(?=.*\\\\$)":"(\\\\)$"::Comment::\n\ Comment Cont cont:"\\1":"\\1"::Label:Comment Cont:C\n\ Comment:"#":"$"::Comment::\n\ Built-in Misc Vars:"(?":::Identifier::\n\ Built-in Pref Vars:"(?":::Identifier2::\n\ Built-in Special Vars:"(?":::String1::\n\ Built-in Subrs:"<(?:append_file|beep|calltip|clipboard_to_string|dialog|focus_window|get_character|get_pattern_(by_name|at_pos)|get_range|get_selection|get_style_(by_name|at_pos)|getenv|kill_calltip|length|list_dialog|max|min|rangeset_(?:add|create|destroy|get_by_name|includes|info|invert|range|set_color|set_mode|set_name|subtract)|read_file|replace_in_string|replace_range|replace_selection|replace_substring|search|search_string|select|select_rectangle|set_cursor_pos|set_language_mode|set_locked|shell_command|split|string_compare|string_dialog|string_to_clipboard|substring|t_print|tolower|toupper|valid_number|write_file)>":::Subroutine::\n\ Menu Actions:"<(?:new|open|open-dialog|open_dialog|open-selected|open_selected|close|save|save-as|save_as|save-as-dialog|save_as_dialog|revert-to-saved|revert_to_saved|revert_to_saved_dialog|include-file|include_file|include-file-dialog|include_file_dialog|load-macro-file|load_macro_file|load-macro-file-dialog|load_macro_file_dialog|load-tags-file|load_tags_file|load-tags-file-dialog|load_tags_file_dialog|unload_tags_file|load_tips_file|load_tips_file_dialog|unload_tips_file|print|print-selection|print_selection|exit|undo|redo|delete|select-all|select_all|shift-left|shift_left|shift-left-by-tab|shift_left_by_tab|shift-right|shift_right|shift-right-by-tab|shift_right_by_tab|find|find-dialog|find_dialog|find-again|find_again|find-selection|find_selection|find_incremental|start_incremental_find|replace|replace-dialog|replace_dialog|replace-all|replace_all|replace-in-selection|replace_in_selection|replace-again|replace_again|replace_find|replace_find_same|replace_find_again|goto-line-number|goto_line_number|goto-line-number-dialog|goto_line_number_dialog|goto-selected|goto_selected|mark|mark-dialog|mark_dialog|goto-mark|goto_mark|goto-mark-dialog|goto_mark_dialog|match|select_to_matching|goto_matching|find-definition|find_definition|show_tip|split-window|split_window|close-pane|close_pane|uppercase|lowercase|fill-paragraph|fill_paragraph|control-code-dialog|control_code_dialog|filter-selection-dialog|filter_selection_dialog|filter-selection|filter_selection|execute-command|execute_command|execute-command-dialog|execute_command_dialog|execute-command-line|execute_command_line|shell-menu-command|shell_menu_command|macro-menu-command|macro_menu_command|bg_menu_command|post_window_bg_menu|beginning-of-selection|beginning_of_selection|end-of-selection|end_of_selection|repeat_macro|repeat_dialog|raise_window|focus_pane|set_statistics_line|set_incremental_search_line|set_show_line_numbers|set_auto_indent|set_wrap_text|set_wrap_margin|set_highlight_syntax|set_make_backup_copy|set_incremental_backup|set_show_matching|set_match_syntax_based|set_overtype_mode|set_locked|set_tab_dist|set_em_tab_dist|set_use_tabs|set_fonts|set_language_mode)(?=\\s*\\()":::Subroutine::\n\ Text Actions:"<(?:self-insert|self_insert|grab-focus|grab_focus|extend-adjust|extend_adjust|extend-start|extend_start|extend-end|extend_end|secondary-adjust|secondary_adjust|secondary-or-drag-adjust|secondary_or_drag_adjust|secondary-start|secondary_start|secondary-or-drag-start|secondary_or_drag_start|process-bdrag|process_bdrag|move-destination|move_destination|move-to|move_to|move-to-or-end-drag|move_to_or_end_drag|end_drag|copy-to|copy_to|copy-to-or-end-drag|copy_to_or_end_drag|exchange|process-cancel|process_cancel|paste-clipboard|paste_clipboard|copy-clipboard|copy_clipboard|cut-clipboard|cut_clipboard|copy-primary|copy_primary|cut-primary|cut_primary|newline|newline-and-indent|newline_and_indent|newline-no-indent|newline_no_indent|delete-selection|delete_selection|delete-previous-character|delete_previous_character|delete-next-character|delete_next_character|delete-previous-word|delete_previous_word|delete-next-word|delete_next_word|delete-to-start-of-line|delete_to_start_of_line|delete-to-end-of-line|delete_to_end_of_line|forward-character|forward_character|backward-character|backward_character|key-select|key_select|process-up|process_up|process-down|process_down|process-shift-up|process_shift_up|process-shift-down|process_shift_down|process-home|process_home|forward-word|forward_word|backward-word|backward_word|forward-paragraph|forward_paragraph|backward-paragraph|backward_paragraph|beginning-of-line|beginning_of_line|end-of-line|end_of_line|beginning-of-file|beginning_of_file|end-of-file|end_of_file|next-page|next_page|previous-page|previous_page|page-left|page_left|page-right|page_right|toggle-overstrike|toggle_overstrike|scroll-up|scroll_up|scroll-down|scroll_down|scroll_left|scroll_right|scroll-to-line|scroll_to_line|select-all|select_all|deselect-all|deselect_all|focusIn|focusOut|process-return|process_return|process-tab|process_tab|insert-string|insert_string|mouse_pan)>":::Subroutine::\n\ Keyword:"<(?:break|continue|define|delete|else|for|if|in|return|while)>":::Keyword::\n\ Braces:"[{}]":::Bracket::D\n\ ParensBrackets:"[\\[\\]()]":::Bracket::D\n\ Global Variable:"\\$[A-Za-z0-9_]+":::Identifier1::\n\ BadString:"""(?:\\\\.|[^""\\\\])*\\\\?$":::Flag::\n\ String:"""":"""":"\\n":String::\n\ Regex Escaped Operator:"(\\\\\\\\)(?:[][()<>{}.|^$*+?&-]|\\\\\\\\)":::String:String:\n\ Regex Escaped Backslash:"\\1":""::String1:Regex Escaped Operator:C\n\ Regex Character Groups:"\\\\\\\\[dDlLsSwWyY]":::Ada Attributes:String:\n\ Regex References:"\\\\\\\\[1-9]|\\&":::Regex:String:\n\ Regex Subst Modifiers:"\\\\\\\\[uUlL](?=\\\\\\\\[1-9]|\\&)":::Regex:String:\n\ Regex Subst Mod Error:"\\\\\\\\[uU]":::Flag:String:\n\ Regex Comment:"\\(\\?#(?:[^\\\\"")]|\\\\.)*\\)?":::Dark:String:\n\ Regex Parens Incomplete:"\\(\\?(?![:=!IiNn<])|\\(\\?\\<(?![=!])|\\((?="")":::Flag:String:\n\ Regex Parens:"\\(\\?[:=!IiNn]|\\(\\?\\<[=!]|[()]":::Pointer:String:\n\ Regex Bracket Group:"\\[\\^?":"(?+*?{}|.^]":::Text Arg:String:\n\ String Escape Char:"\\\\(?:0[0-3][0-7]{1,2}|0[0-7]{1,2}|[xX][0-9a-fA-F]{1,2}|['""?\\\\abefnrtv]|\\n)":::String1:String:\n\ String Escape Undefined:"\\\\.":::Flag:String:\n\ String Normal:".":::String:String:\n\ Numeric Const:"(?":::Numeric Const::\n\ Macro Definition:"(?<=define)\\s+\\w+":::Subroutine1::\n\ Custom Macro:"\\w+(?=\\s*(?:\\\\\\n)?\\s*[\\(])":::Subroutine1::\n\ Variables:"\\w+":::Identifier1::D\n\ Operator:"(=|==|!=|\\<|\\<=|\\>|\\>=|-|\\+|\\+\\+|-|--|\\*|/|%|\\&|\\&\\&|\\||\\|\\||^|!|~)":::Operator::D\n\ BadPunct:"[,;]+\\s*(?:#(?:(?!\\\\$).)*)?$":::Flag::\n\ Comma:",":::Bracket::D\n\ SemiColon:";":::Bracket::D\n\ Continuation:"\\\\$":::Label::D\n\ Spaces:"\\s":::Plain::D\n\ Unknown:".":::Flag::D\n\ }\n\ Pascal:Default\n\ Perl:Default\n\ PostScript:Default\n\ Python:Default\n\ Regex:1:0{\n\ Comments:"(?#This is a comment!)(?n\\(\\?#[^)]*(?:\\)|$))":::Comment::\n\ Special Escape:"(?#Special chars with that need escapes)\\\\[abefnrtv]":::String2::\n\ Shortcut Char Class Escapes:"(?#Shortcuts for common char classes)\\\\[dDlLsSwW]":::Storage Type::\n\ Word Delimiter:"(?#Special token to match NEdit [non]word-delimiters)\\\\[yY]":::Storage Type::\n\ Required Escape:"(?#metacharacters that require escapes)\\\\[-\\[\\]()<>{}.|^$*+?&\\\\]":::String1::\n\ Backreferences:"(?#Internal regex backreferences)\\\\[1-9]":::String2::\n\ Numeric Escape:"(?#Negative lookahead is to exclude \\x0 and \\00)\\\\(?i(?![x0]0(?:[^\\da-f]|$))(?:x0?[1-9a-f][\\da-f]?|0[1-3]?[0-7]?[0-7]))":::String1::\n\ Literal Escape:"(?#non-special escapes - flag as errors: they don't need escaping)\\\\.":::Flag::\n\ Parens and Alternation:"\\((?:\\?:|\\?=|\\?!|\\?\\<=|\\?\\{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]])(?:-(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]]))?)*\\-?]":::Preprocessor1::\n\ Anchors:"(?#\\B is the ""not a word boundary"" anchor)[$^<>]|\\\\B":::Regex::\n\ Match Themselves:"(?#Highlight chars left over which just match themselves).":::String::D\n\ }\n\ SGML HTML:Default\n\ SQL:1:0{\n\ variables:"@@?[#\\w]+":::Identifier2::D\n\ numbers:"[-+]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][-+]?\\d+)?>":::Numeric Const::D\n\ keywords2:"<(?iFUNCTION|NOTFOUND|OTHERS|EXCEPTION|SHOW|PRAGMA|PACKAGE)>(?!#)":::Flag::D\n\ comment:"--":"$"::Comment::\n\ comment2:"/\\*":"\\*/"::Comment::\n\ string:"'":"'":"\\n":String::\n\ dq string:"""":"""":"\\n":String::\n\ callout:"\\\\\\w+|\\$\\w+|\\$\\{[^}]+\\}|\\[|\\]":::Preprocessor2::\n\ data types:"<(?i(?:VAR)?BINARY>(?:\\s*\\(\\s*\\d+\\s*\\))?|BINARY\\s+VARYING>|(?:VAR)?CHAR>(?:\\s*\\(\\s*\\d+\\s*\\))?|CHARACTER\\s+VARYING>|(?:SMALL)?DATETIME>|DECIMAL>(?:\\(\\s*\\d+\\s*(?:,\\s*\\d+\\s*)\\))?|DEC>|NUMERIC>|FLOAT>(?:\\s*\\(\\s*\\d+\\s*\\))?|REAL>|DOUBLE\\s+PRECISION>|(?:SMALL|TINY)?INT>|INTEGER>|(?:SMALL)?MONEY>|BIT>|TIMESTAMP>|TEXT>|IMAGE>)(?!#)":::Storage Type::\n\ data type arglist:"\\(":"\\)"::Bracket:data types:\n\ data type arg val:"\\d+":::Numeric Const:data type arglist:\n\ std functions:"(?(?=\\s*\\()":::Subroutine::D\n\ sybase functions:"(?(?=\\s*\\()":::Subroutine1::D\n\ microsoft functions:"(?(?=\\s*\\()":::Flag::D\n\ keywords:"<(?iADD|ALL|ALTER|AND|ANY|AS|ASC|AVG|BEGIN|BETWEEN|BREAK|BROWSE|BULK|BY|CASE|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COMMIT|COMPUTE|CONFIRM|CONSTRAINT|CONTINUE|CONTROLROW|CONVERT|COUNT|CREATE|CROSS|CURRENT|CURSOR|DATABASE|DBCC|DEALLOCATE|DECLARE|DEFAULT|DELETE|DESC|DISK|DISTINCT|DOUBLE|DROP|DUMMY|DUMP|ELSE|END|ERRLVL|ERROREXIT|EXCEPT|EXEC|EXECUTE|EXISTS|EXIT|FETCH|FILLFACTOR|FOR|FOREIGN|FROM|FULL|GO|GRANT|GROUP|HAVING|HOLDLOCK|IDENTITY_INSERT|IF|IN|INDEX|INNER|INSERT|INTERSECT|INTO|IS|ISOLATION|JOIN|KEY|KILL|LEFT|LEVEL|LIKE|LINENO|LOAD|MAX|MIN|MIRROREXIT|NOHOLDLOCK|NONCLUSTERED|NOT|NULL|NULLIF|OF|OFF|OFFSETS|ON|ONCE|ONLY|OPEN|OPTION|OR|ORDER|OUT|OUTPUT|OVER|PERM|PERMANENT|PLAN|PRECISION|PREPARE|PRIMARY|PRINT|PROC|PROCEDURE|PROCESSEXIT|PUBLIC|RAISERROR|READ|READTEXT|RECONFIGURE|REFERENCES|RETURN|REVOKE|RIGHT|ROLLBACK|ROWCOUNT|RULE|SAVE|SELECT|SESSION|SET|SETUSER|SHUTDOWN|SOME|STATISTICS|SUM|TABLE|TEMP|TEMPORARY|TEXTSIZE|THEN|TO|TRAN|TRANSACTION|TRIGGER|TRUNCATE|TSEQUAL|UNION|UNIQUE|UPDATE|USE|USER|USER_OPTION|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHERE|WHILE|WITH|WRITETEXT)>(?!#)":::Keyword::D\n\ keywords sybase:"<(?iARITH_OVERFLOW|AT|AUTHORIZATION|CASCADE|CHAR_CONVERT|COALESCE|CONNECT|ENDTRAN|ERRORDATA|ESCAPE|EXCLUSIVE|EXP_ROW_SIZE|EXTERNAL|IDENTITY(?:_GAP|_START)?|INSTALL|JAR|LOCK|MAX_ROWS_PER_PAGE|MEMBERSHIP|MIRROR|MODIFY|NATIONAL|NUMERIC_TRUNCATION|ONLINE|PARTITION|PRIVILEGES|PROXY_TABLE|QUIESCE|READPAST|REMOVE|REORG|REPLACE|REPLICATION|RESERVEPAGEGAP|ROLE|ROWS|SCHEMA|SHARED|STRIPE|SYB_IDENTITY|SYB_RESTREE|UNPARTITION|USING|WORK)>(?!#)":::Storage Type1::D\n\ keywords microsoft:"<(?iCOALESCE|COMMITTED|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|FLOPPY|IDENTITY|IDENTITYCOL|INSENSITIVE|MAX_ROWS_PER_PAGE|MIRROR|PIPE|REPEATABLE|REPLICATION|SCROLL|SERIALIZABLE|SESSION_USER|SYSTEM_USER|TAPE|UNCOMMITTED|UPDATETEXT)>(?!#)":::Comment Special::D\n\ goto label:"<(?iGOTO)\\s+<[a-zA-Z_][#\\w]*>":::Keyword::D\n\ goto label label:"<(?!(?iGOTO))[a-zA-Z_][#\\w]*>":::Label:goto label:D\n\ label:"<[a-zA-Z_][#\\w]*\\s*:":::Label::D\n\ label colon:":":::Keyword:label:D\n\ pseudos:"<(?iINSERTED|DELETED)>(?!#)":::Text Key::D\n\ operators:"(?:(?!:.,])(?:-|\\+|/|%|=|\\<=?|\\>=?|\\<\\>|!=|\\*=|=\\*|\\*|\\.\\.?)(?!\\s*[*/%=<>!:.,]))|(?:\\.\\.?\\*)|(?:(?!:.,]),)":::Operator::D\n\ parens:"[()]":::Bracket::D\n\ unknown function:"(?(?=\\s*\\()":::Regex::D\n\ names:"<[a-zA-Z_][#\\w]*>":::Identifier1::D\n\ errors:"\\S":::Flag::D\n\ pattern comments:"(?# from Transact-SQL by Kevin Kline, Lee Gould, Andrew Zanevsky [c] 1999 O'Reilly & Associates - first edition; updated with keywords from online Transact-SQL User's Guide http://manuals.sybase.com/onlinebooks/group-as/asg1200e/asesqlug/@Generic__BookTextView;pt=59;nh=1 )":::Flag::D\n\ }\n\ SQL markup:1:0{\n\ info:"^ {0,2}\\S.*$":::Plain::\n\ markedup:"'?\\<[-\\w]+\\>'?":::Text Comment::\n\ variables:"@@?[#\\w]+":::Identifier2::D\n\ numbers:"[-+]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][-+]?\\d+)?>":::Numeric Const::D\n\ keywords2:"<(?iFUNCTION|NOTFOUND|OTHERS|EXCEPTION|SHOW|OUT|PRAGMA|PACKAGE)>(?!#)":::Flag::D\n\ comment:"--":"$"::Comment::\n\ comment2:"/\\*":"\\*/"::Comment::\n\ string:"'":"'":"\\n":String::\n\ dq string:"""":"""":"\\n":String::\n\ callout:"\\\\\\w+|\\$\\w+|\\$\\{[^}]+\\}|\\[|\\]":::Ada Attributes::\n\ data types:"<(?i(?:VAR)?BINARY>(?:\\s*\\(\\s*\\d+\\s*\\))?|BINARY\\s+VARYING>|(?:VAR)?CHAR>(?:\\s*\\(\\s*\\d+\\s*\\))?|CHARACTER\\s+VARYING>|(?:SMALL)?DATETIME>|DECIMAL>(?:\\(\\s*\\d+\\s*(?:,\\s*\\d+\\s*)\\))?|DEC>|NUMERIC>|FLOAT>(?:\\s*\\(\\s*\\d+\\s*\\))?|REAL>|DOUBLE\\s+PRECISION>|(?:SMALL|TINY)?INT>|INTEGER>|(?:SMALL)?MONEY>|BIT>|TIMESTAMP>|TEXT>|IMAGE>)(?!#)":::Storage Type::\n\ data type arglist:"\\(":"\\)"::Bracket:data types:\n\ data type arg val:"\\d+":::Numeric Const:data type arglist:\n\ std functions:"(?(?=\\s*\\()":::Subroutine::D\n\ sybase functions:"(?(?=\\s*\\()":::Subroutine1::D\n\ microsoft functions:"(?(?=\\s*\\()":::Flag::D\n\ keywords:"<(?iADD|ALL|ALTER|AND|ANY|AS|ASC|AVG|BEGIN|BETWEEN|BREAK|BROWSE|BULK|BY|CASE|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COMMIT|COMPUTE|CONFIRM|CONSTRAINT|CONTINUE|CONTROLROW|CONVERT|COUNT|CREATE|CROSS|CURRENT|CURSOR|DATABASE|DBCC|DEALLOCATE|DECLARE|DEFAULT|DELETE|DESC|DISK|DISTINCT|DOUBLE|DROP|DUMMY|DUMP|ELSE|END|ERRLVL|ERROREXIT|EXCEPT|EXEC|EXECUTE|EXISTS|EXIT|FETCH|FILLFACTOR|FOR|FOREIGN|FROM|FULL|GO|GRANT|GROUP|HAVING|HOLDLOCK|IDENTITY_INSERT|IF|IN|INDEX|INNER|INSERT|INTERSECT|INTO|IS|ISOLATION|JOIN|KEY|KILL|LEFT|LEVEL|LIKE|LINENO|LOAD|MAX|MIN|MIRROREXIT|NOHOLDLOCK|NONCLUSTERED|NOT|NULL|NULLIF|OF|OFF|OFFSETS|ON|ONCE|ONLY|OPEN|OPTION|OR|ORDER|OUT|OUTPUT|OVER|PERM|PERMANENT|PLAN|PRECISION|PREPARE|PRIMARY|PRINT|PROC|PROCEDURE|PROCESSEXIT|PUBLIC|RAISERROR|READ|READTEXT|RECONFIGURE|REFERENCES|RETURN|REVOKE|RIGHT|ROLLBACK|ROWCOUNT|RULE|SAVE|SELECT|SESSION|SET|SETUSER|SHUTDOWN|SOME|STATISTICS|SUM|TABLE|TEMP|TEMPORARY|TEXTSIZE|THEN|TO|TRAN|TRANSACTION|TRIGGER|TRUNCATE|TSEQUAL|UNION|UNIQUE|UPDATE|USE|USER|USER_OPTION|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHERE|WHILE|WITH|WRITETEXT)>(?!#)":::Keyword::D\n\ keywords sybase:"<(?iARITH_OVERFLOW|AT|AUTHORIZATION|CASCADE|CHAR_CONVERT|COALESCE|CONNECT|ENDTRAN|ERRORDATA|ESCAPE|EXCLUSIVE|EXP_ROW_SIZE|EXTERNAL|IDENTITY(?:_GAP|_START)?|INSTALL|JAR|LOCK|MAX_ROWS_PER_PAGE|MEMBERSHIP|MIRROR|MODIFY|NATIONAL|NUMERIC_TRUNCATION|ONLINE|PARTITION|PRIVILEGES|PROXY_TABLE|QUIESCE|READPAST|REMOVE|REORG|REPLACE|REPLICATION|RESERVEPAGEGAP|ROLE|ROWS|SCHEMA|SHARED|STRIPE|SYB_IDENTITY|SYB_RESTREE|UNPARTITION|USING|WORK)>(?!#)":::Storage Type1::D\n\ keywords microsoft:"<(?iCOALESCE|COMMITTED|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|FLOPPY|IDENTITY|IDENTITYCOL|INSENSITIVE|MAX_ROWS_PER_PAGE|MIRROR|PIPE|REPEATABLE|REPLICATION|SCROLL|SERIALIZABLE|SESSION_USER|SYSTEM_USER|TAPE|UNCOMMITTED|UPDATETEXT)>(?!#)":::Comment Special::D\n\ goto label:"<(?iGOTO)\\s+<[a-zA-Z_][#\\w]*>":::Keyword::D\n\ goto label label:"<(?!(?iGOTO))[a-zA-Z_][#\\w]*>":::Label:goto label:D\n\ label:"<[a-zA-Z_][#\\w]*\\s*:":::Label::D\n\ label colon:":":::Keyword:label:D\n\ pseudos:"<(?iINSERTED|DELETED)>(?!#)":::Text Key::D\n\ operators:"(?:-|\\+|\\*|/|%|=|\\<=?|\\>=?|\\<\\>|!=|\\*=|=\\*|\\.\\.?|,)":::Operator::D\n\ syngroup:"\\(\\(|\\)\\)":::Ada Attributes::D\n\ parens:"[()]":::Bracket::D\n\ unknown function:"(?(?=\\s*\\()":::Regex::D\n\ names:"<[a-zA-Z_][#\\w]*>":::Identifier1::D\n\ braces:"[{}]":::Bracket::D\n\ vbar:"\\|":::Ada Attributes::D\n\ errors:"\\S":::Flag::D\n\ pattern comments:"(?# from Transact-SQL by Kevin Kline, Lee Gould, Andrew Zanevsky [c] 1999 O'Reilly & Associates - first edition; updated with keywords from online Transact-SQL User's Guide http://manuals.sybase.com/onlinebooks/group-as/asg1200e/asesqlug/@Generic__BookTextView;pt=59;nh=1 )":::Flag::D\n\ }\n\ Sh Ksh Bash basic:1:0{\n\ README:"Shell syntax highlighting patterns, version 2.2, maintainer Thorsten Haude, nedit at thorstenhau.de ":::Flag::D\n\ escaped special characters:"\\\\[\\\\""$`']":::Keyword::\n\ single quoted string:"'":"'"::String1::\n\ double quoted string:"""":""""::String::\n\ double quoted escape:"\\\\[\\\\""$`]":::String2:double quoted string:\n\ dq command sub:"`":"`":"""":Subroutine:double quoted string:\n\ dq arithmetic expansion:"\\$\\(\\(":"\\)\\)":"""":String:double quoted string:\n\ dq new command sub:"\\$\\(":"\\)":"""":Subroutine:double quoted string:\n\ dqncs single quoted string:"'":"'"::String1:dq new command sub:\n\ dq variables:"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)":::Identifier1:double quoted string:\n\ dq variables2:"\\$\\{":"}":"\\n":Identifier1:double quoted string:\n\ arithmetic expansion:"\\$\\(\\(":"\\)\\)"::String::\n\ ae escapes:"\\\\[\\\\$`""']":::String2:arithmetic expansion:\n\ ae single quoted string:"'":"'":"\\)\\)":String1:arithmetic expansion:\n\ ae command sub:"`":"`":"\\)\\)":Subroutine:arithmetic expansion:\n\ ae arithmetic expansion:"\\$\\(\\(":"\\)\\)"::String:arithmetic expansion:\n\ ae new command sub:"\\$\\(":"\\)":"\\)\\)":Subroutine:arithmetic expansion:\n\ ae variables:"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)":::Identifier1:arithmetic expansion:\n\ ae variables2:"\\$\\{":"}":"\\)\\)":Identifier1:arithmetic expansion:\n\ comments:"^[ \\t]*#":"$"::Comment::\n\ command substitution:"`":"`"::Subroutine::\n\ cs escapes:"\\\\[\\\\$`""']":::Subroutine1:command substitution:\n\ cs single quoted string:"'":"'":"`":String1:command substitution:\n\ cs variables:"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)":::Identifier1:command substitution:\n\ cs variables2:"\\$\\{":"}":"`":Identifier1:command substitution:\n\ new command substitution:"\\$\\(":"\\)"::Subroutine::\n\ ncs new command substitution:"\\$\\(":"\\)"::Subroutine:new command substitution:\n\ ncs escapes:"\\\\[\\\\$`""']":::Subroutine1:new command substitution:\n\ ncs single quoted string:"'":"'"::String1:new command substitution:\n\ ncs variables:"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)":::Identifier1:new command substitution:\n\ ncs variables2:"\\$\\{":"}":"\\)":Identifier1:new command substitution:\n\ assignment:"[a-zA-Z_][0-9a-zA-Z_]*=":::Identifier1::\n\ variables:"\\$([-*@#?$!0-9_]|[a-zA-Z_][0-9a-zA-Z_]*)":::Identifier1::\n\ variables2:"\\$\\{":"}"::Identifier1::\n\ internal var:"\\$\\{":"}"::Identifier1:variables2:\n\ comments in line:"#":"$"::Comment::\n\ numbers:"<(?i0x[\\da-f]+)|((\\d*\\.)?\\d+([eE][-+]?\\d+)?(?iul?|l|f)?)>":::Numeric Const::D\n\ keywords:"(??]+":::Identifier::\n\ delimiters:"[{};<>&~=!|^%[\\]+*|]":::Text Key::D\n\ built ins:"(?)\\s*\\n((.*\\n)*?)(\\t*\\1)\\s*$":::Text Key::\n\ dq command sub:"`":"`":"""":Subroutine:double quoted string:\n\ dq arithmetic expansion:"\\$\\(\\(":"\\)\\)":"""":String:double quoted string:\n\ dq new command sub:"\\$\\(":"\\)":"""":Subroutine:double quoted string:\n\ dq variables:"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)":::Identifier1:double quoted string:\n\ dq variables2:"\\$\\{":"}":"\\n":Identifier1:double quoted string:\n\ arithmetic expansion:"\\$\\(\\(":"\\)\\)"::String::\n\ ae escapes:"\\\\[\\\\$`""']":::String2:arithmetic expansion:\n\ ae single quoted string:"'":"'":"\\)\\)":String1:arithmetic expansion:\n\ ae command sub:"`":"`":"\\)\\)":Subroutine:arithmetic expansion:\n\ ae arithmetic expansion:"\\$\\(\\(":"\\)\\)"::String:arithmetic expansion:\n\ ae new command sub:"\\$\\(":"\\)":"\\)\\)":Subroutine:arithmetic expansion:\n\ ae variables:"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)":::Identifier1:arithmetic expansion:\n\ ae variables2:"\\$\\{":"}":"\\)\\)":Identifier1:arithmetic expansion:\n\ comments:"^[ \\t]*#":"\\n"::Comment::\n\ case val:"(?<=(?:|;;))\\s*(?:;|\\n(?:^\\s*(?:#.*)?\\n)*)\\s*[^)]*\\)":::Label::\n\ case val comment:"#.*":::Comment:case val:\n\ case val punct:"[|)]":::Operator:case val:\n\ command substitution:"`":"`"::Subroutine::\n\ cs escapes:"\\\\[\\\\$`""']":::Subroutine1:command substitution:\n\ cs single quoted string:"'":"'":"`":String1:command substitution:\n\ cs variables:"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)":::Identifier1:command substitution:\n\ cs variables2:"\\$\\{":"}":"`":Identifier1:command substitution:\n\ new command substitution:"\\$\\(":"\\)"::Subroutine::\n\ ncs escapes:"\\\\[\\\\$`""']":::Subroutine1:new command substitution:\n\ ncs single quoted string:"'":"'"::String1:new command substitution:\n\ ncs variables:"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)":::Identifier1:new command substitution:\n\ ncs variables2:"\\$\\{":"}":"\\)":Identifier1:new command substitution:\n\ assignment:"[a-zA-Z_][0-9a-zA-Z_]*=":::Identifier1::\n\ variables:"\\$([-*@#?$!0-9_]|[a-zA-Z_][0-9a-zA-Z_]*)":::Identifier1::\n\ variables2:"\\$\\{":"}"::Identifier1::\n\ internal var:"\\$\\{":"}"::Identifier1:variables2:\n\ comments in line:"#":"\\n"::Comment::\n\ numbers:"<(?i0x[\\da-f]+)|((\\d*\\.)?\\d+([eE][-+]?\\d+)?(?iul?|l|f)?)>":::Numeric Const::D\n\ keywords:"<(if|fi|then|else|elif|case|esac|while|for|do|done|in|select|time|until|function|\\[\\[|]])>(?=(?:\\s|$))":::Keyword::D\n\ command options:"[ \\t]-[^ \\t{}[\\],()'""~!@#$%^&*|\\\\<>?]+":::Identifier::\n\ delimiters:"[{};<>&~=!|^%[\\]+*|]":::Text Key::D\n\ built ins:"<(:|\\.|source|alias|bg|bind|break|builtin|cd|chdir|command|compgen|complete|continue|declare|dirs|disown|echo|enable|eval|exec|exit|export|fc|fg|getopts|hash|help|history|jobs|kill|let|local|logout|popd|print|printf|pushd|pwd|read|readonly|return|set|shift|shopt|stop|suspend|test|times|trap|type|typeset|ulimit|umask|unalias|unset|wait|whence)>[\\s\\n;]":::Subroutine1::D\n\ is start marker:"\\1":""::Marker:inline stream:C\n\ is end marker:"\\4":""::Marker:inline stream:C\n\ is content:"\\2":""::Inline Text:inline stream:C\n\ }\n\ Tcl:Default\n\ VHDL:Default\n\ Verilog:Default\n\ XML:1:0{\n\ comment:"\\