From 98f9880a73c3fa8026023fe29e3e40ae63030e45 Mon Sep 17 00:00:00 2001
From: pompolic <pompolic@special-circumstanc.es>
Date: Fri, 7 Oct 2022 15:45:54 +0200
Subject: [PATCH] Fix off by one in display

The code was meant to leave the first row empty for the text, but ended up drawing the "histogram" one row shorter
---
 gdb-port/top-level-parse.py | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/gdb-port/top-level-parse.py b/gdb-port/top-level-parse.py
index 923a68d..43cb512 100644
--- a/gdb-port/top-level-parse.py
+++ b/gdb-port/top-level-parse.py
@@ -408,21 +408,19 @@ class TopLevelParse:
 			#print(tokenmap_values)
 			#print("len(active_tokens): ", len(active_tokens), "i: ", i)
 			#print(active_tokens)
-			for j in range(1,len(active_tokens)):
+			for j in range(0,len(active_tokens)):
 				#print("j:", j, "j-1:", j-1)
 				#print("token_start:", active_tokens[j-1]["start"], "token_end:", active_tokens[j-1]["end"])
 				#print("i,j:", i, ",", j)
-				if j < len(active_tokens):
-					charbuf[j-1][i] = 'X'
-				else:
-					try:
-						charbuf[j-1][i] = '_'
-					except IndexError as ie:
-						print("len(charbuf):", len(charbuf), "j: ", j)
-						print("len(charbuf[0]):", len(charbuf[0]), "i: ", i)
-						print("end: ", end, "start+w", start+w)
-						print("w:", w, "h=rows:", h)
-						raise ie
+				charbuf[j][i] = 'X'
+					#try:
+					#	charbuf[j-1][i] = '_'
+					#except IndexError as ie:
+					#	print("len(charbuf):", len(charbuf), "j: ", j)
+					#	print("len(charbuf[0]):", len(charbuf[0]), "i: ", i)
+					#	print("end: ", end, "start+w", start+w)
+					#	print("w:", w, "h=rows:", h)
+					#	raise ie
 		charbufrows = ["".join(row) for row in charbuf]
 		charbuf_final = "\n".join(charbufrows)
 		print(charbuf_final)
-- 
GitLab