mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-09-24 15:49:09 +00:00
a21970a278
Extracts the logic for normalizing line endings (CRLF to LF) during clipboard paste operations into a shared utility function. This improves code reusability and consistency across different paste mechanisms, ensuring that pasted content always uses Unix-style line endings and prevents issues like extra blank lines in the terminal.
15 lines
483 B
TypeScript
Executable File
15 lines
483 B
TypeScript
Executable File
import { type ClassValue, clsx } from "clsx"
|
|
import { twMerge } from "tailwind-merge"
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs))
|
|
}
|
|
|
|
/**
|
|
* Normalize line endings to LF (Unix style).
|
|
* Converts CRLF (Windows) and standalone CR (old Mac) to LF.
|
|
* Used for clipboard paste operations in terminal to avoid extra blank lines.
|
|
*/
|
|
export function normalizeLineEndings(text: string): string {
|
|
return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
} |