![]() " \n " end end setClipboardText ( parsed ) end registerAnonymousEventHandler ( "onMouseCopyExample", "onMouseCopyExample" ) ansi2decho ansi2decho(text, default_colour) Converts ANSI colour sequences in text to colour tags that can be processed by the decho() function. symbol end end if l ~= endRow then parsed = parsed. symbol else lastColor = color parsed = parsed. ![]() An example showing implementing a hecho-friendly copy option: addMouseEvent ( "hecho copy", "onMouseCopyExample" ) function rgbToHex ( r, g, b ) local rgb = ( r * 0x10000 ) ( g * 0x100 ) b return string.format ( "#%x", rgb ) end function onMouseCopyExample ( event, menu, window, startCol, startRow, endCol, endRow ) - Check whether there's an actual selection if startCol = endCol and startRow = endRow then return end local parsed = "" local lastColor = nil - Loop through each symbol within the range for l = startRow, endRow do local cStart = l = startRow and startCol or 0 moveCursor ( window, cStart, l ) local cEnd = l = endRow and endCol or # getCurrentLine () - 1 for c = cStart, cEnd do selectSection ( window, c, 1 ) local symbol = getSelection ( window ) or "" - Convert the foreground color to a hex format, suitable for hecho local color = rgbToHex ( getFgColor ( window )) - Don't repeat the color if previous one was the same if color = lastColor then parsed = parsed. They deal mainly with miniconsole/label/gauge creation and manipulation as well as displaying or formatting information on the screen.ĪddCommandLineMenuEvent addCommandLineMenuEvent( label, eventName)Īdds item to right click menu associated with command line. All functions that help you construct custom GUIs. Through the healing power of the Force, this ability allows a Jedi to remove.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |