mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 16:37:27 +00:00
choose-files kitten: Output a trailing newline when writing to a tty in text format
Fixes #9982
This commit is contained in:
parent
fc8a41c93e
commit
5de8734ce3
3 changed files with 14 additions and 7 deletions
|
|
@ -262,6 +262,8 @@ Detailed list of changes
|
|||
|
||||
- Linux: Workaround bug in Nvidia drivers that caused color corruption when resuming after suspend (:iss:`9844`)
|
||||
|
||||
- choose-files kitten: Output a trailing newline when writing to a tty in text format (:iss:`9982`)
|
||||
|
||||
|
||||
0.46.2 [2026-03-21]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
|||
|
|
@ -903,6 +903,10 @@ func main(_ *cli.Command, opts *Options, args []string) (rc int, err error) {
|
|||
m = string(b)
|
||||
}
|
||||
os.Stdout.Write(utils.UnsafeStringToBytes(m))
|
||||
if tty.IsTerminal(os.Stdout.Fd()) && opts.OutputFormat == "text" {
|
||||
// Avoid zsh's silly no trailing newline marker
|
||||
os.Stdout.WriteString("\n")
|
||||
}
|
||||
if opts.WriteOutputTo != "" {
|
||||
os.WriteFile(opts.WriteOutputTo, utils.UnsafeStringToBytes(m), 0600)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ def handle_result(args: list[str], data: dict[str, Any], target_window_id: int,
|
|||
usage = '[directory to start choosing files in]'
|
||||
|
||||
|
||||
OPTIONS = '''
|
||||
OPTIONS = """
|
||||
--mode
|
||||
type=choices
|
||||
choices=file,files,save-file,dir,save-dir,dirs,save-files
|
||||
|
|
@ -266,11 +266,12 @@ Path to a file to which the output is written in addition to STDOUT.
|
|||
--output-format
|
||||
choices=text,json,shell,shell-relative
|
||||
default=text
|
||||
The format in which to write the output. The :code:`text` format is absolute paths separated by newlines.
|
||||
The :code:`shell` format is quoted absolute paths separated by spaces, quoting is done only if needed. The
|
||||
:code:`shell-relative` format is the same as :code:`shell` except it returns paths relative to the starting
|
||||
directory. Note that when invoked from a mapping, this option is ignored,
|
||||
and either text or shell format is used automatically based on whether the cursor is at a shell prompt or not.
|
||||
The format in which to write the output. The :code:`text` format is absolute paths separated by newlines,
|
||||
with a trailing newline. The :code:`shell` format is quoted absolute paths separated by spaces,
|
||||
quoting is done only if needed. The :code:`shell-relative` format is the same as :code:`shell` except that
|
||||
it returns paths relative to the starting directory. Note that when invoked from a mapping,
|
||||
this option is ignored, and either text or shell format is used automatically based on whether
|
||||
the cursor is at a shell prompt or not.
|
||||
|
||||
|
||||
--write-pid-to
|
||||
|
|
@ -280,7 +281,7 @@ Path to a file to which to write the process ID (PID) of this process to.
|
|||
--clear-cache
|
||||
type=bool-set
|
||||
Clear the caches used by this kitten.
|
||||
'''.format(config_help=CONFIG_HELP.format(conf_name='choose-files', appname=appname)).format
|
||||
""".format(config_help=CONFIG_HELP.format(conf_name='choose-files', appname=appname)).format
|
||||
|
||||
|
||||
help_text = '''\
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue