aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-07-14 23:39:16 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2020-07-14 23:51:47 +0200
commite4a60cef0fb2c6eaf4519a29da2167ef9eec6f1c (patch)
tree517c6179e6b8529352c36195d4279f3a7da4b2c3 /wee_slack.py
parentafe461ceaf0536b4d74fd17051f6e06500e2f73d (diff)
downloadwee-slack-e4a60cef0fb2c6eaf4519a29da2167ef9eec6f1c.tar.gz
Remove thread short_name indent if buflist.format.indent checks slack_type
If buflist.format.indent includes "slack_type", assume that it handles the indent for slack threads specifically, so we should not add any indent in the short_name. Otherwise, add a space at the start of short_name so it is indented in the buflist. This means that you can use e.g. this value for buflist.format.indent to get a nice tree view in the buflist, with threads nested under the channels: /set buflist.format.indent "${color:237}${if:${buffer.local_variables.slack_type}==thread?${if:${buffer.next_buffer.local_variables.slack_type}==thread?│ ├─:│ └─}:${if:${buffer.next_buffer.local_variables.type}=~^(channel|private)$?├─:└─}}"
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index a6f7b8d..ac1087d 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2491,7 +2491,10 @@ class SlackThreadChannel(SlackChannelCommon):
if self.label_short_drop_prefix:
return name
else:
- return " ${}".format(name)
+ indent_expr = w.config_string(w.config_get("buflist.format.indent"))
+ # Only indent with space if slack_type isn't mentioned in the indent option
+ indent = "" if "slack_type" in indent_expr else " "
+ return "{}${}".format(indent, name)
elif style == "long_default":
if self.label_full_drop_prefix:
return name