<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"><style type="text/css">body { background: rgba(255, 255, 255, 255); }</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 22.08.2016, at 11:39 , Allan Odgaard <<a href="mailto:mailinglist@textmate.org" class="">mailinglist@textmate.org</a>> wrote:</div><div class=""><div class=""><div style="font-family:sans-serif" class="">
<div style="white-space:normal" class=""><p dir="auto" class="">Yes, you can use these. Though since that only affects the command, if you <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7" class="">exit_discard</code> then you leave the user with a selection, so it might be better to just output an “unchanged” snippet incase you want to abort.</p><p dir="auto" class="">TextMate detects when a command’s output matches what’s already in the document (it does prefix/suffix match) so there should be no visible flash when replacing content with what’s already there</p><div class=""><br class=""></div></div></div></div></div></blockquote><div><br class=""></div>That is the weird thing: My command (running from the Macro):</div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""><br class=""></span></font></div><div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">#!/usr/bin/env ruby18 -wKU<span class="Apple-tab-span" style="white-space:pre"> </span> </span></font></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""><span class="Apple-tab-span" style="white-space:pre"> </span> </span></font></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">require "#{ENV['TM_SUPPORT_PATH']}/lib/escape.rb"</span></font></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""><span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">block = STDIN.read<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""><span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">if block =~ /^\{ [^\s]/<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""> print e_sn("{\n#{block[2..-3]}\n}") </span></font></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">else<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""> print e_sn(block)<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">end<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div class=""><br class=""></div></div><div><div><br class=""></div><div>1. When I replace selected Text, or use "snippet" I get no indentation:</div><div><br class=""></div><div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">function() {<span class="Apple-tab-span" style="white-space: pre;"> </span></span></font></div><div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""> const x = {<span class="Apple-tab-span" style="white-space: pre;"> </span></span></font><span style="background-color: rgb(247, 247, 247); color: rgb(87, 86, 214); font-family: Menlo;" class="">number: 33</span><span style="background-color: rgb(255, 255, 255);" class=""> </span><span style="background-color: rgb(247, 247, 247); color: rgb(87, 86, 214); font-family: Menlo;" class="">} <span class="Apple-tab-span" style="white-space:pre"> </span></span></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">}<span class="Apple-tab-span" style="white-space: pre;"> </span></span></font></div><div class=""><font color="#5756d6" face="Menlo" class=""><br class=""></font></div><div class=""><font color="#5756d6" face="Menlo" class="">-> </font></div><div class=""><font color="#5756d6" face="Menlo" class=""><br class=""></font></div></div></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">function() {<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""> const x = {<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">number: 33<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">} <span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">}<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div><br class=""></div><div><div>2. When I output with insertAsSnippet, I get almost correction indentation </div><div class=""><br class=""></div><div class=""><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">function() {<span class="Apple-tab-span" style="white-space: pre;"> </span></span></font></div><div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""> const x = {<span class="Apple-tab-span" style="white-space: pre;"> </span></span></font><span style="background-color: rgb(247, 247, 247); color: rgb(87, 86, 214); font-family: Menlo;" class="">number: 33</span> <span style="background-color: rgb(247, 247, 247); color: rgb(87, 86, 214); font-family: Menlo;" class="">} <span class="Apple-tab-span" style="white-space: pre;"> </span></span></div><div><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">}<span class="Apple-tab-span" style="white-space: pre;"> </span></span></font></div><div class=""><font color="#5756d6" face="Menlo" class=""><br class=""></font></div><div class=""><font color="#5756d6" face="Menlo" class="">-> </font></div><div class=""><font color="#5756d6" face="Menlo" class=""><br class=""></font></div></div></div><div class=""><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">function() {<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""> const x = {<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""> number: 33<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""> } <span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">}<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div></div><div class=""><br class=""></div><div class="">3. When I output with insertAsSnippet, but just print the block again without changes, I get more indentation than I need…</div><div class=""><br class=""></div><div class=""><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">function() {<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""> const x = {<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""> number: 33<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""> }<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">}<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div></div><div class=""><br class=""></div><div class="">-></div><div class=""><br class=""></div><div class=""><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">function() {<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""> const x = {<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""> number: 33<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class=""> }<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div><div class=""><font color="#5756d6" face="Menlo" class=""><span style="background-color: rgb(247, 247, 247);" class="">}<span class="Apple-tab-span" style="white-space:pre"> </span></span></font></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div></div></div></body></html>