Add an option to choose which wrap character to use

This commit is contained in:
Mikita Wiśniewski 2025-01-31 16:57:05 +07:00
parent 666f2ebacb
commit 080513412f
6 changed files with 23 additions and 7 deletions

View file

@ -18,9 +18,18 @@ local SIGN_GLOW_INTENSITY = 14
local LF_CODEPOINT = utf8.codepoint("\n")
local CR_CODEPOINT = utf8.codepoint("\r")
local SP_CODEPOINT = utf8.codepoint(" ")
local DS_CODEPOINT = utf8.codepoint("-") -- used as the wrapping character
--local INVALID_UTF8_STR = {"<", "I", "n", "v", "a", "l", "i", "d", " ", "U", "T", "F", "-", "8", ">"}
local WRAP_CODEPOINT
do
local setting = core.settings:get("mcl_signs_wrap_character")
local wrap_char = "" -- "hyphen"
if setting == "ellipsis" then
wrap_char = ""
elseif setting == "return" then
wrap_char = ""
end
WRAP_CODEPOINT = utf8.codepoint(wrap_char)
end
local DEFAULT_COLOR = "#000000"
local DYE_TO_COLOR = {
@ -162,7 +171,7 @@ local function ustring_to_line_array(ustr)
table.insert(lines, line)
line = {}
elseif #line >= LINE_LENGTH then
table.insert(line, DS_CODEPOINT)
table.insert(line, WRAP_CODEPOINT)
table.insert(lines, line)
line = {code}
else

View file

@ -507,3 +507,7 @@ _ _un 3
ω _grk_om 5
Ώ _grk_om_tonos_ 4
ώ _grk_om_tonos 5
_hyphen 5
… _ellipsis 5
↵ _return 6

Can't render this file because it contains an unexpected character in line 513 and column 15.

View file

@ -261,6 +261,12 @@ mcl_buckets_use_select_box (Buckets use select box) bool false
# 'Calendar' means from December 24th to January 7th
vl_christmas_decorations (Christmas decorations) enum Calendar Always,Calendar,Never
# The character used to break lines on signs when they reach the character limit.
# * Hyphen:
# * Ellipsis: …
# * Return: ↵
mcl_signs_wrap_character (Signs wrapping character) enum hyphen hyphen,ellipsis,return
[Experimental]
# Whether ice is translucent. If disabled, ice is fully opaque.
#
@ -356,8 +362,5 @@ mcl_logging_dungeons (Dungeons generation logging) bool false
# If enabled generated structures will be logged
mcl_logging_structures (Structure generation logging) bool false
#Complete debug logging for mcl_signs events. Use this if you have issues with signs.
mcl_logging_mcl_signs (Complete debug logging for mcl_signs) bool false
#Debug logging for mcl_events.
# Debug logging for mcl_events.
mcl_logging_event_api (Debug logging for mcl_events) bool false

BIN
textures/_ellipsis.png Normal file

Binary file not shown.

After

(image error) Size: 78 B

BIN
textures/_hyphen.png Normal file

Binary file not shown.

After

(image error) Size: 76 B

BIN
textures/_return.png Normal file

Binary file not shown.

After

(image error) Size: 98 B