<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body><div style="font-family: sans-serif;"><div class="markdown" style="white-space: normal;">
<p dir="auto">On 16 Jul 2022, at 14:44, David Wainberg wrote:</p>
</div><div class="plaintext" style="white-space: normal;"><blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777;"><p dir="auto">One thing I want to fix is the format of the information behind a counter dropdown. The documentation of the format syntax is pretty sparse - <a href="https://manual.mailmate-app.com/format_string_syntax.html" style="color: #777777;">https://manual.mailmate-app.com/format_string_syntax.html</a> - and I'm having trouble figuring it out.</p>
</blockquote></div>
<div class="markdown" style="white-space: normal;">
<p dir="auto">Very understandable.</p>
</div><div class="plaintext" style="white-space: normal;"><blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777;"><p dir="auto">Specifically, what I want to do at the moment is to shorten and fix the length of the subject display, since by default it is variable, and some email subjects are quite long. The size and positioning of the dropdown adjusts accordingly, which I find undesirable.</p>
</blockquote></div>
<div class="markdown" style="white-space: normal;">
<p dir="auto">That could be something like this (using regular expressions):</p>
<pre style="margin-left: 15px; margin-right: 15px; padding: 5px; background-color: #F7F7F7; border-radius: 5px 5px 5px 5px; overflow-x: auto; max-width: 90vw;"><code style="margin: 0 0; border-radius: 3px; background-color: #F7F7F7; padding: 0px;">${subject/(.{,10})(.+)?/$1(?2:…)/}
</code></pre>
<p dir="auto">That looks pretty menacing, but it's the same syntax as provided by some text editors when doing search/replace. The MailMate syntax is identical to the one used by TextMate. That means the documentation found <a href="https://macromates.com/manual/en/regular_expressions#conditional_insertions" style="color: #3983C4;">here</a> is also useful for MailMate (and the example is more advanced than the one provided here).</p>
<p dir="auto">To elaborate, this is the format string variant used above:</p>
<pre style="margin-left: 15px; margin-right: 15px; padding: 5px; background-color: #F7F7F7; border-radius: 5px 5px 5px 5px; overflow-x: auto; max-width: 90vw;"><code style="margin: 0 0; border-radius: 3px; background-color: #F7F7F7; padding: 0px;">${«var»/«regexp»/«format»/«options»}
</code></pre>
<p dir="auto">The <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">var</code> is <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">subject</code>, but this could be any email header (or a subpart of a header).</p>
<p dir="auto">The <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">regexp</code> is:</p>
<pre style="margin-left: 15px; margin-right: 15px; padding: 5px; background-color: #F7F7F7; border-radius: 5px 5px 5px 5px; overflow-x: auto; max-width: 90vw;"><code style="margin: 0 0; border-radius: 3px; background-color: #F7F7F7; padding: 0px;">(.{,10})(.+)?
</code></pre>
<p dir="auto">It matches 10 characters and then the rest in 2 different capture variables.</p>
<p dir="auto">The <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">format</code> used is then:</p>
<pre style="margin-left: 15px; margin-right: 15px; padding: 5px; background-color: #F7F7F7; border-radius: 5px 5px 5px 5px; overflow-x: auto; max-width: 90vw;"><code style="margin: 0 0; border-radius: 3px; background-color: #F7F7F7; padding: 0px;">$1(?2:…)
</code></pre>
<p dir="auto">Which simply uses the (up to) 10 characters in the first capture and then adds the ellipsis if and only if the second capture contains anything.</p>
</div><div class="plaintext" style="white-space: normal;"><blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777;"><p dir="auto">Even if that's not doable, I'd like to play with the format.</p>
<p dir="auto">I've searched the list and haven't found anything. Can anyone point me to more docs or examples I can crib from?</p>
</blockquote></div>
<div class="markdown" style="white-space: normal;">
<p dir="auto">The above isn't much, but maybe it'll help a bit.</p>
<p dir="auto">--<br>
Benny</p>
</div>
</div>
</body>
</html>