Skip to content

Commit

Permalink
Rename input variable
Browse files Browse the repository at this point in the history
  • Loading branch information
alexherbo2 committed Sep 19, 2021
1 parent 98d4b7c commit 92a5303
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 3 additions & 5 deletions src/kakoune/command-builder.cr
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Kakoune::CommandBuilder
alias Command = Array(String)

# Properties
property constructor = [] of Command
property input = [] of Command

# Creates a new builder.
def initialize
Expand All @@ -46,12 +46,12 @@ class Kakoune::CommandBuilder
end

def add(command : Command)
constructor.push(command)
input.push(command)
end

# Adds multiple commands.
def add(commands : Array(Command))
constructor.concat(commands)
input.concat(commands)
end

# Adds commands from a JSON stream.
Expand Down Expand Up @@ -90,8 +90,6 @@ class Kakoune::CommandBuilder

# Builds command.
def build
input = constructor.dup

Log.debug { input.to_json }

# Initialize the stack with the last set of arguments.
Expand Down
10 changes: 5 additions & 5 deletions src/kakoune/completion-builder.cr
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Kakoune::CompletionBuilder
property timestamp : Int32

# Constructor
property constructor = [] of Candidate
property input = [] of Candidate

# Creates a new builder.
def initialize(@name, @line, @column, @length, @timestamp)
Expand All @@ -37,12 +37,12 @@ class Kakoune::CompletionBuilder

# Adds a single candidate.
def add(text : String, command : Array(Command), menu : String)
constructor.push({ text, command, menu })
input.push({ text, command, menu })
end

# Adds multiple candidates.
def add(candidates : Array(Candidate))
constructor.concat(candidates)
input.concat(candidates)
end

# Adds candidates from a JSON stream.
Expand All @@ -52,12 +52,12 @@ class Kakoune::CompletionBuilder

# Builds the completion command.
def build
Log.debug { constructor.to_json }
Log.debug { input.to_json }

command = String.build do |string|
string << quote("set-option", "window", name, build_header(line, column, length, timestamp)) << " "

constructor.each do |text, select_command, menu_text|
input.each do |text, select_command, menu_text|
string << quote(build_candidate(text, select_command, menu_text)) << " "
end
end
Expand Down

0 comments on commit 92a5303

Please sign in to comment.