rufio 1.5.0 → 1.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e68729d1cfbfe899d2bdb0c2626ab46958561319aa6a33f8224eb5aaae4e0ad7
4
- data.tar.gz: 93bfc8f597d0c16339a168b1711abde8bc5251fb7cd8209b199c3d71f0e7068d
3
+ metadata.gz: ff603a8e5d0c14a9bb18bfe116f0ccef4a5eee527ea0a24bd78bc358cd274f74
4
+ data.tar.gz: e4d85a17e12f8601d7e45ae1d338328db7a9febaf96a8aae3f115b10e438d56f
5
5
  SHA512:
6
- metadata.gz: c5631c3ef32be2d26bd9759d32a3c7680274b49291e14054bce8184821445ce9f3209a1c99ceeffcfcde0149d458215c2d3328ce363cff8c85f6b470b5ade7f5
7
- data.tar.gz: 60dfadd02062abd388eb458083685f7b36fb98b0193b5a95a94bccdb6f7a8b962e59f46cbccef12e8962ad0e35688ef522d1dbf6a89bd44c6049717d93f2e602
6
+ metadata.gz: 33abb4a41ddfc5801b8afa1692bb020ba39ca003440349c8475b02436202bc0b3e90f996a68ffe1a1123ebd23c5f0bf75d3192c22a8bf6476123821e132e5347
7
+ data.tar.gz: 1af1b2a50d37c6975697f87621df384d77b1863579b1e62e6396fdc0c7216a32575fec1cafccf964fdb474c87c3899340a94ff47983d43c672331119682f0af4
data/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.5.1] - 2026-11-15
11
+
12
+ ### Fixed
13
+ - G mode recognizes application cursor arrows (SS3), modified CSI arrows, and extended Ctrl+J/K (CSI u) input used by terminals such as Ghostty. Unknown sequences and key releases no longer close G mode, and Unix input briefly waits for escape-sequence continuation bytes
14
+
10
15
  ## [1.5.0] - 2026-11-14
11
16
 
12
17
  ### Added
data/README.md CHANGED
@@ -101,7 +101,7 @@ The most used keys. See the **[User Guide](./docs/guide.md)** for every key and
101
101
  | `?` | Help |
102
102
  | `q`, `T` | Quit, quit and cd the shell to the current directory |
103
103
 
104
- In G mode, use `Ctrl+J` / `Ctrl+K` to select the next / previous result and `Enter` to open it.
104
+ In G mode, use `Up` / `Down` or `Ctrl+J` / `Ctrl+K` to select the next / previous result and `Enter` to open it. Application cursor arrows and extended Ctrl-key sequences are supported, including on Ghostty.
105
105
 
106
106
  ## Documentation
107
107
 
data/README_ja.md CHANGED
@@ -101,7 +101,7 @@ rufio /path/to # 指定したディレクトリで起動
101
101
  | `?` | ヘルプ |
102
102
  | `q`、`T` | 終了、終了してシェルを現在のディレクトリへ移動 |
103
103
 
104
- Gモードでは `Ctrl+J` / `Ctrl+K` で次/前の検索結果を選択し、`Enter` で開きます。
104
+ Gモードでは `↓` / `↑` または `Ctrl+J` / `Ctrl+K` で次/前の検索結果を選択し、`Enter` で開きます。Ghosttyなどのアプリケーションカーソル形式の矢印キーと拡張Ctrlキー入力にも対応しています。
105
105
 
106
106
  ## ドキュメント
107
107
 
data/info/welcome.md CHANGED
@@ -39,7 +39,7 @@ Text previews read at most the first 64 KiB. PDF bodies are not previewed, keepi
39
39
  | `q` | Quit |
40
40
  | `T` | Quit and cd to the current directory |
41
41
 
42
- In G mode, use `Ctrl+J` / `Ctrl+K` to select the next / previous result and `Enter` to open it.
42
+ In G mode, use `Up` / `Down` or `Ctrl+J` / `Ctrl+K` to select the next / previous result and `Enter` to open it. Application cursor arrows and extended Ctrl-key sequences are supported, including on Ghostty.
43
43
 
44
44
  ## Command Mode
45
45
 
@@ -206,6 +206,9 @@ module Rufio
206
206
  b = windows_queue_pop_with_timeout(timeout)
207
207
  b.nil? ? nil : b.chr(Encoding::BINARY)
208
208
  else
