Skip to content

A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.

508 B
Raw Blame

title: wezterm.split_by_newlines tags: - utility - string

wezterm.split_by_newlines(str)

{{since('20200503-171512-b13ef15f')}}

This function takes the input string and splits it by newlines (both \n and \r\n are recognized as newlines) and returns the result as an array of strings that have the newlines removed.

local wezterm = require 'wezterm'

local example = 'hello\nthere\n'

for _, line in ipairs(wezterm.split_by_newlines(example)) do
  wezterm.log_error(line)
end