doing 2.1.115 → 2.1.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/docs/doc/Array.html +1 -1
- data/docs/doc/BooleanTermParser/Clause.html +1 -1
- data/docs/doc/BooleanTermParser/Operator.html +1 -1
- data/docs/doc/BooleanTermParser/Query.html +1 -1
- data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
- data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
- data/docs/doc/BooleanTermParser.html +1 -1
- data/docs/doc/Doing/ArrayCleanup.html +1 -1
- data/docs/doc/Doing/ArrayNestedHash.html +1 -1
- data/docs/doc/Doing/ArrayTags.html +1 -1
- data/docs/doc/Doing/ByDayExport.html +1 -1
- data/docs/doc/Doing/CSVExport.html +1 -1
- data/docs/doc/Doing/CalendarImport.html +1 -1
- data/docs/doc/Doing/Change.html +1 -1
- data/docs/doc/Doing/Changes.html +1 -1
- data/docs/doc/Doing/ChronifyArray.html +1 -1
- data/docs/doc/Doing/ChronifyNumeric.html +1 -1
- data/docs/doc/Doing/ChronifyString.html +1 -1
- data/docs/doc/Doing/Color.html +1 -1
- data/docs/doc/Doing/Completion/BashCompletions.html +1 -1
- data/docs/doc/Doing/Completion/FigCompletions.html +1 -1
- data/docs/doc/Doing/Completion/FishCompletions.html +1 -1
- data/docs/doc/Doing/Completion/StringUtils.html +1 -1
- data/docs/doc/Doing/Completion/ZshCompletions.html +1 -1
- data/docs/doc/Doing/Completion.html +1 -1
- data/docs/doc/Doing/Configuration.html +1 -1
- data/docs/doc/Doing/DayOneRenderer.html +1 -1
- data/docs/doc/Doing/DayoneExport.html +1 -1
- data/docs/doc/Doing/DoingExport.html +1 -1
- data/docs/doc/Doing/DoingImport.html +1 -1
- data/docs/doc/Doing/Entry.html +1 -1
- data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
- data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
- data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
- data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
- data/docs/doc/Doing/Errors/HistoryLimitError.html +1 -1
- data/docs/doc/Doing/Errors/InvalidPlugin.html +1 -1
- data/docs/doc/Doing/Errors/MissingBackupFile.html +1 -1
- data/docs/doc/Doing/Errors/NoResults.html +1 -1
- data/docs/doc/Doing/Errors/PluginException.html +1 -1
- data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
- data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
- data/docs/doc/Doing/Errors.html +1 -1
- data/docs/doc/Doing/HTMLExport.html +1 -1
- data/docs/doc/Doing/Hooks.html +1 -1
- data/docs/doc/Doing/Item.html +1 -1
- data/docs/doc/Doing/ItemDates.html +1 -1
- data/docs/doc/Doing/ItemQuery.html +1 -1
- data/docs/doc/Doing/ItemState.html +1 -1
- data/docs/doc/Doing/ItemTags.html +1 -1
- data/docs/doc/Doing/Items.html +1 -1
- data/docs/doc/Doing/JSONExport.html +1 -1
- data/docs/doc/Doing/JSONImport.html +1 -1
- data/docs/doc/Doing/Logger.html +1 -1
- data/docs/doc/Doing/MarkdownExport.html +1 -1
- data/docs/doc/Doing/Note.html +1 -1
- data/docs/doc/Doing/Pager.html +1 -1
- data/docs/doc/Doing/Plugins.html +1 -1
- data/docs/doc/Doing/Prompt.html +1 -1
- data/docs/doc/Doing/PromptChoose.html +1 -1
- data/docs/doc/Doing/PromptFZF.html +1 -1
- data/docs/doc/Doing/PromptInput.html +1 -1
- data/docs/doc/Doing/PromptSTD.html +1 -1
- data/docs/doc/Doing/PromptYN.html +1 -1
- data/docs/doc/Doing/Section.html +1 -1
- data/docs/doc/Doing/StringHighlight.html +1 -1
- data/docs/doc/Doing/StringNormalize.html +1 -1
- data/docs/doc/Doing/StringQuery.html +1 -1
- data/docs/doc/Doing/StringTags.html +1 -1
- data/docs/doc/Doing/StringTransform.html +1 -1
- data/docs/doc/Doing/StringTruncate.html +1 -1
- data/docs/doc/Doing/StringURL.html +1 -1
- data/docs/doc/Doing/SymbolNormalize.html +1 -1
- data/docs/doc/Doing/TaskPaperExport.html +1 -1
- data/docs/doc/Doing/TemplateExport.html +1 -1
- data/docs/doc/Doing/TemplateString.html +1 -1
- data/docs/doc/Doing/TimingImport.html +1 -1
- data/docs/doc/Doing/Types.html +1 -1
- data/docs/doc/Doing/Util/Backup.html +1 -1
- data/docs/doc/Doing/Util.html +1 -1
- data/docs/doc/Doing/Version.html +1 -1
- data/docs/doc/Doing/WWID.html +1 -1
- data/docs/doc/Doing.html +2 -2
- data/docs/doc/FalseClass.html +1 -1
- data/docs/doc/GLI/Commands/Help.html +1 -1
- data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
- data/docs/doc/GLI/Commands.html +1 -1
- data/docs/doc/GLI.html +1 -1
- data/docs/doc/Hash.html +1 -1
- data/docs/doc/Numeric.html +1 -1
- data/docs/doc/Object.html +1 -1
- data/docs/doc/PhraseParser/Operator.html +1 -1
- data/docs/doc/PhraseParser/PhraseClause.html +1 -1
- data/docs/doc/PhraseParser/Query.html +1 -1
- data/docs/doc/PhraseParser/QueryParser.html +1 -1
- data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
- data/docs/doc/PhraseParser/TermClause.html +1 -1
- data/docs/doc/PhraseParser.html +1 -1
- data/docs/doc/Status.html +1 -1
- data/docs/doc/String.html +1 -1
- data/docs/doc/Symbol.html +1 -1
- data/docs/doc/Time.html +1 -1
- data/docs/doc/TrueClass.html +1 -1
- data/docs/doc/_index.html +1 -1
- data/docs/doc/file.README.html +2 -2
- data/docs/doc/index.html +2 -2
- data/docs/doc/top-level-namespace.html +1 -1
- data/doing.rdoc +1 -1
- data/lib/doing/string/transform.rb +16 -2
- data/lib/doing/template_string.rb +19 -9
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid/display.rb +8 -5
- metadata +1 -1
|
@@ -53,6 +53,7 @@ module Doing
|
|
|
53
53
|
note = Regexp.last_match(0)
|
|
54
54
|
''
|
|
55
55
|
end
|
|
56
|
+
after.sub!(/[ \t]+\z/, '') unless note.empty?
|
|
56
57
|
|
|
57
58
|
left_pad = ' ' * offset
|
|
58
59
|
left_pad += indent
|
|
@@ -82,7 +83,20 @@ module Doing
|
|
|
82
83
|
out.push(line.join(' '))
|
|
83
84
|
|
|
84
85
|
last_color = ''
|
|
85
|
-
|
|
86
|
+
if pad_first && pad.positive?
|
|
87
|
+
out.map!.with_index do |l, idx|
|
|
88
|
+
suffix = idx.zero? ? "#{last_color}#{after}" : last_color
|
|
89
|
+
format("%-#{pad}s%s", l, suffix)
|
|
90
|
+
end
|
|
91
|
+
else
|
|
92
|
+
out[0] = format("%-#{pad}s%s%s", out[0], last_color, after)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
suffix = if note.empty?
|
|
96
|
+
pad_first && pad.positive? ? '' : ' '
|
|
97
|
+
else
|
|
98
|
+
" #{note}".chomp
|
|
99
|
+
end
|
|
86
100
|
|
|
87
101
|
out.map.with_index do |l, idx|
|
|
88
102
|
if !pad_first && idx.zero?
|
|
@@ -90,7 +104,7 @@ module Doing
|
|
|
90
104
|
else
|
|
91
105
|
"#{left_pad}#{color}#{prefix}#{l}#{last_color}"
|
|
92
106
|
end
|
|
93
|
-
end.join("\n") +
|
|
107
|
+
end.join("\n") + suffix
|
|
94
108
|
# res.join("\n").strip + last_color + " #{note}".chomp
|
|
95
109
|
end
|
|
96
110
|
|
|
@@ -105,7 +105,8 @@ module Doing
|
|
|
105
105
|
return unless ph
|
|
106
106
|
|
|
107
107
|
placeholder_offset = ph.begin(0)
|
|
108
|
-
|
|
108
|
+
color_offset = parsed_colors[:string].match(rx)&.begin(0) || placeholder_offset
|
|
109
|
+
last_colors = parsed_colors[:colors].select { |v| v[:index] <= color_offset + 4 }
|
|
109
110
|
|
|
110
111
|
last_color = last_colors.map { |v| v[:color] }.pop(3).join('')
|
|
111
112
|
|
|
@@ -166,10 +167,11 @@ module Doing
|
|
|
166
167
|
line = l.gsub(/%/, '\%').strip.wrap(width, pad: pad, indent: indent, offset: 0, prefix: prefix,
|
|
167
168
|
color: last_color, after: after, reset: reset, pad_first: true)
|
|
168
169
|
line.highlight_tags!(tags_color, last_color: last_color) unless !tags_color || !tags_color.good?
|
|
169
|
-
"#{line} "
|
|
170
|
+
pad.positive? ? line : "#{line} "
|
|
170
171
|
end
|
|
171
172
|
end.join("\n")
|
|
172
|
-
|
|
173
|
+
suffix = pad.positive? ? '' : ' '
|
|
174
|
+
"\n#{last_color}#{mark}#{outstring}#{suffix}"
|
|
173
175
|
else
|
|
174
176
|
out = format("\n%s%s%s%#{pad}s%s", indent, prefix, last_color,
|
|
175
177
|
value.join("\n#{indent}#{prefix}").gsub(/%/, '\%').sub(/\s*$/, ''), after)
|
|
@@ -208,12 +210,14 @@ module Doing
|
|
|
208
210
|
natural = natural_placeholder_width(name, value)
|
|
209
211
|
if width_token == '*'
|
|
210
212
|
if block_placeholder?(name)
|
|
213
|
+
reserved_width += 1
|
|
211
214
|
queues[name] << block_placeholder_width(terminal_width, token)
|
|
212
215
|
else
|
|
216
|
+
reserved_width += visible_literal_width(token['prefix'].to_s)
|
|
213
217
|
stretch_tokens << token
|
|
214
218
|
end
|
|
215
219
|
else
|
|
216
|
-
reserved_width += reserved_placeholder_width(width_token, natural)
|
|
220
|
+
reserved_width += reserved_placeholder_width(name, width_token, natural)
|
|
217
221
|
end
|
|
218
222
|
end
|
|
219
223
|
|
|
@@ -239,7 +243,7 @@ module Doing
|
|
|
239
243
|
end
|
|
240
244
|
|
|
241
245
|
def natural_placeholder_width(name, value)
|
|
242
|
-
#
|
|
246
|
+
# Block placeholders are rendered on their own wrapped lines and should not
|
|
243
247
|
# reserve horizontal width on the title line
|
|
244
248
|
return 0 if block_placeholder?(name)
|
|
245
249
|
return 0 unless value.good?
|
|
@@ -255,13 +259,19 @@ module Doing
|
|
|
255
259
|
normalized.split("\n").map { |line| visible_literal_width(line) }.max || 0
|
|
256
260
|
end
|
|
257
261
|
|
|
258
|
-
def reserved_placeholder_width(width_token, natural_width)
|
|
262
|
+
def reserved_placeholder_width(name, width_token, natural_width)
|
|
263
|
+
return implicit_shortdate_width if name == 'shortdate' && (width_token.nil? || width_token.empty?)
|
|
259
264
|
return natural_width if width_token.nil? || width_token.empty?
|
|
260
265
|
|
|
261
266
|
minimum = width_token.to_i.abs
|
|
262
267
|
[natural_width, minimum].max
|
|
263
268
|
end
|
|
264
269
|
|
|
270
|
+
def implicit_shortdate_width
|
|
271
|
+
fmt_string = Doing.setting('shortdate_format.older', '%m/%d/%y %_I:%M%P', exact: true)
|
|
272
|
+
Date.today.strftime(fmt_string).length
|
|
273
|
+
end
|
|
274
|
+
|
|
265
275
|
def block_placeholder?(name)
|
|
266
276
|
%w[note idnote odnote].include?(name)
|
|
267
277
|
end
|
|
@@ -295,6 +305,9 @@ module Doing
|
|
|
295
305
|
end
|
|
296
306
|
|
|
297
307
|
def detected_terminal_width
|
|
308
|
+
env_width = ENV['COLUMNS'].to_i
|
|
309
|
+
return env_width if env_width.positive?
|
|
310
|
+
|
|
298
311
|
if $stdout.tty?
|
|
299
312
|
begin
|
|
300
313
|
require 'io/console'
|
|
@@ -309,9 +322,6 @@ module Doing
|
|
|
309
322
|
tty_width = TTY::Screen.columns.to_i
|
|
310
323
|
return tty_width if tty_width.positive?
|
|
311
324
|
|
|
312
|
-
env_width = ENV['COLUMNS'].to_i
|
|
313
|
-
return env_width if env_width.positive?
|
|
314
|
-
|
|
315
325
|
80
|
|
316
326
|
end
|
|
317
327
|
|
data/lib/doing/version.rb
CHANGED
data/lib/doing/wwid/display.rb
CHANGED
|
@@ -380,18 +380,20 @@ module Doing
|
|
|
380
380
|
placeholders = cfg['placeholders']
|
|
381
381
|
return template unless placeholders.is_a?(Hash)
|
|
382
382
|
|
|
383
|
-
apply_placeholder_widths(template, placeholders)
|
|
383
|
+
apply_placeholder_widths(template, placeholders, cfg['elements'])
|
|
384
384
|
end
|
|
385
385
|
|
|
386
|
-
def apply_placeholder_widths(template, placeholders)
|
|
386
|
+
def apply_placeholder_widths(template, placeholders, elements)
|
|
387
387
|
keys = TEMPLATE_WIDTH_PLACEHOLDERS.map { |k| Regexp.escape(k) }.sort_by(&:length).reverse
|
|
388
388
|
token_rx = /(?<!\\)%(?<width>\*|-?\d+)?(?:\^(?<mchar>.))?(?:(?<ichar>[ _t]|[^a-z0-9])(?<icount>\d+))?(?<prefix>.[ _t]?)?(?<name>#{keys.join('|')})/i
|
|
389
|
+
managed_elements = Array(elements).map(&:to_s)
|
|
389
390
|
|
|
390
391
|
template.gsub(token_rx) do
|
|
391
392
|
m = Regexp.last_match
|
|
392
393
|
name = m['name']
|
|
393
394
|
|
|
394
|
-
width = normalized_placeholder_width(placeholders[name] || placeholders[name.to_sym]
|
|
395
|
+
width = normalized_placeholder_width(placeholders[name] || placeholders[name.to_sym], m['width'],
|
|
396
|
+
managed_elements.include?(name))
|
|
395
397
|
mchar = m['mchar'] ? "^#{m['mchar']}" : ''
|
|
396
398
|
indent = m['ichar'] ? "#{m['ichar']}#{m['icount']}" : ''
|
|
397
399
|
prefix = m['prefix'] || ''
|
|
@@ -400,10 +402,11 @@ module Doing
|
|
|
400
402
|
end
|
|
401
403
|
end
|
|
402
404
|
|
|
403
|
-
def normalized_placeholder_width(config)
|
|
405
|
+
def normalized_placeholder_width(config, existing_width, managed)
|
|
404
406
|
width = config['width'] || config[:width] if config.is_a?(Hash)
|
|
405
407
|
|
|
406
|
-
return '' if width.nil?
|
|
408
|
+
return '' if width.nil? && managed
|
|
409
|
+
return existing_width.to_s if width.nil?
|
|
407
410
|
|
|
408
411
|
case width.to_s
|
|
409
412
|
when /^stretch$/i
|