mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-20 15:35:03 +02:00
...
This commit is contained in:
@@ -20,7 +20,7 @@ const dnd_accepted_mimes = "text/plain text/uri-list"
|
|||||||
|
|
||||||
func dnd_escape(metadata, payload string) string {
|
func dnd_escape(metadata, payload string) string {
|
||||||
b := strings.Builder{}
|
b := strings.Builder{}
|
||||||
b.WriteString(fmt.Sprintf("\x1b]%d;", kitty.DndCode))
|
fmt.Fprintf(&b, "\x1b]%d;", kitty.DndCode)
|
||||||
b.WriteString(metadata)
|
b.WriteString(metadata)
|
||||||
if payload != "" {
|
if payload != "" {
|
||||||
b.WriteByte(';')
|
b.WriteByte(';')
|
||||||
@@ -319,7 +319,8 @@ func Run(args []string) (rc int, err error) {
|
|||||||
// Data response from terminal
|
// Data response from terminal
|
||||||
if payload == "" {
|
if payload == "" {
|
||||||
// End of data for current MIME type
|
// End of data for current MIME type
|
||||||
if dnd.collecting == "text/plain" {
|
switch dnd.collecting {
|
||||||
|
case "text/plain":
|
||||||
text := dnd.collect_buf.String()
|
text := dnd.collect_buf.String()
|
||||||
// Get first line
|
// Get first line
|
||||||
if before, _, ok := strings.Cut(text, "\n"); ok {
|
if before, _, ok := strings.Cut(text, "\n"); ok {
|
||||||
@@ -334,7 +335,7 @@ func Run(args []string) (rc int, err error) {
|
|||||||
lp.QueueWriteString(dnd_request_data("text/uri-list"))
|
lp.QueueWriteString(dnd_request_data("text/uri-list"))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
} else if dnd.collecting == "text/uri-list" {
|
case "text/uri-list":
|
||||||
text := dnd.collect_buf.String()
|
text := dnd.collect_buf.String()
|
||||||
dnd.collect_buf.Reset()
|
dnd.collect_buf.Reset()
|
||||||
// Parse URI list: lines starting with # are comments
|
// Parse URI list: lines starting with # are comments
|
||||||
|
|||||||
Reference in New Issue
Block a user