Skip to content

Commit

Permalink
Merge pull request #1220 from oxygen-dioxide/textbox-undo
Browse files Browse the repository at this point in the history
Fix several bugs on pressing Ctrl+Z in TextBoxes
  • Loading branch information
stakira authored Jul 24, 2024
2 parents 4e89df7 + 24fe572 commit 2ffaa92
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 4 additions & 1 deletion OpenUtau.Core/Util/SplitLyrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ public static class SplitLyrics {
@"\p{IsCJKUnifiedIdeographs}|\p{IsHiragana}|\p{IsKatakana}|\p{IsHangulSyllables}");
static Regex contracted = new Regex(@"[ゃゅょぁぃぅぇぉャュョァィゥェォ]");

public static List<string> Split(string text) {
public static List<string> Split(string? text) {
if(text == null){
return new List<string>();
}
var lyrics = new List<string>();
var builder = new StringBuilder();
var etor = StringInfo.GetTextElementEnumerator(text);
Expand Down
2 changes: 1 addition & 1 deletion OpenUtau/ViewModels/LyricsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace OpenUtau.App.ViewModels {
class LyricsViewModel : ViewModelBase {
[Reactive] public string Text { get; set; }
[Reactive] public string? Text { get; set; }
[Reactive] public int CurrentCount { get; set; }
[Reactive] public int TotalCount { get; set; }
[Reactive] public int MaxCount { get; set; }
Expand Down
5 changes: 4 additions & 1 deletion OpenUtau/ViewModels/NoteDefaultsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace OpenUtau.App.ViewModels {
class NoteDefaultsViewModel : ViewModelBase {

[Reactive] public string DefaultLyric { get; set; }
[Reactive] public string? DefaultLyric { get; set; }
[Reactive] public int CurrentPortamentoLength { get; set; }
[Reactive] public int CurrentPortamentoStart { get; set; }
[Reactive] public float CurrentVibratoLength { get; set; }
Expand Down Expand Up @@ -57,6 +57,9 @@ public NoteDefaultsViewModel() {

this.WhenAnyValue(vm => vm.DefaultLyric)
.Subscribe(defaultLyric => {
if(defaultLyric == null){
return;
}
NotePresets.Default.DefaultLyric = defaultLyric;
NotePresets.Save();
});
Expand Down
4 changes: 2 additions & 2 deletions OpenUtau/ViewModels/PhoneticAssistantViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public G2pOption(Type klass) {
public List<G2pOption> G2ps => g2ps;

[Reactive] public G2pOption? G2p { get; set; }
[Reactive] public string Grapheme { get; set; }
[Reactive] public string? Grapheme { get; set; }
[Reactive] public string Phonemes { get; set; }

private readonly List<G2pOption> g2ps = new List<G2pOption>() {
Expand Down Expand Up @@ -57,7 +57,7 @@ public PhoneticAssistantViewModel() {
}

private void Refresh() {
if (g2p == null) {
if (Grapheme == null || g2p == null) {
Phonemes = string.Empty;
return;
}
Expand Down

0 comments on commit 2ffaa92

Please sign in to comment.