shithub: ft²

Download patch

ref: 3a734ed06d829dae5e48c0290a6d7269a117dba2
parent: 4dfccacdd7d6538d2073a020a1b7f7d1fb4bf774
author: Olav Sørensen <[email protected]>
date: Tue Dec 17 16:03:27 EST 2019

Quick fix for very recent v1.04 release

--- a/src/ft2_pattern_ed.c
+++ b/src/ft2_pattern_ed.c
@@ -1904,7 +1904,11 @@
 	uint16_t len = pattLens[editor.editPattern];
 
 	song.pattLen = len;
-	editor.pattPos = song.pattPos = CLAMP(song.pattPos, 0, len - 1);
+	if (song.pattPos >= len)
+	{
+		song.pattPos = len - 1;
+		editor.pattPos = song.pattPos;
+	}
 
 	checkMarkLimits();
 }
@@ -1911,22 +1915,44 @@
 
 void pbEditPattUp(void)
 {
-	if (editor.editPattern == 255)
-		return;
+	if (songPlaying)
+	{
+		if (song.pattNr == 255)
+			return;
+	}
+	else
+	{
+		if (editor.editPattern == 255)
+			return;
+	}
 
 	bool audioWasntLocked = !audio.locked;
 	if (audioWasntLocked)
 		lockAudio();
 
-	if (editor.editPattern < 255)
+	if (songPlaying)
 	{
-		editor.editPattern++;
+		if (song.pattNr < 255)
+		{
+			song.pattNr++;
+			updatePtnLen();
 
-		song.pattNr = editor.editPattern;
-		updatePtnLen();
+			editor.ui.updatePatternEditor = true;
+			editor.ui.updatePosSections = true;
+		}
+	}
+	else
+	{
+		if (editor.editPattern < 255)
+		{
+			editor.editPattern++;
 
-		editor.ui.updatePatternEditor = true;
-		editor.ui.updatePosSections = true;
+			song.pattNr = editor.editPattern;
+			updatePtnLen();
+
+			editor.ui.updatePatternEditor = true;
+			editor.ui.updatePosSections = true;
+		}
 	}
 
 	if (audioWasntLocked)
@@ -1935,22 +1961,44 @@
 
 void pbEditPattDown(void)
 {
-	if (editor.editPattern == 0)
-		return;
+	if (songPlaying)
+	{
+		if (song.pattNr == 0)
+			return;
+	}
+	else
+	{
+		if (editor.editPattern == 0)
+			return;
+	}
 
 	bool audioWasntLocked = !audio.locked;
 	if (audioWasntLocked)
 		lockAudio();
 
-	if (editor.editPattern > 0)
+	if (songPlaying)
 	{
-		editor.editPattern--;
+		if (song.pattNr > 0)
+		{
+			song.pattNr--;
+			updatePtnLen();
 
-		song.pattNr = editor.editPattern;
-		updatePtnLen();
+			editor.ui.updatePatternEditor = true;
+			editor.ui.updatePosSections = true;
+		}
+	}
+	else
+	{
+		if (editor.editPattern > 0)
+		{
+			editor.editPattern--;
 
-		editor.ui.updatePatternEditor = true;
-		editor.ui.updatePosSections = true;
+			song.pattNr = editor.editPattern;
+			updatePtnLen();
+
+			editor.ui.updatePatternEditor = true;
+			editor.ui.updatePosSections = true;
+		}
 	}
 
 	if (audioWasntLocked)