Class: Rufio::TerminalUI
- Inherits:
-
Object
- Object
- Rufio::TerminalUI
- Defined in:
- lib/rufio/terminal_ui.rb
Constant Summary collapse
- HEADER_HEIGHT =
Layout constants
1- FOOTER_HEIGHT =
Header占有行数(モードタブ+パス+バージョン 1行に統合)
1- HEADER_FOOTER_MARGIN =
Footer占有行数(ブックマーク一覧 + ステータス情報)
2- LEFT_PANEL_RATIO =
Panel layout ratios
0.5- RIGHT_PANEL_RATIO =
左パネルの幅比率
1.0 - LEFT_PANEL_RATIO
- DEFAULT_SCREEN_WIDTH =
Display constants
80- DEFAULT_SCREEN_HEIGHT =
デフォルト画面幅
24- HEADER_PADDING =
デフォルト画面高さ
2- FILTER_TEXT_RESERVED =
ヘッダーのパディング
15- TAB_SEPARATOR =
フィルタテキスト表示の予約幅
">"- ICON_SIZE_PADDING =
File display constants
12- CURSOR_OFFSET =
アイコン、選択マーク、サイズ情報分
1- KILOBYTE =
Size display constants (bytes)
1024- MEGABYTE =
KILOBYTE * 1024
- GIGABYTE =
MEGABYTE * 1024
- BOOKMARK_HIGHLIGHT_DURATION =
Bookmark highlight duration (seconds)
0.5- CONTENT_START_LINE =
Line offsets
1
Instance Attribute Summary collapse
-
#renderer ⇒ Object
readonly
Screen と Renderer のアクセサ(他のクラスから利用可能に).
-
#screen ⇒ Object
readonly
Screen と Renderer のアクセサ(他のクラスから利用可能に).
-
#ui_renderer ⇒ Object
readonly
Returns the value of attribute ui_renderer.
Instance Method Summary collapse
-
#activate_command_mode ⇒ Object
コマンドモードを起動.
-
#command_mode_active? ⇒ Boolean
コマンドモードがアクティブかどうか.
-
#deactivate_command_mode ⇒ Object
コマンドモードを終了.
-
#drain_csi_sequence(first_char) ⇒ Object
未知の CSI シーケンス(e[X…)の残りバイトを終端アルファベットまで読み捨てる。 Windows Terminal が e[27;1u 等を送った場合のパイプ汚染を防ぐ。.
-
#draw_command_mode_to_overlay ⇒ Object
コマンドモードダイアログをオーバーレイに描画.
-
#draw_job_mode_screen ⇒ Object
ジョブモード画面を描画(バッファベース描画への橋渡し).
-
#draw_notifications ⇒ Object
Noice風の通知を描画.
-
#draw_screen_to_buffer(screen, notification_message = nil, fps = nil) ⇒ Object
UIRenderer に全描画処理を委譲.
-
#enter_log_mode(_project_log) ⇒ Object
ログモードに入る(廃止済み: 空のメソッド).
-
#execute_command(command_string) ⇒ Object
コマンドを実行.
-
#exit_job_mode ⇒ Object
ジョブモードを終了.
-
#exit_log_mode ⇒ Object
ログモードを終了(廃止済み: 空のメソッド).
-
#handle_command_input(input) ⇒ Object
コマンド入力を処理.
-
#handle_tab_completion ⇒ Object
Tab補完を処理.
-
#initialize(test_mode: false) ⇒ TerminalUI
constructor
コンテンツ開始行(フッタ1行: Y=0).
- #refresh_display ⇒ Object
-
#set_job_mode(job_mode, job_manager, notification_manager) ⇒ Object
ジョブモードを設定.
-
#setup_script_runner ⇒ Object
スクリプトランナーを設定.
-
#show_completion_candidates(candidates) ⇒ Object
補完候補を一時的に表示.
-
#show_help_dialog ⇒ Object
ヘルプダイアログを表示.
-
#show_info_notice(notice, info_notice) ⇒ Object
Show a single info notice.
-
#show_info_notices ⇒ Object
Show info notices from the info directory if any are unread.
-
#show_overlay_dialog(title, content_lines, options = {}) { ... } ⇒ String
オーバーレイダイアログを表示してキー入力を待つヘルパーメソッド.
- #start(directory_listing, keybind_handler, file_preview, background_executor = nil) ⇒ Object
-
#trigger_job_mode_redraw ⇒ Object
ジョブモード再描画をトリガー.
Constructor Details
#initialize(test_mode: false) ⇒ TerminalUI
コンテンツ開始行(フッタ1行: Y=0)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/rufio/terminal_ui.rb', line 39 def initialize(test_mode: false) console = IO.console if console @screen_width, @screen_height = console.winsize.reverse else # fallback values (for test environments etc.) @screen_width = DEFAULT_SCREEN_WIDTH @screen_height = DEFAULT_SCREEN_HEIGHT end @running = false @test_mode = test_mode @multibyte_reader = MultibyteInputReader.new(STDIN) @input_queue = nil @input_thread = nil @command_mode_active = false @command_input = "" @command_mode = CommandMode.new @dialog_renderer = DialogRenderer.new @command_mode_ui = CommandModeUI.new(@command_mode, @dialog_renderer) # コマンド履歴と補完 history_file = File.join(Dir.home, '.rufio', 'command_history.txt') FileUtils.mkdir_p(File.dirname(history_file)) @command_history = CommandHistory.new(history_file, max_size: ConfigLoader.command_history_size) @command_completion = CommandCompletion.new(@command_history, @command_mode) # Job mode @job_mode_instance = nil @job_manager = nil @notification_manager = nil @in_job_mode = false @job_mode_needs_redraw = false # Preview cache @preview_cache = {} @last_preview_path = nil # シンタックスハイライター(bat が利用可能な場合のみ動作) @syntax_highlighter = SyntaxHighlighter.new # Tab mode manager @tab_mode_manager = TabModeManager.new # UIRenderer(描画ロジックを担当) ui_opts = ConfigLoader. @ui_renderer = UIRenderer.new( screen_width: @screen_width, screen_height: @screen_height, test_mode: @test_mode, left_panel_ratio: ui_opts[:panel_ratio], preview_enabled: ui_opts[:preview_enabled] ) end |
Instance Attribute Details
#renderer ⇒ Object (readonly)
Screen と Renderer のアクセサ(他のクラスから利用可能に)
1149 1150 1151 |
# File 'lib/rufio/terminal_ui.rb', line 1149 def renderer @renderer end |
#screen ⇒ Object (readonly)
Screen と Renderer のアクセサ(他のクラスから利用可能に)
1149 1150 1151 |
# File 'lib/rufio/terminal_ui.rb', line 1149 def screen @screen end |
#ui_renderer ⇒ Object (readonly)
Returns the value of attribute ui_renderer.
94 95 96 |
# File 'lib/rufio/terminal_ui.rb', line 94 def ui_renderer @ui_renderer end |
Instance Method Details
#activate_command_mode ⇒ Object
コマンドモードを起動
771 772 773 774 775 776 777 778 779 |
# File 'lib/rufio/terminal_ui.rb', line 771 def activate_command_mode @command_mode_active = true @command_input = "" print "\e[?25h" # カーソルを表示(テキスト入力中) STDOUT.flush # 閲覧中ディレクトリをコマンドモードに通知(ローカルスクリプト・Rakefileの検出用) browsing_dir = @directory_listing&.current_path || Dir.pwd @command_mode.update_browsing_directory(browsing_dir) end |
#command_mode_active? ⇒ Boolean
コマンドモードがアクティブかどうか
826 827 828 |
# File 'lib/rufio/terminal_ui.rb', line 826 def command_mode_active? @command_mode_active end |
#deactivate_command_mode ⇒ Object
コマンドモードを終了
782 783 784 785 786 787 788 789 |
# File 'lib/rufio/terminal_ui.rb', line 782 def deactivate_command_mode @command_mode_active = false @command_input = "" print "\e[?25l" # カーソルを非表示(通常のファイラー表示に戻る) STDOUT.flush # オーバーレイをクリア @screen&. if @screen&. end |
#drain_csi_sequence(first_char) ⇒ Object
未知の CSI シーケンス(e[X…)の残りバイトを終端アルファベットまで読み捨てる。Windows Terminal が e[27;1u 等を送った場合のパイプ汚染を防ぐ。
1210 1211 1212 1213 1214 1215 1216 |
# File 'lib/rufio/terminal_ui.rb', line 1210 def drain_csi_sequence(first_char) return if first_char.nil? || first_char =~ /[A-Za-z]/ 10.times do ch = read_next_input_byte break if ch.nil? || ch =~ /[A-Za-z]/ end end |
#draw_command_mode_to_overlay ⇒ Object
コマンドモードダイアログをオーバーレイに描画
792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 |
# File 'lib/rufio/terminal_ui.rb', line 792 def return unless @screen title = "Command Mode" content_lines = [ "", "#{@command_input}_", # カーソル表示 "", "Tab: Complete | Enter: Execute | ESC: Cancel" ] border_color = "\e[34m" # Blue title_color = "\e[1;34m" # Bold blue content_color = "\e[37m" # White # ウィンドウサイズを計算 width, height = @dialog_renderer.calculate_dimensions(content_lines, { title: title, min_width: 50, max_width: 80 }) # 中央位置を計算 x, y = @dialog_renderer.calculate_center(width, height) # オーバーレイにダイアログを描画 @dialog_renderer.(@screen, x, y, width, height, title, content_lines, { border_color: border_color, title_color: title_color, content_color: content_color }) end |
#draw_job_mode_screen ⇒ Object
ジョブモード画面を描画(バッファベース描画への橋渡し)
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 |
# File 'lib/rufio/terminal_ui.rb', line 1028 def draw_job_mode_screen return unless @in_job_mode && @job_mode_instance && @job_manager return unless @screen && @renderer # バッファベースの描画を使用 draw_screen_to_buffer(@screen, nil, nil) @renderer.render(@screen) print "\e[#{@screen_height};#{@screen_width}H" STDOUT.flush @job_mode_needs_redraw = false end |
#draw_notifications ⇒ Object
Noice風の通知を描画
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 |
# File 'lib/rufio/terminal_ui.rb', line 1042 def draw_notifications nm = @notification_manager || @keybind_handler&.notification_manager return unless nm # 期限切れの通知を削除 nm.expire_old_notifications notifications = nm.notifications return if notifications.empty? # 通知の幅と位置 notification_width = 22 x = @screen_width - notification_width - 2 # 右端から2文字マージン notifications.each_with_index do |notif, i| y = 2 + (i * 5) # 各通知4行 + 間隔1行 # 色設定 border_color = notif[:border_color] == :green ? "\e[32m" : "\e[31m" reset = "\e[0m" # ステータスアイコン icon = notif[:type] == :success ? '✓' : '✗' # 通知の内容を作成 name_line = "#{icon} #{notif[:name]}"[0...notification_width - 4] status_line = notif[:status_text][0...notification_width - 4] # 上部ボーダー print "\e[#{y};#{x}H#{border_color}╭#{'─' * (notification_width - 2)}╮#{reset}" # 1行目: アイコン + 名前 print "\e[#{y + 1};#{x}H#{border_color}│#{reset} #{name_line.ljust(notification_width - 4)} #{border_color}│#{reset}" # 2行目: ステータス print "\e[#{y + 2};#{x}H#{border_color}│#{reset} #{status_line.ljust(notification_width - 6)} #{border_color}│#{reset}" # Exit code行(失敗時のみ) if notif[:type] == :error && notif[:exit_code] exit_line = "Exit code: #{notif[:exit_code]}"[0...notification_width - 6] print "\e[#{y + 3};#{x}H#{border_color}│#{reset} #{exit_line.ljust(notification_width - 6)} #{border_color}│#{reset}" print "\e[#{y + 4};#{x}H#{border_color}╰#{'─' * (notification_width - 2)}╯#{reset}" else # 下部ボーダー print "\e[#{y + 3};#{x}H#{border_color}╰#{'─' * (notification_width - 2)}╯#{reset}" end end end |
#draw_screen_to_buffer(screen, notification_message = nil, fps = nil) ⇒ Object
UIRenderer に全描画処理を委譲
484 485 486 487 488 489 490 491 |
# File 'lib/rufio/terminal_ui.rb', line 484 def draw_screen_to_buffer(screen, = nil, fps = nil) @ui_renderer.draw_screen_to_buffer( screen, , fps, in_job_mode: @in_job_mode, job_manager: @job_manager, job_mode_instance: @job_mode_instance ) end |
#enter_log_mode(_project_log) ⇒ Object
ログモードに入る(廃止済み: 空のメソッド)
983 984 985 |
# File 'lib/rufio/terminal_ui.rb', line 983 def enter_log_mode(_project_log) # プロジェクトモード廃止により何もしない end |
#execute_command(command_string) ⇒ Object
コマンドを実行
869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 |
# File 'lib/rufio/terminal_ui.rb', line 869 def execute_command(command_string) return if command_string.nil? || command_string.empty? # コマンド履歴に追加 @command_history.add(command_string) # 現在のディレクトリを取得 working_dir = @directory_listing&.current_path || Dir.pwd result = @command_mode.execute(command_string, working_dir: working_dir) # バックグラウンドコマンドの場合は結果表示をスキップ # (完了通知は別途メインループで表示される) if result && !result.to_s.include?("🔄 Running in background") # コマンド実行結果をフローティングウィンドウで表示 @command_mode_ui.show_result(result) end # メインループの次フレームで再描画される(draw_screenは使わない) # draw_screen(レガシー直接出力)はバッファベースのオーバーレイと座標系が異なるため、 # 使用するとコマンドプロンプトの枠線が残る不具合が発生する end |
#exit_job_mode ⇒ Object
ジョブモードを終了
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 |
# File 'lib/rufio/terminal_ui.rb', line 1005 def exit_job_mode @in_job_mode = false @job_mode_instance = nil @job_manager = nil # バッファベースの全画面再描画を使用 update_screen_size if @screen && @renderer @renderer.clear @screen.clear draw_screen_to_buffer(@screen, nil, nil) @renderer.render(@screen) print "\e[#{@screen_height};#{@screen_width}H" else draw_screen end end |
#exit_log_mode ⇒ Object
ログモードを終了(廃止済み: 空のメソッド)
988 989 990 |
# File 'lib/rufio/terminal_ui.rb', line 988 def exit_log_mode # プロジェクトモード廃止により何もしない end |
#handle_command_input(input) ⇒ Object
コマンド入力を処理
831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 |
# File 'lib/rufio/terminal_ui.rb', line 831 def handle_command_input(input) case input when "\r", "\n" # Enter キーでコマンドを実行 execute_command(@command_input) # コマンド実行後、入力をクリアして再度コマンドモードに戻る @command_input = "" when "\e" # Escape キーでコマンドモードをキャンセル # まずコマンドウィンドウをクリア @command_mode_ui.clear_prompt deactivate_command_mode # ファイラー画面を再描画(バッファベース) if @screen && @renderer # レンダラーの前フレーム情報をリセット(差分レンダリングを強制的に全体描画にする) @renderer.clear @screen.clear draw_screen_to_buffer(@screen, nil, nil) @renderer.render(@screen) # カーソルを画面外に移動(メインループと同じ処理) print "\e[#{@screen_height};#{@screen_width}H" else # フォールバック(古い実装) draw_screen end when "\t" # Tab キーで補完 handle_tab_completion when "\u007F", "\b" # Backspace @command_input.chop! unless @command_input.empty? else # 通常の文字を追加(マルチバイト文字含む) @command_input += input unless input.nil? || input.empty? end end |
#handle_tab_completion ⇒ Object
Tab補完を処理
893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 |
# File 'lib/rufio/terminal_ui.rb', line 893 def handle_tab_completion # 補完候補を取得 candidates = @command_completion.complete(@command_input) # 候補がない場合は何もしない return if candidates.empty? # 候補が1つの場合はそれに補完 if candidates.size == 1 @command_input = candidates.first return end # 複数の候補がある場合、共通プレフィックスまで補完 prefix = @command_completion.common_prefix(@command_input) # 入力が変わる場合は補完して終了 if prefix != @command_input @command_input = prefix return end # 入力が変わらない場合は候補リストを表示 show_completion_candidates(candidates) end |
#refresh_display ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/rufio/terminal_ui.rb', line 132 def refresh_display # ウィンドウサイズを更新してから画面をクリアして再描画 update_screen_size # プレビューキャッシュをクリア(ディレクトリ変更やリフレッシュ時) @preview_cache.clear @last_preview_path = nil # ブックマークキャッシュもクリア @cached_bookmarks = nil @cached_bookmark_time = nil # バッファベースの描画が利用可能な場合は全画面を再描画 if @screen && @renderer # レンダラーの前フレーム情報をリセット(差分レンダリングを強制的に全体描画にする) @renderer.clear @screen.clear draw_screen_to_buffer(@screen, nil, nil) @renderer.render(@screen) # カーソルを画面外に移動 print "\e[#{@screen_height};#{@screen_width}H" end end |
#set_job_mode(job_mode, job_manager, notification_manager) ⇒ Object
ジョブモードを設定
993 994 995 996 997 998 999 1000 1001 1002 |
# File 'lib/rufio/terminal_ui.rb', line 993 def set_job_mode(job_mode, job_manager, notification_manager) @job_mode_instance = job_mode @job_manager = job_manager @notification_manager = notification_manager @in_job_mode = true # レンダラーをリセット(print "\e[2J\e[H" は renderer.clear に含まれる) @renderer.clear if @renderer # 再描画フラグを立てる @job_mode_needs_redraw = true end |
#setup_script_runner ⇒ Object
スクリプトランナーを設定
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/rufio/terminal_ui.rb', line 157 def setup_script_runner return unless @keybind_handler # KeybindHandlerからジョブマネージャーを取得 job_manager = @keybind_handler.job_manager # 設定からスクリプトパスを取得 script_paths = ConfigLoader.script_paths # CommandModeにスクリプトランナーを設定 @command_mode.setup_script_runner( script_paths: script_paths, job_manager: job_manager ) end |
#show_completion_candidates(candidates) ⇒ Object
補完候補を一時的に表示
920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 |
# File 'lib/rufio/terminal_ui.rb', line 920 def show_completion_candidates(candidates) title = "Completions (#{candidates.size})" # 候補を表示用にフォーマット(最大20件) display_candidates = candidates.first(20) content_lines = [""] display_candidates.each do |candidate| content_lines << " #{candidate}" end if candidates.size > 20 content_lines << "" content_lines << " ... 他 #{candidates.size - 20} 件" end content_lines << "" content_lines << "Press any key to continue..." # オーバーレイダイアログを表示 (title, content_lines, { min_width: 40, max_width: 80, border_color: "\e[33m", # Yellow title_color: "\e[1;33m", # Bold yellow content_color: "\e[37m" # White }) end |
#show_help_dialog ⇒ Object
ヘルプダイアログを表示
1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 |
# File 'lib/rufio/terminal_ui.rb', line 1152 def show_help_dialog content_lines = [ '', "rufio v#{VERSION}", '', 'Key Bindings:', '', 'j/k - Move up/down', 'h/l - Navigate back/enter', 'g/G - Go to top/bottom', 'o - Open file', 'f - Filter files', 's - Search with fzf', 'F - Content search (rga)', 'a/A - Create file/directory', 'm/c/x - Move/Copy/Delete', 'b - Add bookmark', 'z - Zoxide navigation', '0 - Go to start directory', '1-9 - Go to bookmark', 'J - Job mode', ': - Command mode', 'q - Quit', '' ] # お知らせ情報を追加 require_relative 'info_notice' info_notice = InfoNotice.new all_notices = Dir.glob(File.join(info_notice.info_dir, '*.txt')) if !all_notices.empty? content_lines << 'Recent Updates:' content_lines << '' all_notices.take(3).each do |file| title = info_notice.extract_title(file) content_lines << " • #{title}" end content_lines << '' end content_lines << 'Press any key to continue...' width = 60 height = [content_lines.length + 4, @screen_height - 4].min # オーバーレイダイアログを表示 ('rufio - Help', content_lines, { width: width, height: height, border_color: "\e[36m", # Cyan title_color: "\e[1;36m", # Bold cyan content_color: "\e[37m" # White }) end |
#show_info_notice(notice, info_notice) ⇒ Object
Show a single info notice
962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 |
# File 'lib/rufio/terminal_ui.rb', line 962 def show_info_notice(notice, info_notice) # Calculate window dimensions width = [@screen_width - 10, 70].min # Calculate height based on content length content_length = notice[:content].length height = [content_length + 4, @screen_height - 4].min # +4 for borders and title # オーバーレイダイアログを表示 (notice[:title], notice[:content], { width: width, height: height, border_color: "\e[36m", # Cyan title_color: "\e[1;36m", # Bold cyan content_color: "\e[37m" # White }) # Mark as shown info_notice.mark_as_shown(notice[:file]) end |
#show_info_notices ⇒ Object
Show info notices from the info directory if any are unread
949 950 951 952 953 954 955 956 957 |
# File 'lib/rufio/terminal_ui.rb', line 949 def show_info_notices require_relative 'info_notice' info_notice = InfoNotice.new notices = info_notice.unread_notices notices.each do |notice| show_info_notice(notice, info_notice) end end |
#show_overlay_dialog(title, content_lines, options = {}) { ... } ⇒ String
オーバーレイダイアログを表示してキー入力を待つヘルパーメソッド
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 |
# File 'lib/rufio/terminal_ui.rb', line 1104 def (title, content_lines, = {}, &block) return nil unless @screen && @renderer # オーバーレイを有効化し、前回のダイアログ残留を除去 @screen. @screen. # ウィンドウサイズを計算 if [:width] && [:height] width = [:width] height = [:height] else width, height = @dialog_renderer.calculate_dimensions(content_lines, { title: title, min_width: [:min_width] || 40, max_width: [:max_width] || 80 }) end # 中央位置を計算 x, y = @dialog_renderer.calculate_center(width, height) # オーバーレイにダイアログを描画 @dialog_renderer.(@screen, x, y, width, height, title, content_lines, { border_color: [:border_color] || "\e[37m", title_color: [:title_color] || "\e[1;33m", content_color: [:content_color] || "\e[37m" }) # レンダリング @renderer.render(@screen) # キー入力を待つ key = block_given? ? yield : STDIN.getch # オーバーレイを無効化 @screen. # 画面を再描画 @renderer.render(@screen) key end |
#start(directory_listing, keybind_handler, file_preview, background_executor = nil) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/rufio/terminal_ui.rb', line 96 def start(directory_listing, keybind_handler, file_preview, background_executor = nil) @directory_listing = directory_listing @keybind_handler = keybind_handler @file_preview = file_preview @background_executor = background_executor @keybind_handler.set_directory_listing(@directory_listing) @keybind_handler.set_terminal_ui(self) # UIRenderer に依存を注入 @ui_renderer.keybind_handler = @keybind_handler @ui_renderer.directory_listing = @directory_listing @ui_renderer.file_preview = @file_preview @ui_renderer.background_executor = @background_executor # command_mode_ui にも terminal_ui を設定 @command_mode_ui.set_terminal_ui(self) # コマンドモードにバックグラウンドエグゼキュータを設定 @command_mode.background_executor = @background_executor if @background_executor # スクリプトランナーを設定(ジョブモードと連携) setup_script_runner @running = true setup_terminal # Show info notices if any show_info_notices begin main_loop ensure cleanup_terminal end end |
#trigger_job_mode_redraw ⇒ Object
ジョブモード再描画をトリガー
1023 1024 1025 |
# File 'lib/rufio/terminal_ui.rb', line 1023 def trigger_job_mode_redraw @job_mode_needs_redraw = true end |