Skip to content

Commit 6b6b2e5

Browse files
committed
Merge branch '2.2'
2 parents 18b168d + e1396bb commit 6b6b2e5

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Tasty Text
33

44
Requires Love **0.9.1+**
55

6-
Version: **2.1**
6+
Version: **2.2**
77

88
This library is for printing pretty texts. The basic premise is to
99
use tags in strings to do special effects. Additionally, the library

src/tastytext.lua

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--[[
2-
TastyText 2.1
2+
TastyText 2.2
33
Copyright (c) 2014 Minh Ngo
44
55
This software is provided 'as-is', without any express or implied
@@ -73,14 +73,14 @@ if composite_number >= 009002 then
7373
utf8sub = function(str,i,j)
7474
j = j or -1
7575

76-
-- only set l if i or j is negative
77-
local l = (i >= 0 and j >= 0) or utf8.len(str)
78-
i = (i >= 0) and i or l + i + 1
79-
j = (j >= 0) and j or l + j + 1
80-
81-
if i < 0 then i = 1 elseif i > l then i = l end
82-
if j < 0 then j = 1 elseif j > l then j = l end
83-
76+
if i < 1 or j < 1 then
77+
local l = utf8.len(str)
78+
i = (i >= 0) and i or l + i + 1
79+
j = (j >= 0) and j or l + j + 1
80+
81+
if i < 0 then i = 1 elseif i > l then i = l end
82+
if j < 0 then j = 1 elseif j > l then j = l end
83+
end
8484

8585
local byte_a = utf8.offset(str,i)
8686
local byte_b = utf8.offset(str,j+1)-1
@@ -112,7 +112,7 @@ local escape_tag = string.format('%s([%s%s])',ESCAPE,START,END)
112112
--TEXT CLASS
113113
------------------------------------------------------------------------
114114

115-
local TastyText = {_VERSION = '2.1'}
115+
local TastyText = {_VERSION = '2.2'}
116116
TastyText.__index= TastyText
117117

118118
function TastyText.new(str,limit,default_font,tags,line_height)

0 commit comments

Comments
 (0)