From e0d061449ea5c4452ef77008b5197ae4d3d77621 Mon Sep 17 00:00:00 2001
From: boatbomber <zack@boatbomber.com>
Date: Tue, 8 Aug 2023 23:23:39 -0700
Subject: [PATCH] Ensure align uses latest line count

---
 README.md    | 2 +-
 package.json | 2 +-
 src/init.lua | 3 ++-
 wally.toml   | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 7971e38..5decef8 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ Wally:
 
 ```toml
 [dependencies]
-Highlighter = "boatbomber/highlighter@0.8.1"
+Highlighter = "boatbomber/highlighter@0.8.2"
 ```
 
 Roblox Model:
diff --git a/package.json b/package.json
index 92c7658..3a90e19 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
     "name": "@boatbomber/highlighter",
-    "version": "0.8.1",
+    "version": "0.8.2",
     "license": "MIT",
     "repository": {
         "type": "git",
diff --git a/src/init.lua b/src/init.lua
index 592507e..d858aaf 100644
--- a/src/init.lua
+++ b/src/init.lua
@@ -18,7 +18,8 @@ function Highlighter._getLabelingInfo(textObject: types.TextObject)
 		return
 	end
 
-	local numLines = #data.Lines
+	local src = utility.convertTabsToSpaces(utility.removeControlChars(textObject.Text))
+	local numLines = #string.split(src, "\n")
 	if numLines == 0 then
 		return
 	end
diff --git a/wally.toml b/wally.toml
index 1c133a5..7f1989d 100644
--- a/wally.toml
+++ b/wally.toml
@@ -1,7 +1,7 @@
 [package]
 name = "boatbomber/highlighter"
 description = "RichText highlighting Lua code with a pure Lua lexer"
-version = "0.8.1"
+version = "0.8.2"
 license = "MIT"
 authors = ["boatbomber (https://boatbomber.com)"]
 registry = "https://github.com/upliftgames/wally-index"