fatty 0.99.8 → 0.99.8.2

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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +316 -211
  3. data/README.org +94 -0
  4. data/exe/fatty +58 -9
  5. data/exe/themer +273 -0
  6. data/lib/fatty/ansi/renderer.rb +17 -7
  7. data/lib/fatty/api/output.rb +4 -15
  8. data/lib/fatty/api/suspend.rb +9 -0
  9. data/lib/fatty/api.rb +1 -0
  10. data/lib/fatty/callback_environment.rb +1 -0
  11. data/lib/fatty/config_files/themes/capuchin_monk.yml +4 -8
  12. data/lib/fatty/config_files/themes/catppuccin_latte.yml +4 -8
  13. data/lib/fatty/config_files/themes/catppuccin_mocha.yml +4 -8
  14. data/lib/fatty/config_files/themes/cyberpunk.yml +4 -8
  15. data/lib/fatty/config_files/themes/dracula.yml +4 -8
  16. data/lib/fatty/config_files/themes/everforest_dark.yml +4 -8
  17. data/lib/fatty/config_files/themes/gruvbox_dark.yml +4 -8
  18. data/lib/fatty/config_files/themes/gruvbox_light.yml +4 -8
  19. data/lib/fatty/config_files/themes/mono.yml +6 -10
  20. data/lib/fatty/config_files/themes/monokai.yml +4 -8
  21. data/lib/fatty/config_files/themes/nordic.yml +16 -8
  22. data/lib/fatty/config_files/themes/onedark.yml +4 -8
  23. data/lib/fatty/config_files/themes/solarized_dark.yml +4 -8
  24. data/lib/fatty/config_files/themes/solarized_light.yml +4 -8
  25. data/lib/fatty/config_files/themes/terminal.yml +8 -12
  26. data/lib/fatty/config_files/themes/tokyo_night.yml +4 -8
  27. data/lib/fatty/config_files/themes/wordperfect.yml +1 -5
  28. data/lib/fatty/log_formats/json.rb +1 -1
  29. data/lib/fatty/log_formats/text.rb +1 -2
  30. data/lib/fatty/output_buffer.rb +40 -5
  31. data/lib/fatty/renderer/curses.rb +60 -8
  32. data/lib/fatty/renderer/truecolor.rb +46 -10
  33. data/lib/fatty/session/output_session.rb +25 -9
  34. data/lib/fatty/terminal.rb +12 -0
  35. data/lib/fatty/themes/manager.rb +12 -3
  36. data/lib/fatty/themes/resolver.rb +1 -1
  37. data/lib/fatty/version.rb +1 -1
  38. metadata +4 -1
@@ -2,7 +2,11 @@
2
2
 
3
3
  module Fatty
4
4
  class OutputSession < Session
5
- VisibleLine = Data.define(:number, :text) do
5
+ VisibleLine = Data.define(:number, :text, :fragments) do
6
+ def initialize(number:, text:, fragments: [])
7
+ super
8
+ end
9
+
6
10
  def to_s
7
11
  text.to_s
8
12
  end
@@ -55,9 +59,14 @@ module Fatty
55
59
  pager.toggle_paging_mode if pager.mode == :scrolling
56
60
  end
57
61
  before = output.lines.length
62
+ Fatty.debug(
63
+ "output append role=#{payload[:role].inspect} text=#{payload[:text].inspect}",
64
+ tag: :session,
65
+ )
58
66
  append_output(
59
67
  payload.fetch(:text, ""),
60
68
  follow: payload.fetch(:follow, true),
69
+ role: payload[:role],
61
70
  )
62
71
  reveal_appended_block(before) if payload[:scroll]
63
72
  []
@@ -245,17 +254,24 @@ module Fatty
245
254
  def visible_lines
246
255
  @visible_lines ||=
247
256
  if narrowed?
248
- terms = narrow_query.split
249
-
257
+ terms = narrow_query.downcase.split
250
258
  output.lines.each_with_index.filter_map do |text, index|
251
- visible_text = visible_output_text(text)
259
+ visible_text = visible_output_text(text).downcase
252
260
  next unless terms.all? { |term| visible_text.include?(term) }
253
261
 
254
- VisibleLine.new(number: index + 1, text: text)
262
+ VisibleLine.new(
263
+ number: index + 1,
264
+ text: text,
265
+ fragments: output.fragments_for(index),
266
+ )
255
267
  end
256
268
  else
257
269
  output.lines.each_with_index.map do |text, index|
258
- VisibleLine.new(number: index + 1, text: text)
270
+ VisibleLine.new(
271
+ number: index + 1,
272
+ text: text,
273
+ fragments: output.fragments_for(index),
274
+ )
259
275
  end
