doing 2.1.117 → 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 +19 -0
- data/Gemfile.lock +1 -1
- data/README.md +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 +17 -8
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid/display.rb +8 -5
- metadata +1 -1
|
@@ -167,10 +167,11 @@ module Doing
|
|
|
167
167
|
line = l.gsub(/%/, '\%').strip.wrap(width, pad: pad, indent: indent, offset: 0, prefix: prefix,
|
|
168
168
|
color: last_color, after: after, reset: reset, pad_first: true)
|
|
169
169
|
line.highlight_tags!(tags_color, last_color: last_color) unless !tags_color || !tags_color.good?
|
|
170
|
-
"#{line} "
|
|
170
|
+
pad.positive? ? line : "#{line} "
|
|
171
171
|
end
|
|
172
172
|
end.join("\n")
|
|
173
|
-
|
|
173
|
+
suffix = pad.positive? ? '' : ' '
|
|
174
|
+
"\n#{last_color}#{mark}#{outstring}#{suffix}"
|
|
174
175
|
else
|
|
175
176
|
out = format("\n%s%s%s%#{pad}s%s", indent, prefix, last_color,
|
|
176
177
|
value.join("\n#{indent}#{prefix}").gsub(/%/, '\%').sub(/\s*$/, ''), after)
|
|
@@ -209,12 +210,14 @@ module Doing
|
|
|
209
210
|
natural = natural_placeholder_width(name, value)
|
|
210
211
|
if width_token == '*'
|
|
211
212
|
if block_placeholder?(name)
|
|
213
|
+
reserved_width += 1
|
|
212
214
|
queues[name] << block_placeholder_width(terminal_width, token)
|
|
213
215
|
else
|
|
216
|
+
reserved_width += visible_literal_width(token['prefix'].to_s)
|
|
214
217
|
stretch_tokens << token
|
|
215
218
|
end
|
|
216
219
|
else
|
|
217
|
-
reserved_width += reserved_placeholder_width(width_token, natural)
|
|
220
|
+
reserved_width += reserved_placeholder_width(name, width_token, natural)
|
|
218
221
|
end
|
|
219
222
|
end
|
|
220
223
|
|
|
@@ -240,7 +243,7 @@ module Doing
|
|
|
240
243
|
end
|
|
241
244
|
|
|
242
245
|
def natural_placeholder_width(name, value)
|
|
243
|
-
#
|
|
246
|
+
# Block placeholders are rendered on their own wrapped lines and should not
|
|
244
247
|
# reserve horizontal width on the title line
|
|
245
248
|
return 0 if block_placeholder?(name)
|
|
246
249
|
return 0 unless value.good?
|
|
@@ -256,13 +259,19 @@ module Doing
|
|
|
256
259
|
normalized.split("\n").map { |line| visible_literal_width(line) }.max || 0
|
|
257
260
|
end
|
|
258
261
|
|
|
259
|
-
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?)
|
|
260
264
|
return natural_width if width_token.nil? || width_token.empty?
|
|
261
265
|
|
|
262
266
|
minimum = width_token.to_i.abs
|
|
263
267
|
[natural_width, minimum].max
|
|
264
268
|
end
|
|
265
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
|
+
|
|
266
275
|
def block_placeholder?(name)
|
|
267
276
|
%w[note idnote odnote].include?(name)
|
|
268
277
|
end
|
|
@@ -296,6 +305,9 @@ module Doing
|
|
|
296
305
|
end
|
|
297
306
|
|
|
298
307
|
def detected_terminal_width
|
|
308
|
+
env_width = ENV['COLUMNS'].to_i
|
|
309
|
+
return env_width if env_width.positive?
|
|
310
|
+
|
|
299
311
|
if $stdout.tty?
|
|
300
312
|
begin
|
|
301
313
|
require 'io/console'
|
|
@@ -310,9 +322,6 @@ module Doing
|
|
|
310
322
|
tty_width = TTY::Screen.columns.to_i
|
|
311
323
|
return tty_width if tty_width.positive?
|
|
312
324
|
|
|
313
|
-
env_width = ENV['COLUMNS'].to_i
|
|
314
|
-
return env_width if env_width.positive?
|
|
315
|
-
|
|
316
325
|
80
|
|
317
326
|
end
|
|
318
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
|