fatty 0.99.12.0 → 0.99.12.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.
- checksums.yaml +4 -4
- data/CHANGELOG.org +10 -0
- data/README.md +238 -226
- data/README.org +20 -5
- data/lib/fatty/ansi/windows_console.rb +26 -0
- data/lib/fatty/curses/context.rb +10 -5
- data/lib/fatty/curses/curses_coder.rb +1 -1
- data/lib/fatty/terminal.rb +7 -5
- data/lib/fatty/version.rb +1 -1
- metadata +16 -10
data/README.org
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
# gem_docs:version begin
|
|
16
|
-
Version: 0.99.12.
|
|
16
|
+
Version: 0.99.12.2
|
|
17
17
|
# gem_docs:version end
|
|
18
18
|
|
|
19
19
|
#+TOC: headlines 4
|
|
@@ -2300,10 +2300,9 @@ error:
|
|
|
2300
2300
|
All demo commands have been tested on Windows 11 with RubyInstaller 3.4.
|
|
2301
2301
|
Compared with Linux, the following differences apply:
|
|
2302
2302
|
|
|
2303
|
-
- Windows
|
|
2304
|
-
handing the terminal to external commands and interactive
|
|
2305
|
-
|
|
2306
|
-
https://github.com/ddoherty03/curses/tree/preserve-screen-suspension
|
|
2303
|
+
- Windows uses the automatically installed =fatty-curses= dependency for
|
|
2304
|
+
temporarily handing the terminal to external commands and interactive
|
|
2305
|
+
programs.
|
|
2307
2306
|
|
|
2308
2307
|
- Mouse input is unavailable with the Windows curses build tested.
|
|
2309
2308
|
|
|
@@ -2321,3 +2320,19 @@ Compared with Linux, the following differences apply:
|
|
|
2321
2320
|
|
|
2322
2321
|
- Exiting Fatty does not restore a saved copy of the screen that was
|
|
2323
2322
|
visible before startup.
|
|
2323
|
+
|
|
2324
|
+
** Curses dependency
|
|
2325
|
+
Fatty depends on =fatty-curses=, our fork of ruby/curses with the
|
|
2326
|
+
=Curses.endwin= API needed for temporary terminal suspension. RubyGems
|
|
2327
|
+
installs it automatically with Fatty or a Byr release that requires
|
|
2328
|
+
Fatty 0.99.12.1 or later. No separate curses installation or Git checkout
|
|
2329
|
+
is needed.
|
|
2330
|
+
|
|
2331
|
+
Windows requires RubyInstaller with DevKit to build the bundled PDCursesMod
|
|
2332
|
+
extension. Unix systems need their usual curses development libraries.
|
|
2333
|
+
The fork keeps the =Curses= Ruby API; applications can explicitly load it
|
|
2334
|
+
with =require "fatty-curses"=. Stock =curses= may remain installed for other
|
|
2335
|
+
applications, but should not be loaded alongside the fork in one process.
|
|
2336
|
+
|
|
2337
|
+
Source and upstream patch information:
|
|
2338
|
+
https://github.com/ddoherty03/fatty-curses
|
|
@@ -24,6 +24,32 @@ module Fatty
|
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
# External programs need ordinary processed output, wrapping and ANSI.
|
|
28
|
+
# PDCurses can leave these disabled even after endwin. Configure both
|
|
29
|
+
# streams for the whole child command, then restore before curses resumes.
|
|
30
|
+
def self.with_shell_output
|
|
31
|
+
return yield unless Gem.win_platform?
|
|
32
|
+
|
|
33
|
+
api = functions
|
|
34
|
+
saved = []
|
|
35
|
+
buffer = [0].pack("L")
|
|
36
|
+
begin
|
|
37
|
+
[-11, -12].each do |stream|
|
|
38
|
+
handle = api[:handle].call(stream)
|
|
39
|
+
next if saved.any? { |entry| entry.first == handle }
|
|
40
|
+
|
|
41
|
+
next if api[:get].call(handle, buffer).zero?
|
|
42
|
+
|
|
43
|
+
mode = buffer.unpack1("L")
|
|
44
|
+
shell_mode = (mode | 0x0007) & ~0x0008
|
|
45
|
+
saved << [handle, mode] if api[:set].call(handle, shell_mode).nonzero?
|
|
46
|
+
end
|
|
47
|
+
yield
|
|
48
|
+
ensure
|
|
49
|
+
saved.reverse_each { |handle, mode| api[:set].call(handle, mode) }
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
27
53
|
def self.functions
|
|
28
54
|
@functions ||= begin
|
|
29
55
|
library = Fiddle.dlopen("kernel32.dll")
|
data/lib/fatty/curses/context.rb
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "curses"
|
|
3
|
+
require "fatty-curses"
|
|
4
4
|
require "fiddle/import"
|
|
5
|
+
require_relative "../ansi/windows_console"
|
|
5
6
|
|
|
6
7
|
module Fatty
|
|
7
8
|
module Curses
|
|
@@ -337,14 +338,18 @@ module Fatty
|
|
|
337
338
|
end
|
|
338
339
|
|
|
339
340
|
def enable_bracketed_paste!
|
|
340
|
-
$stdout
|
|
341
|
-
|
|
341
|
+
Fatty::Ansi::WindowsConsole.with_ansi($stdout) do
|
|
342
|
+
$stdout.write("\e[?2004h")
|
|
343
|
+
$stdout.flush
|
|
344
|
+
end
|
|
342
345
|
nil
|
|
343
346
|
end
|
|
344
347
|
|
|
345
348
|
def disable_bracketed_paste!
|
|
346
|
-
$stdout
|
|
347
|
-
|
|
349
|
+
Fatty::Ansi::WindowsConsole.with_ansi($stdout) do
|
|
350
|
+
$stdout.write("\e[?2004l")
|
|
351
|
+
$stdout.flush
|
|
352
|
+
end
|
|
348
353
|
nil
|
|
349
354
|
end
|
|
350
355
|
end
|
data/lib/fatty/terminal.rb
CHANGED
|
@@ -198,9 +198,9 @@ module Fatty
|
|
|
198
198
|
|
|
199
199
|
# --- Suspension ------------------------------------------------
|
|
200
200
|
|
|
201
|
-
def suspend
|
|
201
|
+
def suspend(&block)
|
|
202
202
|
ctx.suspend
|
|
203
|
-
|
|
203
|
+
Fatty::Ansi::WindowsConsole.with_shell_output(&block)
|
|
204
204
|
ensure
|
|
205
205
|
ctx.resume
|
|
206
206
|
reconcile_terminal_size!
|
|
@@ -652,9 +652,11 @@ module Fatty
|
|
|
652
652
|
@ctx&.close
|
|
653
653
|
ensure
|
|
654
654
|
begin
|
|
655
|
-
$stdout
|
|
656
|
-
|
|
657
|
-
|
|
655
|
+
Fatty::Ansi::WindowsConsole.with_ansi($stdout) do
|
|
656
|
+
$stdout.write("\e[0m") # SGR reset
|
|
657
|
+
$stdout.write("\e[0 q") # DECSCUSR: restore terminal default cursor
|
|
658
|
+
$stdout.flush
|
|
659
|
+
end
|
|
658
660
|
rescue StandardError
|
|
659
661
|
# best-effort cleanup
|
|
660
662
|
end
|
data/lib/fatty/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,42 +1,48 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fatty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.99.12.
|
|
4
|
+
version: 0.99.12.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel E. Doherty
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-11-
|
|
10
|
+
date: 2026-11-24 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
|
-
name:
|
|
13
|
+
name: fat_config
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
|
-
- - "
|
|
16
|
+
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 0.8.1
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
|
-
- - "
|
|
23
|
+
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: 0.8.1
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
|
-
name:
|
|
27
|
+
name: fatty-curses
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 1.7.0
|
|
30
33
|
- - ">="
|
|
31
34
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 0.
|
|
35
|
+
version: 1.7.0.1
|
|
33
36
|
type: :runtime
|
|
34
37
|
prerelease: false
|
|
35
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
39
|
requirements:
|
|
40
|
+
- - "~>"
|
|
41
|
+
- !ruby/object:Gem::Version
|
|
42
|
+
version: 1.7.0
|
|
37
43
|
- - ">="
|
|
38
44
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 0.
|
|
45
|
+
version: 1.7.0.1
|
|
40
46
|
- !ruby/object:Gem::Dependency
|
|
41
47
|
name: fiddle
|
|
42
48
|
requirement: !ruby/object:Gem::Requirement
|