mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 18:44:30 -07:00
feat: preserve EOL in files (#16087)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com> Co-authored-by: Jack Wotherspoon <jackwoth@google.com>
This commit is contained in:
@@ -54,6 +54,17 @@ export function isBinary(
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects the line ending style of a string.
|
||||
* @param content The string content to analyze.
|
||||
* @returns '\r\n' for Windows-style, '\n' for Unix-style.
|
||||
*/
|
||||
export function detectLineEnding(content: string): '\r\n' | '\n' {
|
||||
// If a Carriage Return is found, assume Windows-style endings.
|
||||
// This is a simple but effective heuristic.
|
||||
return content.includes('\r\n') ? '\r\n' : '\n';
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncates a string to a maximum length, appending a suffix if truncated.
|
||||
* @param str The string to truncate.
|
||||
|
||||
Reference in New Issue
Block a user