interact.select_buffer
displays a list of active buffers
local buflist
within_command_line (-> interact.select_buffer :editor), (command_line) ->
  buflist = list_items command_line, 2
assert.same {'a1-buffer', 'a2-buffer', 'b-buffer', 'c-buffer'}, buflist
filters the buffer list based on entered text
local buflist
within_command_line  (-> interact.select_buffer :editor), (command_line) ->
  command_line\write 'a-b'
  buflist = list_items command_line, 2
assert.same {'a1-buffer', 'a2-buffer'}, buflist
previews currently selected buffer in the editor
previews = {}
down_event = {
  key_code: 65364
  key_name: 'down'
  alt: false
  control: false
  meta: false
  shift: false
  super: false
}
within_command_line  (-> interact.select_buffer :editor), (command_line) ->
  table.insert previews, preview_title
  command_line\handle_keypress down_event
  table.insert previews, preview_title
assert.same {'a1-buffer', 'a2-buffer'}, previews
(sending binding_for("buffer-close"))
keymap = ctrl_w: 'buffer-close'
before_each -> bindings.push keymap
after_each -> bindings.remove keymap
close_event = {
  alt: false,
  character: "w",
  control: true,
  key_code: 119,
  key_name: "w",
  meta: false,
  shift: false,
  super: false
}
closes selected buffer
local buflist
within_command_line  (-> interact.select_buffer :editor), (command_line) ->
  command_line\handle_keypress close_event
  command_line\handle_keypress close_event
  buflist = list_items command_line, 2
assert.same {'b-buffer', 'c-buffer'}, buflist
preserves filter
local buflist
within_command_line  (-> interact.select_buffer :editor), (command_line) ->
  command_line\write 'a-b'
  command_line\handle_keypress close_event
  buflist = list_items command_line, 2
assert.same {'a2-buffer'}, buflist
 
(duplicate filenames)
before_each ->
  for b in *app.buffers
    app\close_buffer b
  paths = {'/project1/some/file1', '/project2/some/file1', '/project2/path1/file2', '/project2/path2/file2'}
  for path in *paths
    b = app\new_buffer!
    b.file = File path
  Project.add_root File '/project1'
  Project.add_root File '/project2'
uniquifies title by using project name and parent directory prefix
local buflist
within_command_line  (-> interact.select_buffer :editor), (command_line) ->
  buflist = list_items command_line, 2
assert.same {'file1 [project1]', 'file1 [project2]', 'path1/file2', 'path2/file2'}, buflist