diff --git a/src/Commands/QueryStashes.cs b/src/Commands/QueryStashes.cs index b4067aaf..cbc19bae 100644 --- a/src/Commands/QueryStashes.cs +++ b/src/Commands/QueryStashes.cs @@ -7,9 +7,11 @@ namespace SourceGit.Commands { public QueryStashes(string repo) { + _boundary = $"-----BOUNDARY_OF_COMMIT{Guid.NewGuid()}-----"; + WorkingDirectory = repo; Context = repo; - Args = "stash list --format=%H%n%P%n%ct%n%gd%n%s"; + Args = $"stash list --no-show-signature --format=\"%H%n%P%n%ct%n%gd%n%B%n{_boundary}\""; } public List Result() @@ -41,22 +43,32 @@ namespace SourceGit.Commands case 3: _current.Name = line; break; - case 4: - _current.Message = line; + default: + var boundary = rs.StdOut.IndexOf(_boundary, end + 1, StringComparison.Ordinal); + if (boundary > end) + { + _current.Message = rs.StdOut.Substring(start, boundary - start - 1); + end = boundary + _boundary.Length; + } + else + { + _current.Message = rs.StdOut.Substring(start); + end = rs.StdOut.Length - 2; + } + + nextPartIdx = -1; break; } nextPartIdx++; - if (nextPartIdx > 4) - nextPartIdx = 0; start = end + 1; + if (start >= rs.StdOut.Length - 1) + break; + end = rs.StdOut.IndexOf('\n', start); } - if (start < rs.StdOut.Length) - _current.Message = rs.StdOut.Substring(start); - return outs; } @@ -69,5 +81,6 @@ namespace SourceGit.Commands } private Models.Stash _current = null; + private readonly string _boundary; } } diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index fc596da5..c26fcd4d 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -461,6 +461,7 @@ Vor {0} Monaten Vor {0} Jahren Gestern + Verwende 'Shift+Enter' um eine neue Zeile einzufügen. 'Enter' ist das Kürzel für den OK Button Einstellungen OPEN AI Analysierung des Diff Befehl @@ -643,7 +644,6 @@ Commit: Commit Änderungen rückgängig machen Commit Nachricht umformulieren - Verwende 'Shift+Enter' um eine neue Zeile einzufügen. 'Enter' ist das Kürzel für den OK Button Bitte warten... SPEICHERN Speichern als... @@ -671,7 +671,7 @@ Stash Inklusive nicht-verfolgter Dateien Name: - Optional. Name dieses Stashes + Optional. Informationen zu dieses Stashes Nur gestagte Änderungen Gestagte und unstagte Änderungen der ausgewähleten Datei(en) werden gestasht!!! Lokale Änderungen stashen diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 8c5d1118..5ce5ebea 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -476,6 +476,7 @@ {0} years ago Yesterday Preferences + Use 'Shift+Enter' to input a new line. 'Enter' is the hotkey of OK button AI Analyze Diff Prompt API Key @@ -663,7 +664,6 @@ Commit: Commit revert changes Reword Commit Message - Use 'Shift+Enter' to input a new line. 'Enter' is the hotkey of OK button Running. Please wait... SAVE Save As... @@ -689,10 +689,10 @@ Private SSH key store path START Stash - Selected Changes: Include untracked files Message: - Optional. Name of this stash + Optional. Message of this stash + Mode: Only staged changes Both staged and unstaged changes of selected file(s) will be stashed!!! Stash Local Changes diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index 616799a4..ebf4f4aa 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -478,6 +478,7 @@ Hace {0} meses Hace {0} años Ayer + Usa 'Shift+Enter' para introducir una nueva línea. 'Enter' es el atajo del botón OK Preferencias OPEN AI Analizar Diff Prompt @@ -666,7 +667,6 @@ Commit: Commit revertir cambios Reescribir Mensaje de Commit - Usa 'Shift+Enter' para introducir una nueva línea. 'Enter' es el atajo del botón OK Ejecutando. Por favor espera... GUARDAR Guardar Como... @@ -694,7 +694,7 @@ Stash Incluir archivos no rastreados Mensaje: - Opcional. Nombre de este stash + Opcional. Información de este stash Solo cambios staged ¡Tanto los cambios staged como los no staged de los archivos seleccionados serán stashed! Stash Cambios Locales diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index f3ff7f25..14241cf8 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -444,6 +444,7 @@ il y a {0} mois il y a {0} ans Hier + Utiliser 'Maj+Entrée' pour insérer une nouvelle ligne. 'Entrée' est la touche pour valider Préférences IA Analyser Diff Prompt @@ -619,7 +620,6 @@ Commit : Commit les changements de l'annulation Reformuler le message de commit - Utiliser 'Maj+Entrée' pour insérer une nouvelle ligne. 'Entrée' est la touche pour valider En exécution. Veuillez patienter... SAUVEGARDER Sauvegarder en tant que... @@ -647,7 +647,7 @@ Stash Inclure les fichiers non-suivis Message : - Optionnel. Nom de ce stash + Optionnel. Information de ce stash Seulement les changements indexés Les modifications indexées et non-indexées des fichiers sélectionnés seront stockées!!! Stash les changements locaux diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml index ea9c2c3f..c2072ba5 100644 --- a/src/Resources/Locales/it_IT.axaml +++ b/src/Resources/Locales/it_IT.axaml @@ -464,6 +464,7 @@ {0} mesi fa {0} anni fa Ieri + Usa 'Shift+Enter' per inserire una nuova riga. 'Enter' è il tasto rapido per il pulsante OK Preferenze AI Analizza il Prompt Differenza @@ -647,7 +648,6 @@ Commit: Commit delle modifiche di ripristino Modifica Messaggio di Commit - Usa 'Shift+Enter' per inserire una nuova riga. 'Enter' è il tasto rapido per il pulsante OK In esecuzione. Attendere... SALVA Salva come... @@ -675,7 +675,7 @@ Stasha Includi file non tracciati Messaggio: - Opzionale. Nome di questo stash + Opzionale. Informazioni di questo stash Solo modifiche in stage Sia le modifiche in stage che quelle non in stage dei file selezionati saranno stashate!!! Stasha Modifiche Locali diff --git a/src/Resources/Locales/ja_JP.axaml b/src/Resources/Locales/ja_JP.axaml index 635e5a1d..8da546cb 100644 --- a/src/Resources/Locales/ja_JP.axaml +++ b/src/Resources/Locales/ja_JP.axaml @@ -443,6 +443,7 @@ {0} ヶ月前 {0} 年前 昨日 + 改行には'Shift+Enter'キーを使用します。 'Enter"はOKボタンのホットキーとして機能します。 設定 AI 差分分析プロンプト @@ -617,7 +618,6 @@ コミット: コミットの変更を戻す コミットメッセージを書き直す - 改行には'Shift+Enter'キーを使用します。 'Enter"はOKボタンのホットキーとして機能します。 実行中です。しばらくお待ちください... 保存 名前を付けて保存... @@ -645,7 +645,7 @@ スタッシュ 追跡されていないファイルを含める メッセージ: - オプション. このスタッシュの名前を入力 + オプション. このスタッシュの情報 ステージされた変更のみ 選択したファイルの、ステージされた変更とステージされていない変更の両方がスタッシュされます!!! ローカルの変更をスタッシュ diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index 4e65a2b8..8b3a5d04 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -406,6 +406,7 @@ {0} meses atrás {0} anos atrás Ontem + Use 'Shift+Enter' para inserir uma nova linha. 'Enter' é a tecla de atalho do botão OK Preferências INTELIGÊNCIA ARTIFICIAL Prompt para Analisar Diff @@ -563,7 +564,6 @@ Commit: Commitar alterações de reversão Reescrever Mensagem do Commit - Use 'Shift+Enter' para inserir uma nova linha. 'Enter' é a tecla de atalho do botão OK Executando. Por favor, aguarde... SALVAR Salvar Como... @@ -586,7 +586,7 @@ Stash Incluir arquivos não rastreados Mensagem: - Opcional. Nome deste stash + Opcional. Informações deste stash Apenas mudanças em stage Tanto mudanças em stage e fora de stage dos arquivos selecionados serão enviadas para stash!!! Guardar Alterações Locais diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index b1656631..cce18629 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -476,6 +476,7 @@ {0} месяцев назад {0} лет назад Вчера + Используйте «Shift+Enter» для ввода новой строки. «Enter» - это горячая клавиша кнопки «OK» Параметры ОТКРЫТЬ ИИ Запрос на анализ сравнения @@ -664,7 +665,6 @@ Ревизия: Отмена ревизии Изменить комментарий ревизии - Используйте «Shift+Enter» для ввода новой строки. «Enter» - это горячая клавиша кнопки «OK» Запуск. Подождите пожалуйста... СОХРАНИТЬ Сохранить как... diff --git a/src/Resources/Locales/ta_IN.axaml b/src/Resources/Locales/ta_IN.axaml index 18f86d78..ec102f19 100644 --- a/src/Resources/Locales/ta_IN.axaml +++ b/src/Resources/Locales/ta_IN.axaml @@ -443,6 +443,7 @@ {0} திங்களுக்கு முன்பு {0} ஆண்டுகளுக்கு முன்பு நேற்று + புதிய வரியை உள்ளிட 'உயர்த்து+நுழை' ஐப் பயன்படுத்தவும். 'நுழை' என்பது சரி பொத்தானின் சூடானவிசை ஆகும் விருப்பத்தேர்வுகள் செநு வேறுபாடு உடனடியாக பகுப்பாய்வு செய் @@ -618,7 +619,6 @@ உறுதிமொழி: பின்வாங்கு மாற்றங்களை உறுதிமொழி மாறுசொல் உறுதிமொழி செய்தி - புதிய வரியை உள்ளிட 'உயர்த்து+நுழை' ஐப் பயன்படுத்தவும். 'நுழை' என்பது சரி பொத்தானின் சூடானவிசை ஆகும் இயங்குகிறது. காத்திருக்கவும்... சேமி எனச் சேமி... diff --git a/src/Resources/Locales/uk_UA.axaml b/src/Resources/Locales/uk_UA.axaml index 169e8d68..ad3b8259 100644 --- a/src/Resources/Locales/uk_UA.axaml +++ b/src/Resources/Locales/uk_UA.axaml @@ -448,6 +448,7 @@ {0} місяців тому {0} років тому Вчора + Використовуйте 'Shift+Enter' для введення нового рядка. 'Enter' - гаряча клавіша кнопки OK Налаштування AI Промпт для аналізу різниці @@ -623,7 +624,6 @@ Коміт: Закомітити зміни скасування Змінити повідомлення коміту - Використовуйте 'Shift+Enter' для введення нового рядка. 'Enter' - гаряча клавіша кнопки OK Виконується. Будь ласка, зачекайте... ЗБЕРЕГТИ Зберегти як... diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index ef984806..6adf1c9f 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -479,6 +479,7 @@ {0}个月前 {0}年前 昨天 + 请使用Shift+Enter换行。Enter键已被【确 定】按钮占用。 偏好设置 AI Analyze Diff Prompt @@ -667,7 +668,6 @@ 目标提交 : 回滚后提交更改 编辑提交信息 - 请使用Shift+Enter换行。Enter键已被【确 定】按钮占用。 执行操作中,请耐心等待... 保 存 另存为... @@ -693,10 +693,10 @@ SSH密钥文件 开 始 贮藏(stash) - 已选择变更 : 包含未跟踪的文件 信息 : - 选填,用于命名此贮藏 + 选填,此贮藏的描述信息 + 模式 : 仅贮藏暂存区的变更 选中文件的所有变更均会被贮藏! 贮藏本地变更 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 52ee5648..47b4de20 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -479,6 +479,7 @@ {0} 個月前 {0} 年前 昨天 + 請使用 Shift + Enter 換行。Enter 鍵已被 [確定] 按鈕佔用。 偏好設定 AI 分析變更差異提示詞 @@ -667,7 +668,6 @@ 目標提交: 復原後提交變更 編輯提交訊息 - 請使用 Shift + Enter 換行。Enter 鍵已被 [確定] 按鈕佔用。 執行操作中,請耐心等待... 儲存 另存新檔... @@ -693,10 +693,10 @@ SSH 金鑰檔案 開 始 擱置變更 (stash) - 選定變更: 包含未追蹤的檔案 擱置變更訊息: - 選填,用於命名此擱置變更 + 選填,用於描述此擱置變更 + 操作模式: 僅擱置已暫存的變更 已選取的檔案中的變更均會被擱置! 擱置本機變更 diff --git a/src/Views/ChangeStatusIcon.cs b/src/Views/ChangeStatusIcon.cs index ecb1929b..4cbbf0a6 100644 --- a/src/Views/ChangeStatusIcon.cs +++ b/src/Views/ChangeStatusIcon.cs @@ -54,8 +54,8 @@ namespace SourceGit.Views var color = COLOR[idx]; var hsl = color.ToHsl(); var color2 = ActualThemeVariant == ThemeVariant.Dark - ? new HslColor(hsl.A, hsl.H,hsl.S, hsl.L - 0.1).ToRgb() - : new HslColor(hsl.A, hsl.H,hsl.S, hsl.L + 0.1).ToRgb(); + ? new HslColor(hsl.A, hsl.H, hsl.S, hsl.L - 0.1).ToRgb() + : new HslColor(hsl.A, hsl.H, hsl.S, hsl.L + 0.1).ToRgb(); var background = new LinearGradientBrush { diff --git a/src/Views/Reword.axaml b/src/Views/Reword.axaml index 3ea1ad98..3abbd81b 100644 --- a/src/Views/Reword.axaml +++ b/src/Views/Reword.axaml @@ -21,7 +21,7 @@ diff --git a/src/Views/Squash.axaml b/src/Views/Squash.axaml index 30755bae..30915029 100644 --- a/src/Views/Squash.axaml +++ b/src/Views/Squash.axaml @@ -31,7 +31,7 @@ diff --git a/src/Views/StashChanges.axaml b/src/Views/StashChanges.axaml index 148fc489..5422966f 100644 --- a/src/Views/StashChanges.axaml +++ b/src/Views/StashChanges.axaml @@ -12,23 +12,12 @@ - + - - - - + + + + - + + - - FontFamilyProperty = + AvaloniaProperty.Register(nameof(FontFamily)); + + public FontFamily FontFamily + { + get => GetValue(FontFamilyProperty); + set => SetValue(FontFamilyProperty, value); + } + + public static readonly StyledProperty FontSizeProperty = + AvaloniaProperty.Register(nameof(FontSize), 13); + + public double FontSize + { + get => GetValue(FontSizeProperty); + set => SetValue(FontSizeProperty, value); + } + + public static readonly StyledProperty ForegroundProperty = + AvaloniaProperty.Register(nameof(Foreground), Brushes.White); + + public IBrush Foreground + { + get => GetValue(ForegroundProperty); + set => SetValue(ForegroundProperty, value); + } + + public static readonly StyledProperty PrefixBackgroundProperty = + AvaloniaProperty.Register(nameof(PrefixBackground), Brushes.Transparent); + + public IBrush PrefixBackground + { + get => GetValue(PrefixBackgroundProperty); + set => SetValue(PrefixBackgroundProperty, value); + } + + public static readonly StyledProperty MessageProperty = + AvaloniaProperty.Register(nameof(Message)); + + public string Message + { + get => GetValue(MessageProperty); + set => SetValue(MessageProperty, value); + } + + public override void Render(DrawingContext context) + { + base.Render(context); + + var message = Message ?? string.Empty; + if (string.IsNullOrEmpty(message)) + return; + + var subjectIdx = message.IndexOf('\n', StringComparison.Ordinal); + var subject = subjectIdx > 0 ? message.Substring(0, subjectIdx).Trim() : message; + + var typeface = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Normal); + var foreground = Foreground; + var x = 0.0; + var h = Bounds.Height; + var prefix = null as FormattedText; + + var match = REG_KEYWORD_ON().Match(subject); + if (match.Success) + { + prefix = new FormattedText(match.Groups[1].Value, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, typeface, 11, foreground); + subject = subject.Substring(match.Length); + } + else + { + match = REG_KEYWORD_WIP().Match(subject); + if (match.Success) + { + prefix = new FormattedText($"WIP | {match.Groups[1].Value}", CultureInfo.CurrentCulture, FlowDirection.LeftToRight, typeface, 11, foreground); + subject = subject.Substring(match.Length); + } + } + + if (prefix != null) + { + var pw = prefix.WidthIncludingTrailingWhitespace; + var ph = prefix.Height; + var bh = ph + 4; + var bw = pw + 12; + + context.DrawRectangle(PrefixBackground, null, new RoundedRect(new Rect(0, (h - bh) * 0.5, bw, bh), new CornerRadius(bh * 0.5))); + context.DrawText(prefix, new Point(6, (h - ph) * 0.5)); + x = bw + 4; + } + + var body = new FormattedText(subject, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, typeface, FontSize, foreground); + context.DrawText(body, new Point(x, (h - body.Height) * 0.5)); + } + + protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) + { + base.OnPropertyChanged(change); + + if (change.Property == MessageProperty || + change.Property == FontFamilyProperty || + change.Property == FontSizeProperty || + change.Property == ForegroundProperty || + change.Property == PrefixBackgroundProperty) + { + InvalidateVisual(); + } + } + + protected override Size MeasureOverride(Size availableSize) + { + var typeface = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Normal); + var test = new FormattedText("fgl|", CultureInfo.CurrentCulture, FlowDirection.LeftToRight, typeface, FontSize, Brushes.White); + var h = Math.Max(18, test.Height); + return new Size(availableSize.Width, h); + } + + [GeneratedRegex(@"^On ([^\s]+)\: ")] + private static partial Regex REG_KEYWORD_ON(); + + [GeneratedRegex(@"^WIP on ([^\s]+)\: ([a-f0-9]{6,40}) ")] + private static partial Regex REG_KEYWORD_WIP(); + } +} diff --git a/src/Views/StashesPage.axaml b/src/Views/StashesPage.axaml index daa1ccc7..f5aa6ddd 100644 --- a/src/Views/StashesPage.axaml +++ b/src/Views/StashesPage.axaml @@ -95,7 +95,12 @@ - +