260
276
  end
261
277
  end
@@ -377,8 +393,8 @@ module Fatty
377
393
  vp
378
394
  end
379
395
 
380
- def append_output(text, follow: true)
381
- ntrim = @output.append(text.to_s)
396
+ def append_output(text, follow: true, role: nil)
397
+ ntrim = @output.append(text.to_s, role: role)
382
398
  invalidate_visible_lines!
383
399
  @pager.on_append(ntrim: ntrim)
384
400
 
@@ -474,7 +490,7 @@ module Fatty
474
490
  end
475
491
 
476
492
  def reset_output!
477
- @output.lines.clear
493
+ @output.clear
478
494
  invalidate_visible_lines!
479
495
  @viewport.reset
480
496
  end
@@ -139,6 +139,18 @@ module Fatty
139
139
  preflight!
140
140
  start_curses!
141
141
  install_default_sessions!
142
+
143
+ if (warning = Fatty::Themes::Manager.warning)
144
+ apply_command(
145
+ Command.session(
146
+ :alert,
147
+ :show,
148
+ role: :warn,
149
+ text: warning,
150
+ ),
151
+ )
152
+ end
153
+
142
154
  Fatty.debug("@sessions: #{@sessions.map(&:id).join('==')}")
143
155
 
144
156
  @running = true
@@ -3,8 +3,14 @@
3
3
  module Fatty
4
4
  module Themes
5
5
  module Manager
6
+ attr_reader :warning
7
+
6
8
  FALLBACK_THEME = :terminal
7
9
 
10
+ def self.warning
11
+ @warning
12
+ end
13
+
8
14
  def self.registry
9
15
  @registry ||=
10
16
  begin
@@ -16,6 +22,7 @@ module Fatty
16
22
  end
17
23
 
18
24
  def self.load!
25
+ @warning = nil
19
26
  registry.clear
20
27
  Loader.load_dir(Fatty::Config.user_themes_dir, registry: registry)
21
28
  Loader.load_dir(Fatty::Config.app_themes_dir, registry: registry) if Fatty::Config.app_themes_dir
@@ -30,10 +37,9 @@ module Fatty
30
37
  return @current if @current
31
38
 
32
39
  theme = Fatty::Config.config[:theme]
33
-
34
40
  @current =
35
41
  if theme && !theme.to_s.strip.empty?
36
- theme.to_sym
42
+ set(theme)
37
43
  else
38
44
  FALLBACK_THEME
39
45
  end
@@ -43,10 +49,13 @@ module Fatty
43
49
  return current unless theme
44
50
 
45
51
  t = theme.to_sym
52
+
46
53
  if theme_names.include?(t)
54
+ @warning = nil
47
55
  @current = t
48
56
  else
49
- Fatty.warn("Unknown theme: #{theme}, falling back to #{FALLBACK_THEME}", tag: :theme)
57
+ @warning = "Unknown theme in config: '#{theme}'; using '#{FALLBACK_THEME}'"
58
+ Fatty.warn(@warning, tag: :theme)
50
59
  @current = FALLBACK_THEME
51
60
  end
52
61
  end
@@ -74,7 +74,7 @@ module Fatty
74
74
  info: :output,
75
75
  good: :info,
76
76
  warn: :info,
77
- error: :warn,
77
+ error: :info,
78
78
 
79
79
  pager_status: :status,
80
80
  line_number: :output,
data/lib/fatty/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fatty
4
- VERSION = "0.99.8"
4
+ VERSION = "0.99.8.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fatty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.8
4
+ version: 0.99.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel E. Doherty
@@ -128,6 +128,7 @@ email:
128
128
  - ded@ddoherty.net
129
129
  executables:
130
130
  - fatty
131
+ - themer
131
132
  extensions: []
132
133
  extra_rdoc_files: []
133
134
  files:
@@ -136,6 +137,7 @@ files:
136
137
  - README.md
137
138
  - README.org
138
139
  - exe/fatty
140
+ - exe/themer
139
141
  - help/help.md
140
142
  - lib/fatty.rb
141
143
  - lib/fatty/action.rb
@@ -154,6 +156,7 @@ files:
154
156
  - lib/fatty/api/progress.rb
155
157
  - lib/fatty/api/prompt.rb
156
158
  - lib/fatty/api/status.rb
159
+ - lib/fatty/api/suspend.rb
157
160
  - lib/fatty/callback_environment.rb
158
161
  - lib/fatty/colors.rb
159
162
  - lib/fatty/colors/color.rb