source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | sous-chefs/djbdns | https://github.com/sous-chefs/djbdns | test/integration/source/default_spec.rb | Ruby | apache-2.0 | 19 | main | 578 | control 'public-dnscache' do
describe port(53) do
its('protocols') { should include 'udp' }
end
describe command('host chef.io') do
its(:stdout) { should match(/chef.io has address.*/) }
end
end
control 'tinydns' do
describe port(53) do
its('addresses') { should include '127.0.0.1' }
its('pr... |
github | sous-chefs/djbdns | https://github.com/sous-chefs/djbdns | test/integration/tinydns/default_spec.rb | Ruby | apache-2.0 | 19 | main | 636 | host_ip = interface('eth0').ipv4_addresses.first
control 'public-dnscache' do
describe port(53) do
its('protocols') { should include 'udp' }
end
describe command "dig @#{host_ip} chef.io" do
its(:stdout) { should match(/^chef\.io\..*IN\s+A/) }
end
end
control 'tinydns' do
describe port(53) do
i... |
github | sous-chefs/djbdns | https://github.com/sous-chefs/djbdns | spec/unit/recipes/default_spec.rb | Ruby | apache-2.0 | 19 | main | 296 | require 'spec_helper'
describe 'default recipe on ubuntu 16.04' do
let(:runner) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') }
let(:chef_run) { runner.converge('djbdns::default') }
it 'converges successfully' do
expect { :chef_run }.to_not raise_error
end
end |
github | sous-chefs/djbdns | https://github.com/sous-chefs/djbdns | recipes/default.rb | Ruby | apache-2.0 | 19 | main | 1,904 | #
# Cookbook:: djbdns
# Recipe:: default
# Author:: Joshua Timberman (<joshua@chef.io>)
#
# Copyright:: 2009-2019, Chef Software, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# h... |
github | sous-chefs/djbdns | https://github.com/sous-chefs/djbdns | recipes/cache.rb | Ruby | apache-2.0 | 19 | main | 2,316 | #
# Author:: Joshua Timberman (<joshua@chef.io>)
# Author:: Joshua Sierles (<joshua@37signals.com>)
# Cookbook:: djbdns
# Recipe:: cache
#
# Copyright:: 2009-2019, Chef Software, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... |
github | sous-chefs/djbdns | https://github.com/sous-chefs/djbdns | recipes/internal_server.rb | Ruby | apache-2.0 | 19 | main | 2,121 | #
# Author:: Joshua Timberman (<joshua@chef.io>)
# Cookbook:: djbdns
# Recipe:: internal_server
#
# Copyright:: 2009-2019, Chef Software, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#... |
github | sous-chefs/djbdns | https://github.com/sous-chefs/djbdns | recipes/axfr.rb | Ruby | apache-2.0 | 19 | main | 1,264 | #
# Author:: Joshua Timberman (<joshua@chef.io>)
# Cookbook:: djbdns
# Recipe:: axfr
#
# Copyright:: 2009-2019, Chef Software, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http... |
github | sous-chefs/djbdns | https://github.com/sous-chefs/djbdns | recipes/server.rb | Ruby | apache-2.0 | 19 | main | 1,333 | #
# Author:: Joshua Timberman (<joshua@chef.io>)
# Cookbook:: djbdns
# Recipe:: server
#
# Copyright:: 2009-2019, Chef Software, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
github | sous-chefs/djbdns | https://github.com/sous-chefs/djbdns | tasks/maintainers.rb | Ruby | apache-2.0 | 19 | main | 1,891 | #
# Copyright:: 2015-2019, Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | mui.gemspec | Ruby | mit | 20 | master | 1,829 | # frozen_string_literal: true
require_relative "lib/mui/version"
Gem::Specification.new do |spec|
spec.name = "mui"
spec.version = Mui::VERSION
spec.authors = ["S-H-GAMELINKS"]
spec.email = ["gamelinks007@gmail.com"]
spec.summary = "Mui - A Vim-like TUI editor written in Ruby"
spec.description = "Mui (無為... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | Gemfile | Ruby | mit | 20 | master | 393 | # frozen_string_literal: true
source "https://rubygems.org"
# Specify your gem's dependencies in mui.gemspec
gemspec
gem "irb"
gem "rake", "~> 13.0"
gem "minitest", "~> 6.0"
gem "rubocop", "~> 1.21"
gem "ruby-lsp", "~> 0.26.4"
gem "rubocop-rake", "~> 0.7.1"
gem "rubocop-minitest", "~> 0.38.2"
gem "rubocop-perf... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui.rb | Ruby | mit | 20 | master | 5,342 | # frozen_string_literal: true
require_relative "mui/version"
require_relative "mui/error"
require_relative "mui/key_code"
require_relative "mui/key_notation_parser"
require_relative "mui/key_sequence"
require_relative "mui/key_sequence_buffer"
require_relative "mui/key_sequence_matcher"
require_relative "mui/key_seque... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/completion_renderer.rb | Ruby | mit | 20 | master | 2,479 | # frozen_string_literal: true
module Mui
# Renders completion popup menu
class CompletionRenderer
MAX_VISIBLE_ITEMS = 10
def initialize(screen, color_scheme)
@screen = screen
@color_scheme = color_scheme
end
def render(completion_state, base_row, base_col)
return unless completi... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_code.rb | Ruby | mit | 20 | master | 778 | # frozen_string_literal: true
module Mui
# Key code constants for terminal input handling
module KeyCode
ESCAPE = 27
BACKSPACE = 127
ENTER_CR = 13
ENTER_LF = 10
TAB = 9
PRINTABLE_MIN = 32
# Extended to support Unicode characters (including CJK)
# 0x10FFFF is the maximum valid Unicod... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/config.rb | Ruby | mit | 20 | master | 1,611 | # frozen_string_literal: true
module Mui
class Config
attr_reader :options, :plugins, :keymaps, :commands, :autocmds
def initialize
@options = {
colorscheme: "mui",
syntax: true, # Enable/disable syntax highlighting
shiftwidth: 2, # Indent width for > and < commands
exp... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/wrap_helper.rb | Ruby | mit | 20 | master | 2,588 | # frozen_string_literal: true
module Mui
# Helper module for line wrapping calculations
module WrapHelper
class << self
# Wraps a line into screen lines based on display width
# Returns: [{ text:, start_col:, end_col: }, ...]
def wrap_line(line, width, cache: nil)
return [{ text: "", ... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/search_completer.rb | Ruby | mit | 20 | master | 1,376 | # frozen_string_literal: true
module Mui
# Extracts search completion candidates from buffer content
class SearchCompleter
MAX_CANDIDATES = 50
def initialize
@word_cache = {}
@cache_buffer_id = nil
@cache_version = nil
end
# Extract words from buffer that match the given prefix
... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/register.rb | Ruby | mit | 20 | master | 4,185 | # frozen_string_literal: true
require "clipboard"
module Mui
# Manages yank/delete registers for copy/paste operations
# Supports Vim-compatible registers:
# - "" (unnamed): default register
# - "a-"z: named registers
# - "0: yank register (stores last yank, not affected by delete)
# - "1-"9: delete histo... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_sequence_matcher.rb | Ruby | mit | 20 | master | 2,607 | # frozen_string_literal: true
module Mui
# Matches input key sequences against registered key mappings
class KeySequenceMatcher
# Match result types
MATCH_EXACT = :exact # Complete match found
MATCH_PARTIAL = :partial # Input is prefix of one or more registered sequences
MATCH_NONE = :none ... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/selection.rb | Ruby | mit | 20 | master | 1,447 | # frozen_string_literal: true
module Mui
class Selection
attr_accessor :start_row, :start_col, :end_row, :end_col
attr_reader :line_mode
def initialize(start_row, start_col, line_mode: false)
@start_row = start_row
@start_col = start_col
@end_row = start_row
@end_col = start_col
... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/job.rb | Ruby | mit | 20 | master | 1,579 | # frozen_string_literal: true
module Mui
# Represents a single asynchronous job
class Job
# Job status constants
module Status
PENDING = :pending
RUNNING = :running
COMPLETED = :completed
FAILED = :failed
CANCELLED = :cancelled
end
attr_reader :id, :status, :re... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/search_input.rb | Ruby | mit | 20 | master | 534 | # frozen_string_literal: true
module Mui
class SearchInput
attr_reader :buffer, :prompt
def initialize(prompt = "/")
@buffer = +""
@prompt = prompt
end
def input(char)
@buffer << char
end
def backspace
@buffer = @buffer.chop
end
def clear
@buffer = +"... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/error.rb | Ruby | mit | 20 | master | 717 | # frozen_string_literal: true
module Mui
class Error < StandardError; end
# Raised when a subclass does not override a required method
class MethodNotOverriddenError < Error
def initialize(method_name)
super("Subclass must implement ##{method_name}")
end
end
# Raised when a plugin operation f... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/command_completer.rb | Ruby | mit | 20 | master | 747 | # frozen_string_literal: true
module Mui
# Provides command name completion
class CommandCompleter
COMMANDS = %w[
e w q wq q!
sp split vs vsplit close only
tabnew tabe tabedit tabclose tabc
tabnext tabn tabprev tabp tabprevious
tabfirst tabf tabrewind tabr tablast tabl
tabmo... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/color_scheme.rb | Ruby | mit | 20 | master | 1,201 | # frozen_string_literal: true
module Mui
class ColorScheme
ELEMENTS = %i[
normal
status_line
status_line_mode
search_highlight
visual_selection
line_number
message_error
message_info
tab_bar
tab_bar_active
completion_popup
completion_popup_s... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/window_manager.rb | Ruby | mit | 20 | master | 5,984 | # frozen_string_literal: true
module Mui
class WindowManager
# Predicates for determining if a window is in a given direction from another
DIRECTION_PREDICATES = {
left: ->(w, active) { w.x + w.width <= active.x },
right: ->(w, active) { w.x >= active.x + active.width },
up: ->(w, active) {... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_handler.rb | Ruby | mit | 20 | master | 711 | # frozen_string_literal: true
require_relative "key_handler/motions/motion_handler"
require_relative "key_handler/operators/base_operator"
require_relative "key_handler/operators/delete_operator"
require_relative "key_handler/operators/change_operator"
require_relative "key_handler/operators/yank_operator"
require_rel... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/search_state.rb | Ruby | mit | 20 | master | 4,020 | # frozen_string_literal: true
module Mui
class SearchState
attr_reader :pattern, :direction
def initialize
@pattern = nil
@direction = :forward
@pattern_version = 0
@buffer_matches = {} # { buffer_object_id => { version:, matches: [] } }
end
def set_pattern(pattern, directio... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_sequence.rb | Ruby | mit | 20 | master | 1,649 | # frozen_string_literal: true
module Mui
# Represents a sequence of keys for key mapping
# Parses Vim-style notation and provides normalization for matching
class KeySequence
attr_reader :keys, :notation
# @param notation [String] Key notation string (e.g., "<Leader>gd", "<C-x><C-s>")
def initialize... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/undoable_action.rb | Ruby | mit | 20 | master | 3,554 | # frozen_string_literal: true
module Mui
# Base class for undoable actions
class UndoableAction
def execute(buffer); end
def undo(buffer); end
end
# Insert a single character
class InsertCharAction < UndoableAction
def initialize(row, col, char)
super()
@row = row
@col = col
... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/command_history.rb | Ruby | mit | 20 | master | 1,670 | # frozen_string_literal: true
module Mui
# Manages command history with file persistence
class CommandHistory
MAX_HISTORY = 100
HISTORY_FILE = File.expand_path("~/.mui_history")
attr_reader :history
def initialize(history_file: HISTORY_FILE)
@history_file = history_file
@history = []
... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_sequence_buffer.rb | Ruby | mit | 20 | master | 1,933 | # frozen_string_literal: true
module Mui
# Buffer for accumulating key inputs for multi-key sequence matching
# Tracks timing for timeout detection
class KeySequenceBuffer
attr_reader :last_input_time
def initialize
@buffer = []
@last_input_time = nil
end
# Push a key into the buffe... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/buffer.rb | Ruby | mit | 20 | master | 7,251 | # frozen_string_literal: true
module Mui
class Buffer
attr_reader :lines, :change_count
attr_accessor :name, :modified, :undo_manager, :readonly
# Alias for autocmd pattern matching
alias file_path name
def initialize(name = "[No Name]")
@name = name
@lines = [empty_line]
@mod... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/unicode_width.rb | Ruby | mit | 20 | master | 2,678 | # frozen_string_literal: true
module Mui
# Utility module for calculating display width of Unicode characters
# CJK characters and some other characters are "wide" (2 cells)
module UnicodeWidth
class << self
# Returns the display width of a single character
def char_width(char)
return 0 i... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/command_context.rb | Ruby | mit | 20 | master | 2,720 | # frozen_string_literal: true
module Mui
# Provides plugin access to editor internals
class CommandContext
attr_reader :buffer, :window, :editor
def initialize(editor:, buffer:, window:)
@editor = editor
@buffer = buffer
@window = window
end
def cursor
{ line: @buffer.curs... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/plugin_manager.rb | Ruby | mit | 20 | master | 2,590 | # frozen_string_literal: true
require "bundler/inline"
module Mui
# Manages plugin lifecycle: loading, initialization, dependency resolution
class PluginManager
attr_reader :plugins, :loaded_plugins, :pending_gems
def initialize
@plugins = {} # Registered plugin definitions (DSL/class)
... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/insert_completion_state.rb | Ruby | mit | 20 | master | 2,206 | # frozen_string_literal: true
module Mui
# Manages Insert mode completion state for LSP completions
class InsertCompletionState
attr_reader :items, :selected_index, :prefix, :original_items
def initialize
@needs_clear = false
reset(set_needs_clear: false)
end
def reset(set_needs_clear... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/tab_page.rb | Ruby | mit | 20 | master | 729 | # frozen_string_literal: true
module Mui
# Represents a single tab page containing a window manager
# Each tab page has its own independent window layout
class TabPage
attr_reader :window_manager
attr_accessor :name
def initialize(screen, color_scheme: nil, name: nil)
@window_manager = WindowM... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/floating_window.rb | Ruby | mit | 20 | master | 5,689 | # frozen_string_literal: true
module Mui
# A floating window (popup) for displaying temporary content like hover info
class FloatingWindow
attr_reader :content, :row, :col, :width, :height, :last_bounds
attr_accessor :visible
def initialize(color_scheme)
@color_scheme = color_scheme
@conte... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_sequence_handler.rb | Ruby | mit | 20 | master | 4,790 | # frozen_string_literal: true
module Mui
# Main handler for multi-key sequence processing
# Integrates buffer, matcher, and timeout handling
class KeySequenceHandler
DEFAULT_TIMEOUT_MS = 1000
# Process result types
RESULT_HANDLED = :handled # Handler executed
RESULT_PENDING = :pending ... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/job_manager.rb | Ruby | mit | 20 | master | 2,385 | # frozen_string_literal: true
require "open3"
module Mui
# Manages asynchronous job execution and result collection
class JobManager
def initialize(autocmd: nil)
@autocmd = autocmd
@result_queue = Queue.new
@next_id = 0
@id_mutex = Mutex.new
@active_jobs = {}
@jobs_mutex = ... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/status_line_renderer.rb | Ruby | mit | 20 | master | 947 | # frozen_string_literal: true
module Mui
class StatusLineRenderer
def initialize(buffer, window, color_scheme)
@buffer = buffer
@window = window
@color_scheme = color_scheme
end
def render(screen, y_position)
full_status = format_status_line(build_status_text, build_position_text... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/line_renderer.rb | Ruby | mit | 20 | master | 5,328 | # frozen_string_literal: true
module Mui
class LineRenderer
def initialize(color_scheme)
@color_scheme = color_scheme
@highlighters = []
@resolved_styles = {} # Cache for resolved styles
end
def add_highlighter(highlighter)
@highlighters << highlighter
end
def render(scr... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/buffer_word_completer.rb | Ruby | mit | 20 | master | 2,379 | # frozen_string_literal: true
module Mui
# Collects words from buffer for completion
class BufferWordCompleter
# Minimum word length to include in completion
MIN_WORD_LENGTH = 2
# Maximum candidates to collect (for performance)
MAX_CANDIDATES = 50
def initialize(buffer)
@buffer = buffer
... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/color_manager.rb | Ruby | mit | 20 | master | 10,018 | # frozen_string_literal: true
module Mui
class ColorManager
# Standard 8 colors
COLOR_MAP = {
black: 0,
red: 1,
green: 2,
yellow: 3,
blue: 4,
magenta: 5,
cyan: 6,
white: 7
}.freeze
# 256-color palette extended colors
# Use https://www.ditig.com/256... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/screen.rb | Ruby | mit | 20 | master | 2,584 | # frozen_string_literal: true
module Mui
class Screen
attr_reader :width, :height
def initialize(adapter:, color_manager: nil)
@adapter = adapter
@color_manager = color_manager
@initialized_pairs = {}
@adapter.init
update_size
end
def refresh
update_size
@a... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/wrap_cache.rb | Ruby | mit | 20 | master | 704 | # frozen_string_literal: true
module Mui
# Caches wrap calculation results for performance
# Cache key: [line_content, width]
class WrapCache
def initialize
@cache = {}
end
def get(line, width)
key = cache_key(line, width)
@cache[key]
end
def set(line, width, result)
... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/input.rb | Ruby | mit | 20 | master | 232 | # frozen_string_literal: true
module Mui
class Input
def initialize(adapter:)
@adapter = adapter
end
def read
@adapter.getch
end
def read_nonblock
@adapter.getch_nonblock
end
end
end |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/editor.rb | Ruby | mit | 20 | master | 12,552 | # frozen_string_literal: true
module Mui
# Main editor class that coordinates all components
class Editor
attr_reader :tab_manager, :undo_manager, :autocmd, :command_registry, :job_manager, :color_scheme, :floating_window,
:insert_completion_state, :key_sequence_handler
attr_accessor :messa... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/mode_manager.rb | Ruby | mit | 20 | master | 5,687 | # frozen_string_literal: true
module Mui
# Manages editor mode state and transitions
class ModeManager
attr_reader :mode, :selection, :register, :undo_manager, :search_state, :search_input, :editor,
:last_visual_selection, :key_sequence_handler
def initialize(window:, buffer:, command_line... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/buffer_word_cache.rb | Ruby | mit | 20 | master | 3,661 | # frozen_string_literal: true
module Mui
# Caches words from buffer for fast completion
# Built once when entering Insert mode, updated incrementally on changes
class BufferWordCache
# Minimum word length to include in cache
MIN_WORD_LENGTH = 2
# Maximum candidates to return (for performance)
MAX... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/motion.rb | Ruby | mit | 20 | master | 3,880 | # frozen_string_literal: true
module Mui
module Motion
WORD_CHARS = /[a-zA-Z0-9_]/
class << self
# Basic movements
def left(_buffer, row, col)
col.positive? ? { row:, col: col - 1 } : nil
end
def right(buffer, row, col)
line = buffer.line(row)
col < line.size... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/command_registry.rb | Ruby | mit | 20 | master | 854 | # frozen_string_literal: true
module Mui
# Registry for Ex commands
class CommandRegistry
def initialize
@commands = {}
end
def register(name, &block)
@commands[name.to_sym] = block
end
def execute(name, context, *)
command = find(name)
raise UnknownCommandError, name ... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/insert_completion_renderer.rb | Ruby | mit | 20 | master | 2,711 | # frozen_string_literal: true
module Mui
# Renders completion popup for Insert mode (LSP completions)
class InsertCompletionRenderer
MAX_VISIBLE_ITEMS = 10
def initialize(screen, color_scheme)
@screen = screen
@color_scheme = color_scheme
end
def render(completion_state, cursor_row, c... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/command_line.rb | Ruby | mit | 20 | master | 4,614 | # frozen_string_literal: true
module Mui
class CommandLine
# Commands that accept file path arguments
FILE_COMMANDS = %w[e w sp split vs vsplit tabnew tabe tabedit].freeze
attr_reader :buffer, :cursor_pos, :history
def initialize(history: CommandHistory.new)
@buffer = ""
@cursor_pos = 0... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/plugin.rb | Ruby | mit | 20 | master | 628 | # frozen_string_literal: true
module Mui
# Base class for class-based plugins
class Plugin
class << self
attr_accessor :plugin_name, :plugin_dependencies
def name(n)
@plugin_name = n
end
def depends_on(*deps)
@plugin_dependencies = deps
end
end
def setup... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/undo_manager.rb | Ruby | mit | 20 | master | 1,559 | # frozen_string_literal: true
module Mui
# Manages undo/redo stacks for the editor
class UndoManager
MAX_STACK_SIZE = 1000
def initialize
@undo_stack = []
@redo_stack = []
@current_group = nil
end
# Record a single action
def record(action)
if @current_group
@c... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/window.rb | Ruby | mit | 20 | master | 7,080 | # frozen_string_literal: true
module Mui
class Window
# Threshold for using smart scroll jump (in logical rows)
SMART_JUMP_THRESHOLD = 100
attr_accessor :x, :y, :width, :height, :cursor_row, :cursor_col, :scroll_row
attr_reader :buffer
def initialize(buffer, x: 0, y: 0, width: 80, height: 24, c... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/tab_manager.rb | Ruby | mit | 20 | master | 1,926 | # frozen_string_literal: true
module Mui
# Manages multiple tab pages
# Each tab page has its own window layout
class TabManager
attr_reader :tabs, :current_index
def initialize(screen, color_scheme: nil)
@screen = screen
@color_scheme = color_scheme
@tabs = []
@current_index = 0... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/handler_result.rb | Ruby | mit | 20 | master | 2,626 | # frozen_string_literal: true
module Mui
module HandlerResult
# Base class for handler results with common attributes and default implementations
class Base
attr_reader :mode, :message
def initialize(mode: nil, message: nil, quit: false, pending_sequence: false)
@mode = mode
@mes... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/tab_bar_renderer.rb | Ruby | mit | 20 | master | 2,375 | # frozen_string_literal: true
module Mui
# Renders the tab bar at the top of the screen
class TabBarRenderer
TAB_BAR_HEIGHT = 1
SEPARATOR_HEIGHT = 1
TAB_SEPARATOR = " | "
SEPARATOR_CHAR = "─"
def initialize(tab_manager, color_scheme: nil)
@tab_manager = tab_manager
@color_scheme = ... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/autocmd.rb | Ruby | mit | 20 | master | 1,475 | # frozen_string_literal: true
module Mui
# Event-driven hook system for plugins
class Autocmd
EVENTS = %i[
BufEnter
BufLeave
BufWrite
BufWritePre
BufWritePost
ModeChanged
CursorMoved
TextChanged
InsertEnter
InsertLeave
InsertCompletion
Job... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_notation_parser.rb | Ruby | mit | 20 | master | 4,512 | # frozen_string_literal: true
require "strscan"
module Mui
# Parser for Vim-style key notation strings
# Converts notation like "<Leader>gd", "<C-x><C-s>", "<Space>w" to internal key arrays
module KeyNotationParser
# Special key mappings (case-insensitive)
SPECIAL_KEYS = {
"space" => " ",
"t... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/completion_state.rb | Ruby | mit | 20 | master | 1,115 | # frozen_string_literal: true
module Mui
# Manages completion popup state
class CompletionState
attr_reader :candidates, :selected_index, :original_input, :completion_type
def initialize
reset
end
def reset
@candidates = []
@selected_index = 0
@original_input = nil
@... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/highlight.rb | Ruby | mit | 20 | master | 490 | # frozen_string_literal: true
module Mui
class Highlight
attr_reader :start_col, :end_col, :style, :priority
def initialize(start_col:, end_col:, style:, priority:)
@start_col = start_col
@end_col = end_col
@style = style
@priority = priority
end
def overlaps?(other)
s... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/file_completer.rb | Ruby | mit | 20 | master | 1,158 | # frozen_string_literal: true
module Mui
# Provides file path completion
class FileCompleter
def complete(partial_path)
return list_current_directory if partial_path.empty?
dir, prefix = split_path(partial_path)
entries = list_directory(dir)
entries.filter_map do |entry|
forma... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/mode.rb | Ruby | mit | 20 | master | 259 | # frozen_string_literal: true
module Mui
module Mode
NORMAL = :normal
INSERT = :insert
COMMAND = :command
VISUAL = :visual
VISUAL_LINE = :visual_line
SEARCH_FORWARD = :search_forward
SEARCH_BACKWARD = :search_backward
end
end |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/themes/default.rb | Ruby | mit | 20 | master | 22,141 | # frozen_string_literal: true
module Mui
module Themes
def self.mui
scheme = ColorScheme.new("mui")
# Basic UI colors
scheme.define :normal, fg: :mui_fg, bg: :mui_bg
scheme.define :status_line, fg: :mui_fg, bg: :mui_status_bg
scheme.define :status_line_mode, fg: :mui_bg, bg: :mui_t... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/syntax/lexer_base.rb | Ruby | mit | 20 | master | 2,824 | # frozen_string_literal: true
module Mui
module Syntax
# Base class for language-specific lexers
# Subclasses should override token_patterns and optionally handle_multiline_state
class LexerBase
# Tokenize a single line of text
# TODO: Refactor to reduce complexity (Metrics/CyclomaticComplexi... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/syntax/token.rb | Ruby | mit | 20 | master | 1,237 | # frozen_string_literal: true
module Mui
module Syntax
# Represents a token identified by a lexer
# Tokens are immutable value objects
class Token
attr_reader :type, :start_col, :end_col, :text
# Token types:
# :keyword - language keywords (def, class, if, etc.)
# :string ... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/syntax/language_detector.rb | Ruby | mit | 20 | master | 2,871 | # frozen_string_literal: true
module Mui
module Syntax
# Detects programming language from file path and provides appropriate lexer
class LanguageDetector
# Map file extensions to language symbols
EXTENSION_MAP = {
".rb" => :ruby,
".ru" => :ruby,
".rake" => :ruby,
... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/syntax/token_cache.rb | Ruby | mit | 20 | master | 2,711 | # frozen_string_literal: true
module Mui
module Syntax
# Caches tokenization results on a per-line basis
# Handles multiline state propagation across lines
class TokenCache
# Number of lines to prefetch ahead/behind visible area
PREFETCH_LINES = 50
def initialize(lexer)
@lexer ... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/syntax/lexers/ruby_lexer.rb | Ruby | mit | 20 | master | 4,377 | # frozen_string_literal: true
module Mui
module Syntax
module Lexers
# Lexer for Ruby source code
class RubyLexer < LexerBase
KEYWORDS = %w[
BEGIN END __ENCODING__ __END__ __FILE__ __LINE__
alias and begin break case class def defined? do
else elsif end ensure fa... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/syntax/lexers/javascript_lexer.rb | Ruby | mit | 20 | master | 7,354 | # frozen_string_literal: true
module Mui
module Syntax
module Lexers
# Lexer for JavaScript source code
class JavaScriptLexer < LexerBase
# JavaScript keywords
KEYWORDS = %w[
async await break case catch class const continue debugger default
delete do else export e... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/syntax/lexers/html_lexer.rb | Ruby | mit | 20 | master | 3,567 | # frozen_string_literal: true
module Mui
module Syntax
module Lexers
# Lexer for HTML source files
class HtmlLexer < LexerBase
# Pre-compiled patterns with \G anchor for position-specific matching
COMPILED_PATTERNS = [
# HTML comment (single line)
[:comment, /\G<!-... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/syntax/lexers/go_lexer.rb | Ruby | mit | 20 | master | 6,751 | # frozen_string_literal: true
module Mui
module Syntax
module Lexers
# Lexer for Go source code
class GoLexer < LexerBase
# Go keywords
KEYWORDS = %w[
break case chan const continue default defer else fallthrough
for func go goto if import interface map package ran... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/syntax/lexers/rust_lexer.rb | Ruby | mit | 20 | master | 5,234 | # frozen_string_literal: true
module Mui
module Syntax
module Lexers
# Lexer for Rust source code
class RustLexer < LexerBase
# Rust keywords
KEYWORDS = %w[
as async await break const continue crate dyn else enum extern
false fn for if impl in let loop match mod mo... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/syntax/lexers/c_lexer.rb | Ruby | mit | 20 | master | 4,658 | # frozen_string_literal: true
module Mui
module Syntax
module Lexers
# Lexer for C source code
class CLexer < LexerBase
# Pre-compiled patterns with \G anchor for position-specific matching
# These are compiled once at class load time
COMPILED_PATTERNS = [
# Single l... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/syntax/lexers/css_lexer.rb | Ruby | mit | 20 | master | 4,018 | # frozen_string_literal: true
module Mui
module Syntax
module Lexers
# Lexer for CSS source files
class CssLexer < LexerBase
# Pre-compiled patterns with \G anchor for position-specific matching
COMPILED_PATTERNS = [
# Single-line block comment /* ... */ on one line
... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/syntax/lexers/markdown_lexer.rb | Ruby | mit | 20 | master | 5,937 | # frozen_string_literal: true
module Mui
module Syntax
module Lexers
# Lexer for Markdown source files
class MarkdownLexer < LexerBase
# Pre-compiled patterns with \G anchor for position-specific matching
# Markdown is line-oriented, so we check line-start patterns separately
... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/syntax/lexers/typescript_lexer.rb | Ruby | mit | 20 | master | 7,901 | # frozen_string_literal: true
module Mui
module Syntax
module Lexers
# Lexer for TypeScript source code
# Extends JavaScript with additional TypeScript-specific patterns
class TypeScriptLexer < LexerBase
# TypeScript keywords (JavaScript keywords + TypeScript-specific)
KEYWORDS ... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/highlighters/syntax_highlighter.rb | Ruby | mit | 20 | master | 3,149 | # frozen_string_literal: true
module Mui
module Highlighters
# Provides syntax highlighting based on language-specific lexers
class SyntaxHighlighter < Base
# Maps token types to ColorScheme style names
# Note: identifier and operator are excluded to reduce highlight count
# (they typically... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/highlighters/selection_highlighter.rb | Ruby | mit | 20 | master | 1,141 | # frozen_string_literal: true
module Mui
module Highlighters
class SelectionHighlighter < Base
def highlights_for(row, line, options = {})
selection = options[:selection]
return [] unless selection
range = selection.normalized_range
return [] if row < range[:start_row] || r... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/highlighters/search_highlighter.rb | Ruby | mit | 20 | master | 640 | # frozen_string_literal: true
module Mui
module Highlighters
class SearchHighlighter < Base
def highlights_for(row, _line, options = {})
search_state = options[:search_state]
buffer = options[:buffer]
return [] unless search_state&.has_pattern?
matches = search_state.matche... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/highlighters/base.rb | Ruby | mit | 20 | master | 467 | # frozen_string_literal: true
module Mui
module Highlighters
class Base
PRIORITY_SYNTAX = 100
PRIORITY_SELECTION = 200
PRIORITY_SEARCH = 300
def initialize(color_scheme)
@color_scheme = color_scheme
end
def highlights_for(_row, _line, _options = {})
raise Mui... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/terminal_adapter/curses.rb | Ruby | mit | 20 | master | 4,250 | # frozen_string_literal: true
require "curses"
module Mui
module TerminalAdapter
# Curses-based terminal adapter for production use
class Curses < Base
def init
::Curses.init_screen
::Curses.ESCDELAY = 10
::Curses.raw
::Curses.noecho
::Curses.curs_set(1)
... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/terminal_adapter/base.rb | Ruby | mit | 20 | master | 2,903 | # frozen_string_literal: true
module Mui
module TerminalAdapter
# Abstract base class for terminal adapters
class Base
attr_accessor :color_resolver
# Initialize terminal
def init
raise MethodNotOverriddenError, __method__
end
# Close terminal
def close
r... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_handler/window_command.rb | Ruby | mit | 20 | master | 2,611 | # frozen_string_literal: true
module Mui
module KeyHandler
class WindowCommand
def initialize(window_manager)
@window_manager = window_manager
end
def handle(key)
if key.is_a?(Integer)
result = handle_control_key(key)
return result if result
end
... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_handler/base.rb | Ruby | mit | 20 | master | 5,207 | # frozen_string_literal: true
require_relative "../error"
module Mui
module KeyHandler
class MethodNotOverriddenError < Mui::Error; end
# Base class for mode-specific key handlers
class Base
attr_accessor :mode_manager
def initialize(mode_manager, buffer)
@mode_manager = mode_manag... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_handler/visual_mode.rb | Ruby | mit | 20 | master | 11,809 | # frozen_string_literal: true
module Mui
module KeyHandler
# Handler for character-wise visual mode (v)
class VisualMode < Base
include Motions::MotionHandler
INDENT_PATTERN = [" ", "\t"].freeze
attr_reader :selection
def initialize(mode_manager, buffer, selection, register = nil, ... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_handler/insert_mode.rb | Ruby | mit | 20 | master | 10,674 | # frozen_string_literal: true
module Mui
module KeyHandler
# Handles key inputs in Insert mode
class InsertMode < Base
def initialize(mode_manager, buffer, undo_manager: nil, group_started: false)
super(mode_manager, buffer)
@undo_manager = undo_manager
# Start undo group unless... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_handler/search_mode.rb | Ruby | mit | 20 | master | 5,390 | # frozen_string_literal: true
module Mui
module KeyHandler
# Handles key inputs in Search mode (/ and ?)
class SearchMode < Base
attr_reader :completion_state
def initialize(mode_manager, buffer, search_input, search_state)
super(mode_manager, buffer)
@search_input = search_input... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_handler/command_mode.rb | Ruby | mit | 20 | master | 13,598 | # frozen_string_literal: true
module Mui
module KeyHandler
# Handles key inputs in Command mode
class CommandMode < Base
attr_reader :completion_state
def initialize(mode_manager, buffer, command_line)
super(mode_manager, buffer)
@command_line = command_line
@completion_s... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_handler/visual_line_mode.rb | Ruby | mit | 20 | master | 476 | # frozen_string_literal: true
module Mui
module KeyHandler
# Handler for line-wise visual mode (V)
class VisualLineMode < VisualMode
private
def handle_v_key
# v in visual line mode switches to visual mode
result(mode: Mode::VISUAL, toggle_line_mode: true)
end
def ha... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_handler/normal_mode.rb | Ruby | mit | 20 | master | 16,169 | # frozen_string_literal: true
module Mui
module KeyHandler
# Handles key inputs in Normal mode
class NormalMode < Base
include Motions::MotionHandler
def initialize(mode_manager, buffer, register = nil, undo_manager: nil, search_state: nil)
super(mode_manager, buffer)
@register =... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_handler/motions/motion_handler.rb | Ruby | mit | 20 | master | 1,465 | # frozen_string_literal: true
module Mui
module KeyHandler
module Motions
# Shared motion handling for NormalMode and VisualMode
# Provides common handle_* methods that delegate to Motion module
module MotionHandler
def handle_word_forward
apply_motion(Motion.word_forward(buff... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_handler/operators/delete_operator.rb | Ruby | mit | 20 | master | 5,965 | # frozen_string_literal: true
module Mui
module KeyHandler
module Operators
# Handles delete operator (d) in Normal mode
class DeleteOperator < BaseOperator
# Handle pending delete motion
def handle_pending(char, pending_register: nil)
@pending_register = pending_register
... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_handler/operators/paste_operator.rb | Ruby | mit | 20 | master | 3,960 | # frozen_string_literal: true
module Mui
module KeyHandler
module Operators
# Handles paste operator (p/P) in Normal mode
class PasteOperator < BaseOperator
# Paste after cursor (p)
def paste_after(pending_register: nil)
return :done if @register.empty?(name: pending_registe... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_handler/operators/yank_operator.rb | Ruby | mit | 20 | master | 4,033 | # frozen_string_literal: true
module Mui
module KeyHandler
module Operators
# Handles yank operator (y) in Normal mode
# Unlike delete/change, yank does not modify the buffer
class YankOperator < BaseOperator
# Handle pending yank motion
def handle_pending(char, pending_register... |
github | S-H-GAMELINKS/mui | https://github.com/S-H-GAMELINKS/mui | lib/mui/key_handler/operators/base_operator.rb | Ruby | mit | 20 | master | 4,703 | # frozen_string_literal: true
module Mui
module KeyHandler
module Operators
# Base class for operator implementations (delete, change, yank, paste)
# Provides common functionality for text extraction, deletion, and cursor management
class BaseOperator
def initialize(buffer:, window:, re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.