209
+ # ESC と後続バイトが別々に届く端末でも、矢印を ESC と誤認しない。
210
+ return nil unless IO.select([STDIN], nil, nil, 0.025)
211
+
209
212
  STDIN.read_nonblock(1) rescue nil
210
213
  end
211
214
  end
@@ -479,24 +482,33 @@ module Rufio
479
482
  end
480
483
  return true
481
484
  end
482
- input = case third_char
483
- when 'A' then global_search_active? && !help_dialog_active? ? :up : 'k' # Up arrow
484
- when 'B' then global_search_active? && !help_dialog_active? ? :down : 'j' # Down arrow
485
- when 'C' then global_search_active? && !help_dialog_active? ? :right : 'l' # Right arrow
486
- when 'D' then global_search_active? && !help_dialog_active? ? :left : 'h' # Left arrow
487
- when 'Z'
488
- if help_dialog_active?
489
- handle_help_input("\e[Z")
490
- elsif !global_search_active?
491
- handle_shift_tab
492
- end
493
- return true # Shift+Tab
485
+ if global_search_active? && !help_dialog_active?
486
+ input = read_global_search_csi(third_char)
487
+ return true unless input
494
488
  else
495
- # 未知の CSI シーケンス(\e[27;1u 等): 残りバイトを読み捨てて
496
- # パイプを汚染しないようにする
497
- drain_csi_sequence(third_char)
498
- "\e"
489
+ input = case third_char
490
+ when 'A' then global_search_active? && !help_dialog_active? ? :up : 'k' # Up arrow
491
+ when 'B' then global_search_active? && !help_dialog_active? ? :down : 'j' # Down arrow
492
+ when 'C' then global_search_active? && !help_dialog_active? ? :right : 'l' # Right arrow
493
+ when 'D' then global_search_active? && !help_dialog_active? ? :left : 'h' # Left arrow
494
+ when 'Z'
495
+ if help_dialog_active?
496
+ handle_help_input("\e[Z")
497
+ elsif !global_search_active?
498
+ handle_shift_tab
499
+ end
500
+ return true # Shift+Tab
501
+ else
502
+ # 未知の CSI シーケンス(\e[27;1u 等): 残りバイトを読み捨てて
503
+ # パイプを汚染しないようにする
504
+ drain_csi_sequence(third_char)
505
+ "\e"
506
+ end
499
507
  end
508
+ elsif next_char == 'O' && global_search_active? && !help_dialog_active?
509
+ # Application cursor mode (SS3), used by terminals such as Ghostty.
510
+ input = { 'A' => :up, 'B' => :down, 'C' => :right, 'D' => :left }[read_next_input_byte]
511
+ return true unless input
500
512
  else
501
513
  input = "\e" # ESCキー(そのまま保持)
502
514
  end
@@ -1056,6 +1068,29 @@ module Rufio
1056
1068
  true
1057
1069
  end
1058
1070
 
1071
+ # G mode accepts legacy CSI arrows and extended keyboard events. Unknown
1072
+ # sequences and key releases are consumed without acting like Escape.
1073
+ def read_global_search_csi(first_char)
1074
+ sequence = +first_char.to_s
1075
+ 64.times do
1076
+ break if sequence.match?(/[@-~]\z/)
1077
+
1078
+ char = read_next_input_byte
1079
+ return nil unless char
1080
+
1081
+ sequence << char
1082
+ end
1083
+ if (match = sequence.match(/\A(?:1(?:;\d+(?::([123]))?)?)?([ABCD])\z/))
1084
+ return nil if match[1] == '3'
1085
+
1086
+ return { 'A' => :up, 'B' => :down, 'C' => :right, 'D' => :left }[match[2]]
1087
+ end
1088
+ match = sequence.match(/\A(\d+);5(?::([123]))?u\z/)
1089
+ return nil unless match && match[2] != '3'
1090
+
1091
+ { 106 => "\x0a", 107 => "\x0b", 110 => "\x0e", 112 => "\x10", 117 => "\x15" }[match[1].to_i]
1092
+ end
1093
+
1059
1094
  # 未知の CSI シーケンス(\e[X...)の残りバイトを終端アルファベットまで読み捨てる。
1060
1095
  # Windows Terminal が \e[27;1u 等を送った場合のパイプ汚染を防ぐ。
1061
1096
  def drain_csi_sequence(first_char)
data/lib/rufio/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rufio
4
- VERSION = '1.5.0'
4
+ VERSION = '1.5.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - masisz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-14 00:00:00.000000000 Z
11
+ date: 2026-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: io-console