macro "Lowercase" { start = .GetSelBegin(); num = .GetSelCount(); if (num) { chars = .Get(start, num); for (i = 0; i < count(chars); ++i) if (chars[i] < 'A' || chars[i] > 'Z') continue; else chars[i] = chars[i] | 0x0020; .Remove(); .Insert(start, chars); } } macro "Trim right" { num = .GetSelCount(); if (num) { begin = .GetSelBegin(); end = begin + num - 1; last_sel_line = .GetLine(end); end_offset = .GetColumn(end); last_line = last_sel_line; eol = .Get(end); if (eol != [13, 10] && eol != [10] && eol != [13]) --last_line; removed = 0; for (line = last_line; line >= .GetLine(begin); --line) { .SetCursor(.GetLinePos(line)); .MoveEnd(); while (.GetColumn(.GetCursor())) { .MoveLeft(); chr = .Get(.GetCursor()); if (chr == " " || chr == "\t") { .Remove(1); removed++; } else break; } } SetSelection(begin, num - removed); } } macro "Uppercase" { start = .GetSelBegin(); num = .GetSelCount(); if (num) { chars = .Get(start, num); for (i = 0; i < count(chars); ++i) if (chars[i] < 'a' || chars[i] > 'z') continue; else chars[i] = chars[i] & 0xFFDF; .Remove(); .Insert(start, chars); } }